Skip to content

Commit

Permalink
fix(linter): temporary disable docs changes
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav committed Oct 16, 2023
1 parent ecf0737 commit 2917a6d
Show file tree
Hide file tree
Showing 19 changed files with 102 additions and 88 deletions.
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions docs/generated/manifests/menus.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -6541,28 +6541,28 @@
},
{
"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,
"disableCollapsible": false
},
{
"id": "workspace-rule",
"path": "/nx-api/eslint/generators/workspace-rule",
"path": "/nx-api/linter/generators/workspace-rule",
"name": "workspace-rule",
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"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,
Expand Down
34 changes: 17 additions & 17 deletions docs/generated/manifests/nx-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 11 additions & 11 deletions docs/generated/packages-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "lint",
"name": "eslint",
"implementation": "/packages/eslint/src/executors/lint/lint.impl.ts",
"schema": {
"version": 2,
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion docs/shared/packages/linter/linter-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading

0 comments on commit 2917a6d

Please sign in to comment.