@angular-eslint/eslint-plugin 19.5.1-alpha.11 → 19.5.1-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ Please see https://github.com/angular-eslint/angular-eslint for full usage instr
|
|
|
65
65
|
| [`no-pipe-impure`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-pipe-impure.md) | Disallows the declaration of impure pipes | | | :bulb: |
|
|
66
66
|
| [`no-queries-metadata-property`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-queries-metadata-property.md) | Disallows usage of the `queries` metadata property. See more at https://angular.dev/style-guide#style-05-12. | | | |
|
|
67
67
|
| [`pipe-prefix`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/pipe-prefix.md) | Enforce consistent prefix for pipes. | | | |
|
|
68
|
-
| [`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 |
|
|
68
|
+
| [`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 | | | |
|
|
69
69
|
| [`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: |
|
|
70
70
|
| [`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()` | | | |
|
|
71
71
|
| [`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`, `OutputEmitterRef` and `OutputRef` as `readonly` since they are not supposed to be reassigned | | | :bulb: |
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"@angular-eslint/no-output-on-prefix": "error",
|
|
13
13
|
"@angular-eslint/no-output-rename": "error",
|
|
14
14
|
"@angular-eslint/no-outputs-metadata-property": "error",
|
|
15
|
-
"@angular-eslint/prefer-inject": "error",
|
|
16
15
|
"@angular-eslint/prefer-standalone": "error",
|
|
17
16
|
"@angular-eslint/use-pipe-transform-interface": "error",
|
|
18
17
|
"@angular-eslint/use-lifecycle-interface": "warn"
|
package/dist/index.d.ts
CHANGED
|
@@ -62,7 +62,6 @@ declare const _default: {
|
|
|
62
62
|
"@angular-eslint/no-output-on-prefix": string;
|
|
63
63
|
"@angular-eslint/no-output-rename": string;
|
|
64
64
|
"@angular-eslint/no-outputs-metadata-property": string;
|
|
65
|
-
"@angular-eslint/prefer-inject": string;
|
|
66
65
|
"@angular-eslint/prefer-standalone": string;
|
|
67
66
|
"@angular-eslint/use-pipe-transform-interface": string;
|
|
68
67
|
"@angular-eslint/use-lifecycle-interface": string;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkIA,kBAkDE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-inject.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-inject.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AAEzB,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC;AACxC,eAAO,MAAM,SAAS,kBAAkB,CAAC;;AAEzC,
|
|
1
|
+
{"version":3,"file":"prefer-inject.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-inject.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AAEzB,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC;AACxC,eAAO,MAAM,SAAS,kBAAkB,CAAC;;AAEzC,wBAiGG"}
|
|
@@ -11,7 +11,6 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
11
11
|
type: 'suggestion',
|
|
12
12
|
docs: {
|
|
13
13
|
description: 'Prefer using the inject() function over constructor parameter injection',
|
|
14
|
-
recommended: 'recommended',
|
|
15
14
|
},
|
|
16
15
|
schema: [],
|
|
17
16
|
messages: {
|
|
@@ -68,19 +67,10 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
68
67
|
}
|
|
69
68
|
return {
|
|
70
69
|
[`${utils_1.Selectors.decoratorDefinition(angularDecoratorsPattern)} > ClassBody > MethodDefinition[kind="constructor"]`](node) {
|
|
71
|
-
const params = node.value.params;
|
|
70
|
+
const params = node.value.params ?? [];
|
|
72
71
|
if (params.length === 0) {
|
|
73
72
|
return;
|
|
74
73
|
}
|
|
75
|
-
// ignore constructors that only call super() (no parameters to inject)
|
|
76
|
-
const body = node.value.body?.body ?? [];
|
|
77
|
-
const onlySuper = body.length === 1 &&
|
|
78
|
-
body[0].type === utils_2.AST_NODE_TYPES.ExpressionStatement &&
|
|
79
|
-
body[0].expression.type === utils_2.AST_NODE_TYPES.CallExpression &&
|
|
80
|
-
body[0].expression.callee.type === utils_2.AST_NODE_TYPES.Super;
|
|
81
|
-
if (onlySuper && params.length === 0) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
74
|
for (const param of params) {
|
|
85
75
|
if (shouldReportParameter(param)) {
|
|
86
76
|
context.report({ node: param, messageId: 'preferInject' });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-eslint/eslint-plugin",
|
|
3
|
-
"version": "19.5.1-alpha.
|
|
3
|
+
"version": "19.5.1-alpha.12",
|
|
4
4
|
"description": "ESLint plugin for Angular applications, following https://angular.dev/style-guide",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"LICENSE"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@angular-eslint/bundled-angular-compiler": "19.5.1-alpha.
|
|
22
|
-
"@angular-eslint/utils": "19.5.1-alpha.
|
|
21
|
+
"@angular-eslint/bundled-angular-compiler": "19.5.1-alpha.12",
|
|
22
|
+
"@angular-eslint/utils": "19.5.1-alpha.12"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@angular-eslint/test-utils": "19.5.1-alpha.
|
|
25
|
+
"@angular-eslint/test-utils": "19.5.1-alpha.12"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@typescript-eslint/utils": "^7.11.0 || ^8.0.0",
|