Run ESLint on a project.
@nx/eslint
Package reference
Here is a list of all the executors, generators and migrations available from this package.
Executors
Generators
initInternal
Set up the ESLint plugin.
workspace-rules-projectInternal
Create the Workspace Lint Rules Project.
Create a new Workspace ESLint rule.
Convert an Nx workspace's ESLint configs to use Flat Config.
Convert existing ESLint project(s) using
@nx/eslint:lint
executor to use@nx/eslint/plugin
.
Migrations
21.2.x
20.7.x
20.4.x
20.3.x
20.2.x
19.5.x
21.2.0-typescript-eslint-package-updates
Requires
Name | Version |
---|---|
typescript-eslint | >8.0.0 <8.29.0 |
Packages
Name | Version | Always Add to package.json |
---|---|---|
typescript-eslint | ^8.29.0 | Update only |
@typescript-eslint/eslint-plugin | ^8.29.0 | Update only |
@typescript-eslint/parser | ^8.29.0 | Update only |
@typescript-eslint/utils | ^8.29.0 | Update only |
@typescript-eslint/rule-tester | ^8.29.0 | Update only |
@typescript-eslint/scope-manager | ^8.29.0 | Update only |
@typescript-eslint/typescript-estree | ^8.29.0 | Update only |
21.2.0-@typescript-eslint-package-updates
Requires
Name | Version |
---|---|
@typescript-eslint/eslint-plugin | >8.0.0 <8.29.0 |
Packages
Name | Version | Always Add to package.json |
---|---|---|
typescript-eslint | ^8.29.0 | Update only |
@typescript-eslint/eslint-plugin | ^8.29.0 | Update only |
@typescript-eslint/parser | ^8.29.0 | Update only |
@typescript-eslint/utils | ^8.29.0 | Update only |
@typescript-eslint/rule-tester | ^8.29.0 | Update only |
@typescript-eslint/scope-manager | ^8.29.0 | Update only |
@typescript-eslint/typescript-estree | ^8.29.0 | Update only |
20.7.0-package-updates
Packages
Name | Version | Always Add to package.json |
---|---|---|
eslint-config-prettier | ^10.0.0 | Update only |
20.4.0-typescript-eslint-package-updates
Requires
Name | Version |
---|---|
typescript-eslint | >8.0.0 <8.19.0 |
Packages
Name | Version | Always Add to package.json |
---|---|---|
typescript-eslint | ^8.19.0 | Update only |
@typescript-eslint/eslint-plugin | ^8.19.0 | Update only |
@typescript-eslint/parser | ^8.19.0 | Update only |
@typescript-eslint/utils | ^8.19.0 | Update only |
@typescript-eslint/rule-tester | ^8.19.0 | Update only |
@typescript-eslint/scope-manager | ^8.19.0 | Update only |
@typescript-eslint/typescript-estree | ^8.19.0 | Update only |
20.4.0-@typescript-eslint-package-updates
Requires
Name | Version |
---|---|
@typescript-eslint/eslint-plugin | >8.0.0 <8.19.0 |
Packages
Name | Version | Always Add to package.json |
---|---|---|
typescript-eslint | ^8.19.0 | Update only |
@typescript-eslint/eslint-plugin | ^8.19.0 | Update only |
@typescript-eslint/parser | ^8.19.0 | Update only |
@typescript-eslint/utils | ^8.19.0 | Update only |
@typescript-eslint/rule-tester | ^8.19.0 | Update only |
@typescript-eslint/scope-manager | ^8.19.0 | Update only |
@typescript-eslint/typescript-estree | ^8.19.0 | Update only |
add-file-extensions-to-overrides
Update ESLint flat config to include .cjs, .mjs, .cts, and .mts files in overrides (if needed)
Update ESLint Config File Extensions in Overrides
Update ESLint flat config to include .cjs, .mjs, .cts, and .mts files in overrides (if needed)
Sample Code Changes
Add .cjs
, .mjs
, .cts
, .mts
file extensions to overrides converted using convert-to-flat-config
1const { FlatCompat } = require('@eslint/eslintrc');
2const js = require('@eslint/js');
3const nxEslintPlugin = require('@nx/eslint-plugin');
4
5const compat = new FlatCompat({
6 baseDirectory: __dirname,
7 recommendedConfig: js.configs.recommended,
8});
9
10module.exports = [
11 ...compat
12 .config({
13 extends: ['plugin:@nx/typescript'],
14 })
15 .map((config) => ({
16 ...config,
17 files: ['**/*.ts', '**/*.tsx'],
18 rules: {
19 ...config.rules,
20 },
21 })),
22 ...compat
23 .config({
24 extends: ['plugin:@nx/javascript'],
25 })
26 .map((config) => ({
27 ...config,
28 files: ['**/*.js', '**/*.jsx'],
29 rules: {
30 ...config.rules,
31 },
32 })),
33];
34
update-typescript-eslint-v8.13.0
Update TypeScript ESLint packages to v8.13.0 if they are already on v8
Update TypeScript ESLint to v8.13.0
Update TypeScript ESLint packages to v8.13.0 if they are already on v8
Sample Code Changes
This migration will update typescript-eslint
, @typescript-eslint/eslint-plugin
, @typescript-eslint/parser
and @typescript-eslint/utils
to 8.13.0
if they are between version 8.0.0
and 8.13.0
.
1{
2 "devDependencies": {
3 "typescript-eslint": "^8.0.0",
4 "@typescript-eslint/eslint-plugin": "^8.0.0",
5 "@typescript-eslint/parser": "^8.0.0",
6 "@typescript-eslint/utils": "^8.0.0"
7 }
8}
9
19.5.0-package-updates
Packages
Name | Version | Always Add to package.json |
---|---|---|
@typescript-eslint/parser | ^7.16.0 | Update only |
@typescript-eslint/eslint-plugin | ^7.16.0 | Update only |
@typescript-eslint/utils | ^7.16.0 | Update only |
@typescript-eslint/rule-tester | ^7.16.0 | Update only |
@typescript-eslint/scope-manager | ^7.16.0 | Update only |
@typescript-eslint/typescript-estree | ^7.16.0 | Update only |