-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
(chore) use eslint on src files #2602
Conversation
Sorry but I don't think we can merge this one.
This destroys/pollutes Git history. I'm usually against large style changes like this because as a maintainer I find clean history to be MUCH more valuable than perfect style. (and the style issues here aren't terrible) We'll improve them with time.
Maybe one day, not today. I don't think adding more friction for maintainers/contributors right now is a win. Out of curiosity: Is there perhaps some easy way to only lint MODIFIED files?
It's used in "jsonly" mode and for all the type inference it can do plus the JSDoc types really helps with catching errors while coding. It supplements the linter nicely in this regard.
I have definitely consider doing this. :-) I'm still debating if they add some type of documentation value (better a useless escape than missing a REAL escape) or if they are truly just clutter and should all be cleaned up. |
I might be more open to adding this (lint on test) for JUST the core parser source (excluding languages for now)... I might experiment with that locally and see how that works out. |
Actually there are some that outline real issues: highlight.js/src/languages/yaml.js Line 96 in 1936dbd
Here eslint repports begin: '^---\\s*$',
I think solutions exist involving commit hooks. I've never use it myself though. |
FWIW I think that would be the right approach. Maybe let the linter check the languages modules but disable all the rules that do not currently pass? |
That's kind of what I do now, but I don't feel any compulsion to "update them all at once". I keep an eye on the linter warnings (they are toned way done for languages) when I'm updating a language... but if I'm making larger changes I might quickly comment out all the language rules to get a much stricter ruleset in place and update some styles while I'm in there. |
Added task for now: dfeb3a1 |
This is an attempt to answer @yyyc514's request on #2601 (comment).
This PR is adding eslint to the test command, to enforce rules on source files. I have also run
eslint --fix
on the source files.I have changed a few rules from the
eslintrc
file:no-useless-escape
on the./src/languages/…
files. There are just too many of them.