Skip to content

Commit

Permalink
feat(eslint-plugin): add prefer-standalone rule for checking all dire…
Browse files Browse the repository at this point in the history
…ctives (#1627)
  • Loading branch information
csvn committed Mar 15, 2024
1 parent c741307 commit e013477
Show file tree
Hide file tree
Showing 10 changed files with 1,320 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/builder/src/lint.impl.spec.ts
Expand Up @@ -4,7 +4,7 @@ import { json, logging, schema } from '@angular-devkit/core';
import type { ESLint } from 'eslint';
import { mkdtempSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { join, sep } from 'node:path';
import type { Schema } from './schema';

// Add a placeholder file for the native workspace context within nx implementation details otherwise it will hang in CI
Expand Down Expand Up @@ -178,7 +178,7 @@ describe('Linter Builder', () => {
fix: true,
quiet: false,
cache: true,
cacheLocation: 'cacheLocation1/<???>',
cacheLocation: `cacheLocation1${sep}<???>`,
cacheStrategy: 'content',
format: 'stylish',
force: false,
Expand Down Expand Up @@ -214,7 +214,7 @@ describe('Linter Builder', () => {
fix: true,
quiet: false,
cache: true,
cacheLocation: 'cacheLocation1/<???>',
cacheLocation: `cacheLocation1${sep}<???>`,
cacheStrategy: 'content',
format: 'stylish',
force: false,
Expand Down
10 changes: 9 additions & 1 deletion packages/eslint-plugin/README.md
Expand Up @@ -64,7 +64,7 @@
| [`pipe-prefix`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/pipe-prefix.md) | Enforce consistent prefix for pipes. | | | |
| [`prefer-on-push-component-change-detection`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-on-push-component-change-detection.md) | Ensures component's `changeDetection` is set to `ChangeDetectionStrategy.OnPush` | | | :bulb: |
| [`prefer-output-readonly`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-output-readonly.md) | Prefer to declare `@Output` as `readonly` since they are not supposed to be reassigned | | | :bulb: |
| [`prefer-standalone-component`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-standalone-component.md) | Ensures component `standalone` property is set to `true` in the component decorator | | :wrench: | |
| [`prefer-standalone`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-standalone.md) | Ensures component, directive and pipe `standalone` property is set to `true` in the component decorator | | :wrench: | |
| [`relative-url-prefix`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/relative-url-prefix.md) | The ./ and ../ prefix is standard syntax for relative URLs; don't depend on Angular's current ability to do without that prefix. See more at https://angular.io/styleguide#style-05-04 | | | |
| [`require-localize-metadata`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/require-localize-metadata.md) | Ensures that $localize tagged messages contain helpful metadata to aid with translations. | | | |
| [`sort-ngmodule-metadata-arrays`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/sort-ngmodule-metadata-arrays.md) | Ensures ASC alphabetical order for `NgModule` metadata arrays for easy visual scanning | | :wrench: | |
Expand All @@ -83,4 +83,12 @@

<!-- begin deprecated rule list -->

### Deprecated

<!-- prettier-ignore-start -->
| Rule | Replaced by |
| --- | --- |
| [`prefer-standalone-component`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-standalone-component.md) | [`prefer-standalone`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-standalone-component.md) |
<!-- prettier-ignore-end -->

<!-- end deprecated rule list -->
Expand Up @@ -15,6 +15,12 @@

# `@angular-eslint/prefer-standalone-component`

## ⚠️ THIS RULE IS DEPRECATED

Please use `@angular-eslint/prefer-standalone` instead.

---

Ensures component `standalone` property is set to `true` in the component decorator

- Type: suggestion
Expand Down

0 comments on commit e013477

Please sign in to comment.