From 2917a6d065b096144014e447384b9d22c164cee6 Mon Sep 17 00:00:00 2001 From: Miroslav Jonas Date: Fri, 13 Oct 2023 17:26:28 +0200 Subject: [PATCH] fix(linter): temporary disable docs changes --- CODEOWNERS | 2 +- docs/generated/manifests/menus.json | 22 +++++------ docs/generated/manifests/nx-api.json | 34 ++++++++--------- docs/generated/packages-metadata.json | 22 +++++------ .../documents/dependency-checks.md | 2 +- .../eslint-plugin/documents/overview.md | 2 +- .../executors/eslint.json} | 4 +- .../generators/convert-to-flat-config.json | 0 .../generators/workspace-rule.json | 2 +- .../generators/workspace-rules-project.json | 0 .../automate-updating-dependencies.md | 2 +- docs/shared/packages/linter/linter-plugin.md | 2 +- .../tips-n-tricks/migrating-to-flat-eslint.md | 2 +- docs/shared/reference/sitemap.md | 14 +++---- nx-dev/nx-dev/redirect-rules.js | 7 ++-- packages/eslint/docs/eslint-examples.md | 12 +++--- .../eslint/docs/workspace-rule-examples.md | 4 +- packages/nx/src/adapter/ngcli-adapter.ts | 37 ++++++++++--------- .../package-schemas/package-metadata.ts | 20 ++++++++-- 19 files changed, 102 insertions(+), 88 deletions(-) rename docs/generated/packages/{eslint/executors/lint.json => linter/executors/eslint.json} (62%) rename docs/generated/packages/{eslint => linter}/generators/convert-to-flat-config.json (100%) rename docs/generated/packages/{eslint => linter}/generators/workspace-rule.json (92%) rename docs/generated/packages/{eslint => linter}/generators/workspace-rules-project.json (100%) diff --git a/CODEOWNERS b/CODEOWNERS index a64f882bfd7ec1..9bf00f1c1329ff 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -113,7 +113,7 @@ rust-toolchain @nrwl/nx-native-reviewers # Linter /docs/generated/packages/eslint-plugin/** @nrwl/nx-linter-reviewers @nrwl/nx-docs-reviewers -/docs/generated/packages/eslint/** @nrwl/nx-linter-reviewers @nrwl/nx-docs-reviewers +/docs/generated/packages/linter/** @nrwl/nx-linter-reviewers @nrwl/nx-docs-reviewers /docs/shared/packages/linter/** @nrwl/nx-linter-reviewers @nrwl/nx-docs-reviewers /packages/eslint-plugin/** @nrwl/nx-linter-reviewers /packages/eslint/** @nrwl/nx-linter-reviewers diff --git a/docs/generated/manifests/menus.json b/docs/generated/manifests/menus.json index 7d650767d884b7..6a275b25e2ecab 100644 --- a/docs/generated/manifests/menus.json +++ b/docs/generated/manifests/menus.json @@ -6518,19 +6518,19 @@ "disableCollapsible": false }, { - "id": "eslint", - "path": "/nx-api/eslint", - "name": "eslint", + "id": "linter", + "path": "/nx-api/linter", + "name": "linter", "children": [ { "id": "executors", - "path": "/nx-api/eslint/executors", + "path": "/nx-api/linter/executors", "name": "executors", "children": [ { - "id": "lint", - "path": "/nx-api/eslint/executors/lint", - "name": "lint", + "id": "eslint", + "path": "/nx-api/linter/executors/eslint", + "name": "eslint", "children": [], "isExternal": false, "disableCollapsible": false @@ -6541,12 +6541,12 @@ }, { "id": "generators", - "path": "/nx-api/eslint/generators", + "path": "/nx-api/linter/generators", "name": "generators", "children": [ { "id": "workspace-rules-project", - "path": "/nx-api/eslint/generators/workspace-rules-project", + "path": "/nx-api/linter/generators/workspace-rules-project", "name": "workspace-rules-project", "children": [], "isExternal": false, @@ -6554,7 +6554,7 @@ }, { "id": "workspace-rule", - "path": "/nx-api/eslint/generators/workspace-rule", + "path": "/nx-api/linter/generators/workspace-rule", "name": "workspace-rule", "children": [], "isExternal": false, @@ -6562,7 +6562,7 @@ }, { "id": "convert-to-flat-config", - "path": "/nx-api/eslint/generators/convert-to-flat-config", + "path": "/nx-api/linter/generators/convert-to-flat-config", "name": "convert-to-flat-config", "children": [], "isExternal": false, diff --git a/docs/generated/manifests/nx-api.json b/docs/generated/manifests/nx-api.json index c6d1e28a82abda..48b0a0e07292e9 100644 --- a/docs/generated/manifests/nx-api.json +++ b/docs/generated/manifests/nx-api.json @@ -650,55 +650,55 @@ }, "path": "/nx-api/esbuild" }, - "eslint": { + "linter": { "githubRoot": "https://github.com/nrwl/nx/blob/master", - "name": "eslint", - "packageName": "@nx/eslint", + "name": "linter", + "packageName": "@nx/linter", "description": "The ESLint plugin for Nx contains executors, generators and utilities used for linting JavaScript/TypeScript projects within an Nx workspace.", "documents": {}, "root": "/packages/eslint", "source": "/packages/eslint/src", "executors": { - "/nx-api/eslint/executors/lint": { + "/nx-api/linter/executors/eslint": { "description": "Run ESLint on a project.", - "file": "generated/packages/eslint/executors/lint.json", + "file": "generated/packages/linter/executors/eslint.json", "hidden": false, - "name": "lint", + "name": "eslint", "originalFilePath": "/packages/eslint/src/executors/lint/schema.json", - "path": "/nx-api/eslint/executors/lint", + "path": "/nx-api/linter/executors/eslint", "type": "executor" } }, "generators": { - "/nx-api/eslint/generators/workspace-rules-project": { + "/nx-api/linter/generators/workspace-rules-project": { "description": "Create the Workspace Lint Rules Project.", - "file": "generated/packages/eslint/generators/workspace-rules-project.json", + "file": "generated/packages/linter/generators/workspace-rules-project.json", "hidden": true, "name": "workspace-rules-project", "originalFilePath": "/packages/eslint/src/generators/workspace-rules-project/schema.json", - "path": "/nx-api/eslint/generators/workspace-rules-project", + "path": "/nx-api/linter/generators/workspace-rules-project", "type": "generator" }, - "/nx-api/eslint/generators/workspace-rule": { + "/nx-api/linter/generators/workspace-rule": { "description": "Create a new Workspace ESLint rule.", - "file": "generated/packages/eslint/generators/workspace-rule.json", + "file": "generated/packages/linter/generators/workspace-rule.json", "hidden": false, "name": "workspace-rule", "originalFilePath": "/packages/eslint/src/generators/workspace-rule/schema.json", - "path": "/nx-api/eslint/generators/workspace-rule", + "path": "/nx-api/linter/generators/workspace-rule", "type": "generator" }, - "/nx-api/eslint/generators/convert-to-flat-config": { + "/nx-api/linter/generators/convert-to-flat-config": { "description": "Convert an Nx workspace's ESLint configs to use Flat Config.", - "file": "generated/packages/eslint/generators/convert-to-flat-config.json", + "file": "generated/packages/linter/generators/convert-to-flat-config.json", "hidden": false, "name": "convert-to-flat-config", "originalFilePath": "/packages/eslint/src/generators/convert-to-flat-config/schema.json", - "path": "/nx-api/eslint/generators/convert-to-flat-config", + "path": "/nx-api/linter/generators/convert-to-flat-config", "type": "generator" } }, - "path": "/nx-api/eslint" + "path": "/nx-api/linter" }, "eslint-plugin": { "githubRoot": "https://github.com/nrwl/nx/blob/master", diff --git a/docs/generated/packages-metadata.json b/docs/generated/packages-metadata.json index 1ccb5bfbc70638..56234c61572c6e 100644 --- a/docs/generated/packages-metadata.json +++ b/docs/generated/packages-metadata.json @@ -649,46 +649,46 @@ "executors": [ { "description": "Run ESLint on a project.", - "file": "generated/packages/eslint/executors/lint.json", + "file": "generated/packages/linter/executors/eslint.json", "hidden": false, - "name": "lint", + "name": "eslint", "originalFilePath": "/packages/eslint/src/executors/lint/schema.json", - "path": "eslint/executors/lint", + "path": "linter/executors/eslint", "type": "executor" } ], "generators": [ { "description": "Create the Workspace Lint Rules Project.", - "file": "generated/packages/eslint/generators/workspace-rules-project.json", + "file": "generated/packages/linter/generators/workspace-rules-project.json", "hidden": true, "name": "workspace-rules-project", "originalFilePath": "/packages/eslint/src/generators/workspace-rules-project/schema.json", - "path": "eslint/generators/workspace-rules-project", + "path": "linter/generators/workspace-rules-project", "type": "generator" }, { "description": "Create a new Workspace ESLint rule.", - "file": "generated/packages/eslint/generators/workspace-rule.json", + "file": "generated/packages/linter/generators/workspace-rule.json", "hidden": false, "name": "workspace-rule", "originalFilePath": "/packages/eslint/src/generators/workspace-rule/schema.json", - "path": "eslint/generators/workspace-rule", + "path": "linter/generators/workspace-rule", "type": "generator" }, { "description": "Convert an Nx workspace's ESLint configs to use Flat Config.", - "file": "generated/packages/eslint/generators/convert-to-flat-config.json", + "file": "generated/packages/linter/generators/convert-to-flat-config.json", "hidden": false, "name": "convert-to-flat-config", "originalFilePath": "/packages/eslint/src/generators/convert-to-flat-config/schema.json", - "path": "eslint/generators/convert-to-flat-config", + "path": "linter/generators/convert-to-flat-config", "type": "generator" } ], "githubRoot": "https://github.com/nrwl/nx/blob/master", - "name": "eslint", - "packageName": "@nx/eslint", + "name": "linter", + "packageName": "@nx/linter", "root": "/packages/eslint", "source": "/packages/eslint/src" }, diff --git a/docs/generated/packages/eslint-plugin/documents/dependency-checks.md b/docs/generated/packages/eslint-plugin/documents/dependency-checks.md index 1a571d8a4dd5d5..6e8aae7bf9294d 100644 --- a/docs/generated/packages/eslint-plugin/documents/dependency-checks.md +++ b/docs/generated/packages/eslint-plugin/documents/dependency-checks.md @@ -38,7 +38,7 @@ Additionally, you need to adjust your `lintFilePatterns` to include the project' "targets": { // ... more targets "lint": { - "executor": "@nx/eslint:lint", + "executor": "@nx/linter:lint", "outputs": ["{options.outputFile}"], "options": { "lintFilePatterns": [ diff --git a/docs/generated/packages/eslint-plugin/documents/overview.md b/docs/generated/packages/eslint-plugin/documents/overview.md index dcab3273d9a5e1..751e5efbb12d18 100644 --- a/docs/generated/packages/eslint-plugin/documents/overview.md +++ b/docs/generated/packages/eslint-plugin/documents/overview.md @@ -1,4 +1,4 @@ -The `@nx/eslint-plugin` 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 the following Nx-specific ESLint rules: +The `@nx/linter-plugin` 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 the following Nx-specific ESLint rules: - [enforce-module-boundaries](#enforce-module-boundaries-rule) - [dependency-checks](#dependency-checks-rule) diff --git a/docs/generated/packages/eslint/executors/lint.json b/docs/generated/packages/linter/executors/eslint.json similarity index 62% rename from docs/generated/packages/eslint/executors/lint.json rename to docs/generated/packages/linter/executors/eslint.json index 1e4453f0fc0733..77173d5a0928b8 100644 --- a/docs/generated/packages/eslint/executors/lint.json +++ b/docs/generated/packages/linter/executors/eslint.json @@ -1,5 +1,5 @@ { - "name": "lint", + "name": "eslint", "implementation": "/packages/eslint/src/executors/lint/lint.impl.ts", "schema": { "version": 2, @@ -136,7 +136,7 @@ } }, "required": ["lintFilePatterns"], - "examplesFile": "Linter can be configured in multiple ways. The basic way is to provide only `lintFilePatterns`, which is a mandatory property. This tells us where to look for files to lint.\n\n`project.json`:\n\n```json\n\"lint\": {\n \"executor\": \"@nx/eslint:lint\",\n \"options\": {\n \"lintFilePatterns\": [\"apps/frontend/**/*.ts\"]\n }\n}\n```\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Fixing linter issues\" %}\n\nLinter provides an automated way of fixing known issues. To ensure that those changes are properly cached, we need to add an `outputs` property to the `lint` target. Omitting the `outputs` property would produce an invalid cache record. Both of these properties are set by default when scaffolding a new project.\n\n```json\n\"lint\": {\n \"executor\": \"@nx/eslint:lint\",\n \"outputs\": [\"{options.outputFile}\"],\n \"options\": {\n \"lintFilePatterns\": [\"apps/frontend/**/*.ts\"]\n }\n}\n```\n\nWith these settings, we can run the command with a `--fix` flag:\n\n```bash\nnx run frontend:lint --fix\n```\n\nWe can also set this flag via project configuration to always fix files when running lint:\n\n```json\n\"lint\": {\n \"executor\": \"@nx/eslint:lint\",\n \"outputs\": [\"{options.outputFile}\"],\n \"options\": {\n \"lintFilePatterns\": [\"apps/frontend/**/*.ts\"],\n \"fix\": true\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"Custom output format\" %}\n\nESLint executor uses the `stylish` output format by default. You can change this by specifying the `format` property:\n\n```json\n\"lint\": {\n \"executor\": \"@nx/eslint:lint\",\n \"outputs\": [\"{options.outputFile}\"],\n \"options\": {\n \"lintFilePatterns\": [\"apps/frontend/**/*.ts\"],\n \"format\": \"compact\"\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"Silence warnings\" %}\n\nMigrated or legacy projects tend to have an overwhelming amount of lint errors. We might want to change those temporarily to be warnings so they don't block the development. But they would still clutter the report. We can run the command with `--quiet` to hide warning (errors would still break the lint):\n\n```bash\nnx run frontend:lint --quiet\n```\n\nWe can also set this via project configuration as a default option.\n\n```json\n\"lint\": {\n \"executor\": \"@nx/eslint:lint\",\n \"outputs\": [\"{options.outputFile}\"],\n \"options\": {\n \"lintFilePatterns\": [\"apps/frontend/**/*.ts\"],\n \"quiet\": true\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"Flat Config file\" %}\n\n`ESLint` provides several ways of specifying the configuration. The default one is using `.eslintrc.json` but you can override it by setting the `eslintConfig` flag. The new `Flat Config` is now also supported:\n\n```json\n\"lint\": {\n \"executor\": \"@nx/eslint:lint\",\n \"outputs\": [\"{options.outputFile}\"],\n \"options\": {\n \"lintFilePatterns\": [\"apps/frontend/**/*.ts\"],\n \"eslintConfig\": \"eslint.config.js\"\n }\n}\n```\n\n**Note:** In contrast to other configuration formats, the `Flat Config` requires that all configuration files are converted to `eslint.config.js`. Built-in migrations and generators support only `.eslintrc.json` at the moment.\n\n{% /tab %}\n{% /tabs %}\n\n---\n", + "examplesFile": "Linter can be configured in multiple ways. The basic way is to provide only `lintFilePatterns`, which is a mandatory property. This tells us where to look for files to lint.\n\n`project.json`:\n\n```json\n\"lint\": {\n \"executor\": \"@nx/linter:eslint\",\n \"options\": {\n \"lintFilePatterns\": [\"apps/frontend/**/*.ts\"]\n }\n}\n```\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Fixing linter issues\" %}\n\nLinter provides an automated way of fixing known issues. To ensure that those changes are properly cached, we need to add an `outputs` property to the `lint` target. Omitting the `outputs` property would produce an invalid cache record. Both of these properties are set by default when scaffolding a new project.\n\n```json\n\"lint\": {\n \"executor\": \"@nx/linter:eslint\",\n \"outputs\": [\"{options.outputFile}\"],\n \"options\": {\n \"lintFilePatterns\": [\"apps/frontend/**/*.ts\"]\n }\n}\n```\n\nWith these settings, we can run the command with a `--fix` flag:\n\n```bash\nnx run frontend:lint --fix\n```\n\nWe can also set this flag via project configuration to always fix files when running lint:\n\n```json\n\"lint\": {\n \"executor\": \"@nx/linter:eslint\",\n \"outputs\": [\"{options.outputFile}\"],\n \"options\": {\n \"lintFilePatterns\": [\"apps/frontend/**/*.ts\"],\n \"fix\": true\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"Custom output format\" %}\n\nESLint executor uses the `stylish` output format by default. You can change this by specifying the `format` property:\n\n```json\n\"lint\": {\n \"executor\": \"@nx/linter:eslint\",\n \"outputs\": [\"{options.outputFile}\"],\n \"options\": {\n \"lintFilePatterns\": [\"apps/frontend/**/*.ts\"],\n \"format\": \"compact\"\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"Silence warnings\" %}\n\nMigrated or legacy projects tend to have an overwhelming amount of lint errors. We might want to change those temporarily to be warnings so they don't block the development. But they would still clutter the report. We can run the command with `--quiet` to hide warning (errors would still break the lint):\n\n```bash\nnx run frontend:lint --quiet\n```\n\nWe can also set this via project configuration as a default option.\n\n```json\n\"lint\": {\n \"executor\": \"@nx/linter:eslint\",\n \"outputs\": [\"{options.outputFile}\"],\n \"options\": {\n \"lintFilePatterns\": [\"apps/frontend/**/*.ts\"],\n \"quiet\": true\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"Flat Config file\" %}\n\n`ESLint` provides several ways of specifying the configuration. The default one is using `.eslintrc.json` but you can override it by setting the `eslintConfig` flag. The new `Flat Config` is now also supported:\n\n```json\n\"lint\": {\n \"executor\": \"@nx/linter:eslint\",\n \"outputs\": [\"{options.outputFile}\"],\n \"options\": {\n \"lintFilePatterns\": [\"apps/frontend/**/*.ts\"],\n \"eslintConfig\": \"eslint.config.js\"\n }\n}\n```\n\n**Note:** In contrast to other configuration formats, the `Flat Config` requires that all configuration files are converted to `eslint.config.js`. Built-in migrations and generators support only `.eslintrc.json` at the moment.\n\n{% /tab %}\n{% /tabs %}\n\n---\n", "presets": [] }, "hasher": "./src/executors/lint/hasher", diff --git a/docs/generated/packages/eslint/generators/convert-to-flat-config.json b/docs/generated/packages/linter/generators/convert-to-flat-config.json similarity index 100% rename from docs/generated/packages/eslint/generators/convert-to-flat-config.json rename to docs/generated/packages/linter/generators/convert-to-flat-config.json diff --git a/docs/generated/packages/eslint/generators/workspace-rule.json b/docs/generated/packages/linter/generators/workspace-rule.json similarity index 92% rename from docs/generated/packages/eslint/generators/workspace-rule.json rename to docs/generated/packages/linter/generators/workspace-rule.json index c063d51be5170e..10e513eb0a64be 100644 --- a/docs/generated/packages/eslint/generators/workspace-rule.json +++ b/docs/generated/packages/linter/generators/workspace-rule.json @@ -22,7 +22,7 @@ } }, "required": ["name", "directory"], - "examplesFile": "{% tabs %}\n{% tab label=\"Create rule\" %}\n\nThis command will generate a new workspace lint rule called `my-custom-rule`. The new rule will be generated in `tools/eslint-rules/rules` folder:\n\n```shell\nnx g @nx/eslint:workspace-rule my-custom-rule\n```\n\n{% /tab %}\n{% tab label=\"Custom sub-folder\" %}\n\nWe can change the default sub-folder from `rules` and specify a custom one:\n\n```shell\nnx g @nx/eslint:workspace-rule --name=my-custom-rule --directory=my/custom/path\n```\n\nThe command above will generate the rule in `tools/eslint-rules/my/custom/path` folder.\n\n{% /tab %}\n{% /tabs %}\n\n---\n", + "examplesFile": "{% tabs %}\n{% tab label=\"Create rule\" %}\n\nThis command will generate a new workspace lint rule called `my-custom-rule`. The new rule will be generated in `tools/eslint-rules/rules` folder:\n\n```shell\nnx g @nx/linter:workspace-rule my-custom-rule\n```\n\n{% /tab %}\n{% tab label=\"Custom sub-folder\" %}\n\nWe can change the default sub-folder from `rules` and specify a custom one:\n\n```shell\nnx g @nx/linter:workspace-rule --name=my-custom-rule --directory=my/custom/path\n```\n\nThe command above will generate the rule in `tools/eslint-rules/my/custom/path` folder.\n\n{% /tab %}\n{% /tabs %}\n\n---\n", "presets": [] }, "description": "Create a new Workspace ESLint rule.", diff --git a/docs/generated/packages/eslint/generators/workspace-rules-project.json b/docs/generated/packages/linter/generators/workspace-rules-project.json similarity index 100% rename from docs/generated/packages/eslint/generators/workspace-rules-project.json rename to docs/generated/packages/linter/generators/workspace-rules-project.json diff --git a/docs/shared/core-features/automate-updating-dependencies.md b/docs/shared/core-features/automate-updating-dependencies.md index 0e3f70dae8bb73..1f320e04983f1d 100644 --- a/docs/shared/core-features/automate-updating-dependencies.md +++ b/docs/shared/core-features/automate-updating-dependencies.md @@ -17,7 +17,7 @@ title="How Automated Code Migrations Work" Nx knows where its configuration files are and can therefore make sure they match the expected format. This automated update process, commonly referred to as "migration," becomes even more powerful when you leverage [Nx plugins](/nx-api). Nx plugins, which are NPM packages with a range of capabilities (code generation, task automation...), offer targeted updates based on their specific areas of responsibility. -For example, the [Nx ESLint plugin](/nx-api/eslint) excels at configuring linting in your workspace. With its understanding of the configuration file locations, this plugin can provide precise migration scripts to update ESLint packages in your `package.json` and corresponding configuration files in your workspace when a new version is released. +For example, the [Nx ESLint plugin](/nx-api/linter) excels at configuring linting in your workspace. With its understanding of the configuration file locations, this plugin can provide precise migration scripts to update ESLint packages in your `package.json` and corresponding configuration files in your workspace when a new version is released. Updating happens in three steps: diff --git a/docs/shared/packages/linter/linter-plugin.md b/docs/shared/packages/linter/linter-plugin.md index 9c48f7cdcfc868..c8f105fff55f3f 100644 --- a/docs/shared/packages/linter/linter-plugin.md +++ b/docs/shared/packages/linter/linter-plugin.md @@ -32,7 +32,7 @@ nx lint my-lib ## Utils -- [convert-to-flat-config](/nx-api/eslint/generators/convert-to-flat-config) - Converts the workspace's [ESLint](https://eslint.org/) configs to the new [Flat Config](https://eslint.org/blog/2022/08/new-config-system-part-2) +- [convert-to-flat-config](/nx-api/linter/generators/convert-to-flat-config) - Converts the workspace's [ESLint](https://eslint.org/) configs to the new [Flat Config](https://eslint.org/blog/2022/08/new-config-system-part-2) ## ESLint plugin diff --git a/docs/shared/recipes/tips-n-tricks/migrating-to-flat-eslint.md b/docs/shared/recipes/tips-n-tricks/migrating-to-flat-eslint.md index 6d254d91749e76..f9e9adb84e250f 100644 --- a/docs/shared/recipes/tips-n-tricks/migrating-to-flat-eslint.md +++ b/docs/shared/recipes/tips-n-tricks/migrating-to-flat-eslint.md @@ -156,7 +156,7 @@ module.exports = { For additional details, head over to [ESLint's official blog post](https://eslint.org/blog/2022/08/new-config-system-part-2/). -Since version 16.8.0, Nx supports the usage of flat config in the [@nx/eslint:lint](/nx-api/eslint/executors/lint) executor and `@nx/*` generators, and provides an automated config conversion from `.eslintrc.json` config files. +Since version 16.8.0, Nx supports the usage of flat config in the [@nx/lint:eslint](/nx-api/linter/executors/eslint) executor and `@nx/*` generators, and provides an automated config conversion from `.eslintrc.json` config files. ## Converting workspace from .eslintrc.json to flat config diff --git a/docs/shared/reference/sitemap.md b/docs/shared/reference/sitemap.md index 54d609abcb6d53..ad0e81cbf82b3a 100644 --- a/docs/shared/reference/sitemap.md +++ b/docs/shared/reference/sitemap.md @@ -371,13 +371,13 @@ - [generators](/nx-api/esbuild/generators) - [init](/nx-api/esbuild/generators/init) - [configuration](/nx-api/esbuild/generators/configuration) - - [eslint](/nx-api/eslint) - - [executors](/nx-api/eslint/executors) - - [lint](/nx-api/eslint/executors/lint) - - [generators](/nx-api/eslint/generators) - - [workspace-rules-project](/nx-api/eslint/generators/workspace-rules-project) - - [workspace-rule](/nx-api/eslint/generators/workspace-rule) - - [convert-to-flat-config](/nx-api/eslint/generators/convert-to-flat-config) + - [linter](/nx-api/linter) + - [executors](/nx-api/linter/executors) + - [eslint](/nx-api/linter/executors/eslint) + - [generators](/nx-api/linter/generators) + - [workspace-rules-project](/nx-api/linter/generators/workspace-rules-project) + - [workspace-rule](/nx-api/linter/generators/workspace-rule) + - [convert-to-flat-config](/nx-api/linter/generators/convert-to-flat-config) - [eslint-plugin](/nx-api/eslint-plugin) - [documents](/nx-api/eslint-plugin/documents) - [Overview](/nx-api/eslint-plugin/documents/overview) diff --git a/nx-dev/nx-dev/redirect-rules.js b/nx-dev/nx-dev/redirect-rules.js index 71da4bf5c77cf9..a7bd264d311d4b 100644 --- a/nx-dev/nx-dev/redirect-rules.js +++ b/nx-dev/nx-dev/redirect-rules.js @@ -895,10 +895,11 @@ const aiChat = { }; // rename nx/linter to eslint +// TODO(v17) invert these redirects const eslintRename = { - '/nx-api/linter': '/nx-api/eslint', - '/packages/linter': '/packages/eslint', - '/nx-api/linter/executors/eslint': '/nx-api/eslint/executors/lint', + '/nx-api/eslint': '/nx-api/linter', + '/packages/eslint': '/packages/linter', + '/nx-api/eslint/executors/lint': '/nx-api/linter/executors/eslint', }; /** diff --git a/packages/eslint/docs/eslint-examples.md b/packages/eslint/docs/eslint-examples.md index 03f7651a5e98be..95136037a12054 100644 --- a/packages/eslint/docs/eslint-examples.md +++ b/packages/eslint/docs/eslint-examples.md @@ -4,7 +4,7 @@ Linter can be configured in multiple ways. The basic way is to provide only `lin ```json "lint": { - "executor": "@nx/eslint:lint", + "executor": "@nx/linter:eslint", "options": { "lintFilePatterns": ["apps/frontend/**/*.ts"] } @@ -20,7 +20,7 @@ Linter provides an automated way of fixing known issues. To ensure that those ch ```json "lint": { - "executor": "@nx/eslint:lint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { "lintFilePatterns": ["apps/frontend/**/*.ts"] @@ -38,7 +38,7 @@ We can also set this flag via project configuration to always fix files when run ```json "lint": { - "executor": "@nx/eslint:lint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { "lintFilePatterns": ["apps/frontend/**/*.ts"], @@ -54,7 +54,7 @@ ESLint executor uses the `stylish` output format by default. You can change this ```json "lint": { - "executor": "@nx/eslint:lint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { "lintFilePatterns": ["apps/frontend/**/*.ts"], @@ -76,7 +76,7 @@ We can also set this via project configuration as a default option. ```json "lint": { - "executor": "@nx/eslint:lint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { "lintFilePatterns": ["apps/frontend/**/*.ts"], @@ -92,7 +92,7 @@ We can also set this via project configuration as a default option. ```json "lint": { - "executor": "@nx/eslint:lint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { "lintFilePatterns": ["apps/frontend/**/*.ts"], diff --git a/packages/eslint/docs/workspace-rule-examples.md b/packages/eslint/docs/workspace-rule-examples.md index 0191bee4c1b53f..0446b7e102b855 100644 --- a/packages/eslint/docs/workspace-rule-examples.md +++ b/packages/eslint/docs/workspace-rule-examples.md @@ -4,7 +4,7 @@ This command will generate a new workspace lint rule called `my-custom-rule`. The new rule will be generated in `tools/eslint-rules/rules` folder: ```shell -nx g @nx/eslint:workspace-rule my-custom-rule +nx g @nx/linter:workspace-rule my-custom-rule ``` {% /tab %} @@ -13,7 +13,7 @@ nx g @nx/eslint:workspace-rule my-custom-rule We can change the default sub-folder from `rules` and specify a custom one: ```shell -nx g @nx/eslint:workspace-rule --name=my-custom-rule --directory=my/custom/path +nx g @nx/linter:workspace-rule --name=my-custom-rule --directory=my/custom/path ``` The command above will generate the rule in `tools/eslint-rules/my/custom/path` folder. diff --git a/packages/nx/src/adapter/ngcli-adapter.ts b/packages/nx/src/adapter/ngcli-adapter.ts index d6348c3b342641..a9f5c469ec647f 100644 --- a/packages/nx/src/adapter/ngcli-adapter.ts +++ b/packages/nx/src/adapter/ngcli-adapter.ts @@ -195,7 +195,7 @@ export async function scheduleTarget( tap( (output) => (lastOutputError = !output.success ? output.error : undefined), - (error) => { }, // do nothing, this could be an intentional error + (error) => {}, // do nothing, this could be an intentional error () => { lastOutputError ? logger.error(lastOutputError) : 0; } @@ -253,9 +253,10 @@ async function createRecorder( if (event.kind === 'error') { record.error = true; logger.warn( - `ERROR! ${eventPath} ${event.description == 'alreadyExist' - ? 'already exists' - : 'does not exist.' + `ERROR! ${eventPath} ${ + event.description == 'alreadyExist' + ? 'already exists' + : 'does not exist.' }.` ); } else if (event.kind === 'update') { @@ -512,8 +513,8 @@ export class NxScopedHost extends virtualFs.ScopedHost { concatMap((r) => r ? super - .read(path as any) - .pipe(map((r) => parseJson(arrayBufferToString(r)))) + .read(path as any) + .pipe(map((r) => parseJson(arrayBufferToString(r)))) : of(null) ) ); @@ -847,12 +848,12 @@ export function wrapAngularDevkitSchematic( } const emptyLogger = { - log: (e) => { }, - info: (e) => { }, - warn: (e) => { }, - debug: () => { }, - error: (e) => { }, - fatal: (e) => { }, + log: (e) => {}, + info: (e) => {}, + warn: (e) => {}, + debug: () => {}, + error: (e) => {}, + fatal: (e) => {}, } as any; emptyLogger.createChild = () => emptyLogger; @@ -1083,16 +1084,16 @@ async function getWrappedWorkspaceNodeModulesArchitectHost( const batchImplementationFactory = executorConfig.batchImplementation ? this.getImplementationFactory( - executorConfig.batchImplementation, - executorsDir - ) + executorConfig.batchImplementation, + executorsDir + ) : null; const hasherFactory = executorConfig.hasher ? this.getImplementationFactory( - executorConfig.hasher, - executorsDir - ) + executorConfig.hasher, + executorsDir + ) : null; return { diff --git a/scripts/documentation/package-schemas/package-metadata.ts b/scripts/documentation/package-schemas/package-metadata.ts index 10e5a498b9b9f6..f167dfc5d42aa8 100644 --- a/scripts/documentation/package-schemas/package-metadata.ts +++ b/scripts/documentation/package-schemas/package-metadata.ts @@ -139,8 +139,13 @@ export function findPackageMetadataList( ? null : { githubRoot: 'https://github.com/nrwl/nx/blob/master', - name: folderName, - packageName: packageJson.name, + // TODO(v17): Remove this replace + name: folderName === 'eslint' ? 'linter' : folderName, + // TODO(v17): Remove this replace + packageName: + packageJson.name === '@nx/eslint' + ? '@nx/linter' + : packageJson.name, description: packageJson.description, root: relativeFolderPath, source: join(relativeFolderPath, '/src'), @@ -152,7 +157,7 @@ export function findPackageMetadataList( content: readFileSync( join('docs', item.file + '.md'), 'utf8' - ), + ).replace('@nx/eslint', '@nx/linter'), })) : [], generators: getSchemaList( @@ -172,7 +177,14 @@ export function findPackageMetadataList( }, 'executors.json', ['executors', 'builders'] - ), + ) + // TODO(v17): Remove this remapping + .map((schema) => { + if (folderName === 'eslint' && schema.name === 'lint') { + schema.name = 'eslint'; + } + return schema; + }), }; }) .filter(Boolean);