mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-12-01 20:05:21 +01:00
135 lines
No EOL
13 KiB
JavaScript
135 lines
No EOL
13 KiB
JavaScript
'use strict';
|
|
|
|
|
|
|
|
|
|
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
|
|
|
|
const EXPORT_MESSAGE = 'Expected "export" or "export default"',
|
|
IMPORT_MESSAGE = 'Expected "import" instead of "require()"'; /**
|
|
* @fileoverview Rule to prefer ES6 to CJS
|
|
* @author Jamund Ferguson
|
|
*/function normalizeLegacyOptions(options) {if (options.indexOf('allow-primitive-modules') >= 0) {
|
|
return { allowPrimitiveModules: true };
|
|
}
|
|
return options[0] || {};
|
|
}
|
|
|
|
function allowPrimitive(node, options) {
|
|
if (!options.allowPrimitiveModules) return false;
|
|
if (node.parent.type !== 'AssignmentExpression') return false;
|
|
return node.parent.right.type !== 'ObjectExpression';
|
|
}
|
|
|
|
function allowRequire(node, options) {
|
|
return options.allowRequire;
|
|
}
|
|
|
|
function allowConditionalRequire(node, options) {
|
|
return options.allowConditionalRequire !== false;
|
|
}
|
|
|
|
function validateScope(scope) {
|
|
return scope.variableScope.type === 'module';
|
|
}
|
|
|
|
// https://github.com/estree/estree/blob/master/es5.md
|
|
function isConditional(node) {
|
|
if (
|
|
node.type === 'IfStatement' ||
|
|
node.type === 'TryStatement' ||
|
|
node.type === 'LogicalExpression' ||
|
|
node.type === 'ConditionalExpression')
|
|
return true;
|
|
if (node.parent) return isConditional(node.parent);
|
|
return false;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Rule Definition
|
|
//------------------------------------------------------------------------------
|
|
|
|
const schemaString = { enum: ['allow-primitive-modules'] };
|
|
const schemaObject = {
|
|
type: 'object',
|
|
properties: {
|
|
allowPrimitiveModules: { 'type': 'boolean' },
|
|
allowRequire: { 'type': 'boolean' },
|
|
allowConditionalRequire: { 'type': 'boolean' } },
|
|
|
|
additionalProperties: false };
|
|
|
|
|
|
module.exports = {
|
|
meta: {
|
|
type: 'suggestion',
|
|
docs: {
|
|
url: (0, _docsUrl2.default)('no-commonjs') },
|
|
|
|
|
|
schema: {
|
|
anyOf: [
|
|
{
|
|
type: 'array',
|
|
items: [schemaString],
|
|
additionalItems: false },
|
|
|
|
{
|
|
type: 'array',
|
|
items: [schemaObject],
|
|
additionalItems: false }] } },
|
|
|
|
|
|
|
|
|
|
|
|
create: function (context) {
|
|
const options = normalizeLegacyOptions(context.options);
|
|
|
|
return {
|
|
|
|
'MemberExpression': function (node) {
|
|
|
|
// module.exports
|
|
if (node.object.name === 'module' && node.property.name === 'exports') {
|
|
if (allowPrimitive(node, options)) return;
|
|
context.report({ node, message: EXPORT_MESSAGE });
|
|
}
|
|
|
|
// exports.
|
|
if (node.object.name === 'exports') {
|
|
const isInScope = context.getScope().
|
|
variables.
|
|
some(variable => variable.name === 'exports');
|
|
if (!isInScope) {
|
|
context.report({ node, message: EXPORT_MESSAGE });
|
|
}
|
|
}
|
|
|
|
},
|
|
'CallExpression': function (call) {
|
|
if (!validateScope(context.getScope())) return;
|
|
|
|
if (call.callee.type !== 'Identifier') return;
|
|
if (call.callee.name !== 'require') return;
|
|
|
|
if (call.arguments.length !== 1) return;
|
|
var module = call.arguments[0];
|
|
|
|
if (module.type !== 'Literal') return;
|
|
if (typeof module.value !== 'string') return;
|
|
|
|
if (allowRequire(call, options)) return;
|
|
|
|
if (allowConditionalRequire(call, options) && isConditional(call.parent)) return;
|
|
|
|
// keeping it simple: all 1-string-arg `require` calls are reported
|
|
context.report({
|
|
node: call.callee,
|
|
message: IMPORT_MESSAGE });
|
|
|
|
} };
|
|
|
|
|
|
} };
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1jb21tb25qcy5qcyJdLCJuYW1lcyI6WyJFWFBPUlRfTU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