-
Notifications
You must be signed in to change notification settings - Fork 176
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
Set up linting and style checking for javascript #1924
Comments
I know that pre-commit does some linting of javascript for us, but I think it's only configured to run on js files, and it might not be aware of es2016+ stuff that we're doing now. |
I think it might make sense to switch to something like ESlint which does a very good job of enforcing both code style and catching anti-patterns. Maybe we could add the ESlint and a config and then add it as a pre-commit once all of the initial errors have been worked through? |
Since #4381 we actually use the |
I'd be interested in trying to integrate this if the WST thinks it's a good direction to go in. I ran ESlint on the JavaScript code to see what kind of errors it would get. For the most part:
Over 75% of the issues raised can be automatically fixed by ESlint. I'm sure some of the other ones are false positives that would need to be fixed by further configuration. |
Yes, if we can run this over the whole code base (js + jsx) that would be very nice to ensure we have a consistent coding style over the whole code base. Thanks for looking into this! |
It's important that this work on both js and jsx files. It would be particularly awesome if it also works on javascript inside of html and javascript inside of erb, but it's okay if that's not easy to do.
(See #1856 (comment) for some discussion about indentation of promises)
The text was updated successfully, but these errors were encountered: