Skip to content

Commit 2d4646d

Browse files
leosvelperezFrozenPandaz
authored andcommitted
fix(linter): do not infer lint tasks for projects without files to lint (#22944)
(cherry picked from commit 1e4324f)
1 parent 9b5a1cb commit 2d4646d

File tree

4 files changed

+318
-163
lines changed

4 files changed

+318
-163
lines changed

docs/generated/packages/eslint/documents/overview.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This will install the correct version of `@nx/eslint`.
2121

2222
### How @nx/eslint Infers Tasks
2323

24-
The `@nx/eslint` plugin will create a task for any project that has an ESLint configuration file present. Any of the following files will be recognized as an ESLint configuration file:
24+
The `@nx/eslint` plugin will create a task for any project that has an ESLint configuration file present and files to lint. Any of the following files will be recognized as an ESLint configuration file:
2525

2626
- `.eslintrc`
2727
- `.eslintrc.js`
@@ -33,6 +33,8 @@ The `@nx/eslint` plugin will create a task for any project that has an ESLint co
3333

3434
Because ESLint applies configuration files to all subdirectories, the `@nx/eslint` plugin will also infer tasks for projects in subdirectories. So, if there is an ESLint configuration file in the root of the repository, every project will have an inferred ESLint task.
3535

36+
Even if a project has an ESLint configuration file, it will only have an inferred ESLint task if there are files to lint. Otherwise, the task will not be created. Therefore, if you don't want an ESLint task to be inferred for a particular project, make sure the project files are properly excluded from ESLint.
37+
3638
### View Inferred Tasks
3739

3840
To view inferred tasks for a project, open the [project details view](/concepts/inferred-tasks) in Nx Console or run `nx show project my-project --web` in the command line.

docs/shared/packages/eslint/eslint.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This will install the correct version of `@nx/eslint`.
2121

2222
### How @nx/eslint Infers Tasks
2323

24-
The `@nx/eslint` plugin will create a task for any project that has an ESLint configuration file present. Any of the following files will be recognized as an ESLint configuration file:
24+
The `@nx/eslint` plugin will create a task for any project that has an ESLint configuration file present and files to lint. Any of the following files will be recognized as an ESLint configuration file:
2525

2626
- `.eslintrc`
2727
- `.eslintrc.js`
@@ -33,6 +33,8 @@ The `@nx/eslint` plugin will create a task for any project that has an ESLint co
3333

3434
Because ESLint applies configuration files to all subdirectories, the `@nx/eslint` plugin will also infer tasks for projects in subdirectories. So, if there is an ESLint configuration file in the root of the repository, every project will have an inferred ESLint task.
3535

36+
Even if a project has an ESLint configuration file, it will only have an inferred ESLint task if there are files to lint. Otherwise, the task will not be created. Therefore, if you don't want an ESLint task to be inferred for a particular project, make sure the project files are properly excluded from ESLint.
37+
3638
### View Inferred Tasks
3739

3840
To view inferred tasks for a project, open the [project details view](/concepts/inferred-tasks) in Nx Console or run `nx show project my-project --web` in the command line.

0 commit comments

Comments
 (0)