Skip to content

Commit

Permalink
docs: Update removed CLI flags migration (#17939)
Browse files Browse the repository at this point in the history
* docs: Update removed CLI flags migration

fixes #17931

* Update docs/src/use/configure/migration-guide.md

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* Update docs/src/use/configure/migration-guide.md

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

---------

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
  • Loading branch information
nzakas and mdjermanovic committed Jan 3, 2024
1 parent 750b8df commit 3a877d6
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions docs/src/use/configure/migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,57 @@ The following CLI flags are no longer supported with the flat config file format
The flag `--no-eslintrc` has been replaced with `--no-config-lookup`.
#### `--rulesdir`
The `--rulesdir` flag was used to load additional rules from a specified directory. This is no longer supported when using flat config. You can instead create a plugin containing the local rules you have directly in your config, like this:
```js
// eslint.config.js
import myRule from "./rules/my-rule.js";
export default [
{
// define the plugin
plugins: {
local: {
rules: {
"my-rule": myRule
}
}
},
// configure the rule
rules: {
"local/my-rule": ["error"]
}
}
];
```
#### `--ext`
The `--ext` flag was used to specify additional file extensions ESLint should search for when a directory was passed on the command line, such as `npx eslint .`. This is no longer supported when using flat config. Instead, specify the file patterns you'd like ESLint to search for directly in your config. For example, if you previously were using `--ext .ts,.tsx`, then you will need to update your config file like this:
```js
// eslint.config.js
export default [
{
files: ["**/*.ts", "**/*.tsx"]
// any additional configuration for these file types here
}
];
```
ESLint uses the `files` keys from the config file to determine which files should be linted.
#### `--resolve-plugins-relative-to`
The `--resolve-plugins-relative-to` flag was used to indicate which directory plugin references in your configuration file should be resolved relative to. This was necessary because shareable configs could only resolve plugins that were peer dependencies or dependencies of parent packages.
With flat config, shareable configs can specify their dependencies directly, so this flag is no longer needed.
### Additional Changes
The following changes have been made from the eslintrc to the flat config file format:
Expand Down

0 comments on commit 3a877d6

Please sign in to comment.