Change Request: Allow manually opting into flat config without an `eslint.config.js`
See original GitHub issueESLint version
v8.24.0
What problem do you want to solve?
Right now you have to create an eslint.config.js
file to use flat config. It would be nice if flat configs could be passed on the command line using the -c
or --config
argument. The docs currently make it sound like it should work, but it doesn’t.
What do you think is the correct solution?
I can think of two options:
- A CLI argument like
--use-flat-config
that would make ESLint treat the config as a flat config - Assume a config is a flat config if it’s ESM because the legacy config files can’t be ESM
I think I prefer option 1 because option 2 doesn’t support CJS flat configs, which I think are allowed?
Participation
- I am willing to submit a pull request for this change.
Additional comments
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
ESLint's new config system, Part 2: Introduction to flat config
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Configuration Files (New) - ESLint - Pluggable JavaScript Linter
To opt-in, place an eslint.config.js file in the root of your project or set the ESLINT_USE_FLAT_CONFIG environment variable to true . To opt-out,...
Read more >Configuration Files - ESLint - Pluggable JavaScript Linter
ESLint supports adding shared settings into configuration files. Plugins use settings to specify the information that should be shared across all of its...
Read more >Command Line Interface - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Configuring ESLint - ESLint - Pluggable JavaScript Linter
There are two primary ways to configure ESLint: Configuration Comments - use JavaScript comments to embed configuration information directly into a file.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m not opposed to adding an environment variable either.
Do we want it to also include an option to opt-out of flat config even if
eslint.config.js
is present?ESLINT_USE_FLAT_CONFIG=true
- forces flat config mode regardless of the presence ofeslint.config.js
(--config
would be loaded as a flat config file; it would error if there is noeslint.config.js
and--config
was not specified).ESLINT_USE_FLAT_CONFIG=false
- forces eslintrc mode regardless of the presence ofeslint.config.js
.eslint.config.js
determines the mode.That seems like a good idea. It would certainly make compatibility testing a lot easier.
I like the proposal so marking as accepted.
@TomerAberbach would you like to submit a PR for this?