Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(linter): add support for workspace rules #6859

Merged
merged 11 commits into from Sep 1, 2021
Merged
55 changes: 55 additions & 0 deletions docs/angular/api-linter/generators/workspace-rule.md
@@ -0,0 +1,55 @@
# @nrwl/linter:workspace-rule

Create a new workspace ESLint rule

## Usage

```bash
nx generate workspace-rule ...
```

By default, Nx will search for `workspace-rule` in the default collection provisioned in `angular.json`.

You can specify the collection explicitly as follows:

```bash
nx g @nrwl/linter:workspace-rule ...
```

Show what will be generated without writing to disk:

```bash
nx g workspace-rule ... --dry-run
```

### Examples

Create a new workspace lint rule called my-custom-rule:

```bash
nx g @nrwl/linter:workspace-rule my-custom-rule
```

Create a new workspace lint rule located at tools/eslint-rules/a/b/c/my-custom-rule.ts:

```bash
nx g @nrwl/linter:workspace-rule --name=my-custom-rule --directory=a/b/c
```

## Options

### directory (_**required**_)

Alias(es): dir

Default: `rules`

Type: `string`

Create the rule under this directory within tools/eslint-rules/ (can be nested).

### name (_**required**_)

Type: `string`

The name of the new rule
1 change: 1 addition & 0 deletions docs/angular/generators.json
Expand Up @@ -5,6 +5,7 @@
"express",
"gatsby",
"jest",
"linter",
"nest",
"next",
"node",
Expand Down
15 changes: 15 additions & 0 deletions docs/map.json
Expand Up @@ -670,6 +670,11 @@
"name": "lint executor",
"id": "lint",
"file": "angular/api-linter/executors/lint"
},
{
"name": "workspace-rule generator",
"id": "workspace-rule",
"file": "angular/api-linter/generators/workspace-rule"
}
]
},
Expand Down Expand Up @@ -1959,6 +1964,11 @@
"name": "lint executor",
"id": "lint",
"file": "react/api-linter/executors/lint"
},
{
"name": "workspace-rule generator",
"id": "workspace-rule",
"file": "react/api-linter/generators/workspace-rule"
}
]
},
Expand Down Expand Up @@ -3210,6 +3220,11 @@
"name": "lint executor",
"id": "lint",
"file": "node/api-linter/executors/lint"
},
{
"name": "workspace-rule generator",
"id": "workspace-rule",
"file": "node/api-linter/generators/workspace-rule"
}
]
},
Expand Down
55 changes: 55 additions & 0 deletions docs/node/api-linter/generators/workspace-rule.md
@@ -0,0 +1,55 @@
# @nrwl/linter:workspace-rule

Create a new workspace ESLint rule

## Usage

```bash
nx generate workspace-rule ...
```

By default, Nx will search for `workspace-rule` in the default collection provisioned in `workspace.json`.

You can specify the collection explicitly as follows:

```bash
nx g @nrwl/linter:workspace-rule ...
```

Show what will be generated without writing to disk:

```bash
nx g workspace-rule ... --dry-run
```

### Examples

Create a new workspace lint rule called my-custom-rule:

```bash
nx g @nrwl/linter:workspace-rule my-custom-rule
```

Create a new workspace lint rule located at tools/eslint-rules/a/b/c/my-custom-rule.ts:

```bash
nx g @nrwl/linter:workspace-rule --name=my-custom-rule --directory=a/b/c
```

## Options

### directory (_**required**_)

Alias(es): dir

Default: `rules`

Type: `string`

Create the rule under this directory within tools/eslint-rules/ (can be nested).

### name (_**required**_)

Type: `string`

The name of the new rule
1 change: 1 addition & 0 deletions docs/node/generators.json
Expand Up @@ -5,6 +5,7 @@
"express",
"gatsby",
"jest",
"linter",
"nest",
"next",
"node",
Expand Down
55 changes: 55 additions & 0 deletions docs/react/api-linter/generators/workspace-rule.md
@@ -0,0 +1,55 @@
# @nrwl/linter:workspace-rule

Create a new workspace ESLint rule

## Usage

```bash
nx generate workspace-rule ...
```

By default, Nx will search for `workspace-rule` in the default collection provisioned in `workspace.json`.

You can specify the collection explicitly as follows:

```bash
nx g @nrwl/linter:workspace-rule ...
```

Show what will be generated without writing to disk:

```bash
nx g workspace-rule ... --dry-run
```

### Examples

Create a new workspace lint rule called my-custom-rule:

```bash
nx g @nrwl/linter:workspace-rule my-custom-rule
```

Create a new workspace lint rule located at tools/eslint-rules/a/b/c/my-custom-rule.ts:

```bash
nx g @nrwl/linter:workspace-rule --name=my-custom-rule --directory=a/b/c
```

## Options

### directory (_**required**_)

Alias(es): dir

Default: `rules`

Type: `string`

Create the rule under this directory within tools/eslint-rules/ (can be nested).

### name (_**required**_)

Type: `string`

The name of the new rule
1 change: 1 addition & 0 deletions docs/react/generators.json
Expand Up @@ -5,6 +5,7 @@
"express",
"gatsby",
"jest",
"linter",
"nest",
"next",
"node",
Expand Down