@angular-eslint/eslint-plugin 18.0.2-alpha.1 → 18.0.2-alpha.11

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-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. | | | |
66
66
  | [`pipe-prefix`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/pipe-prefix.md) | Enforce consistent prefix for pipes. | | | |
67
67
  | [`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: |
68
- | [`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: |
68
+ | [`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: |
69
69
  | [`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: | |
70
70
  | [`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 | | | |
71
71
  | [`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. | | | |
@@ -1,45 +1,45 @@
1
1
  {
2
- "parser": "@typescript-eslint/parser",
3
- "plugins": ["@angular-eslint"],
4
- "rules": {
5
- "@angular-eslint/component-class-suffix": "error",
6
- "@angular-eslint/component-max-inline-declarations": "error",
7
- "@angular-eslint/component-selector": "error",
8
- "@angular-eslint/consistent-component-styles": "error",
9
- "@angular-eslint/contextual-decorator": "error",
10
- "@angular-eslint/contextual-lifecycle": "error",
11
- "@angular-eslint/directive-class-suffix": "error",
12
- "@angular-eslint/directive-selector": "error",
13
- "@angular-eslint/no-async-lifecycle-method": "error",
14
- "@angular-eslint/no-attribute-decorator": "error",
15
- "@angular-eslint/no-conflicting-lifecycle": "error",
16
- "@angular-eslint/no-duplicates-in-metadata-arrays": "error",
17
- "@angular-eslint/no-empty-lifecycle-method": "error",
18
- "@angular-eslint/no-forward-ref": "error",
19
- "@angular-eslint/no-host-metadata-property": "error",
20
- "@angular-eslint/no-input-prefix": "error",
21
- "@angular-eslint/no-input-rename": "error",
22
- "@angular-eslint/no-inputs-metadata-property": "error",
23
- "@angular-eslint/no-lifecycle-call": "error",
24
- "@angular-eslint/no-output-native": "error",
25
- "@angular-eslint/no-output-on-prefix": "error",
26
- "@angular-eslint/no-output-rename": "error",
27
- "@angular-eslint/no-outputs-metadata-property": "error",
28
- "@angular-eslint/no-pipe-impure": "error",
29
- "@angular-eslint/no-queries-metadata-property": "error",
30
- "@angular-eslint/pipe-prefix": "error",
31
- "@angular-eslint/prefer-on-push-component-change-detection": "error",
32
- "@angular-eslint/prefer-output-readonly": "error",
33
- "@angular-eslint/prefer-standalone": "error",
34
- "@angular-eslint/prefer-standalone-component": "error",
35
- "@angular-eslint/relative-url-prefix": "error",
36
- "@angular-eslint/require-localize-metadata": "error",
37
- "@angular-eslint/sort-lifecycle-methods": "error",
38
- "@angular-eslint/sort-ngmodule-metadata-arrays": "error",
39
- "@angular-eslint/use-component-selector": "error",
40
- "@angular-eslint/use-component-view-encapsulation": "error",
41
- "@angular-eslint/use-injectable-provided-in": "error",
42
- "@angular-eslint/use-lifecycle-interface": "error",
43
- "@angular-eslint/use-pipe-transform-interface": "error"
44
- }
2
+ "parser": "@typescript-eslint/parser",
3
+ "plugins": ["@angular-eslint"],
4
+ "rules": {
5
+ "@angular-eslint/component-class-suffix": "error",
6
+ "@angular-eslint/component-max-inline-declarations": "error",
7
+ "@angular-eslint/component-selector": "error",
8
+ "@angular-eslint/consistent-component-styles": "error",
9
+ "@angular-eslint/contextual-decorator": "error",
10
+ "@angular-eslint/contextual-lifecycle": "error",
11
+ "@angular-eslint/directive-class-suffix": "error",
12
+ "@angular-eslint/directive-selector": "error",
13
+ "@angular-eslint/no-async-lifecycle-method": "error",
14
+ "@angular-eslint/no-attribute-decorator": "error",
15
+ "@angular-eslint/no-conflicting-lifecycle": "error",
16
+ "@angular-eslint/no-duplicates-in-metadata-arrays": "error",
17
+ "@angular-eslint/no-empty-lifecycle-method": "error",
18
+ "@angular-eslint/no-forward-ref": "error",
19
+ "@angular-eslint/no-host-metadata-property": "error",
20
+ "@angular-eslint/no-input-prefix": "error",
21
+ "@angular-eslint/no-input-rename": "error",
22
+ "@angular-eslint/no-inputs-metadata-property": "error",
23
+ "@angular-eslint/no-lifecycle-call": "error",
24
+ "@angular-eslint/no-output-native": "error",
25
+ "@angular-eslint/no-output-on-prefix": "error",
26
+ "@angular-eslint/no-output-rename": "error",
27
+ "@angular-eslint/no-outputs-metadata-property": "error",
28
+ "@angular-eslint/no-pipe-impure": "error",
29
+ "@angular-eslint/no-queries-metadata-property": "error",
30
+ "@angular-eslint/pipe-prefix": "error",
31
+ "@angular-eslint/prefer-on-push-component-change-detection": "error",
32
+ "@angular-eslint/prefer-output-readonly": "error",
33
+ "@angular-eslint/prefer-standalone": "error",
34
+ "@angular-eslint/prefer-standalone-component": "error",
35
+ "@angular-eslint/relative-url-prefix": "error",
36
+ "@angular-eslint/require-localize-metadata": "error",
37
+ "@angular-eslint/sort-lifecycle-methods": "error",
38
+ "@angular-eslint/sort-ngmodule-metadata-arrays": "error",
39
+ "@angular-eslint/use-component-selector": "error",
40
+ "@angular-eslint/use-component-view-encapsulation": "error",
41
+ "@angular-eslint/use-injectable-provided-in": "error",
42
+ "@angular-eslint/use-lifecycle-interface": "error",
43
+ "@angular-eslint/use-pipe-transform-interface": "error"
44
+ }
45
45
  }
@@ -1,18 +1,18 @@
1
1
  {
2
- "parser": "@typescript-eslint/parser",
3
- "plugins": ["@angular-eslint"],
4
- "rules": {
5
- "@angular-eslint/component-class-suffix": "error",
6
- "@angular-eslint/contextual-lifecycle": "error",
7
- "@angular-eslint/directive-class-suffix": "error",
8
- "@angular-eslint/no-empty-lifecycle-method": "error",
9
- "@angular-eslint/no-input-rename": "error",
10
- "@angular-eslint/no-inputs-metadata-property": "error",
11
- "@angular-eslint/no-output-native": "error",
12
- "@angular-eslint/no-output-on-prefix": "error",
13
- "@angular-eslint/no-output-rename": "error",
14
- "@angular-eslint/no-outputs-metadata-property": "error",
15
- "@angular-eslint/use-pipe-transform-interface": "error",
16
- "@angular-eslint/use-lifecycle-interface": "warn"
17
- }
2
+ "parser": "@typescript-eslint/parser",
3
+ "plugins": ["@angular-eslint"],
4
+ "rules": {
5
+ "@angular-eslint/component-class-suffix": "error",
6
+ "@angular-eslint/contextual-lifecycle": "error",
7
+ "@angular-eslint/directive-class-suffix": "error",
8
+ "@angular-eslint/no-empty-lifecycle-method": "error",
9
+ "@angular-eslint/no-input-rename": "error",
10
+ "@angular-eslint/no-inputs-metadata-property": "error",
11
+ "@angular-eslint/no-output-native": "error",
12
+ "@angular-eslint/no-output-on-prefix": "error",
13
+ "@angular-eslint/no-output-rename": "error",
14
+ "@angular-eslint/no-outputs-metadata-property": "error",
15
+ "@angular-eslint/use-pipe-transform-interface": "error",
16
+ "@angular-eslint/use-lifecycle-interface": "warn"
17
+ }
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-output-readonly.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-output-readonly.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,UAAU,GAAG,sBAAsB,GAAG,4BAA4B,CAAC;AAC/E,eAAO,MAAM,SAAS,2BAA2B,CAAC;;AAElD,wBAmCG"}
1
+ {"version":3,"file":"prefer-output-readonly.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-output-readonly.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,UAAU,GAAG,sBAAsB,GAAG,4BAA4B,CAAC;AAC/E,eAAO,MAAM,SAAS,2BAA2B,CAAC;;AAElD,wBAkDG"}
@@ -9,12 +9,12 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
9
9
  meta: {
10
10
  type: 'suggestion',
11
11
  docs: {
12
- description: 'Prefer to declare `@Output` as `readonly` since they are not supposed to be reassigned',
12
+ description: 'Prefer to declare `@Output`, `OutputEmitterRef` and `OutputRef` as `readonly` since they are not supposed to be reassigned',
13
13
  },
14
14
  hasSuggestions: true,
15
15
  schema: [],
16
16
  messages: {
17
- preferOutputReadonly: 'Prefer to declare `@Output` as `readonly` since they are not supposed to be reassigned',
17
+ preferOutputReadonly: 'Prefer to declare `{{type}}` as `readonly` since they are not supposed to be reassigned',
18
18
  suggestAddReadonlyModifier: 'Add `readonly` modifier',
19
19
  },
20
20
  },
@@ -22,17 +22,27 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
22
22
  create(context) {
23
23
  return {
24
24
  [`PropertyDefinition:not([readonly=true]) > ${utils_1.Selectors.OUTPUT_DECORATOR}`]({ parent: { key }, }) {
25
- context.report({
26
- node: key,
27
- messageId: 'preferOutputReadonly',
28
- suggest: [
29
- {
30
- messageId: 'suggestAddReadonlyModifier',
31
- fix: (fixer) => fixer.insertTextBefore(key, 'readonly '),
32
- },
33
- ],
34
- });
25
+ report(key, '@Output');
26
+ },
27
+ [`PropertyDefinition:not([readonly=true]):matches([typeAnnotation.typeAnnotation.typeName.name=OutputEmitterRef], [value.callee.name=output])`]({ key, }) {
28
+ report(key, 'OutputEmitterRef');
29
+ },
30
+ [`PropertyDefinition:not([readonly=true]):matches([typeAnnotation.typeAnnotation.typeName.name=OutputRef], [value.callee.name=outputFromObservable])`]({ key, }) {
31
+ report(key, 'OutputRef');
35
32
  },
36
33
  };
34
+ function report(key, type) {
35
+ context.report({
36
+ node: key,
37
+ messageId: 'preferOutputReadonly',
38
+ data: { type },
39
+ suggest: [
40
+ {
41
+ messageId: 'suggestAddReadonlyModifier',
42
+ fix: (fixer) => fixer.insertTextBefore(key, 'readonly '),
43
+ },
44
+ ],
45
+ });
46
+ }
37
47
  },
38
48
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/eslint-plugin",
3
- "version": "18.0.2-alpha.1",
3
+ "version": "18.0.2-alpha.11",
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,14 +18,14 @@
18
18
  "LICENSE"
19
19
  ],
20
20
  "dependencies": {
21
- "@angular-eslint/bundled-angular-compiler": "18.0.2-alpha.1",
22
- "@angular-eslint/utils": "18.0.2-alpha.1"
21
+ "@angular-eslint/bundled-angular-compiler": "18.0.2-alpha.11",
22
+ "@angular-eslint/utils": "18.0.2-alpha.11"
23
23
  },
24
24
  "devDependencies": {
25
- "@angular-eslint/test-utils": "18.0.2-alpha.1"
25
+ "@angular-eslint/test-utils": "18.0.2-alpha.11"
26
26
  },
27
27
  "peerDependencies": {
28
- "@typescript-eslint/utils": "^7.11.0 || ^8.0.0-alpha.20",
28
+ "@typescript-eslint/utils": "^7.11.0 || ^8.0.0-alpha.37",
29
29
  "eslint": "^8.57.0 || ^9.0.0",
30
30
  "typescript": "*"
31
31
  },