-
Notifications
You must be signed in to change notification settings - Fork 151
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
eslint: switch from custom rules to eslint-config-wikimedia #1976
Open
NovemLinguae
wants to merge
2
commits into
wikimedia-gadgets:master
Choose a base branch
from
NovemLinguae:eslint-config-wikimedia-2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
eslint: switch from custom rules to eslint-config-wikimedia #1976
NovemLinguae
wants to merge
2
commits into
wikimedia-gadgets:master
from
NovemLinguae:eslint-config-wikimedia-2
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Why switch? - it's standard for wikimedia projects - it has some cool features such as jquery deprecation warnings, and enforcing a specific version of JavaScript - I believe it has many more rules than our previous configuration, which will help with identifying areas of the code to modernize What this patch does - delete all old linter rules, except for these rules I carried over: - `no-nested-ternary` - `no-restricted-syntax` for `.done()` and `.fail()` - upgrade eslint a couple minor versions - add eslint-config-wikimedia and its default rules - disable controversial rules such as - whitespace in parentheses (`space-in-parens`, `space-before-function-paren`, `array-bracket-spacing`, `computed-property-spacing`, `object-curly-spacing`) - max line length 100 (`max-len`) - disable some rules - `indent` because it would involve touching almost every line, messing up git blame (although I may autofix this in the future and set a .git-blame-ignore-revs to reduce git blame spam) - `wrap-iife` to reduce VS Code yellow underline spam (will autofix this in a future patch) - couple others that I don't like and have disabled in my other projects - set it to ES6 since wikimedia "modern layer" support is now on ES6 - warn/error for syntax or internal functions higher than ES6 (this is more thorough than the old >ES6 detection we were using) - set all remaining detected violations to "warn" for now, so that CI passes - will apply autofixes for all the rules that "warn" in a future patch The rules are in two groups, with an extra line break in the middle separating them. - The top group are rules that should not be fixed - The bottom group are rules that should be fixed over time via autofixes and manual fixing. Once everything for that rule is fixed, that rule can be deleted, so that the linter starts enforcing it in CI. Over time, rules will be fixed and removed from the config, and the code will be incrementally modernized, until it arrives at the Wikimedia standard.
github-actions
bot
added
the
dependencies
Pull requests that update a dependency file, likely through dependabot
label
Jun 22, 2024
NovemLinguae
changed the title
https://github.com/wikimedia/eslint-config-wikimedia
eslint: switch from custom rules to eslint-config-wikimedia
Jun 22, 2024
NovemLinguae
commented
Oct 20, 2024
@@ -14,7 +14,8 @@ | |||
"deployall": "perl scripts/sync.pl --mode=deploy --all" | |||
}, | |||
"devDependencies": { | |||
"eslint": "^8.54.0", | |||
"eslint": "^8.57.0", |
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.
Can probably just delete this. I think it's included in eslint-config-wikimedia
I may merge this one when the PR queue is mostly empty. The follow up patches with autofoxes would otherwise create a lot of merge conflicts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://github.com/wikimedia/eslint-config-wikimedia
Why switch?
What this patch does
no-nested-ternary
no-restricted-syntax
for.done()
and.fail()
space-in-parens
,space-before-function-paren
,array-bracket-spacing
,computed-property-spacing
,object-curly-spacing
)max-len
)indent
because it would involve touching almost every line, messing up git blame (although I may autofix this in the future and set a .git-blame-ignore-revs to reduce git blame spam)wrap-iife
to reduce VS Code yellow underline spam (will autofix this in a future patch)The rules are in two groups, with an extra line break in the middle separating them.
Over time, rules will be fixed and removed from the config, and the code will be incrementally modernized, until it arrives at the Wikimedia standard.