-
-
Notifications
You must be signed in to change notification settings - Fork 283
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
Updating to Eslint 9 #3383
Open
reosarevok
wants to merge
22
commits into
metabrainz:master
Choose a base branch
from
reosarevok:eslint-9-for-realsies
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
Updating to Eslint 9 #3383
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
reosarevok
force-pushed
the
eslint-9-for-realsies
branch
5 times, most recently
from
October 15, 2024 13:02
64b7838
to
7f3f557
Compare
reosarevok
force-pushed
the
eslint-9-for-realsies
branch
from
October 29, 2024 13:49
bed953a
to
0aca65c
Compare
https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-mutable-exports.md In most cases we don't need this - there's only one case, in storage.js, where we cannot change this without making sure that browsers no longer error on trying to access sessionStorage.
yarn up '*hermes*' --exact
Adds a new rule which seems sensible: https://github.com/jsx-eslint/eslint-plugin-react/blob/v7.36.0/docs/rules/forward-ref-uses-ref.md
This is supposed to work with eslint9 - we'll see. It allows a new checkTypeImports option for import/extensions which we might as well include. Some new warnings were being shown for /unambiguous and /no-cycle. /unambiguous turns out to be way too whiny and we decided to turn it off. /no-cycle required a fairly large rewriting of the guess case code, which was a mess and is certainly somewhat better (if not quite yet *good*) because of it.
These were broken with flat config but now work again. no-named-as-default-member did hit a lot of issues, mostly with the way we access DBDefs properties. There's no real reason why we need a default export for DBDefs files, really, and it seems cleaner anyway to just import the one or two properties we need in most cases and do import * as DBDefs for the few cases where we use three or more properties. As such, this also autogenerates DBDefs-client-browser so that it contains the same exports as DBDefs-client. There seems to be no real reason why unformatTrackLength and calculateDiscID were exported separately while nothing else in utils was - this just makes them consistent with everything else in the file.
This introduces a crash in no-unused-vars in some flow type pages (eslint/eslint#18876) which might or might not get fixed on eslint or hermes. That said, for now we are fine just disabling the no-unused-vars rule on the three affected files. A few new issues were detected for no-unused-vars for errors. I explicitly indicated now that we're ignoring the error by using the variable name ignoredError and ignoring that name for the rule. In some places, eslint let us know the rules we were disabling are no longer erroring (probably due to now fixed eslint bugs). As such, we can remove those disable lines.
See whole list in https://eslint.org/docs/latest/rules/ This adds the new(ish) rule no-empty-static-block, drops some cases where we were listing the same rule twice (differently!) and moves a bunch of rules from problems to suggestions.
They now recommend just using their default plugin rather than the separate js and jsx ones, so this changes our usage to follow that.
https://eslint.style/rules/default/indent-binary-ops This indents multiline ops to the same level as the previous line + 2, but we often want to indent them to the same level as the start of the multiline list itself. As such, I'm disabling it for now.
Using the full plugin does mean there are a few TypeScript rules. Nothing useful for us so all are disabled.
This has breaking changes in /rules-of-hooks but we don't use that (because Flow takes care of it and it clashes with component syntax).
reosarevok
force-pushed
the
eslint-9-for-realsies
branch
from
November 6, 2024 11:39
0aca65c
to
2959bc1
Compare
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.
This updates our Eslint setup to Eslint 9 (we had been waiting for all the plugins we use to support it and the last one,
eslint-plugin-import
, finally got there last week).There's a few issues, including a crash in
no-unused-vars
in some flow type pages (eslint/eslint#18876) which might or might not get fixed oneslint
orhermes
. That said, for now we are fine just disabling theno-unused-vars
rule on the three affected files.