-
Notifications
You must be signed in to change notification settings - Fork 0
Warn for declarative func-style in eslint #300
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
base: master
Are you sure you want to change the base?
Conversation
|
The problem I've noticed with using I think we should just set this to And just to confirm what @waximabbax mentioned, this applies to declarations only, so anonymous arrow functions are still allowed. |
|
Agree that warn causes spam I don't think it is a good time investment for us to go change the syntax everywhere |
|
There is a bit of code inconsistency we can avoid, we can also make this run only for new code. Other than code inconsistency, I don't think there are any other technical concerns. |
9214992 to
a1b63a5
Compare
|
I am not sure what should we do with this PR, I've added code to include only files that have changes but it will still include the entire file but fixing one file shouldn't be any trouble at all. @JeroenDeDauw Please feel free to close this PR if it is not worth it. |
| sourceType: 'module' | ||
| }, | ||
| rules: { | ||
| 'func-style': [ 'error', 'declaration', { allowArrowFunctions: false } ], |
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.
neojs doesn't have code like const foo = () => {} so it doesn't hurt to keep it.
For: https://coda.io/d/_dW9bnkUghpB/Coding-Conventions_supcbaNC#_lucUnu9p
Since we are going this route where we should define a function like
function foo() {}instead ofconst foo = () => {}.Most of the AI-generated code uses the arrow function in these scenarios it might help to warn developers while testing.
This will still allow arrow functions in callbacks and loops as you can see in the screenshot:
Perhaps we can create a ticket for formatting older code,
--fixwon't fix the entire app, we can either perhaps use IDE to format all files to manually reformat. Anyway, it's only a warning, not an error so older code can still go through.