New issue
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
Rule Enhancement Proposal: func-names with never #6059
Comments
Should Should we allow a "tolerate" value for the first option, so that a user can decide that s/he does not always want function names, but when a function name is specified, it must match the assigned variable name? |
Yes.
Ah, interesting. |
So if
I think I agree-- that could be a separate rule, which wouldn't do much if function expressions don't have names, but it would execute safely and not confuse the options schema of this proposed rule. |
From requireAnonymousFunctions. This proposal is to add {
"func-names": [
"error",
"always" or "never"
]
}
Valid: /*eslint func-names: ["error", "never"]*/
function foo() {
}
var foo = function() {
}; Invalid: /*eslint func-names: ["error", "never"]*/
var foo = function foo() {
}; |
related: #938 |
@eslint/eslint-team opinions? I can champion this one |
👍 |
👍 Here's another reason—if you care about cross-browser issues—to make this happen: https://kangax.github.io/nfe/#safari-bug Would it be asking for too much to have a only if not part of an assignment expression option for never? |
Looks like we are good to move forward here. @Mouvedia this issue is for creating an option that is compatible with JSCS functionality. If you want more than that, please open a new issue. |
@nzakas after 3 refusals, I don't think Ill submit a new one… |
EDIT: this proposal was updated in #6059 (comment)
From requireAnonymousFunctions and requireMatchingFunctionName.
This proposal is to add some options.
"always"
(default) - This is the current behavior."never"
- This will disallow a use of function expression names.sameAsVariable
(default isfalse
) - If this istrue
, the function expression name must be the same as the variable name which is the destination of the assignment. For example:let foo = function foo() {};
. But if the destination ismodule.exports
, this rule will ignore it.The text was updated successfully, but these errors were encountered: