Skip to content
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
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

reosarevok
Copy link
Member

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 on eslint or hermes. That said, for now we are fine just disabling the no-unused-vars rule on the three affected files.

@reosarevok reosarevok added the Refactoring Refactoring-only PRs (eslint fixes etc) label Oct 11, 2024
@reosarevok reosarevok force-pushed the eslint-9-for-realsies branch 5 times, most recently from 64b7838 to 7f3f557 Compare October 15, 2024 13:02
@reosarevok reosarevok marked this pull request as ready for review October 15, 2024 14:47
reosarevok and others added 22 commits November 6, 2024 12:27
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 '@babel/*' --exact
yarn up '*hermes*' --exact
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactoring Refactoring-only PRs (eslint fixes etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant