-
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
Add ESLint #5259
Add ESLint #5259
Conversation
That's awesome, thanks @UnsolvedCypher! May I push to your branch to commit the necessary fixes? |
Sure, please feel free to push! If you want, I can re-create this commit from the most recent repo version (all that needs to be done is adding the dependencies to yarn, overcommit config and then run If the errors that are unfixable are all a certain class of error (like import errors), we can just turn that entire category of errors off for now. |
That's exactly what I did :)
Yes definitely, it's good to try migrating some of our stuff from the assets pipelines if we can and it fixes some detected errors ^^ |
f6d29a4
to
488bfcb
Compare
Finally. |
Damn that's definitely non intuitive, but overcommit passes all the files not excluded in the configuration after the "app/javascript" path, so it validates also all our sprockets assets (for which I'm fine just using jshint, since we can't even use ES in there...). Also it doesn't go over jsx file by just running on the directory, because eslint uses only js by default (it's somewhere in the user guide, but not in the help text).
There are actually 400+ more issues to fix in our jsx files! I think I'll end up adding something like this in the overcommit config: EsLint:
required_executable: 'WcaOnRails/bin/yarn'
enabled: true
include:
- 'WcaOnRails/app/javascript/**/*.js[x]'
command: ['WcaOnRails/bin/yarn', 'run', 'eslint', '-c', '.eslintrc.json', '-f', 'compact'] (so that it's only overcommit which decides what goes after that, and we manually glob only the file we want to pass to it) I'll also disable JsHint on our webpacker assets, because some validations conflicts with EsLint :p |
I spent a whole lot of time fixing the edit-schedule pack, I've extensively manually tested it but hopefully I didn't break it. I'll make sure tests pass and then sqash/reorganize commits so that if something break we can cleanly revert the edit-schedule one. |
Wow, that is an amazing amount of work! And sorry I completely forgot about enabling scanning for jsx 🤦♂️ |
Also add overcommit rule for ESlint.
ESLint fixes
Thanks again! |
Closes #1924 by adding ESLint to overcommit. It auto-fixes several hundred problems but more issues remain. You can run 'yarn run eslint app/javascript` to see remaining problems and warnings.