`func-name-matching`: "never"
See original GitHub issueChange request: func-name-matching
This rule currently has no options, and requires that function names always match the variable or property to which they are assigned.
I’d like to request the schema be expanded to accept a string: “always” (the default) or “never” (the new one).
“never” would require that the function name differ from the variable or property to which it is assigned.
Per https://github.com/eslint/eslint/pull/7063#issuecomment-247104931 / https://github.com/eslint/eslint/pull/7063#issuecomment-247106545
I’ll be happy to make a PR for this.
Updated: answers from http://eslint.org/docs/developer-guide/contributing/changes
The version of ESLint you are using.
v3.8.0
The problem you want to solve.
I want to prevent named functions from being stored in variables or properties that match their name - in other words, to force the function name and the container name to be different.
Your take on the correct solution to problem.
An optional string (before the object) that defaults to “always” when omitted, and can be set to “never”.
If you’re requesting a change to a rule, it’s helpful to include this information as well: What you did.
const foo = function foo() {};
const bar = function baz() {};
What you would like to happen.
A warning on the first line only.
What actually happened.
A warning on the second line only (with func-name-matching
enabled).
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:8 (7 by maintainers)
Thanks @ljharb! I will champion this change.
👍