@angular-eslint/eslint-plugin
Advanced tools
Comparing version
@@ -5,5 +5,3 @@ { | ||
"rules": { | ||
"@angular-eslint/component-class-suffix": "error", | ||
"@angular-eslint/contextual-lifecycle": "error", | ||
"@angular-eslint/directive-class-suffix": "error", | ||
"@angular-eslint/no-empty-lifecycle-method": "error", | ||
@@ -16,2 +14,3 @@ "@angular-eslint/no-input-rename": "error", | ||
"@angular-eslint/no-outputs-metadata-property": "error", | ||
"@angular-eslint/prefer-inject": "error", | ||
"@angular-eslint/prefer-standalone": "error", | ||
@@ -18,0 +17,0 @@ "@angular-eslint/use-pipe-transform-interface": "error", |
@@ -55,5 +55,3 @@ declare const _default: { | ||
rules: { | ||
"@angular-eslint/component-class-suffix": string; | ||
"@angular-eslint/contextual-lifecycle": string; | ||
"@angular-eslint/directive-class-suffix": string; | ||
"@angular-eslint/no-empty-lifecycle-method": string; | ||
@@ -66,2 +64,3 @@ "@angular-eslint/no-input-rename": string; | ||
"@angular-eslint/no-outputs-metadata-property": string; | ||
"@angular-eslint/prefer-inject": string; | ||
"@angular-eslint/prefer-standalone": string; | ||
@@ -107,3 +106,3 @@ "@angular-eslint/use-pipe-transform-interface": string; | ||
}], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>; | ||
"prefer-standalone": import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferStandalone", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>; | ||
"prefer-standalone": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/prefer-standalone").MessageIds, [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>; | ||
"prefer-inject": import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferInject", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>; | ||
@@ -110,0 +109,0 @@ "prefer-output-emitter-ref": import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferOutputEmitterRef", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>; |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.RULE_NAME = 'component-class-suffix'; | ||
const STYLE_GUIDE_LINK = 'https://angular.dev/style-guide#style-02-03'; | ||
exports.default = (0, create_eslint_rule_1.createESLintRule)({ | ||
@@ -14,4 +13,3 @@ name: exports.RULE_NAME, | ||
docs: { | ||
description: `Classes decorated with @Component must have suffix "Component" (or custom) in their name. See more at ${STYLE_GUIDE_LINK}`, | ||
recommended: 'recommended', | ||
description: `Classes decorated with @Component must have suffix "Component" (or custom) in their name. Note: As of v20, this is no longer recommended by the Angular Team.`, | ||
}, | ||
@@ -33,3 +31,3 @@ schema: [ | ||
messages: { | ||
componentClassSuffix: `Component class names should end with one of these suffixes: {{suffixes}} (${STYLE_GUIDE_LINK})`, | ||
componentClassSuffix: `Component class names should end with one of these suffixes: {{suffixes}}`, | ||
}, | ||
@@ -36,0 +34,0 @@ }, |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.RULE_NAME = 'directive-class-suffix'; | ||
const STYLE_GUIDE_LINK = 'https://angular.dev/style-guide#style-02-03'; | ||
const DEFAULT_SUFFIXES = ['Directive']; | ||
@@ -16,4 +15,3 @@ const VALIDATOR_SUFFIX = 'Validator'; | ||
docs: { | ||
description: `Classes decorated with @Directive must have suffix "Directive" (or custom) in their name. See more at ${STYLE_GUIDE_LINK}`, | ||
recommended: 'recommended', | ||
description: `Classes decorated with @Directive must have suffix "Directive" (or custom) in their name. Note: As of v20, this is no longer recommended by the Angular Team.`, | ||
}, | ||
@@ -35,3 +33,3 @@ schema: [ | ||
messages: { | ||
directiveClassSuffix: `Directive class names should end with one of these suffixes: {{suffixes}} (${STYLE_GUIDE_LINK})`, | ||
directiveClassSuffix: `Directive class names should end with one of these suffixes: {{suffixes}}`, | ||
}, | ||
@@ -38,0 +36,0 @@ }, |
@@ -14,2 +14,3 @@ "use strict"; | ||
description: 'Prefer using the inject() function over constructor parameter injection', | ||
recommended: 'recommended', | ||
}, | ||
@@ -16,0 +17,0 @@ schema: [], |
export type Options = []; | ||
export type MessageIds = 'preferStandalone'; | ||
export type MessageIds = 'preferStandalone' | 'removeStandaloneFalse'; | ||
export declare const RULE_NAME = "prefer-standalone"; | ||
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferStandalone", [], import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>; | ||
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, [], import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>; | ||
export default _default; | ||
//# sourceMappingURL=prefer-standalone.d.ts.map |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.RULE_NAME = 'prefer-standalone'; | ||
const RECOMMENDED_GUIDE_URL = 'https://angular.dev/reference/migrations/standalone'; | ||
exports.default = (0, create_eslint_rule_1.createESLintRule)({ | ||
@@ -13,9 +14,10 @@ name: exports.RULE_NAME, | ||
docs: { | ||
description: `Ensures Components, Directives and Pipes do not opt out of standalone`, | ||
description: `Ensures Components, Directives and Pipes do not opt out of standalone.`, | ||
recommended: 'recommended', | ||
}, | ||
fixable: 'code', | ||
hasSuggestions: true, | ||
schema: [], | ||
messages: { | ||
preferStandalone: `Components, Directives and Pipes should not opt out of standalone`, | ||
preferStandalone: `Components, Directives and Pipes should not opt out of standalone. Following this guide is highly recommended: ${RECOMMENDED_GUIDE_URL}`, | ||
removeStandaloneFalse: `Quickly remove 'standalone: false'. NOTE - Following this guide is highly recommended: ${RECOMMENDED_GUIDE_URL}`, | ||
}, | ||
@@ -39,13 +41,18 @@ }, | ||
data: { type }, | ||
fix: (fixer) => { | ||
// Remove the standalone property altogether if it was set to false | ||
const tokenAfter = context.sourceCode.getTokenAfter(standalone.parent); | ||
// Remove the trailing comma, if present | ||
const removeStart = standalone.parent.range[0]; | ||
let removeEnd = standalone.parent.range[1]; | ||
if (tokenAfter && tokenAfter.value === ',') { | ||
removeEnd = tokenAfter.range[1]; | ||
} | ||
return fixer.removeRange([removeStart, removeEnd]); | ||
}, | ||
suggest: [ | ||
{ | ||
messageId: 'removeStandaloneFalse', | ||
fix: (fixer) => { | ||
// Remove the standalone property altogether if it was set to false | ||
const tokenAfter = context.sourceCode.getTokenAfter(standalone.parent); | ||
// Remove the trailing comma, if present | ||
const removeStart = standalone.parent.range[0]; | ||
let removeEnd = standalone.parent.range[1]; | ||
if (tokenAfter && tokenAfter.value === ',') { | ||
removeEnd = tokenAfter.range[1]; | ||
} | ||
return fixer.removeRange([removeStart, removeEnd]); | ||
}, | ||
}, | ||
], | ||
}); | ||
@@ -52,0 +59,0 @@ }; |
{ | ||
"name": "@angular-eslint/eslint-plugin", | ||
"version": "19.6.1-alpha.0", | ||
"version": "20.0.0-alpha.0", | ||
"description": "ESLint plugin for Angular applications, following https://angular.dev/style-guide", | ||
@@ -21,7 +21,7 @@ "license": "MIT", | ||
"dependencies": { | ||
"@angular-eslint/bundled-angular-compiler": "19.6.1-alpha.0", | ||
"@angular-eslint/utils": "19.6.1-alpha.0" | ||
"@angular-eslint/bundled-angular-compiler": "20.0.0-alpha.0", | ||
"@angular-eslint/utils": "20.0.0-alpha.0" | ||
}, | ||
"devDependencies": { | ||
"@angular-eslint/test-utils": "19.6.1-alpha.0" | ||
"@angular-eslint/test-utils": "20.0.0-alpha.0" | ||
}, | ||
@@ -28,0 +28,0 @@ "peerDependencies": { |
@@ -46,3 +46,3 @@ # @angular-eslint/eslint-plugin | ||
| --- | --- | --- | --- | --- | | ||
| [`component-class-suffix`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/component-class-suffix.md) | Classes decorated with @Component must have suffix "Component" (or custom) in their name. See more at https://angular.dev/style-guide#style-02-03 | :white_check_mark: | | | | ||
| [`component-class-suffix`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/component-class-suffix.md) | Classes decorated with @Component must have suffix "Component" (or custom) in their name. Note: As of v20, this is no longer recommended by the Angular Team. | | | | | ||
| [`component-max-inline-declarations`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/component-max-inline-declarations.md) | Enforces a maximum number of lines in inline template, styles and animations. See more at https://angular.dev/style-guide#style-05-04 | | | | | ||
@@ -52,3 +52,3 @@ | [`component-selector`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/component-selector.md) | Component selectors should follow given naming rules. See more at https://angular.dev/style-guide#style-02-07, https://angular.dev/style-guide#style-05-02 and https://angular.dev/style-guide#style-05-03. | | | | | ||
| [`contextual-decorator`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/contextual-decorator.md) | Ensures that classes use contextual decorators in its body | | | | | ||
| [`directive-class-suffix`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/directive-class-suffix.md) | Classes decorated with @Directive must have suffix "Directive" (or custom) in their name. See more at https://angular.dev/style-guide#style-02-03 | :white_check_mark: | | | | ||
| [`directive-class-suffix`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/directive-class-suffix.md) | Classes decorated with @Directive must have suffix "Directive" (or custom) in their name. Note: As of v20, this is no longer recommended by the Angular Team. | | | | | ||
| [`directive-selector`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/directive-selector.md) | Directive selectors should follow given naming rules. See more at https://angular.dev/style-guide#style-02-06 and https://angular.dev/style-guide#style-02-08. | | | | | ||
@@ -70,3 +70,3 @@ | [`no-conflicting-lifecycle`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-conflicting-lifecycle.md) | Ensures that directives not implement conflicting lifecycle interfaces. | | | | | ||
| [`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-inject`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-inject.md) | Prefer using the inject() function over constructor parameter injection | | | | | ||
| [`prefer-inject`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-inject.md) | Prefer using the inject() function over constructor parameter injection | :white_check_mark: | | | | ||
| [`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: | | ||
@@ -76,3 +76,3 @@ | [`prefer-output-emitter-ref`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-output-emitter-ref.md) | Use `OutputEmitterRef` instead of `@Output()` | | | | | ||
| [`prefer-signals`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-signals.md) | Use readonly signals instead of `@Input()`, `@ViewChild()` and other legacy decorators | | :wrench: | | | ||
| [`prefer-standalone`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-standalone.md) | Ensures Components, Directives and Pipes do not opt out of standalone | :white_check_mark: | :wrench: | | | ||
| [`prefer-standalone`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-standalone.md) | Ensures Components, Directives and Pipes do not opt out of standalone. | :white_check_mark: | | :bulb: | | ||
| [`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.dev/style-guide#style-05-04 | | | | | ||
@@ -79,0 +79,0 @@ | [`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. | | | | |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
221334
4.85%147
6.52%3814
5.89%+ Added
+ Added
- Removed
- Removed
Updated