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

Use ESLint new flat config system #13271

Open
filetvignon opened this issue Jul 6, 2023 · 3 comments
Open

Use ESLint new flat config system #13271

filetvignon opened this issue Jul 6, 2023 · 3 comments

Comments

@filetvignon
Copy link

filetvignon commented Jul 6, 2023

Is your proposal related to a problem?

ESLint is deprecating its current config system and moving to a new one.

Blog post: https://eslint.org/blog/2022/08/new-config-system-part-1/
Docs: https://eslint.org/docs/latest/use/configure/configuration-files-new

I can't find a way to make CRA eslint rules to work with the new config system.

@connorjs
Copy link

connorjs commented Sep 26, 2023

Quick note for consumers that want to move to flat config. I think this works.

  1. Set up plugins.
  2. Include rules. The overrides[0] is TypeScript specific.
plugins: {
	flowtype: flowtypePlugin,
	"jsx-a11y": jsxA11y,
	react: reactPlugin,
	"react-hooks": reactHooks,
},
rules: {
	...reactAppConfig.rules,
	...reactAppConfig.overrides[0].rules,
},

@lmeysel
Copy link

lmeysel commented Mar 22, 2024

still no progress :( eslint v9 makes flat config to be the default format and deprecates .eslintrc

@bayasdev
Copy link

still no progress :( eslint v9 makes flat config to be the default format and deprecates .eslintrc

+1

sergei-maertens added a commit to maykinmedia/open-archiefbeheer that referenced this issue Jan 3, 2025
See CRA upstream issue: facebook/create-react-app#13271

Essentially, the eslint.config.mjs flat config is not picked up by
CRA, and it tries to run it with its default configuration (especially
now that .eslintrc.json is gone).

The linter errors during builds on the main branch are turned into
warnings (because of how the CRA shared config works) and currently
they're ignore anyway - I suspect that's why CI=false is added in the
frontend build in Github actions, as the default behaviour is to fail
the build.

Instead, the CI job now explicitly invokes 'npm run lint', which *will*
error the build. 'npm start' also disables the eslint plugin which is
a slightly worse developer experience, but the linting runs as a husky
pre-commit hook so hopefully this is an acceptable tradeoff.

ESLint flat config *is* the way forward and CRA is holding projects
back - if it becomes too problematic I'd consider migrating to ViteJS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants