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 Proposal: func-name-matching #6065
Comments
Should this be added as an option for Also there is an additional option to also check module exports |
In the first proposal, this had been merged to I thought the name |
That's why I proposed an option. Values could be |
I think 4 options are needed in that case: |
Oh, now I see. It could also be the 3 options mentioned and a refinement for |
Separated version:
And an option -- Merged version, maybe:
And an option -- |
@eslint/eslint-team Any insights about combining? |
Now that I read this again I am not sure it is a big problem if the rules are separated. Given this code:
We would get two errors on |
This seems like two rules to me, like @alberto said. |
heh, it was actually @mysticatea who was proposing that. I just backed out 😅 |
I also think having two rules makes the most sense. |
OK, I saw consensus. In future, I hope the option to match the containing file's name for |
@eslint/eslint-team opinions? I can champion this one |
Per TSC meeting (7/21/16), marking as accepted. |
i can work on this! |
Go ahead @azhang496! |
Thanks for all the recent contributions to ESLint, @azhang496! |
Yeah, thanks, @azhang496! Great job :) |
thanks everyone for being so welcoming! :) |
should there be an option for other reserved/ignored words in addition to |
I think we can just special case module exports for now and leave it open in case other special cases pop up later. I would suggest, though a slightly different format for the option, as I think the original is unclear:
Where Sorry @mysticatea , I think the filename match doesn't belong in this rule. :) |
I'm OK. |
From requireMatchingFunctionName.
This rule will enforce function expression names with the variable name (or property name) which is the destination of the assignment.
Options
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."fileName"
- The function's name should match camelcase of the file name.Examples:
The text was updated successfully, but these errors were encountered: