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

docs: document lack of config file names #17442

Merged
merged 3 commits into from Aug 4, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion docs/src/use/configure/configuration-files-new.md
Expand Up @@ -58,6 +58,18 @@ module.exports = (async () => {
})();
```

::: warning

Unlike other tools in the JavaScript ecosystem, ESLint does not automatically look for a config file with a name of `eslint.config.mjs` or `eslint.config.cjs`. The ESLint team [does not want to support these file extensions](https://github.com/eslint/eslint/issues/16580) because we want to keep things simple: users are expected to use the same format for their ESLint files that the rest of their project uses, as defined in the `type` field of the project's `package.json` file.

If you want to force a different kind of ESLint config, then name your config file accordingly and use the `-c` or `--config` flag when running ESLint. For example, if you want to have an ESM ESLint config in a CommonJS project, name the config file `eslint.config.mjs` and then run ESLint with:

```shell
ESLINT_USE_FLAT_CONFIG=true npx eslint --config eslint.config.mjs **/*.js
```

Zamiell marked this conversation as resolved.
Show resolved Hide resolved
:::

## Configuration Objects

Each configuration object contains all of the information ESLint needs to execute on a set of files. Each configuration object is made up of these properties:
Expand Down Expand Up @@ -667,7 +679,7 @@ When ESLint is run on the command line, it first checks the current working dire
You can prevent this search for `eslint.config.js` by setting the `ESLINT_USE_FLAT_CONFIG` environment variable to `true` and using the `-c` or `--config` option on the command line to specify an alternate configuration file, such as:

```shell
ESLINT_USE_FLAT_CONFIG=true npx eslint -c some-other-file.js **/*.js
ESLINT_USE_FLAT_CONFIG=true npx eslint --config some-other-file.js **/*.js
Zamiell marked this conversation as resolved.
Show resolved Hide resolved
```

In this case, ESLint does not search for `eslint.config.js` and instead uses `some-other-file.js`.