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/e2e/linter/src/linter.test.ts b/e2e/linter/src/linter.test.ts index 9a7a6d224bb4fe..64d7b82225e2c5 100644 --- a/e2e/linter/src/linter.test.ts +++ b/e2e/linter/src/linter.test.ts @@ -168,7 +168,7 @@ describe('Linter', () => { ); updateFile(newRulePath, updatedRuleContents); - const newRuleNameForUsage = `@nx/nx/workspace/${newRuleName}`; + const newRuleNameForUsage = `@nx/workspace/${newRuleName}`; // Add the new workspace rule to the lint config and run linting const eslintrc = readJson('.eslintrc.json'); @@ -199,10 +199,10 @@ describe('Linter', () => { const eslint = readJson('.eslintrc.json'); eslint.overrides[0].rules[ - '@nx/nx/enforce-module-boundaries' + '@nx/enforce-module-boundaries' ][1].depConstraints = [ { sourceTag: 'validtag', onlyDependOnLibsWithTags: ['validtag'] }, - ...eslint.overrides[0].rules['@nx/nx/enforce-module-boundaries'][1] + ...eslint.overrides[0].rules['@nx/enforce-module-boundaries'][1] .depConstraints, ]; updateFile('.eslintrc.json', JSON.stringify(eslint, null, 2)); @@ -454,8 +454,8 @@ describe('Linter', () => { const e2eEslint = readJson('e2e/.eslintrc.json'); // should directly refer to nx plugin - expect(rootEslint.plugins).toEqual(['@nx/nx']); - expect(e2eEslint.plugins).toEqual(['@nx/nx']); + expect(rootEslint.plugins).toEqual(['@nx']); + expect(e2eEslint.plugins).toEqual(['@nx']); } function verifySuccessfulMigratedSetup(myapp: string, mylib: string) { @@ -476,7 +476,7 @@ describe('Linter', () => { const libEslint = readJson(`libs/${mylib}/.eslintrc.json`); // should directly refer to nx plugin - expect(rootEslint.plugins).toEqual(['@nx/nx']); + expect(rootEslint.plugins).toEqual(['@nx']); expect(appEslint.plugins).toBeUndefined(); expect(e2eEslint.plugins).toBeUndefined(); expect(libEslint.plugins).toBeUndefined(); @@ -541,7 +541,7 @@ describe('Linter', () => { // should have no plugin extends expect(appEslint.overrides[0].extends).toEqual([ - 'plugin:@nx/nx/angular', + 'plugin:@nx/angular', 'plugin:@angular-eslint/template/process-inline-templates', ]); expect(e2eEslint.overrides[0].extends).toBeUndefined(); 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/add-linting/__snapshots__/add-linting.spec.ts.snap b/packages/angular/src/generators/add-linting/__snapshots__/add-linting.spec.ts.snap index eef973bd737d79..4a116b49186477 100644 --- a/packages/angular/src/generators/add-linting/__snapshots__/add-linting.spec.ts.snap +++ b/packages/angular/src/generators/add-linting/__snapshots__/add-linting.spec.ts.snap @@ -11,7 +11,7 @@ exports[`addLinting generator should correctly generate the .eslintrc.json file "overrides": [ { "extends": [ - "plugin:@nx/nx/angular", + "plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates", ], "files": [ @@ -38,7 +38,7 @@ exports[`addLinting generator should correctly generate the .eslintrc.json file }, { "extends": [ - "plugin:@nx/nx/angular-template", + "plugin:@nx/angular-template", ], "files": [ "*.html", @@ -60,7 +60,7 @@ exports[`addLinting generator support angular v14 should correctly generate the "overrides": [ { "extends": [ - "plugin:@nx/nx/angular", + "plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates", ], "files": [ @@ -87,7 +87,7 @@ exports[`addLinting generator support angular v14 should correctly generate the }, { "extends": [ - "plugin:@nx/nx/angular-template", + "plugin:@nx/angular-template", ], "files": [ "*.html", diff --git a/packages/angular/src/generators/add-linting/lib/create-eslint-configuration.ts b/packages/angular/src/generators/add-linting/lib/create-eslint-configuration.ts index 3c6b352028acf5..5a1b791571b709 100644 --- a/packages/angular/src/generators/add-linting/lib/create-eslint-configuration.ts +++ b/packages/angular/src/generators/add-linting/lib/create-eslint-configuration.ts @@ -18,7 +18,7 @@ export const extendAngularEslintJson = ( files: ['*.ts'], extends: [ ...(json.overrides[0].extends || []), - 'plugin:@nx/nx/angular', + 'plugin:@nx/angular', 'plugin:@angular-eslint/template/process-inline-templates', ], rules: { @@ -42,7 +42,7 @@ export const extendAngularEslintJson = ( }, { files: ['*.html'], - extends: ['plugin:@nx/nx/angular-template'], + extends: ['plugin:@nx/angular-template'], /** * Having an empty rules object present makes it more obvious to the user where they would * extend things from if they needed to @@ -75,7 +75,7 @@ export function createEsLintConfiguration( { files: ['*.ts'], extends: [ - 'plugin:@nx/nx/angular', + 'plugin:@nx/angular', 'plugin:@angular-eslint/template/process-inline-templates', ], /** @@ -117,7 +117,7 @@ export function createEsLintConfiguration( }, { files: ['*.html'], - extends: ['plugin:@nx/nx/angular-template'], + extends: ['plugin:@nx/angular-template'], /** * Having an empty rules object present makes it more obvious to the user where they would * extend things from if they needed to diff --git a/packages/angular/src/generators/application/application.spec.ts b/packages/angular/src/generators/application/application.spec.ts index 54bbaa8f7d5746..857641a3ba13d7 100644 --- a/packages/angular/src/generators/application/application.spec.ts +++ b/packages/angular/src/generators/application/application.spec.ts @@ -506,7 +506,7 @@ describe('app', () => { "overrides": [ { "extends": [ - "plugin:@nx/nx/angular", + "plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates", ], "files": [ @@ -533,7 +533,7 @@ describe('app', () => { }, { "extends": [ - "plugin:@nx/nx/angular-template", + "plugin:@nx/angular-template", ], "files": [ "*.html", 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..a714f78fa9013f 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 @@ -14,7 +14,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio "*.jsx", ], "rules": { - "@nx/nx/enforce-module-boundaries": [ + "@nx/enforce-module-boundaries": [ "error", { "allow": [ @@ -92,7 +92,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio }, { "extends": [ - "plugin:@nx/nx/typescript", + "plugin:@nx/typescript", ], "files": [ "*.ts", @@ -102,7 +102,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio }, { "extends": [ - "plugin:@nx/nx/javascript", + "plugin:@nx/javascript", ], "files": [ "*.js", @@ -238,7 +238,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio }, ], "plugins": [ - "@nx/nx", + "@nx", ], "root": true, } @@ -255,7 +255,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio "overrides": [ { "extends": [ - "plugin:@nx/nx/angular", + "plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates", ], "files": [ @@ -287,7 +287,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio }, { "extends": [ - "plugin:@nx/nx/angular-template", + "plugin:@nx/angular-template", ], "files": [ "*.html", @@ -317,7 +317,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio "*.jsx", ], "rules": { - "@nx/nx/enforce-module-boundaries": [ + "@nx/enforce-module-boundaries": [ "error", { "allow": [ @@ -395,7 +395,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio }, { "extends": [ - "plugin:@nx/nx/typescript", + "plugin:@nx/typescript", ], "files": [ "*.ts", @@ -405,7 +405,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio }, { "extends": [ - "plugin:@nx/nx/javascript", + "plugin:@nx/javascript", ], "files": [ "*.js", @@ -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", @@ -604,7 +604,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 3`] = ` "*.jsx", ], "rules": { - "@nx/nx/enforce-module-boundaries": [ + "@nx/enforce-module-boundaries": [ "error", { "allow": [ @@ -682,7 +682,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 3`] = ` }, { "extends": [ - "plugin:@nx/nx/typescript", + "plugin:@nx/typescript", ], "files": [ "*.ts", @@ -692,7 +692,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 3`] = ` }, { "extends": [ - "plugin:@nx/nx/javascript", + "plugin:@nx/javascript", ], "files": [ "*.js", @@ -828,7 +828,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 3`] = ` }, ], "plugins": [ - "@nx/nx", + "@nx", ], "root": true, } @@ -845,7 +845,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 4`] = ` "overrides": [ { "extends": [ - "plugin:@nx/nx/angular", + "plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates", ], "files": [ @@ -883,7 +883,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 4`] = ` }, { "extends": [ - "plugin:@nx/nx/angular-template", + "plugin:@nx/angular-template", ], "files": [ "*.html", @@ -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", @@ -956,7 +956,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 3`] = ` "*.jsx", ], "rules": { - "@nx/nx/enforce-module-boundaries": [ + "@nx/enforce-module-boundaries": [ "error", { "allow": [ @@ -1034,7 +1034,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 3`] = ` }, { "extends": [ - "plugin:@nx/nx/typescript", + "plugin:@nx/typescript", ], "files": [ "*.ts", @@ -1044,7 +1044,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 3`] = ` }, { "extends": [ - "plugin:@nx/nx/javascript", + "plugin:@nx/javascript", ], "files": [ "*.js", @@ -1180,7 +1180,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 3`] = ` }, ], "plugins": [ - "@nx/nx", + "@nx", ], "root": true, } @@ -1197,7 +1197,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 4`] = ` "overrides": [ { "extends": [ - "plugin:@nx/nx/angular", + "plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates", ], "files": [ @@ -1229,7 +1229,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 4`] = ` }, { "extends": [ - "plugin:@nx/nx/angular-template", + "plugin:@nx/angular-template", ], "files": [ "*.html", diff --git a/packages/angular/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.spec.ts b/packages/angular/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.spec.ts index 482128a9e797c1..cbcf10b79c527e 100644 --- a/packages/angular/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.spec.ts +++ b/packages/angular/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.spec.ts @@ -321,7 +321,7 @@ describe('convert-tslint-to-eslint', () => { * We will make a change to the eslint config before the next step */ eslintContent.overrides[0].rules[ - '@nx/nx/enforce-module-boundaries' + '@nx/enforce-module-boundaries' ][1].enforceBuildableLibDependency = false; writeJson(host, '.eslintrc.json', eslintContent); diff --git a/packages/angular/src/generators/library/library.spec.ts b/packages/angular/src/generators/library/library.spec.ts index 913bcd2a537751..d6d1e544ac521d 100644 --- a/packages/angular/src/generators/library/library.spec.ts +++ b/packages/angular/src/generators/library/library.spec.ts @@ -1140,7 +1140,7 @@ describe('lib', () => { "overrides": [ { "extends": [ - "plugin:@nx/nx/angular", + "plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates", ], "files": [ @@ -1167,7 +1167,7 @@ describe('lib', () => { }, { "extends": [ - "plugin:@nx/nx/angular-template", + "plugin:@nx/angular-template", ], "files": [ "*.html", 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..1a1f6a2b99accb 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 @@ -53,7 +53,7 @@ exports[`workspace move to nx layout should create a root eslint config 1`] = ` "*.jsx", ], "rules": { - "@nx/nx/enforce-module-boundaries": [ + "@nx/enforce-module-boundaries": [ "error", { "allow": [], @@ -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/migrators/projects/app.migrator.spec.ts b/packages/angular/src/generators/ng-add/migrators/projects/app.migrator.spec.ts index 65a3e313e80a34..8b7eaa5c366f44 100644 --- a/packages/angular/src/generators/ng-add/migrators/projects/app.migrator.spec.ts +++ b/packages/angular/src/generators/ng-add/migrators/projects/app.migrator.spec.ts @@ -945,7 +945,7 @@ describe('app migrator', () => { overrides: [ { files: ['*.ts', '*.tsx'], - extends: ['plugin:@nx/nx/typescript'], + extends: ['plugin:@nx/typescript'], rules: { '@typescript-eslint/await-thenable': 'error' }, }, ], diff --git a/packages/angular/src/generators/ng-add/migrators/projects/lib.migrator.spec.ts b/packages/angular/src/generators/ng-add/migrators/projects/lib.migrator.spec.ts index 713af801e0abf6..ce1cd972365188 100644 --- a/packages/angular/src/generators/ng-add/migrators/projects/lib.migrator.spec.ts +++ b/packages/angular/src/generators/ng-add/migrators/projects/lib.migrator.spec.ts @@ -784,7 +784,7 @@ describe('lib migrator', () => { overrides: [ { files: ['*.ts', '*.tsx'], - extends: ['plugin:@nx/nx/typescript'], + extends: ['plugin:@nx/typescript'], rules: { '@typescript-eslint/await-thenable': 'error' }, }, ], diff --git a/packages/angular/src/generators/ng-add/utilities/workspace.ts b/packages/angular/src/generators/ng-add/utilities/workspace.ts index 3d59f5ac5c88d9..cd67e071b7ffb0 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) => { @@ -224,13 +224,13 @@ export function updateRootEsLintConfig( delete override.parserOptions.project; }); - // add the @nx/nx/enforce-module-boundaries rule + // add the @nx/enforce-module-boundaries rule existingEsLintConfig.overrides = [ ...(existingEsLintConfig.overrides ?? []), { files: ['*.ts', '*.tsx', '*.js', '*.jsx'], rules: { - '@nx/nx/enforce-module-boundaries': [ + '@nx/enforce-module-boundaries': [ 'error', { enforceBuildableLibDependency: true, 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..055963f6525d30 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", @@ -53,7 +53,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 3`] = ` "*.jsx", ], "rules": { - "@nx/nx/enforce-module-boundaries": [ + "@nx/enforce-module-boundaries": [ "error", { "allow": [ @@ -131,7 +131,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 3`] = ` }, { "extends": [ - "plugin:@nx/nx/typescript", + "plugin:@nx/typescript", ], "files": [ "*.ts", @@ -141,7 +141,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 3`] = ` }, { "extends": [ - "plugin:@nx/nx/javascript", + "plugin:@nx/javascript", ], "files": [ "*.js", @@ -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/generators/cypress-e2e-configuration/__snapshots__/cypress-e2e-configuration.spec.ts.snap b/packages/cypress/src/generators/cypress-e2e-configuration/__snapshots__/cypress-e2e-configuration.spec.ts.snap index 8cc06861de3133..f53013dfe72d71 100644 --- a/packages/cypress/src/generators/cypress-e2e-configuration/__snapshots__/cypress-e2e-configuration.spec.ts.snap +++ b/packages/cypress/src/generators/cypress-e2e-configuration/__snapshots__/cypress-e2e-configuration.spec.ts.snap @@ -12,7 +12,7 @@ exports[`Cypress e2e configuration v10+ should not override eslint settings if p "overrides": [ { "extends": [ - "plugin:@nx/nx/angular", + "plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates", ], "files": [ @@ -39,7 +39,7 @@ exports[`Cypress e2e configuration v10+ should not override eslint settings if p }, { "extends": [ - "plugin:@nx/nx/angular-template", + "plugin:@nx/angular-template", ], "files": [ "*.html", diff --git a/packages/cypress/src/generators/cypress-e2e-configuration/cypress-e2e-configuration.spec.ts b/packages/cypress/src/generators/cypress-e2e-configuration/cypress-e2e-configuration.spec.ts index e5c5036dc2d72e..62d20273f69354 100644 --- a/packages/cypress/src/generators/cypress-e2e-configuration/cypress-e2e-configuration.spec.ts +++ b/packages/cypress/src/generators/cypress-e2e-configuration/cypress-e2e-configuration.spec.ts @@ -248,13 +248,13 @@ describe('Cypress e2e configuration', () => { ], }, extends: [ - 'plugin:@nx/nx/angular', + 'plugin:@nx/angular', 'plugin:@angular-eslint/template/process-inline-templates', ], }, { files: ['*.html'], - extends: ['plugin:@nx/nx/angular-template'], + extends: ['plugin:@nx/angular-template'], rules: {}, }, ], 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..d44db176e7af78 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": [ { @@ -18,7 +18,7 @@ exports[`@nx/linter:init --linter eslint should generate the global eslint confi "*.jsx" ], "rules": { - "@nx/nx/enforce-module-boundaries": [ + "@nx/enforce-module-boundaries": [ "error", { "enforceBuildableLibDependency": true, @@ -41,7 +41,7 @@ exports[`@nx/linter:init --linter eslint should generate the global eslint confi "*.tsx" ], "extends": [ - "plugin:@nx/nx/typescript" + "plugin:@nx/typescript" ], "rules": {} }, @@ -51,7 +51,7 @@ exports[`@nx/linter:init --linter eslint should generate the global eslint confi "*.jsx" ], "extends": [ - "plugin:@nx/nx/javascript" + "plugin:@nx/javascript" ], "rules": {} } diff --git a/packages/linter/src/generators/init/global-eslint-config.ts b/packages/linter/src/generators/init/global-eslint-config.ts index ed40159d6ccdda..fb6a90947e494a 100644 --- a/packages/linter/src/generators/init/global-eslint-config.ts +++ b/packages/linter/src/generators/init/global-eslint-config.ts @@ -6,7 +6,7 @@ import { ESLint, Linter as LinterType } from 'eslint'; */ export const globalTypeScriptOverrides = { files: ['*.ts', '*.tsx'], - extends: ['plugin:@nx/nx/typescript'], + extends: ['plugin:@nx/typescript'], /** * Having an empty rules object present makes it more obvious to the user where they would * extend things from if they needed to @@ -20,7 +20,7 @@ export const globalTypeScriptOverrides = { */ export const globalJavaScriptOverrides = { files: ['*.js', '*.jsx'], - extends: ['plugin:@nx/nx/javascript'], + extends: ['plugin:@nx/javascript'], /** * Having an empty rules object present makes it more obvious to the user where they would * extend things from if they needed to @@ -35,7 +35,7 @@ export const globalJavaScriptOverrides = { export const moduleBoundariesOverride = { files: ['*.ts', '*.tsx', '*.js', '*.jsx'], rules: { - '@nx/nx/enforce-module-boundaries': [ + '@nx/enforce-module-boundaries': [ 'error', { enforceBuildableLibDependency: true, @@ -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..1951efab243f39 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; @@ -77,9 +77,9 @@ function migrateEslintFile(projectEslintPath: string, tree: Tree) { if (override.extends) { override.extends = override.extends.filter( (ext) => - ext !== 'plugin:@nx/nx/typescript' && + ext !== 'plugin:@nx/typescript' && ext !== 'plugin:@nrwl/nx/typescript' && - ext !== 'plugin:@nx/nx/javascript' && + ext !== 'plugin:@nx/javascript' && ext !== 'plugin:@nrwl/nx/javascript' ); if (override.extends.length === 0) { 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/linter/src/generators/workspace-rule/__snapshots__/workspace-rule.spec.ts.snap b/packages/linter/src/generators/workspace-rule/__snapshots__/workspace-rule.spec.ts.snap index 202da28a350cb2..af1a6ab027f523 100644 --- a/packages/linter/src/generators/workspace-rule/__snapshots__/workspace-rule.spec.ts.snap +++ b/packages/linter/src/generators/workspace-rule/__snapshots__/workspace-rule.spec.ts.snap @@ -19,7 +19,7 @@ exports[`@nx/linter:workspace-rule --dir should support creating the rule in a n import { ESLintUtils } from '@typescript-eslint/utils'; -// NOTE: The rule will be available in ESLint configs as "@nx/nx/workspace/another-rule" +// NOTE: The rule will be available in ESLint configs as "@nx/workspace/another-rule" export const RULE_NAME = 'another-rule'; export const rule = ESLintUtils.RuleCreator(() => __filename)({ @@ -75,7 +75,7 @@ exports[`@nx/linter:workspace-rule --dir should support creating the rule in a n import { ESLintUtils } from '@typescript-eslint/utils'; -// NOTE: The rule will be available in ESLint configs as "@nx/nx/workspace/one-more-rule" +// NOTE: The rule will be available in ESLint configs as "@nx/workspace/one-more-rule" export const RULE_NAME = 'one-more-rule'; export const rule = ESLintUtils.RuleCreator(() => __filename)({ @@ -131,7 +131,7 @@ exports[`@nx/linter:workspace-rule should generate the required files 1`] = ` import { ESLintUtils } from '@typescript-eslint/utils'; -// NOTE: The rule will be available in ESLint configs as "@nx/nx/workspace/my-rule" +// NOTE: The rule will be available in ESLint configs as "@nx/workspace/my-rule" export const RULE_NAME = 'my-rule'; export const rule = ESLintUtils.RuleCreator(() => __filename)({ diff --git a/packages/linter/src/generators/workspace-rule/files/__name__.ts__tmpl__ b/packages/linter/src/generators/workspace-rule/files/__name__.ts__tmpl__ index b60294a2859edf..b20a24f0027251 100644 --- a/packages/linter/src/generators/workspace-rule/files/__name__.ts__tmpl__ +++ b/packages/linter/src/generators/workspace-rule/files/__name__.ts__tmpl__ @@ -16,7 +16,7 @@ import { ESLintUtils } from '@typescript-eslint/utils'; -// NOTE: The rule will be available in ESLint configs as "@nx/nx/workspace/<%= name %>" +// NOTE: The rule will be available in ESLint configs as "@nx/workspace/<%= name %>" export const RULE_NAME = '<%= name %>'; export const rule = ESLintUtils.RuleCreator(() => __filename)({ diff --git a/packages/linter/src/generators/workspace-rule/workspace-rule.ts b/packages/linter/src/generators/workspace-rule/workspace-rule.ts index 51e69718e5543d..505fc968f0ef19 100644 --- a/packages/linter/src/generators/workspace-rule/workspace-rule.ts +++ b/packages/linter/src/generators/workspace-rule/workspace-rule.ts @@ -109,7 +109,7 @@ export async function lintWorkspaceRuleGenerator( logger.info(`NX Reminder: Once you have finished writing your rule logic, you need to actually enable the rule within an appropriate .eslintrc.json in your workspace, for example: "rules": { - "@nx/nx/workspace/${options.name}": "error" + "@nx/workspace/${options.name}": "error" } `); diff --git a/packages/linter/src/utils/convert-tslint-to-eslint/convert-nx-enforce-module-boundaries-rule.spec.ts b/packages/linter/src/utils/convert-tslint-to-eslint/convert-nx-enforce-module-boundaries-rule.spec.ts index 0902fa670c81b0..227027e60de12b 100644 --- a/packages/linter/src/utils/convert-tslint-to-eslint/convert-nx-enforce-module-boundaries-rule.spec.ts +++ b/packages/linter/src/utils/convert-tslint-to-eslint/convert-nx-enforce-module-boundaries-rule.spec.ts @@ -63,7 +63,7 @@ describe('convertTslintNxRuleToEslintNxRule()', () => { }, }, expected: { - ruleName: '@nx/nx/enforce-module-boundaries', + ruleName: '@nx/enforce-module-boundaries', ruleConfig: ['error', configFromNxExamplesRepo], }, }, @@ -76,7 +76,7 @@ describe('convertTslintNxRuleToEslintNxRule()', () => { }, }, expected: { - ruleName: '@nx/nx/enforce-module-boundaries', + ruleName: '@nx/enforce-module-boundaries', ruleConfig: ['off', configFromNxExamplesRepo], }, }, @@ -89,7 +89,7 @@ describe('convertTslintNxRuleToEslintNxRule()', () => { }, }, expected: { - ruleName: '@nx/nx/enforce-module-boundaries', + ruleName: '@nx/enforce-module-boundaries', ruleConfig: ['warn', configFromNxExamplesRepo], }, }, @@ -104,7 +104,7 @@ describe('convertTslintNxRuleToEslintNxRule()', () => { }, }, expected: { - ruleName: '@nx/nx/enforce-module-boundaries', + ruleName: '@nx/enforce-module-boundaries', ruleConfig: ['error', configFromNxExamplesRepo], }, }, @@ -119,7 +119,7 @@ describe('convertTslintNxRuleToEslintNxRule()', () => { }, }, expected: { - ruleName: '@nx/nx/enforce-module-boundaries', + ruleName: '@nx/enforce-module-boundaries', ruleConfig: ['warn', configFromNxExamplesRepo], }, }, @@ -134,7 +134,7 @@ describe('convertTslintNxRuleToEslintNxRule()', () => { }, }, expected: { - ruleName: '@nx/nx/enforce-module-boundaries', + ruleName: '@nx/enforce-module-boundaries', ruleConfig: ['off', configFromNxExamplesRepo], }, }, @@ -150,7 +150,7 @@ describe('convertTslintNxRuleToEslintNxRule()', () => { }, }, expected: { - ruleName: '@nx/nx/enforce-module-boundaries', + ruleName: '@nx/enforce-module-boundaries', ruleConfig: ['warn', configFromNxExamplesRepo], }, }, diff --git a/packages/linter/src/utils/convert-tslint-to-eslint/convert-nx-enforce-module-boundaries-rule.ts b/packages/linter/src/utils/convert-tslint-to-eslint/convert-nx-enforce-module-boundaries-rule.ts index 9129045ae4ad0a..57074f65157bcd 100644 --- a/packages/linter/src/utils/convert-tslint-to-eslint/convert-nx-enforce-module-boundaries-rule.ts +++ b/packages/linter/src/utils/convert-tslint-to-eslint/convert-nx-enforce-module-boundaries-rule.ts @@ -73,7 +73,7 @@ export function convertTslintNxRuleToEslintNxRule( ); return { - ruleName: '@nx/nx/enforce-module-boundaries', + ruleName: '@nx/enforce-module-boundaries', ruleConfig: [ruleSeverity, existingRuleConfig], }; } diff --git a/packages/linter/src/utils/convert-tslint-to-eslint/project-converter.ts b/packages/linter/src/utils/convert-tslint-to-eslint/project-converter.ts index cbcb737361caea..1340a4776c7431 100644 --- a/packages/linter/src/utils/convert-tslint-to-eslint/project-converter.ts +++ b/packages/linter/src/utils/convert-tslint-to-eslint/project-converter.ts @@ -192,9 +192,9 @@ export class ProjectConverter { /** * The only piece of the converted root tslint.json that we need to pull out to * apply to the existing overrides within the root .eslintrc.json is the - * @nx/nx/enforce-module-boundaries rule. + * @nx/enforce-module-boundaries rule. */ - const nxRuleName = '@nx/nx/enforce-module-boundaries'; + const nxRuleName = '@nx/enforce-module-boundaries'; const nxEnforceModuleBoundariesRule = convertedRootESLintConfig.rules[nxRuleName]; if (nxEnforceModuleBoundariesRule) { 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..61419fde515ee8 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", @@ -52,7 +52,7 @@ exports[`convert-tslint-to-eslint should work for NestJS applications 3`] = ` "*.jsx", ], "rules": { - "@nx/nx/enforce-module-boundaries": [ + "@nx/enforce-module-boundaries": [ "error", { "allow": [ @@ -130,7 +130,7 @@ exports[`convert-tslint-to-eslint should work for NestJS applications 3`] = ` }, { "extends": [ - "plugin:@nx/nx/typescript", + "plugin:@nx/typescript", ], "files": [ "*.ts", @@ -140,7 +140,7 @@ exports[`convert-tslint-to-eslint should work for NestJS applications 3`] = ` }, { "extends": [ - "plugin:@nx/nx/javascript", + "plugin:@nx/javascript", ], "files": [ "*.js", @@ -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", @@ -337,7 +337,7 @@ exports[`convert-tslint-to-eslint should work for NestJS libraries 3`] = ` "*.jsx", ], "rules": { - "@nx/nx/enforce-module-boundaries": [ + "@nx/enforce-module-boundaries": [ "error", { "allow": [ @@ -415,7 +415,7 @@ exports[`convert-tslint-to-eslint should work for NestJS libraries 3`] = ` }, { "extends": [ - "plugin:@nx/nx/typescript", + "plugin:@nx/typescript", ], "files": [ "*.ts", @@ -425,7 +425,7 @@ exports[`convert-tslint-to-eslint should work for NestJS libraries 3`] = ` }, { "extends": [ - "plugin:@nx/nx/javascript", + "plugin:@nx/javascript", ], "files": [ "*.js", @@ -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/next/src/generators/application/application.spec.ts b/packages/next/src/generators/application/application.spec.ts index 34d4a675f60eca..935033ba28e9e5 100644 --- a/packages/next/src/generators/application/application.spec.ts +++ b/packages/next/src/generators/application/application.spec.ts @@ -339,7 +339,7 @@ describe('app', () => { "jest": true, }, "extends": [ - "plugin:@nx/nx/react-typescript", + "plugin:@nx/react-typescript", "next", "next/core-web-vitals", "../../.eslintrc.json", diff --git a/packages/next/src/generators/application/lib/add-linting.ts b/packages/next/src/generators/application/lib/add-linting.ts index c69906f26c9f78..82e38de2ec1f7a 100644 --- a/packages/next/src/generators/application/lib/add-linting.ts +++ b/packages/next/src/generators/application/lib/add-linting.ts @@ -78,10 +78,11 @@ export async function addLinting( json.extends.unshift(...['next', 'next/core-web-vitals']); // remove nx/react plugin, as it conflicts with the next.js one json.extends = json.extends.filter( - (name) => name !== 'plugin:@nx/nx/react' + (name) => + name !== 'plugin:@nx/react' && name !== 'plugin:@nrwl/nx/react' ); - json.extends.unshift('plugin:@nx/nx/react-typescript'); + json.extends.unshift('plugin:@nx/react-typescript'); if (!json.env) { json.env = {}; } 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-plugin/src/generators/lint-checks/generator.spec.ts b/packages/nx-plugin/src/generators/lint-checks/generator.spec.ts index 630fa4ea9ae857..8ce875b7b789af 100644 --- a/packages/nx-plugin/src/generators/lint-checks/generator.spec.ts +++ b/packages/nx-plugin/src/generators/lint-checks/generator.spec.ts @@ -76,7 +76,7 @@ describe('lint-checks generator', () => { './generators.json', ]), rules: { - '@nx/nx/nx-plugin-checks': 'error', + '@nx/nx-plugin-checks': 'error', }, }) ); @@ -100,7 +100,7 @@ describe('lint-checks generator', () => { ); expect( - eslintConfig.overrides.filter((x) => '@nx/nx/nx-plugin-checks' in x.rules) + eslintConfig.overrides.filter((x) => '@nx/nx-plugin-checks' in x.rules) ).toHaveLength(1); }); @@ -155,7 +155,7 @@ describe('lint-checks generator', () => { './migrations.json', ]), rules: { - '@nx/nx/nx-plugin-checks': 'error', + '@nx/nx-plugin-checks': 'error', }, }) ); diff --git a/packages/nx-plugin/src/generators/lint-checks/generator.ts b/packages/nx-plugin/src/generators/lint-checks/generator.ts index 8f0a43edd148c1..8482f9ae56f744 100644 --- a/packages/nx-plugin/src/generators/lint-checks/generator.ts +++ b/packages/nx-plugin/src/generators/lint-checks/generator.ts @@ -115,7 +115,7 @@ export function addMigrationJsonChecks( (c) => { const override = c.overrides.find( (o) => - Object.keys(o.rules ?? {})?.includes('@nx/nx/nx-plugin-checks') || + Object.keys(o.rules ?? {})?.includes('@nx/nx-plugin-checks') || Object.keys(o.rules ?? {})?.includes('@nrwl/nx/nx-plugin-checks') ); if ( @@ -195,7 +195,7 @@ function updateProjectEslintConfig( let entry: ESLint.ConfigOverride = eslintConfig.overrides.find( (x) => - Object.keys(x.rules ?? {}).includes('@nx/nx/nx-plugin-checks') || + Object.keys(x.rules ?? {}).includes('@nx/nx-plugin-checks') || Object.keys(x.rules ?? {}).includes('@nrwl/nx/nx-plugin-checks') ); const newentry = !entry; @@ -214,7 +214,7 @@ function updateProjectEslintConfig( ]; entry.parser = 'jsonc-eslint-parser'; entry.rules ??= { - '@nx/nx/nx-plugin-checks': 'error', + '@nx/nx-plugin-checks': 'error', }; if (newentry) { 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/packages/workspace/src/generators/move/lib/update-eslintrc-json.spec.ts b/packages/workspace/src/generators/move/lib/update-eslintrc-json.spec.ts index 3922510d777dbf..f128f6914449e6 100644 --- a/packages/workspace/src/generators/move/lib/update-eslintrc-json.spec.ts +++ b/packages/workspace/src/generators/move/lib/update-eslintrc-json.spec.ts @@ -100,7 +100,7 @@ describe('updateEslint', () => { }); updateJson(tree, 'libs/my-lib/.eslintrc.json', (eslintRcJson) => { eslintRcJson.extends = [ - 'plugin:@nx/nx/react', + 'plugin:@nx/react', '../../.eslintrc.json', './customrc.json', ]; @@ -120,7 +120,7 @@ describe('updateEslint', () => { ).toEqual( expect.objectContaining({ extends: [ - 'plugin:@nx/nx/react', + 'plugin:@nx/react', '../../../.eslintrc.json', './customrc.json', ], 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"],