@angular-eslint/eslint-plugin 20.0.0-beta.1 → 20.0.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"no-uncalled-signals.d.ts","sourceRoot":"","sources":["../../src/rules/no-uncalled-signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAGZ,MAAM,0BAA0B,CAAC;AAIlC,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AACnE,eAAO,MAAM,SAAS,wBAAwB,CAAC;;AAE/C,wBA+CG"}
1
+ {"version":3,"file":"no-uncalled-signals.d.ts","sourceRoot":"","sources":["../../src/rules/no-uncalled-signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAGZ,MAAM,0BAA0B,CAAC;AAIlC,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AACnE,eAAO,MAAM,SAAS,wBAAwB,CAAC;;AAE/C,wBAwDG"}
@@ -27,6 +27,12 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
27
27
  if (node.parent.type === utils_1.AST_NODE_TYPES.CallExpression) {
28
28
  return;
29
29
  }
30
+ // Check if this identifier is the property in a MemberExpression that's being called
31
+ if (node.parent.type === utils_1.AST_NODE_TYPES.MemberExpression &&
32
+ node.parent.property === node &&
33
+ node.parent.parent?.type === utils_1.AST_NODE_TYPES.CallExpression) {
34
+ return;
35
+ }
30
36
  const type = services.getTypeAtLocation(node);
31
37
  const identifierType = type.getSymbol()?.name;
32
38
  if (identifierType && signals_1.KNOWN_SIGNAL_TYPES.has(identifierType)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/eslint-plugin",
3
- "version": "20.0.0-beta.1",
3
+ "version": "20.0.0",
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": "20.0.0-beta.1",
22
- "@angular-eslint/utils": "20.0.0-beta.1"
21
+ "@angular-eslint/bundled-angular-compiler": "20.0.0",
22
+ "@angular-eslint/utils": "20.0.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@angular-eslint/test-utils": "20.0.0-beta.1"
25
+ "@angular-eslint/test-utils": "20.0.0"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@typescript-eslint/utils": "^7.11.0 || ^8.0.0",
@@ -1,8 +0,0 @@
1
- export type Options = [{
2
- readonly allowStatic?: boolean;
3
- }];
4
- export type MessageIds = 'noHostMetadataProperty';
5
- export declare const RULE_NAME = "no-host-metadata-property";
6
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noHostMetadataProperty", Options, import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
7
- export default _default;
8
- //# sourceMappingURL=no-host-metadata-property.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-host-metadata-property.d.ts","sourceRoot":"","sources":["../../src/rules/no-host-metadata-property.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,OAAO,GAAG,CAAC;IAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAC3D,MAAM,MAAM,UAAU,GAAG,wBAAwB,CAAC;AAClD,eAAO,MAAM,SAAS,8BAA8B,CAAC;;AAIrD,wBA4CG"}
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RULE_NAME = void 0;
4
- const utils_1 = require("@angular-eslint/utils");
5
- const utils_2 = require("@typescript-eslint/utils");
6
- const create_eslint_rule_1 = require("../utils/create-eslint-rule");
7
- exports.RULE_NAME = 'no-host-metadata-property';
8
- const DEFAULT_OPTIONS = { allowStatic: false };
9
- const METADATA_PROPERTY_NAME = 'host';
10
- exports.default = (0, create_eslint_rule_1.createESLintRule)({
11
- name: exports.RULE_NAME,
12
- meta: {
13
- type: 'suggestion',
14
- deprecated: true,
15
- docs: {
16
- description: `Disallows usage of the \`${METADATA_PROPERTY_NAME}\` metadata property. NOTE: This used to be recommended by the Angular Team, but now they recommend the exact opposite: https://github.com/angular/angular/issues/54284`,
17
- },
18
- schema: [
19
- {
20
- type: 'object',
21
- properties: {
22
- allowStatic: {
23
- type: 'boolean',
24
- default: DEFAULT_OPTIONS.allowStatic,
25
- },
26
- },
27
- additionalProperties: false,
28
- },
29
- ],
30
- messages: {
31
- noHostMetadataProperty: `Use @${utils_1.ASTUtils.AngularInnerClassDecorators.HostBinding} or @${utils_1.ASTUtils.AngularInnerClassDecorators.HostListener} rather than the \`${METADATA_PROPERTY_NAME}\` metadata property`,
32
- },
33
- },
34
- defaultOptions: [DEFAULT_OPTIONS],
35
- create(context, [{ allowStatic }]) {
36
- return {
37
- [`${utils_1.Selectors.COMPONENT_OR_DIRECTIVE_CLASS_DECORATOR} Property[key.name="${METADATA_PROPERTY_NAME}"]`](node) {
38
- const properties = allowStatic && utils_1.ASTUtils.isObjectExpression(node.value)
39
- ? node.value.properties.filter(isDynamic)
40
- : [node];
41
- properties.forEach((property) => {
42
- context.report({
43
- node: property,
44
- messageId: 'noHostMetadataProperty',
45
- });
46
- });
47
- },
48
- };
49
- },
50
- });
51
- function startsWithLetter({ [0]: firstLetter }) {
52
- return firstLetter.toLowerCase() !== firstLetter.toUpperCase();
53
- }
54
- function isEmptyStringValue(property) {
55
- return (utils_1.ASTUtils.isStringLiteral(property.value) && property.value.value === '');
56
- }
57
- function isStatic(property) {
58
- return (!property.computed &&
59
- (utils_2.ASTUtils.isIdentifier(property.key) ||
60
- (utils_1.ASTUtils.isStringLiteral(property.key) &&
61
- startsWithLetter(property.key.value))));
62
- }
63
- function isDynamic(property) {
64
- return (utils_1.ASTUtils.isProperty(property) &&
65
- !isStatic(property) &&
66
- !isEmptyStringValue(property));
67
- }
@@ -1,6 +0,0 @@
1
- export type Options = [];
2
- export type MessageIds = 'preferStandaloneComponent';
3
- export declare const RULE_NAME = "prefer-standalone-component";
4
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferStandaloneComponent", [], import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
5
- export default _default;
6
- //# sourceMappingURL=prefer-standalone-component.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prefer-standalone-component.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-standalone-component.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,2BAA2B,CAAC;AACrD,eAAO,MAAM,SAAS,gCAAgC,CAAC;;AAIvD,wBA0DG"}
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RULE_NAME = void 0;
4
- const utils_1 = require("@angular-eslint/utils");
5
- const create_eslint_rule_1 = require("../utils/create-eslint-rule");
6
- exports.RULE_NAME = 'prefer-standalone-component';
7
- const METADATA_PROPERTY_NAME = 'standalone';
8
- const IS_STANDALONE = 'true';
9
- exports.default = (0, create_eslint_rule_1.createESLintRule)({
10
- name: exports.RULE_NAME,
11
- meta: {
12
- type: 'suggestion',
13
- docs: {
14
- description: `Ensures component \`${METADATA_PROPERTY_NAME}\` property is set to \`${IS_STANDALONE}\` in the component decorator`,
15
- },
16
- deprecated: true,
17
- replacedBy: ['prefer-standalone'],
18
- fixable: 'code',
19
- schema: [],
20
- messages: {
21
- preferStandaloneComponent: `The component \`${METADATA_PROPERTY_NAME}\` property should be set to \`${IS_STANDALONE}\``,
22
- },
23
- },
24
- defaultOptions: [],
25
- create(context) {
26
- return {
27
- [utils_1.Selectors.COMPONENT_CLASS_DECORATOR](node) {
28
- const standalone = utils_1.ASTUtils.getDecoratorPropertyValue(node, METADATA_PROPERTY_NAME);
29
- if (standalone &&
30
- utils_1.ASTUtils.isLiteral(standalone) &&
31
- standalone.value === true) {
32
- return;
33
- }
34
- context.report({
35
- node: nodeToReport(node),
36
- messageId: 'preferStandaloneComponent',
37
- fix: (fixer) => {
38
- if (standalone &&
39
- utils_1.ASTUtils.isLiteral(standalone) &&
40
- standalone.value !== true) {
41
- return [fixer.replaceText(standalone, IS_STANDALONE)].filter(utils_1.isNotNullOrUndefined);
42
- }
43
- return [
44
- utils_1.RuleFixes.getDecoratorPropertyAddFix(node, fixer, `${METADATA_PROPERTY_NAME}: ${IS_STANDALONE}`),
45
- ].filter(utils_1.isNotNullOrUndefined);
46
- },
47
- });
48
- },
49
- };
50
- },
51
- });
52
- function nodeToReport(node) {
53
- if (!utils_1.ASTUtils.isProperty(node)) {
54
- return node;
55
- }
56
- return utils_1.ASTUtils.isMemberExpression(node.value)
57
- ? node.value.property
58
- : node.value;
59
- }
@@ -1,10 +0,0 @@
1
- export type Options = [
2
- {
3
- readonly locale: string;
4
- }
5
- ];
6
- export type MessageIds = 'sortNgmoduleMetadataArrays';
7
- export declare const RULE_NAME = "sort-ngmodule-metadata-arrays";
8
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"sortNgmoduleMetadataArrays", Options, import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
9
- export default _default;
10
- //# sourceMappingURL=sort-ngmodule-metadata-arrays.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sort-ngmodule-metadata-arrays.d.ts","sourceRoot":"","sources":["../../src/rules/sort-ngmodule-metadata-arrays.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,OAAO,GAAG;IACpB;QACE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,4BAA4B,CAAC;AACtD,eAAO,MAAM,SAAS,kCAAkC,CAAC;;AAGzD,wBA2DG"}
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RULE_NAME = void 0;
4
- const utils_1 = require("@angular-eslint/utils");
5
- const utils_2 = require("@typescript-eslint/utils");
6
- const create_eslint_rule_1 = require("../utils/create-eslint-rule");
7
- exports.RULE_NAME = 'sort-ngmodule-metadata-arrays';
8
- const DEFAULT_LOCALE = 'en-US';
9
- exports.default = (0, create_eslint_rule_1.createESLintRule)({
10
- name: exports.RULE_NAME,
11
- meta: {
12
- type: 'suggestion',
13
- deprecated: true,
14
- docs: {
15
- description: 'Ensures ASC alphabetical order for `NgModule` metadata arrays for easy visual scanning',
16
- },
17
- fixable: 'code',
18
- schema: [
19
- {
20
- type: 'object',
21
- properties: {
22
- locale: {
23
- type: 'string',
24
- description: 'A string with a BCP 47 language tag.',
25
- default: DEFAULT_LOCALE,
26
- },
27
- },
28
- additionalProperties: false,
29
- },
30
- ],
31
- messages: {
32
- sortNgmoduleMetadataArrays: '`NgModule` metadata arrays should be sorted in ASC alphabetical order',
33
- },
34
- },
35
- defaultOptions: [
36
- {
37
- locale: DEFAULT_LOCALE,
38
- },
39
- ],
40
- create(context, [{ locale }]) {
41
- return {
42
- [`${utils_1.Selectors.MODULE_CLASS_DECORATOR} Property[key.name!="deps"] > ArrayExpression`]({ elements, }) {
43
- const unorderedNodes = elements
44
- .filter(utils_2.ASTUtils.isIdentifier)
45
- .map((current, index, list) => [current, list[index + 1]])
46
- .find(([current, next]) => {
47
- return next && current.name.localeCompare(next.name, locale) === 1;
48
- });
49
- if (!unorderedNodes)
50
- return;
51
- const [unorderedNode, nextNode] = unorderedNodes;
52
- context.report({
53
- node: nextNode,
54
- messageId: 'sortNgmoduleMetadataArrays',
55
- fix: (fixer) => [
56
- fixer.replaceText(unorderedNode, nextNode.name),
57
- fixer.replaceText(nextNode, unorderedNode.name),
58
- ],
59
- });
60
- },
61
- };
62
- },
63
- });