From 7c43180af4b02e5a677e370b6fe278ce311aa4af Mon Sep 17 00:00:00 2001 From: FrozenPandaz Date: Wed, 19 Apr 2023 16:08:00 -0400 Subject: [PATCH] feat(linter): rename @nx/eslint-plugin-nx to @nx/eslint-plugin --- docs/generated/manifests/menus.json | 12 +++--- docs/generated/manifests/packages.json | 26 ++++++------- docs/generated/packages-metadata.json | 18 ++++----- .../documents/enforce-module-boundaries.md | 0 .../documents/overview.md | 2 +- .../packages/linter/documents/overview.md | 2 +- docs/map.json | 10 ++--- .../{eslint-plugin-nx.md => eslint-plugin.md} | 2 +- docs/shared/packages/linter/linter-plugin.md | 2 +- nx-dev/nx-dev/redirect-rules.config.js | 7 +++- nx-dev/ui-references/src/lib/icons-map.ts | 2 +- packages-legacy/eslint-plugin-nx/README.md | 2 +- packages-legacy/eslint-plugin-nx/index.ts | 2 +- packages-legacy/eslint-plugin-nx/package.json | 2 +- packages-legacy/linter/project.json | 3 +- .../convert-tslint-to-eslint.spec.ts.snap | 12 +++--- .../migrate-from-angular-cli.spec.ts.snap | 2 +- .../generators/ng-add/utilities/workspace.ts | 2 +- .../convert-tslint-to-eslint.spec.ts.snap | 4 +- packages/cypress/src/utils/add-linter.ts | 2 +- .../update-16-0-0-add-nx-packages.ts | 14 ------- .../.eslintrc.json | 0 .../README.md | 0 .../jest.config.ts | 2 +- .../migrations.json | 2 +- .../package.json | 2 +- .../project.json | 22 +++++------ .../src/configs/angular-template.ts | 0 .../src/configs/angular.ts | 0 .../src/configs/javascript.ts | 0 .../src/configs/react-base.ts | 0 .../src/configs/react-jsx.ts | 0 .../src/configs/react-tmp.ts | 6 +-- .../src/configs/react-typescript.ts | 0 .../src/configs/typescript.ts | 0 .../src/constants.ts | 2 +- .../src/index.ts | 0 .../update-16-0-0-add-nx-packages.spec.ts | 10 ++--- .../update-16-0-0-add-nx-packages.ts | 38 +++++++++++++++++++ .../src/resolve-workspace-rules.ts | 0 .../rules/enforce-module-boundaries.spec.ts | 0 .../src/rules/enforce-module-boundaries.ts | 0 .../src/rules/nx-plugin-checks.ts | 0 .../src/utils/ast-utils.ts | 0 .../src/utils/config-utils.ts | 0 .../src/utils/create-eslint-rule.ts | 0 .../src/utils/graph-utils.spec.ts | 0 .../src/utils/graph-utils.ts | 0 .../src/utils/project-graph-utils.ts | 2 +- .../src/utils/runtime-lint-utils.spec.ts | 0 .../src/utils/runtime-lint-utils.ts | 0 .../tsconfig.json | 0 .../tsconfig.lib.json | 0 .../tsconfig.spec.json | 0 .../js/src/generators/library/library.spec.ts | 2 +- packages/linter/project.json | 2 +- .../init/__snapshots__/init.spec.ts.snap | 2 +- .../generators/init/global-eslint-config.ts | 2 +- .../src/generators/init/init-migration.ts | 2 +- packages/linter/src/generators/init/init.ts | 2 +- .../convert-tslint-to-eslint.spec.ts.snap | 8 ++-- .../src/generators/e2e-project/e2e-project.ts | 2 +- packages/nx/package.json | 2 +- .../application/application.spec.ts | 8 ++-- .../src/generators/library/library.spec.ts | 2 +- packages/react/src/utils/lint.ts | 7 +--- scripts/depcheck/missing.ts | 2 +- tsconfig.base.json | 2 +- 68 files changed, 142 insertions(+), 117 deletions(-) rename docs/generated/packages/{eslint-plugin-nx => eslint-plugin}/documents/enforce-module-boundaries.md (100%) rename docs/generated/packages/{eslint-plugin-nx => eslint-plugin}/documents/overview.md (95%) rename docs/shared/packages/linter/{eslint-plugin-nx.md => eslint-plugin.md} (95%) delete mode 100644 packages/eslint-plugin-nx/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.ts rename packages/{eslint-plugin-nx => eslint-plugin}/.eslintrc.json (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/README.md (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/jest.config.ts (87%) rename packages/{eslint-plugin-nx => eslint-plugin}/migrations.json (95%) rename packages/{eslint-plugin-nx => eslint-plugin}/package.json (97%) rename packages/{eslint-plugin-nx => eslint-plugin}/project.json (67%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/configs/angular-template.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/configs/angular.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/configs/javascript.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/configs/react-base.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/configs/react-jsx.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/configs/react-tmp.ts (76%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/configs/react-typescript.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/configs/typescript.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/constants.ts (94%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/index.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.spec.ts (85%) create mode 100644 packages/eslint-plugin/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.ts rename packages/{eslint-plugin-nx => eslint-plugin}/src/resolve-workspace-rules.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/rules/enforce-module-boundaries.spec.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/rules/enforce-module-boundaries.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/rules/nx-plugin-checks.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/utils/ast-utils.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/utils/config-utils.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/utils/create-eslint-rule.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/utils/graph-utils.spec.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/utils/graph-utils.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/utils/project-graph-utils.ts (96%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/utils/runtime-lint-utils.spec.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/src/utils/runtime-lint-utils.ts (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/tsconfig.json (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/tsconfig.lib.json (100%) rename packages/{eslint-plugin-nx => eslint-plugin}/tsconfig.spec.json (100%) diff --git a/docs/generated/manifests/menus.json b/docs/generated/manifests/menus.json index 639615962c0a0e..d792712a74c306 100644 --- a/docs/generated/manifests/menus.json +++ b/docs/generated/manifests/menus.json @@ -4405,18 +4405,18 @@ "disableCollapsible": false }, { - "id": "eslint-plugin-nx", - "path": "/packages/eslint-plugin-nx", - "name": "eslint-plugin-nx", + "id": "eslint-plugin", + "path": "/packages/eslint-plugin", + "name": "eslint-plugin", "children": [ { "id": "documents", - "path": "/packages/eslint-plugin-nx/documents", + "path": "/packages/eslint-plugin/documents", "name": "documents", "children": [ { "name": "Overview", - "path": "/packages/eslint-plugin-nx/documents/overview", + "path": "/packages/eslint-plugin/documents/overview", "id": "overview", "isExternal": false, "children": [], @@ -4424,7 +4424,7 @@ }, { "name": "The `enforce-module-boundaries` rule", - "path": "/packages/eslint-plugin-nx/documents/enforce-module-boundaries", + "path": "/packages/eslint-plugin/documents/enforce-module-boundaries", "id": "enforce-module-boundaries", "isExternal": false, "children": [], diff --git a/docs/generated/manifests/packages.json b/docs/generated/manifests/packages.json index 0677bcc53f8a07..cea58528eebc74 100644 --- a/docs/generated/manifests/packages.json +++ b/docs/generated/manifests/packages.json @@ -645,40 +645,40 @@ }, "path": "/packages/esbuild" }, - "eslint-plugin-nx": { + "eslint-plugin": { "githubRoot": "https://github.com/nrwl/nx/blob/master", - "name": "eslint-plugin-nx", - "packageName": "@nrwl/eslint-plugin-nx", + "name": "eslint-plugin", + "packageName": "@nrwl/eslint-plugin", "description": "The eslint-plugin-nx package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.", "documents": { - "/packages/eslint-plugin-nx/documents/overview": { + "/packages/eslint-plugin/documents/overview": { "id": "overview", "name": "Overview", "description": "The eslint-plugin-nx package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.", - "file": "generated/packages/eslint-plugin-nx/documents/overview", + "file": "generated/packages/eslint-plugin/documents/overview", "itemList": [], "isExternal": false, - "path": "/packages/eslint-plugin-nx/documents/overview", + "path": "/packages/eslint-plugin/documents/overview", "tags": [], - "originalFilePath": "shared/packages/linter/eslint-plugin-nx" + "originalFilePath": "shared/packages/linter/eslint-plugin" }, - "/packages/eslint-plugin-nx/documents/enforce-module-boundaries": { + "/packages/eslint-plugin/documents/enforce-module-boundaries": { "id": "enforce-module-boundaries", "name": "The `enforce-module-boundaries` rule", "description": "The eslint-plugin-nx package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.", - "file": "generated/packages/eslint-plugin-nx/documents/enforce-module-boundaries", + "file": "generated/packages/eslint-plugin/documents/enforce-module-boundaries", "itemList": [], "isExternal": false, - "path": "/packages/eslint-plugin-nx/documents/enforce-module-boundaries", + "path": "/packages/eslint-plugin/documents/enforce-module-boundaries", "tags": [], "originalFilePath": "shared/packages/linter/enforce-module-boundaries" } }, - "root": "/packages/eslint-plugin-nx", - "source": "/packages/eslint-plugin-nx/src", + "root": "/packages/eslint-plugin", + "source": "/packages/eslint-plugin/src", "executors": {}, "generators": {}, - "path": "/packages/eslint-plugin-nx" + "path": "/packages/eslint-plugin" }, "expo": { "githubRoot": "https://github.com/nrwl/nx/blob/master", diff --git a/docs/generated/packages-metadata.json b/docs/generated/packages-metadata.json index 687e95d7bb48bd..f8fbd5466cc0d8 100644 --- a/docs/generated/packages-metadata.json +++ b/docs/generated/packages-metadata.json @@ -645,21 +645,21 @@ "id": "overview", "name": "Overview", "description": "The eslint-plugin-nx package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.", - "file": "generated/packages/eslint-plugin-nx/documents/overview", + "file": "generated/packages/eslint-plugin/documents/overview", "itemList": [], "isExternal": false, - "path": "eslint-plugin-nx/documents/overview", + "path": "eslint-plugin/documents/overview", "tags": [], - "originalFilePath": "shared/packages/linter/eslint-plugin-nx" + "originalFilePath": "shared/packages/linter/eslint-plugin" }, { "id": "enforce-module-boundaries", "name": "The `enforce-module-boundaries` rule", "description": "The eslint-plugin-nx package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.", - "file": "generated/packages/eslint-plugin-nx/documents/enforce-module-boundaries", + "file": "generated/packages/eslint-plugin/documents/enforce-module-boundaries", "itemList": [], "isExternal": false, - "path": "eslint-plugin-nx/documents/enforce-module-boundaries", + "path": "eslint-plugin/documents/enforce-module-boundaries", "tags": [], "originalFilePath": "shared/packages/linter/enforce-module-boundaries" } @@ -667,10 +667,10 @@ "executors": [], "generators": [], "githubRoot": "https://github.com/nrwl/nx/blob/master", - "name": "eslint-plugin-nx", - "packageName": "@nrwl/eslint-plugin-nx", - "root": "/packages/eslint-plugin-nx", - "source": "/packages/eslint-plugin-nx/src" + "name": "eslint-plugin", + "packageName": "@nrwl/eslint-plugin", + "root": "/packages/eslint-plugin", + "source": "/packages/eslint-plugin/src" }, { "description": "The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.", diff --git a/docs/generated/packages/eslint-plugin-nx/documents/enforce-module-boundaries.md b/docs/generated/packages/eslint-plugin/documents/enforce-module-boundaries.md similarity index 100% rename from docs/generated/packages/eslint-plugin-nx/documents/enforce-module-boundaries.md rename to docs/generated/packages/eslint-plugin/documents/enforce-module-boundaries.md diff --git a/docs/generated/packages/eslint-plugin-nx/documents/overview.md b/docs/generated/packages/eslint-plugin/documents/overview.md similarity index 95% rename from docs/generated/packages/eslint-plugin-nx/documents/overview.md rename to docs/generated/packages/eslint-plugin/documents/overview.md index a5fc65844d6177..9a577e5821f65d 100644 --- a/docs/generated/packages/eslint-plugin-nx/documents/overview.md +++ b/docs/generated/packages/eslint-plugin/documents/overview.md @@ -54,4 +54,4 @@ You can also use `@nrwl/nx/react` which includes all three `@nrwl/nx/react-*` pl ### Enforce Module Boundaries rule -The `enforce-module-boundaries` ESLint rule enables you to define strict rules for accessing resources between different projects in the repository. Enforcing strict boundaries helps keep prevent unplanned cross-dependencies. Read more about it on a [dedicated page](/packages/eslint-plugin-nx/documents/enforce-module-boundaries) +The `enforce-module-boundaries` ESLint rule enables you to define strict rules for accessing resources between different projects in the repository. Enforcing strict boundaries helps keep prevent unplanned cross-dependencies. Read more about it on a [dedicated page](/packages/eslint-plugin/documents/enforce-module-boundaries) diff --git a/docs/generated/packages/linter/documents/overview.md b/docs/generated/packages/linter/documents/overview.md index 596e8c1d068162..d3720e15de7043 100644 --- a/docs/generated/packages/linter/documents/overview.md +++ b/docs/generated/packages/linter/documents/overview.md @@ -32,4 +32,4 @@ nx lint my-lib ## ESLint plugin -Read about our dedicated ESLint plugin - [eslint-plugin-nx](/packages/eslint-plugin-nx/documents/overview). +Read about our dedicated ESLint plugin - [eslint-plugin-nx](/packages/eslint-plugin/documents/overview). diff --git a/docs/map.json b/docs/map.json index 40639dc43e1b71..8c78ea239b97ab 100644 --- a/docs/map.json +++ b/docs/map.json @@ -1936,20 +1936,20 @@ ] }, { - "name": "eslint-plugin-nx", - "id": "eslint-plugin-nx", + "name": "eslint-plugin", + "id": "eslint-plugin", "description": "ESLint plugin package.", "itemList": [ { "id": "overview", "name": "Overview", - "path": "/packages/eslint-plugin-nx", - "file": "shared/packages/linter/eslint-plugin-nx" + "path": "/packages/eslint-plugin", + "file": "shared/packages/linter/eslint-plugin" }, { "id": "enforce-module-boundaries", "name": "The `enforce-module-boundaries` rule", - "path": "/packages/eslint-plugin-nx", + "path": "/packages/eslint-plugin", "file": "shared/packages/linter/enforce-module-boundaries" } ] diff --git a/docs/shared/packages/linter/eslint-plugin-nx.md b/docs/shared/packages/linter/eslint-plugin.md similarity index 95% rename from docs/shared/packages/linter/eslint-plugin-nx.md rename to docs/shared/packages/linter/eslint-plugin.md index a5fc65844d6177..9a577e5821f65d 100644 --- a/docs/shared/packages/linter/eslint-plugin-nx.md +++ b/docs/shared/packages/linter/eslint-plugin.md @@ -54,4 +54,4 @@ You can also use `@nrwl/nx/react` which includes all three `@nrwl/nx/react-*` pl ### Enforce Module Boundaries rule -The `enforce-module-boundaries` ESLint rule enables you to define strict rules for accessing resources between different projects in the repository. Enforcing strict boundaries helps keep prevent unplanned cross-dependencies. Read more about it on a [dedicated page](/packages/eslint-plugin-nx/documents/enforce-module-boundaries) +The `enforce-module-boundaries` ESLint rule enables you to define strict rules for accessing resources between different projects in the repository. Enforcing strict boundaries helps keep prevent unplanned cross-dependencies. Read more about it on a [dedicated page](/packages/eslint-plugin/documents/enforce-module-boundaries) diff --git a/docs/shared/packages/linter/linter-plugin.md b/docs/shared/packages/linter/linter-plugin.md index 596e8c1d068162..d3720e15de7043 100644 --- a/docs/shared/packages/linter/linter-plugin.md +++ b/docs/shared/packages/linter/linter-plugin.md @@ -32,4 +32,4 @@ nx lint my-lib ## ESLint plugin -Read about our dedicated ESLint plugin - [eslint-plugin-nx](/packages/eslint-plugin-nx/documents/overview). +Read about our dedicated ESLint plugin - [eslint-plugin-nx](/packages/eslint-plugin/documents/overview). diff --git a/nx-dev/nx-dev/redirect-rules.config.js b/nx-dev/nx-dev/redirect-rules.config.js index 861b2b72365279..0cafa7ed371641 100644 --- a/nx-dev/nx-dev/redirect-rules.config.js +++ b/nx-dev/nx-dev/redirect-rules.config.js @@ -433,7 +433,7 @@ const packagesIndexes = { '/cypress': '/packages/cypress', '/detox': '/packages/detox', '/esbuild': '/packages/esbuild', - '/eslint-plugin-nx': '/packages/eslint', + '/eslint-plugin-nx': '/packages/eslint-plugin-nx', '/expo': '/packages/expo', '/express': '/packages/express', '/jest': '/packages/jest', @@ -514,6 +514,11 @@ const packagesDocuments = { '/packages/add-nx-to-monorepo': '/packages/nx/documents/init', '/packages/cra-to-nx': '/packages/nx/documents/init', '/packages/make-angular-cli-faster': '/packages/nx/documents/init', + '/packages/eslint-plugin-nx': '/packages/eslint-plugin', + '/packages/eslint-plugin-nx/documents/enforce-module-boundaries': + '/packages/eslint-plugin/documents/enforce-module-boundaries', + '/packages/eslint-plugin-nx/documents/overview': + '/packages/eslint-plugin/documents/overview', }; /** diff --git a/nx-dev/ui-references/src/lib/icons-map.ts b/nx-dev/ui-references/src/lib/icons-map.ts index 1d19b7b32923ab..119e3fc28bdce8 100644 --- a/nx-dev/ui-references/src/lib/icons-map.ts +++ b/nx-dev/ui-references/src/lib/icons-map.ts @@ -5,7 +5,7 @@ export const iconsMap: Record = { detox: '/images/icons/react.svg', devkit: '/images/icons/nx.svg', esbuild: '/images/icons/esbuild.svg', - 'eslint-plugin-nx': '/images/icons/eslint.svg', + 'eslint-plugin': '/images/icons/eslint.svg', expo: '/images/icons/expo.svg', express: '/images/icons/express.svg', jest: '/images/icons/jest.svg', diff --git a/packages-legacy/eslint-plugin-nx/README.md b/packages-legacy/eslint-plugin-nx/README.md index a4078e1c78d23c..f4a4f16bd0dddc 100644 --- a/packages-legacy/eslint-plugin-nx/README.md +++ b/packages-legacy/eslint-plugin-nx/README.md @@ -1,6 +1,6 @@ ## @nrwl/eslint-plugin-nx has been deprecated! -@nrwl/eslint-plugin-nx has been deprecated in favor of [@nx/eslint-plugin-nx](https://www.npmjs.com/package/@nx/eslint-plugin-nx). Please use that instead. +@nrwl/eslint-plugin-nx has been deprecated in favor of [@nx/eslint-plugin](https://www.npmjs.com/package/@nx/eslint-plugin). Please use that instead. @nrwl/eslint-plugin-nx will no longer be published in Nx v17. diff --git a/packages-legacy/eslint-plugin-nx/index.ts b/packages-legacy/eslint-plugin-nx/index.ts index 8ee2780ec94318..1f2421378a8361 100644 --- a/packages-legacy/eslint-plugin-nx/index.ts +++ b/packages-legacy/eslint-plugin-nx/index.ts @@ -1 +1 @@ -export * from '@nx/eslint-plugin-nx'; +export * from '@nx/eslint-plugin'; diff --git a/packages-legacy/eslint-plugin-nx/package.json b/packages-legacy/eslint-plugin-nx/package.json index 71b295245f955e..6fc6041746be43 100644 --- a/packages-legacy/eslint-plugin-nx/package.json +++ b/packages-legacy/eslint-plugin-nx/package.json @@ -24,7 +24,7 @@ }, "homepage": "https://nx.dev", "dependencies": { - "@nx/eslint-plugin-nx": "file:../../packages/eslint-plugin-nx" + "@nx/eslint-plugin": "file:../../packages/eslint-plugin" }, "publishConfig": { "access": "public" diff --git a/packages-legacy/linter/project.json b/packages-legacy/linter/project.json index 3e81782f6932ad..4c2a69e97ea8f0 100644 --- a/packages-legacy/linter/project.json +++ b/packages-legacy/linter/project.json @@ -32,6 +32,5 @@ ] } } - }, - "implicitDependencies": ["eslint-plugin-nx"] + } } diff --git a/packages/angular/src/generators/convert-tslint-to-eslint/__snapshots__/convert-tslint-to-eslint.spec.ts.snap b/packages/angular/src/generators/convert-tslint-to-eslint/__snapshots__/convert-tslint-to-eslint.spec.ts.snap index acbc30ccf437f8..65b008064a44cd 100644 --- a/packages/angular/src/generators/convert-tslint-to-eslint/__snapshots__/convert-tslint-to-eslint.spec.ts.snap +++ b/packages/angular/src/generators/convert-tslint-to-eslint/__snapshots__/convert-tslint-to-eslint.spec.ts.snap @@ -238,7 +238,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio }, ], "plugins": [ - "@nx/nx", + "@nx", ], "root": true, } @@ -541,7 +541,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio }, ], "plugins": [ - "@nx/nx", + "@nx", ], "root": true, } @@ -554,7 +554,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 1`] = ` "@angular-eslint/eslint-plugin": "~15.0.0", "@angular-eslint/eslint-plugin-template": "~15.0.0", "@angular-eslint/template-parser": "~15.0.0", - "@nx/eslint-plugin-nx": "0.0.1", + "@nx/eslint-plugin": "0.0.1", "@nx/linter": "0.0.1", "@typescript-eslint/eslint-plugin": "^5.58.0", "@typescript-eslint/parser": "^5.58.0", @@ -828,7 +828,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 3`] = ` }, ], "plugins": [ - "@nx/nx", + "@nx", ], "root": true, } @@ -906,7 +906,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 1`] = ` "@angular-eslint/eslint-plugin": "~15.0.0", "@angular-eslint/eslint-plugin-template": "~15.0.0", "@angular-eslint/template-parser": "~15.0.0", - "@nx/eslint-plugin-nx": "0.0.1", + "@nx/eslint-plugin": "0.0.1", "@nx/linter": "0.0.1", "@typescript-eslint/eslint-plugin": "^5.58.0", "@typescript-eslint/parser": "^5.58.0", @@ -1180,7 +1180,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 3`] = ` }, ], "plugins": [ - "@nx/nx", + "@nx", ], "root": true, } diff --git a/packages/angular/src/generators/ng-add/__snapshots__/migrate-from-angular-cli.spec.ts.snap b/packages/angular/src/generators/ng-add/__snapshots__/migrate-from-angular-cli.spec.ts.snap index 46a168e13bf759..8f02dd6207401d 100644 --- a/packages/angular/src/generators/ng-add/__snapshots__/migrate-from-angular-cli.spec.ts.snap +++ b/packages/angular/src/generators/ng-add/__snapshots__/migrate-from-angular-cli.spec.ts.snap @@ -72,7 +72,7 @@ exports[`workspace move to nx layout should create a root eslint config 1`] = ` }, ], "plugins": [ - "@nx/nx", + "@nx", ], "root": true, } diff --git a/packages/angular/src/generators/ng-add/utilities/workspace.ts b/packages/angular/src/generators/ng-add/utilities/workspace.ts index 3d59f5ac5c88d9..5f7093491895ac 100644 --- a/packages/angular/src/generators/ng-add/utilities/workspace.ts +++ b/packages/angular/src/generators/ng-add/utilities/workspace.ts @@ -214,7 +214,7 @@ export function updateRootEsLintConfig( existingEsLintConfig.ignorePatterns = ['**/*']; if (!(existingEsLintConfig.plugins ?? []).includes('@nrwl/nx')) { existingEsLintConfig.plugins = Array.from( - new Set([...(existingEsLintConfig.plugins ?? []), '@nx/nx']) + new Set([...(existingEsLintConfig.plugins ?? []), '@nx']) ); } existingEsLintConfig.overrides?.forEach((override) => { diff --git a/packages/cypress/src/generators/convert-tslint-to-eslint/__snapshots__/convert-tslint-to-eslint.spec.ts.snap b/packages/cypress/src/generators/convert-tslint-to-eslint/__snapshots__/convert-tslint-to-eslint.spec.ts.snap index ac7eddee605321..4a6fce3845e8ab 100644 --- a/packages/cypress/src/generators/convert-tslint-to-eslint/__snapshots__/convert-tslint-to-eslint.spec.ts.snap +++ b/packages/cypress/src/generators/convert-tslint-to-eslint/__snapshots__/convert-tslint-to-eslint.spec.ts.snap @@ -4,7 +4,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 1`] = ` { "dependencies": {}, "devDependencies": { - "@nx/eslint-plugin-nx": "0.0.1", + "@nx/eslint-plugin": "0.0.1", "@nx/linter": "0.0.1", "@typescript-eslint/eslint-plugin": "^5.58.0", "@typescript-eslint/parser": "^5.58.0", @@ -238,7 +238,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 3`] = ` }, ], "plugins": [ - "@nx/nx", + "@nx", ], "root": true, } diff --git a/packages/cypress/src/utils/add-linter.ts b/packages/cypress/src/utils/add-linter.ts index 425127d7165e5e..3a476c69c2094f 100644 --- a/packages/cypress/src/utils/add-linter.ts +++ b/packages/cypress/src/utils/add-linter.ts @@ -78,7 +78,7 @@ export async function addLinterToCyProject( joinPathFragments(projectConfig.root, '.eslintrc.json'), (json) => { if (options.rootProject) { - json.plugins = ['@nx/nx']; + json.plugins = ['@nx']; json.extends = ['plugin:cypress/recommended']; } else { json.extends = ['plugin:cypress/recommended', ...json.extends]; diff --git a/packages/eslint-plugin-nx/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.ts b/packages/eslint-plugin-nx/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.ts deleted file mode 100644 index c9d5d299712ff1..00000000000000 --- a/packages/eslint-plugin-nx/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Tree, formatFiles } from '@nx/devkit'; -import { replaceNrwlPackageWithNxPackage } from '@nx/devkit/src/utils/replace-package'; - -export default async function replacePackage(tree: Tree): Promise { - await replaceNrwlPackageWithNxPackage( - tree, - '@nrwl/eslint-plugin-nx', - '@nx/eslint-plugin-nx' - ); - - await replaceNrwlPackageWithNxPackage(tree, '@nrwl/nx', '@nx/nx'); - - await formatFiles(tree); -} diff --git a/packages/eslint-plugin-nx/.eslintrc.json b/packages/eslint-plugin/.eslintrc.json similarity index 100% rename from packages/eslint-plugin-nx/.eslintrc.json rename to packages/eslint-plugin/.eslintrc.json diff --git a/packages/eslint-plugin-nx/README.md b/packages/eslint-plugin/README.md similarity index 100% rename from packages/eslint-plugin-nx/README.md rename to packages/eslint-plugin/README.md diff --git a/packages/eslint-plugin-nx/jest.config.ts b/packages/eslint-plugin/jest.config.ts similarity index 87% rename from packages/eslint-plugin-nx/jest.config.ts rename to packages/eslint-plugin/jest.config.ts index 7fe2a9ea15fe62..6a55cb70577d30 100644 --- a/packages/eslint-plugin-nx/jest.config.ts +++ b/packages/eslint-plugin/jest.config.ts @@ -5,7 +5,7 @@ export default { }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], globals: {}, - displayName: 'eslint-plugin-nx', + displayName: 'packages-eslint-plugin', testEnvironment: 'node', preset: '../../jest.preset.js', }; diff --git a/packages/eslint-plugin-nx/migrations.json b/packages/eslint-plugin/migrations.json similarity index 95% rename from packages/eslint-plugin-nx/migrations.json rename to packages/eslint-plugin/migrations.json index 6f5c74a5751ecc..723895bcbe347b 100644 --- a/packages/eslint-plugin-nx/migrations.json +++ b/packages/eslint-plugin/migrations.json @@ -3,7 +3,7 @@ "update-16-0-0-add-nx-packages": { "cli": "nx", "version": "16.0.0-beta.1", - "description": "Replace @nrwl/eslint-plugin-nx with @nx/eslint-plugin-nx", + "description": "Replace @nrwl/eslint-plugin-nx with @nx/eslint-plugin", "implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages" } }, diff --git a/packages/eslint-plugin-nx/package.json b/packages/eslint-plugin/package.json similarity index 97% rename from packages/eslint-plugin-nx/package.json rename to packages/eslint-plugin/package.json index 78d63922d58b3f..c8554d5df03928 100644 --- a/packages/eslint-plugin-nx/package.json +++ b/packages/eslint-plugin/package.json @@ -1,5 +1,5 @@ { - "name": "@nx/eslint-plugin-nx", + "name": "@nx/eslint-plugin", "version": "0.0.1", "private": false, "description": "The eslint-plugin-nx package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.", diff --git a/packages/eslint-plugin-nx/project.json b/packages/eslint-plugin/project.json similarity index 67% rename from packages/eslint-plugin-nx/project.json rename to packages/eslint-plugin/project.json index b950eb2a205048..0cd549165053e5 100644 --- a/packages/eslint-plugin-nx/project.json +++ b/packages/eslint-plugin/project.json @@ -1,39 +1,39 @@ { - "name": "eslint-plugin-nx", + "name": "eslint-plugin", "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "packages/eslint-plugin-nx", + "sourceRoot": "packages/eslint-plugin", "projectType": "library", "targets": { "test": {}, "build-base": { "executor": "@nrwl/js:tsc", "options": { - "main": "packages/eslint-plugin-nx/src/index.ts", + "main": "packages/eslint-plugin/src/index.ts", "assets": [ { - "input": "packages/eslint-plugin-nx", + "input": "packages/eslint-plugin", "glob": "**/files/**", "output": "/" }, { - "input": "packages/eslint-plugin-nx", + "input": "packages/eslint-plugin", "glob": "**/files/**/.gitkeep", "output": "/" }, { - "input": "packages/eslint-plugin-nx", + "input": "packages/eslint-plugin", "glob": "**/*.json", "ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"], "output": "/" }, { - "input": "packages/eslint-plugin-nx", + "input": "packages/eslint-plugin", "glob": "**/*.js", "ignore": ["**/jest.config.js"], "output": "/" }, { - "input": "packages/eslint-plugin-nx", + "input": "packages/eslint-plugin", "glob": "**/*.d.ts", "output": "/" }, @@ -47,11 +47,11 @@ }, "build": { "executor": "nx:run-commands", - "outputs": ["{workspaceRoot}/build/packages/eslint-plugin-nx"], + "outputs": ["{workspaceRoot}/build/packages/eslint-plugin"], "options": { "commands": [ - "node ./scripts/copy-readme.js eslint-plugin-nx", - "node ./scripts/add-dependency-to-build.js eslint-plugin-nx @nrwl/eslint-plugin-nx" + "node ./scripts/copy-readme.js eslint-plugin", + "node ./scripts/add-dependency-to-build.js eslint-plugin @nrwl/eslint-plugin-nx" ] } }, diff --git a/packages/eslint-plugin-nx/src/configs/angular-template.ts b/packages/eslint-plugin/src/configs/angular-template.ts similarity index 100% rename from packages/eslint-plugin-nx/src/configs/angular-template.ts rename to packages/eslint-plugin/src/configs/angular-template.ts diff --git a/packages/eslint-plugin-nx/src/configs/angular.ts b/packages/eslint-plugin/src/configs/angular.ts similarity index 100% rename from packages/eslint-plugin-nx/src/configs/angular.ts rename to packages/eslint-plugin/src/configs/angular.ts diff --git a/packages/eslint-plugin-nx/src/configs/javascript.ts b/packages/eslint-plugin/src/configs/javascript.ts similarity index 100% rename from packages/eslint-plugin-nx/src/configs/javascript.ts rename to packages/eslint-plugin/src/configs/javascript.ts diff --git a/packages/eslint-plugin-nx/src/configs/react-base.ts b/packages/eslint-plugin/src/configs/react-base.ts similarity index 100% rename from packages/eslint-plugin-nx/src/configs/react-base.ts rename to packages/eslint-plugin/src/configs/react-base.ts diff --git a/packages/eslint-plugin-nx/src/configs/react-jsx.ts b/packages/eslint-plugin/src/configs/react-jsx.ts similarity index 100% rename from packages/eslint-plugin-nx/src/configs/react-jsx.ts rename to packages/eslint-plugin/src/configs/react-jsx.ts diff --git a/packages/eslint-plugin-nx/src/configs/react-tmp.ts b/packages/eslint-plugin/src/configs/react-tmp.ts similarity index 76% rename from packages/eslint-plugin-nx/src/configs/react-tmp.ts rename to packages/eslint-plugin/src/configs/react-tmp.ts index 49e75b3cb8e433..a603379b6cc6dd 100644 --- a/packages/eslint-plugin-nx/src/configs/react-tmp.ts +++ b/packages/eslint-plugin/src/configs/react-tmp.ts @@ -8,8 +8,8 @@ */ export default { extends: [ - 'plugin:@nx/nx/react-base', - 'plugin:@nx/nx/react-typescript', - 'plugin:@nx/nx/react-jsx', + 'plugin:@nx/react-base', + 'plugin:@nx/react-typescript', + 'plugin:@nx/react-jsx', ], }; diff --git a/packages/eslint-plugin-nx/src/configs/react-typescript.ts b/packages/eslint-plugin/src/configs/react-typescript.ts similarity index 100% rename from packages/eslint-plugin-nx/src/configs/react-typescript.ts rename to packages/eslint-plugin/src/configs/react-typescript.ts diff --git a/packages/eslint-plugin-nx/src/configs/typescript.ts b/packages/eslint-plugin/src/configs/typescript.ts similarity index 100% rename from packages/eslint-plugin-nx/src/configs/typescript.ts rename to packages/eslint-plugin/src/configs/typescript.ts diff --git a/packages/eslint-plugin-nx/src/constants.ts b/packages/eslint-plugin/src/constants.ts similarity index 94% rename from packages/eslint-plugin-nx/src/constants.ts rename to packages/eslint-plugin/src/constants.ts index 81ce623ff9f569..a081d5edb5c4f9 100644 --- a/packages/eslint-plugin-nx/src/constants.ts +++ b/packages/eslint-plugin/src/constants.ts @@ -11,6 +11,6 @@ export const WORKSPACE_PLUGIN_DIR = join(workspaceRoot, 'tools/eslint-rules'); * E.g. if a user writes a rule called "foo", then they will include it in their ESLint * config files as: * - * "@nx/nx/workspace/foo": "error" + * "@nx/workspace/foo": "error" */ export const WORKSPACE_RULE_NAMESPACE = 'workspace'; diff --git a/packages/eslint-plugin-nx/src/index.ts b/packages/eslint-plugin/src/index.ts similarity index 100% rename from packages/eslint-plugin-nx/src/index.ts rename to packages/eslint-plugin/src/index.ts diff --git a/packages/eslint-plugin-nx/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.spec.ts b/packages/eslint-plugin/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.spec.ts similarity index 85% rename from packages/eslint-plugin-nx/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.spec.ts rename to packages/eslint-plugin/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.spec.ts index 81120e8754db52..6f72c9d7443f92 100644 --- a/packages/eslint-plugin-nx/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.spec.ts +++ b/packages/eslint-plugin/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.spec.ts @@ -24,13 +24,13 @@ describe('update-16-0-0-add-nx-packages', () => { ).not.toBeDefined(); }); - it('should add a dependency on @nx/eslint-plugin-nx', async () => { + it('should add a dependency on @nx/eslint-plugin', async () => { await replacePackage(tree); const packageJson = readJson(tree, 'package.json'); const newDependencyVersion = - packageJson.devDependencies['@nx/eslint-plugin-nx'] ?? - packageJson.dependencies['@nx/eslint-plugin-nx']; + packageJson.devDependencies['@nx/eslint-plugin'] ?? + packageJson.dependencies['@nx/eslint-plugin']; expect(newDependencyVersion).toBeDefined(); }); @@ -48,10 +48,10 @@ describe('update-16-0-0-add-nx-packages', () => { expect(readJson(tree, '.eslintrc.json')).toMatchInlineSnapshot(` { "plugins": [ - "@nx/nx", + "@nx", ], "rules": { - "@nx/nx/enforce-module-boundaries": [ + "@nx/enforce-module-boundaries": [ "error", {}, ], diff --git a/packages/eslint-plugin/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.ts b/packages/eslint-plugin/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.ts new file mode 100644 index 00000000000000..43558164d854e7 --- /dev/null +++ b/packages/eslint-plugin/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.ts @@ -0,0 +1,38 @@ +import { Tree, formatFiles, visitNotIgnoredFiles } from '@nx/devkit'; +import { replaceNrwlPackageWithNxPackage } from '@nx/devkit/src/utils/replace-package'; + +import { basename } from 'path'; + +const eslintFileNames = [ + '.eslintrc', + '.eslintrc.js', + '.eslintrc.cjs', + '.eslintrc.yaml', + '.eslintrc.yml', + '.eslintrc.json', + 'eslint.config.js', // new format that requires `ESLINT_USE_FLAT_CONFIG=true` +]; + +export default async function replacePackage(tree: Tree): Promise { + await replaceNrwlPackageWithNxPackage( + tree, + '@nrwl/eslint-plugin-nx', + '@nx/eslint-plugin' + ); + + visitNotIgnoredFiles(tree, '.', (path) => { + if (!eslintFileNames.includes(basename(path))) { + return; + } + + const contents = tree.read(path).toString(); + + if (!contents.includes('@nrwl/nx')) { + return; + } + + tree.write(path, contents.replace(new RegExp('@nrwl/nx', 'g'), '@nx')); + }); + + await formatFiles(tree); +} diff --git a/packages/eslint-plugin-nx/src/resolve-workspace-rules.ts b/packages/eslint-plugin/src/resolve-workspace-rules.ts similarity index 100% rename from packages/eslint-plugin-nx/src/resolve-workspace-rules.ts rename to packages/eslint-plugin/src/resolve-workspace-rules.ts diff --git a/packages/eslint-plugin-nx/src/rules/enforce-module-boundaries.spec.ts b/packages/eslint-plugin/src/rules/enforce-module-boundaries.spec.ts similarity index 100% rename from packages/eslint-plugin-nx/src/rules/enforce-module-boundaries.spec.ts rename to packages/eslint-plugin/src/rules/enforce-module-boundaries.spec.ts diff --git a/packages/eslint-plugin-nx/src/rules/enforce-module-boundaries.ts b/packages/eslint-plugin/src/rules/enforce-module-boundaries.ts similarity index 100% rename from packages/eslint-plugin-nx/src/rules/enforce-module-boundaries.ts rename to packages/eslint-plugin/src/rules/enforce-module-boundaries.ts diff --git a/packages/eslint-plugin-nx/src/rules/nx-plugin-checks.ts b/packages/eslint-plugin/src/rules/nx-plugin-checks.ts similarity index 100% rename from packages/eslint-plugin-nx/src/rules/nx-plugin-checks.ts rename to packages/eslint-plugin/src/rules/nx-plugin-checks.ts diff --git a/packages/eslint-plugin-nx/src/utils/ast-utils.ts b/packages/eslint-plugin/src/utils/ast-utils.ts similarity index 100% rename from packages/eslint-plugin-nx/src/utils/ast-utils.ts rename to packages/eslint-plugin/src/utils/ast-utils.ts diff --git a/packages/eslint-plugin-nx/src/utils/config-utils.ts b/packages/eslint-plugin/src/utils/config-utils.ts similarity index 100% rename from packages/eslint-plugin-nx/src/utils/config-utils.ts rename to packages/eslint-plugin/src/utils/config-utils.ts diff --git a/packages/eslint-plugin-nx/src/utils/create-eslint-rule.ts b/packages/eslint-plugin/src/utils/create-eslint-rule.ts similarity index 100% rename from packages/eslint-plugin-nx/src/utils/create-eslint-rule.ts rename to packages/eslint-plugin/src/utils/create-eslint-rule.ts diff --git a/packages/eslint-plugin-nx/src/utils/graph-utils.spec.ts b/packages/eslint-plugin/src/utils/graph-utils.spec.ts similarity index 100% rename from packages/eslint-plugin-nx/src/utils/graph-utils.spec.ts rename to packages/eslint-plugin/src/utils/graph-utils.spec.ts diff --git a/packages/eslint-plugin-nx/src/utils/graph-utils.ts b/packages/eslint-plugin/src/utils/graph-utils.ts similarity index 100% rename from packages/eslint-plugin-nx/src/utils/graph-utils.ts rename to packages/eslint-plugin/src/utils/graph-utils.ts diff --git a/packages/eslint-plugin-nx/src/utils/project-graph-utils.ts b/packages/eslint-plugin/src/utils/project-graph-utils.ts similarity index 96% rename from packages/eslint-plugin-nx/src/utils/project-graph-utils.ts rename to packages/eslint-plugin/src/utils/project-graph-utils.ts index f1ef0a0a4b9eed..c683466e3900af 100644 --- a/packages/eslint-plugin-nx/src/utils/project-graph-utils.ts +++ b/packages/eslint-plugin/src/utils/project-graph-utils.ts @@ -31,7 +31,7 @@ export function ensureGlobalProjectGraph(ruleName: string) { ); } catch { const WARNING_PREFIX = `${chalk.reset.keyword('orange')('warning')}`; - const RULE_NAME_SUFFIX = `${chalk.reset.dim(`@nx/nx/${ruleName}`)}`; + const RULE_NAME_SUFFIX = `${chalk.reset.dim(`@nx/${ruleName}`)}`; process.stdout .write(`${WARNING_PREFIX} No cached ProjectGraph is available. The rule will be skipped. If you encounter this error as part of running standard \`nx\` commands then please open an issue on https://github.com/nrwl/nx diff --git a/packages/eslint-plugin-nx/src/utils/runtime-lint-utils.spec.ts b/packages/eslint-plugin/src/utils/runtime-lint-utils.spec.ts similarity index 100% rename from packages/eslint-plugin-nx/src/utils/runtime-lint-utils.spec.ts rename to packages/eslint-plugin/src/utils/runtime-lint-utils.spec.ts diff --git a/packages/eslint-plugin-nx/src/utils/runtime-lint-utils.ts b/packages/eslint-plugin/src/utils/runtime-lint-utils.ts similarity index 100% rename from packages/eslint-plugin-nx/src/utils/runtime-lint-utils.ts rename to packages/eslint-plugin/src/utils/runtime-lint-utils.ts diff --git a/packages/eslint-plugin-nx/tsconfig.json b/packages/eslint-plugin/tsconfig.json similarity index 100% rename from packages/eslint-plugin-nx/tsconfig.json rename to packages/eslint-plugin/tsconfig.json diff --git a/packages/eslint-plugin-nx/tsconfig.lib.json b/packages/eslint-plugin/tsconfig.lib.json similarity index 100% rename from packages/eslint-plugin-nx/tsconfig.lib.json rename to packages/eslint-plugin/tsconfig.lib.json diff --git a/packages/eslint-plugin-nx/tsconfig.spec.json b/packages/eslint-plugin/tsconfig.spec.json similarity index 100% rename from packages/eslint-plugin-nx/tsconfig.spec.json rename to packages/eslint-plugin/tsconfig.spec.json diff --git a/packages/js/src/generators/library/library.spec.ts b/packages/js/src/generators/library/library.spec.ts index d8fb788cea1c60..152a45cea1926e 100644 --- a/packages/js/src/generators/library/library.spec.ts +++ b/packages/js/src/generators/library/library.spec.ts @@ -423,7 +423,7 @@ describe('lib', () => { const packageJson = readJson(tree, 'package.json'); expect(packageJson.devDependencies['eslint']).toBeDefined(); expect(packageJson.devDependencies['@nx/linter']).toBeDefined(); - expect(packageJson.devDependencies['@nx/eslint-plugin-nx']).toBeDefined(); + expect(packageJson.devDependencies['@nx/eslint-plugin']).toBeDefined(); }); describe('not nested', () => { diff --git a/packages/linter/project.json b/packages/linter/project.json index c4733dc31dc3e4..387d832ac0a3d1 100644 --- a/packages/linter/project.json +++ b/packages/linter/project.json @@ -56,5 +56,5 @@ }, "lint": {} }, - "implicitDependencies": ["eslint-plugin-nx"] + "implicitDependencies": ["eslint-plugin"] } diff --git a/packages/linter/src/generators/init/__snapshots__/init.spec.ts.snap b/packages/linter/src/generators/init/__snapshots__/init.spec.ts.snap index 85d2764097a50c..d5c93dea6be78f 100644 --- a/packages/linter/src/generators/init/__snapshots__/init.spec.ts.snap +++ b/packages/linter/src/generators/init/__snapshots__/init.spec.ts.snap @@ -7,7 +7,7 @@ exports[`@nx/linter:init --linter eslint should generate the global eslint confi "**/*" ], "plugins": [ - "@nx/nx" + "@nx" ], "overrides": [ { diff --git a/packages/linter/src/generators/init/global-eslint-config.ts b/packages/linter/src/generators/init/global-eslint-config.ts index ed40159d6ccdda..397ece50572cb1 100644 --- a/packages/linter/src/generators/init/global-eslint-config.ts +++ b/packages/linter/src/generators/init/global-eslint-config.ts @@ -53,7 +53,7 @@ export const getGlobalEsLintConfiguration = ( const config: ESLint.ConfigData = { root: true, ignorePatterns: rootProject ? ['!**/*'] : ['**/*'], - plugins: ['@nx/nx'], + plugins: ['@nx'], /** * We leverage ESLint's "overrides" capability so that we can set up a root config which will support * all permutations of Nx workspaces across all frameworks, libraries and tools. diff --git a/packages/linter/src/generators/init/init-migration.ts b/packages/linter/src/generators/init/init-migration.ts index ff08d5331322f7..0d6480590b0572 100644 --- a/packages/linter/src/generators/init/init-migration.ts +++ b/packages/linter/src/generators/init/init-migration.ts @@ -57,7 +57,7 @@ function migrateEslintFile(projectEslintPath: string, tree: Tree) { // remove nrwl/nx plugins if (json.plugins) { json.plugins = json.plugins.filter( - (p) => p !== '@nx/nx' && p !== '@nrwl/nx' + (p) => p !== '@nx' && p !== '@nrwl/nx' ); if (json.plugins.length === 0) { delete json.plugins; diff --git a/packages/linter/src/generators/init/init.ts b/packages/linter/src/generators/init/init.ts index d78f8c5a531d2e..582f17b6001685 100644 --- a/packages/linter/src/generators/init/init.ts +++ b/packages/linter/src/generators/init/init.ts @@ -81,7 +81,7 @@ function initEsLint(tree: Tree, options: LinterInitOptions): GeneratorCallback { {}, { '@nx/linter': nxVersion, - '@nx/eslint-plugin-nx': nxVersion, + '@nx/eslint-plugin': nxVersion, '@typescript-eslint/parser': typescriptESLintVersion, '@typescript-eslint/eslint-plugin': typescriptESLintVersion, eslint: eslintVersion, diff --git a/packages/nest/src/generators/convert-tslint-to-eslint/__snapshots__/convert-tslint-to-eslint.spec.ts.snap b/packages/nest/src/generators/convert-tslint-to-eslint/__snapshots__/convert-tslint-to-eslint.spec.ts.snap index 13c6575fa9a860..529c76c7a5ea5b 100644 --- a/packages/nest/src/generators/convert-tslint-to-eslint/__snapshots__/convert-tslint-to-eslint.spec.ts.snap +++ b/packages/nest/src/generators/convert-tslint-to-eslint/__snapshots__/convert-tslint-to-eslint.spec.ts.snap @@ -4,7 +4,7 @@ exports[`convert-tslint-to-eslint should work for NestJS applications 1`] = ` { "dependencies": {}, "devDependencies": { - "@nx/eslint-plugin-nx": "0.0.1", + "@nx/eslint-plugin": "0.0.1", "@nx/linter": "0.0.1", "@typescript-eslint/eslint-plugin": "^5.58.0", "@typescript-eslint/parser": "^5.58.0", @@ -237,7 +237,7 @@ exports[`convert-tslint-to-eslint should work for NestJS applications 3`] = ` }, ], "plugins": [ - "@nx/nx", + "@nx", ], "root": true, } @@ -289,7 +289,7 @@ exports[`convert-tslint-to-eslint should work for NestJS libraries 1`] = ` { "dependencies": {}, "devDependencies": { - "@nx/eslint-plugin-nx": "0.0.1", + "@nx/eslint-plugin": "0.0.1", "@nx/linter": "0.0.1", "@typescript-eslint/eslint-plugin": "^5.58.0", "@typescript-eslint/parser": "^5.58.0", @@ -522,7 +522,7 @@ exports[`convert-tslint-to-eslint should work for NestJS libraries 3`] = ` }, ], "plugins": [ - "@nx/nx", + "@nx", ], "root": true, } diff --git a/packages/node/src/generators/e2e-project/e2e-project.ts b/packages/node/src/generators/e2e-project/e2e-project.ts index 5785a9e2ea6c92..f32bbfe955280e 100644 --- a/packages/node/src/generators/e2e-project/e2e-project.ts +++ b/packages/node/src/generators/e2e-project/e2e-project.ts @@ -113,7 +113,7 @@ export async function e2eProjectGenerator(host: Tree, _options: Schema) { updateJson(host, join(options.e2eProjectRoot, '.eslintrc.json'), (json) => { if (options.rootProject) { - json.plugins = ['@nx/nx']; + json.plugins = ['@nx']; json.extends = []; } json.overrides = [ diff --git a/packages/nx/package.json b/packages/nx/package.json index 70f77010cf01fa..06aeaffd5829c1 100644 --- a/packages/nx/package.json +++ b/packages/nx/package.json @@ -110,7 +110,7 @@ "@nrwl/devkit", "@nx/esbuild", "@nrwl/esbuild", - "@nx/eslint-plugin-nx", + "@nx/eslint-plugin", "@nrwl/eslint-plugin-nx", "@nx/expo", "@nrwl/expo", diff --git a/packages/react/src/generators/application/application.spec.ts b/packages/react/src/generators/application/application.spec.ts index 3ad86142d0eddd..b9591df3b3cb5f 100644 --- a/packages/react/src/generators/application/application.spec.ts +++ b/packages/react/src/generators/application/application.spec.ts @@ -131,7 +131,7 @@ describe('app', () => { const eslintJson = readJson(appTree, 'apps/my-app/.eslintrc.json'); expect(eslintJson.extends).toEqual([ - 'plugin:@nx/nx/react', + 'plugin:@nx/react', '../../.eslintrc.json', ]); @@ -247,7 +247,7 @@ describe('app', () => { { path: 'apps/my-dir/my-app/.eslintrc.json', lookupFn: (json) => json.extends, - expectedValue: ['plugin:@nx/nx/react', '../../../.eslintrc.json'], + expectedValue: ['plugin:@nx/react', '../../../.eslintrc.json'], }, ].forEach(hasJsonValue); }); @@ -515,7 +515,7 @@ describe('app', () => { expect(packageJson.devDependencies.eslint).toBeDefined(); expect(packageJson.devDependencies['@nx/linter']).toBeDefined(); - expect(packageJson.devDependencies['@nx/eslint-plugin-nx']).toBeDefined(); + expect(packageJson.devDependencies['@nx/eslint-plugin']).toBeDefined(); expect(packageJson.devDependencies['eslint-plugin-react']).toBeDefined(); expect( packageJson.devDependencies['eslint-plugin-react-hooks'] @@ -532,7 +532,7 @@ describe('app', () => { expect(eslintJson).toMatchInlineSnapshot(` { "extends": [ - "plugin:@nx/nx/react", + "plugin:@nx/react", "../../.eslintrc.json", ], "ignorePatterns": [ diff --git a/packages/react/src/generators/library/library.spec.ts b/packages/react/src/generators/library/library.spec.ts index fc69b24a87cfc6..a6a3d9cfdc215b 100644 --- a/packages/react/src/generators/library/library.spec.ts +++ b/packages/react/src/generators/library/library.spec.ts @@ -194,7 +194,7 @@ describe('lib', () => { expect(eslintJson).toMatchInlineSnapshot(` { "extends": [ - "plugin:@nx/nx/react", + "plugin:@nx/react", "../../.eslintrc.json", ], "ignorePatterns": [ diff --git a/packages/react/src/utils/lint.ts b/packages/react/src/utils/lint.ts index 5ccf554aaee043..8640d0329e51ae 100644 --- a/packages/react/src/utils/lint.ts +++ b/packages/react/src/utils/lint.ts @@ -21,7 +21,7 @@ export const extendReactEslintJson = (json: Linter.Config) => { const { extends: pluginExtends, ...config } = json; return { - extends: ['plugin:@nx/nx/react', ...(pluginExtends || [])], + extends: ['plugin:@nx/react', ...(pluginExtends || [])], ...config, }; }; @@ -33,10 +33,7 @@ export const createReactEslintJson = ( projectRoot: string, setParserOptionsProject: boolean ): Linter.Config => ({ - extends: [ - 'plugin:@nx/nx/react', - `${offsetFromRoot(projectRoot)}.eslintrc.json`, - ], + extends: ['plugin:@nx/react', `${offsetFromRoot(projectRoot)}.eslintrc.json`], ignorePatterns: ['!**/*'], overrides: [ { diff --git a/scripts/depcheck/missing.ts b/scripts/depcheck/missing.ts index a0dbcdb40e615d..bb73710f11d9d5 100644 --- a/scripts/depcheck/missing.ts +++ b/scripts/depcheck/missing.ts @@ -60,7 +60,7 @@ const IGNORE_MATCHES_IN_PACKAGE = { 'rxjs', 'webpack', ], - 'eslint-plugin-nx': ['@angular-eslint/eslint-plugin'], + 'eslint-plugin': ['@angular-eslint/eslint-plugin'], jest: [ 'jest', '@jest/types', diff --git a/tsconfig.base.json b/tsconfig.base.json index b14d71e378e19c..23c390c60ea01a 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -75,7 +75,7 @@ "@nx/devkit": ["packages/devkit"], "@nx/devkit/*": ["packages/devkit/*"], "@nx/esbuild": ["packages/esbuild"], - "@nx/eslint-plugin-nx": ["packages/eslint-plugin-nx/src"], + "@nx/eslint-plugin": ["packages/eslint-plugin/src"], "@nx/expo": ["packages/expo"], "@nx/expo/*": ["packages/expo/*"], "@nx/express": ["packages/express"],