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

client: Update to ESLint 9 #1507

Merged
merged 3 commits into from
Nov 26, 2024
Merged

client: Update to ESLint 9 #1507

merged 3 commits into from
Nov 26, 2024

Conversation

jtojnar
Copy link
Member

@jtojnar jtojnar commented Nov 26, 2024

Fixes: #1490

ESLint 9 deprecates the eslintrc settings format, let’s switch to the new flat format.

https://eslint.org/blog/2023/10/flat-config-rollout-plans/
https://eslint.org/blog/2022/08/new-config-system-part-1/
https://eslint.org/blog/2022/08/new-config-system-part-2/

- `--ext` flag not supported with flat config, using files option
  https://eslint.org/docs/latest/use/configure/migration-guide#--ext
  `.jsx` not part of the default extension set so we still need to add it:
  https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-with-arbitrary-extensions

- Since we want to imports in the config, we need to change package type to `module`.

- `eslint-plugin-react-hooks` does not currently setup flat config
  so we need to work around it by creating it ourselves or using `@eslint/compat`.
Gets rid of the following warning:

    Warning: React version not specified in eslint-plugin-react settings. See https://github.com/jsx-eslint/eslint-plugin-react#configuration .
@jtojnar jtojnar added this to the 2.20 milestone Nov 26, 2024
Copy link

netlify bot commented Nov 26, 2024

Deploy Preview for selfoss canceled.

Name Link
🔨 Latest commit b4aa33f
🔍 Latest deploy log https://app.netlify.com/sites/selfoss/deploys/6746430e8a74d100085d25f2

@jtojnar jtojnar added the dependencies Pull requests that update a dependency file label Nov 26, 2024
- ESLint 9:
  https://eslint.org/blog/2024/04/eslint-v9.0.0-released/
  https://eslint.org/docs/latest/use/migrate-to-9.0.0

  - Lints current directory without any arguments:
    https://eslint.org/docs/latest/use/migrate-to-9.0.0#-change-in-behavior-when-no-patterns-are-passed-to-cli

- eslint-plugin-react-hooks:
  https://github.com/facebook/react/blob/eslint-plugin-react-hooks%405.0.0/packages/eslint-plugin-react-hooks/CHANGELOG.md

- eslint-plugin-react:
  https://www.github.com/jsx-eslint/eslint-plugin-react/pull/3759

- Prettier config not as necessary since ESLint 9 phased out stylistic lints:
  https://www.github.com/prettier/eslint-config-prettier/issues/290

  But there are some rules that are still enabled by recommended `@eslint/js` config.
  It is possible to check them with `npx eslint-config-prettier js/index.js`.
  In our case `no-unexpected-multiline` is still enabled:
  https://github.com/prettier/eslint-config-prettier/tree/v9.1.0#special-rules
@jtojnar jtojnar force-pushed the wip/jtojnar/eslint9 branch from 88721aa to b4aa33f Compare November 26, 2024 21:52
@jtojnar jtojnar changed the title cĺient: Update to ESLint 9 client: Update to ESLint 9 Nov 26, 2024
@jtojnar jtojnar merged commit b4aa33f into master Nov 26, 2024
15 checks passed
@jtojnar jtojnar deleted the wip/jtojnar/eslint9 branch November 26, 2024 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update to eslint 9
1 participant