-
Notifications
You must be signed in to change notification settings - Fork 365
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
Add func-style
ESLint rule
#1421
Conversation
@@ -152,40 +150,43 @@ async function pickTemplate() { | |||
}, | |||
}) | |||
return chosentemplate | |||
function filterRegistry(registry, input) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those functions can be safely moved to the top-level scope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we enable https://eslint.org/docs/rules/func-style#allowarrowfunctions?
d9696fb
to
74a2e21
Compare
That option is always enabled when the rule is set to Both styles are almost the same and work IMHO. However, do you think it would it be useful for consistency to enforce one of them over the other? If so, which ESLint rule would be the best to enforce this? I have struggled with this specific linting problem in my personal projects, but there might be a solution. I have even opened an issue to ESLint repository in April about this :) |
Cool, didn't notice that. I would also prefer to choose one of the two styles. Don't think it is a blocker for this PR (especially if we don't have built in support for it). |
74a2e21
to
15c6fac
Compare
Rebased. Ready for another review 👍 It looks like there might be a way to enforce the function declaration style using |
15c6fac
to
995e025
Compare
This is enforceable with module.exports = {
onBuild() {...}
} As: module.exports = {
onBuild: () => {...}
} Which might be more verbose? Also, this would not come with autofixing, so I am thinking this specific rule might be more of a nuisance than a help there, and leaving inconsistent style might be more practical. What do you think? |
Agreed |
This adds the
func-style
ESLint rule.