We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I expected the no-es6-methods rule to accept an exceptMethods option, the same way that no-es6-static-methods does. However, it does not.
no-es6-methods
exceptMethods
no-es6-static-methods
So I used patch-package to patch eslint-plugin-es5@1.5.0 to add that rule option:
eslint-plugin-es5@1.5.0
diff --git a/node_modules/eslint-plugin-es5/src/rules/no-es6-methods.js b/node_modules/eslint-plugin-es5/src/rules/no-es6-methods.js index b313f28..260cbd1 100644 --- a/node_modules/eslint-plugin-es5/src/rules/no-es6-methods.js +++ b/node_modules/eslint-plugin-es5/src/rules/no-es6-methods.js @@ -52,9 +52,22 @@ module.exports = { docs: { description: 'Forbid methods added in ES6' }, - schema: [] + schema: [{ + type: 'object', + properties: { + exceptMethods: { + type: 'array', + items: { + type: 'string' + } + } + } + }] }, create(context) { + const options = Object.assign({ exceptMethods: [] }, context.options[0]); + const exceptMethods = new Set(options.exceptMethods); + return { CallExpression(node) { if(!node.callee || !node.callee.property) { @@ -77,7 +90,7 @@ module.exports = { const es6Functions = [].concat( es6ArrayFunctions, es6StringFunctions - ); + ).filter((name) => !exceptMethods.has(name)); if (es6Functions.indexOf(functionName) > -1 && !isPermitted(node.callee)) { context.report({ node: node.callee.property,
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I expected the
no-es6-methods
rule to accept anexceptMethods
option, the same way thatno-es6-static-methods
does. However, it does not.So I used patch-package to patch
eslint-plugin-es5@1.5.0
to add that rule option:This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: