Rule Proposal: func-name-matching
See original GitHub issueFrom requireMatchingFunctionName.
This rule will enforce function expression names with the variable name (or property name) which is the destination of the assignment.
Options
{
"func-name-matching": ["error", {"module.exports": "ignore"}]
}
module.exports
- The setting formodule.exports = function foo() {};
"ignore"
(default) - The function is ignored."propertyName"
- The function’s name should beexports
. Original JSCS rule has this option.- (in my head, in future)
"fileName"
- The function’s name should match camelcase of the file name.
Examples:
/*eslint func-name-matching: "error"*/
// ✔ GOOD ---------------------------------------------------------------------
let foo = function foo() {};
foo = function foo() {};
obj.foo = function foo() {};
let obj = {foo: function foo() {}};
// ignore anonymous function expressions.
// it's warned by `func-names` rule.
let foo = function() {};
foo = function() {};
obj.foo = function() {};
let obj = {foo: function() {}};
// ignore it if it's not assigned
foo(function bar() {});
// ignore 'module.exports' by default.
module.exports = function foo() {};
// ✘ BAD ----------------------------------------------------------------------
let foo = function bar() {};
foo = function bar() {};
obj.foo = function bar() {};
let obj = {foo: function bar() {}};
// Should warn simple computed properties from original JSCS rule.
obj["foo"] = function bar() {};
let obj = {["foo"]: function bar() {}};
Issue Analytics
- State:
- Created 7 years ago
- Comments:22 (22 by maintainers)
Top Results From Across the Web
Proposed rule: Order Competition Rule - SEC.gov
proposed rule would prohibit a restricted competition trading center from internally executing certain orders of individual investors at a ...
Read more >Proposed Rules - GovInfo
Commission has requested comment on a release proposing amendments to its rules under the Securities Act and. Exchange Act that would require.
Read more >eslint | Yarn - Package Manager
A bug fix in a rule that results in ESLint reporting fewer linting errors. A bug fix to the CLI or core (including...
Read more >ESLint equivalents in Elm - Elmcraft
228/263 (87%) of the core ESLint rules aren't necessary in Elm: ... func-name-matching ... This is a proposal for elm-format .
Read more >disallow reassigning exceptions in catch clauses (no-ex-assign)
Since there is no arguments object to offer alternative access to this data, assignment of ... This rule disallows reassigning exceptions in catch...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@eslint/eslint-team opinions?
I can champion this one
i can work on this!