@angular-eslint/eslint-plugin 19.0.0-alpha.0 → 19.0.0-alpha.1

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
@@ -85,14 +85,4 @@ Please see https://github.com/angular-eslint/angular-eslint for full usage instr
85
85
 
86
86
  <!-- begin deprecated rule list -->
87
87
 
88
- ### Deprecated
89
-
90
- <!-- prettier-ignore-start -->
91
- | Rule | Replaced by |
92
- | --- | --- |
93
- | [`no-host-metadata-property`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-host-metadata-property.md) | |
94
- | [`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.md) |
95
- | [`sort-ngmodule-metadata-arrays`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/sort-ngmodule-metadata-arrays.md) | |
96
- <!-- prettier-ignore-end -->
97
-
98
88
  <!-- end deprecated rule list -->
@@ -16,7 +16,6 @@
16
16
  "@angular-eslint/no-duplicates-in-metadata-arrays": "error",
17
17
  "@angular-eslint/no-empty-lifecycle-method": "error",
18
18
  "@angular-eslint/no-forward-ref": "error",
19
- "@angular-eslint/no-host-metadata-property": "error",
20
19
  "@angular-eslint/no-input-prefix": "error",
21
20
  "@angular-eslint/no-input-rename": "error",
22
21
  "@angular-eslint/no-inputs-metadata-property": "error",
@@ -31,12 +30,10 @@
31
30
  "@angular-eslint/prefer-on-push-component-change-detection": "error",
32
31
  "@angular-eslint/prefer-output-readonly": "error",
33
32
  "@angular-eslint/prefer-standalone": "error",
34
- "@angular-eslint/prefer-standalone-component": "error",
35
33
  "@angular-eslint/relative-url-prefix": "error",
36
34
  "@angular-eslint/require-localize-metadata": "error",
37
35
  "@angular-eslint/runtime-localize": "error",
38
36
  "@angular-eslint/sort-lifecycle-methods": "error",
39
- "@angular-eslint/sort-ngmodule-metadata-arrays": "error",
40
37
  "@angular-eslint/use-component-selector": "error",
41
38
  "@angular-eslint/use-component-view-encapsulation": "error",
42
39
  "@angular-eslint/use-injectable-provided-in": "error",
package/dist/index.d.ts CHANGED
@@ -18,7 +18,6 @@ declare const _default: {
18
18
  "@angular-eslint/no-duplicates-in-metadata-arrays": string;
19
19
  "@angular-eslint/no-empty-lifecycle-method": string;
20
20
  "@angular-eslint/no-forward-ref": string;
21
- "@angular-eslint/no-host-metadata-property": string;
22
21
  "@angular-eslint/no-input-prefix": string;
23
22
  "@angular-eslint/no-input-rename": string;
24
23
  "@angular-eslint/no-inputs-metadata-property": string;
@@ -33,12 +32,10 @@ declare const _default: {
33
32
  "@angular-eslint/prefer-on-push-component-change-detection": string;
34
33
  "@angular-eslint/prefer-output-readonly": string;
35
34
  "@angular-eslint/prefer-standalone": string;
36
- "@angular-eslint/prefer-standalone-component": string;
37
35
  "@angular-eslint/relative-url-prefix": string;
38
36
  "@angular-eslint/require-localize-metadata": string;
39
37
  "@angular-eslint/runtime-localize": string;
40
38
  "@angular-eslint/sort-lifecycle-methods": string;
41
- "@angular-eslint/sort-ngmodule-metadata-arrays": string;
42
39
  "@angular-eslint/use-component-selector": string;
43
40
  "@angular-eslint/use-component-view-encapsulation": string;
44
41
  "@angular-eslint/use-injectable-provided-in": string;
@@ -80,7 +77,6 @@ declare const _default: {
80
77
  "no-duplicates-in-metadata-arrays": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noDuplicatesInMetadataArrays", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
81
78
  "no-empty-lifecycle-method": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/no-empty-lifecycle-method").MessageIds, [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
82
79
  "no-forward-ref": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noForwardRef", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
83
- "no-host-metadata-property": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noHostMetadataProperty", import("./rules/no-host-metadata-property").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
84
80
  "no-input-prefix": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noInputPrefix", import("./rules/no-input-prefix").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
85
81
  "no-input-rename": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/no-input-rename").MessageIds, import("./rules/no-input-rename").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
86
82
  "no-inputs-metadata-property": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noInputsMetadataProperty", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
@@ -94,13 +90,11 @@ declare const _default: {
94
90
  "pipe-prefix": import("@typescript-eslint/utils/ts-eslint").RuleModule<"pipePrefix", import("./rules/pipe-prefix").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
95
91
  "prefer-on-push-component-change-detection": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/prefer-on-push-component-change-detection").MessageIds, [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
96
92
  "prefer-standalone": import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferStandalone", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
97
- "prefer-standalone-component": import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferStandaloneComponent", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
98
93
  "prefer-output-readonly": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/prefer-output-readonly").MessageIds, [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
99
94
  "relative-url-prefix": import("@typescript-eslint/utils/ts-eslint").RuleModule<"relativeUrlPrefix", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
100
95
  "require-localize-metadata": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/require-localize-metadata").MessageIds, import("./rules/require-localize-metadata").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
101
96
  "runtime-localize": import("@typescript-eslint/utils/ts-eslint").RuleModule<"runtimeLocalize", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
102
97
  "sort-lifecycle-methods": import("@typescript-eslint/utils/ts-eslint").RuleModule<"lifecycleMethodsNotSorted", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
103
- "sort-ngmodule-metadata-arrays": import("@typescript-eslint/utils/ts-eslint").RuleModule<"sortNgmoduleMetadataArrays", import("./rules/sort-ngmodule-metadata-arrays").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
104
98
  "use-component-selector": import("@typescript-eslint/utils/ts-eslint").RuleModule<"useComponentSelector", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
105
99
  "use-component-view-encapsulation": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/use-component-view-encapsulation").MessageIds, [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
106
100
  "use-injectable-provided-in": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/use-injectable-provided-in").MessageIds, import("./rules/use-injectable-provided-in").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4HA,kBAgDE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmHA,kBA6CE"}
package/dist/index.js CHANGED
@@ -40,7 +40,6 @@ const no_attribute_decorator_1 = __importStar(require("./rules/no-attribute-deco
40
40
  const no_conflicting_lifecycle_1 = __importStar(require("./rules/no-conflicting-lifecycle"));
41
41
  const no_empty_lifecycle_method_1 = __importStar(require("./rules/no-empty-lifecycle-method"));
42
42
  const no_forward_ref_1 = __importStar(require("./rules/no-forward-ref"));
43
- const no_host_metadata_property_1 = __importStar(require("./rules/no-host-metadata-property"));
44
43
  const no_input_prefix_1 = __importStar(require("./rules/no-input-prefix"));
45
44
  const no_input_rename_1 = __importStar(require("./rules/no-input-rename"));
46
45
  const no_inputs_metadata_property_1 = __importStar(require("./rules/no-inputs-metadata-property"));
@@ -55,12 +54,10 @@ const pipe_prefix_1 = __importStar(require("./rules/pipe-prefix"));
55
54
  const prefer_on_push_component_change_detection_1 = __importStar(require("./rules/prefer-on-push-component-change-detection"));
56
55
  const prefer_output_readonly_1 = __importStar(require("./rules/prefer-output-readonly"));
57
56
  const prefer_standalone_1 = __importStar(require("./rules/prefer-standalone"));
58
- const prefer_standalone_component_1 = __importStar(require("./rules/prefer-standalone-component"));
59
57
  const relative_url_prefix_1 = __importStar(require("./rules/relative-url-prefix"));
60
58
  const require_localize_metadata_1 = __importStar(require("./rules/require-localize-metadata"));
61
59
  const runtime_localize_1 = __importStar(require("./rules/runtime-localize"));
62
60
  const sort_lifecycle_methods_1 = __importStar(require("./rules/sort-lifecycle-methods"));
63
- const sort_ngmodule_metadata_arrays_1 = __importStar(require("./rules/sort-ngmodule-metadata-arrays"));
64
61
  const use_component_selector_1 = __importStar(require("./rules/use-component-selector"));
65
62
  const use_component_view_encapsulation_1 = __importStar(require("./rules/use-component-view-encapsulation"));
66
63
  const use_injectable_provided_in_1 = __importStar(require("./rules/use-injectable-provided-in"));
@@ -87,7 +84,6 @@ module.exports = {
87
84
  [no_duplicates_in_metadata_arrays_1.RULE_NAME]: no_duplicates_in_metadata_arrays_1.default,
88
85
  [no_empty_lifecycle_method_1.RULE_NAME]: no_empty_lifecycle_method_1.default,
89
86
  [no_forward_ref_1.RULE_NAME]: no_forward_ref_1.default,
90
- [no_host_metadata_property_1.RULE_NAME]: no_host_metadata_property_1.default,
91
87
  [no_input_prefix_1.RULE_NAME]: no_input_prefix_1.default,
92
88
  [no_input_rename_1.RULE_NAME]: no_input_rename_1.default,
93
89
  [no_inputs_metadata_property_1.RULE_NAME]: no_inputs_metadata_property_1.default,
@@ -101,13 +97,11 @@ module.exports = {
101
97
  [pipe_prefix_1.RULE_NAME]: pipe_prefix_1.default,
102
98
  [prefer_on_push_component_change_detection_1.RULE_NAME]: prefer_on_push_component_change_detection_1.default,
103
99
  [prefer_standalone_1.RULE_NAME]: prefer_standalone_1.default,
104
- [prefer_standalone_component_1.RULE_NAME]: prefer_standalone_component_1.default,
105
100
  [prefer_output_readonly_1.RULE_NAME]: prefer_output_readonly_1.default,
106
101
  [relative_url_prefix_1.RULE_NAME]: relative_url_prefix_1.default,
107
102
  [require_localize_metadata_1.RULE_NAME]: require_localize_metadata_1.default,
108
103
  [runtime_localize_1.RULE_NAME]: runtime_localize_1.default,
109
104
  [sort_lifecycle_methods_1.RULE_NAME]: sort_lifecycle_methods_1.default,
110
- [sort_ngmodule_metadata_arrays_1.RULE_NAME]: sort_ngmodule_metadata_arrays_1.default,
111
105
  [use_component_selector_1.RULE_NAME]: use_component_selector_1.default,
112
106
  [use_component_view_encapsulation_1.RULE_NAME]: use_component_view_encapsulation_1.default,
113
107
  [use_injectable_provided_in_1.RULE_NAME]: use_injectable_provided_in_1.default,
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-standalone.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-standalone.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AAEzB,MAAM,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAC5C,eAAO,MAAM,SAAS,sBAAsB,CAAC;;AAI7C,wBAkEG"}
1
+ {"version":3,"file":"prefer-standalone.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-standalone.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AAEzB,MAAM,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAC5C,eAAO,MAAM,SAAS,sBAAsB,CAAC;;AAI7C,wBAiEG"}
@@ -23,9 +23,8 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
23
23
  create(context) {
24
24
  const standaloneRuleFactory = (type) => (node) => {
25
25
  const standalone = utils_1.ASTUtils.getDecoratorPropertyValue(node, METADATA_PROPERTY_NAME);
26
- if (standalone &&
27
- utils_1.ASTUtils.isLiteral(standalone) &&
28
- standalone.value === true) {
26
+ if (!standalone ||
27
+ (utils_1.ASTUtils.isLiteral(standalone) && standalone.value === true)) {
29
28
  return;
30
29
  }
31
30
  if (!utils_1.ASTUtils.getDecoratorArgument(node)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/eslint-plugin",
3
- "version": "19.0.0-alpha.0",
3
+ "version": "19.0.0-alpha.1",
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.0.0-alpha.0",
22
- "@angular-eslint/utils": "19.0.0-alpha.0"
21
+ "@angular-eslint/utils": "19.0.0-alpha.1",
22
+ "@angular-eslint/bundled-angular-compiler": "19.0.0-alpha.1"
23
23
  },
24
24
  "devDependencies": {
25
- "@angular-eslint/test-utils": "19.0.0-alpha.0"
25
+ "@angular-eslint/test-utils": "19.0.0-alpha.1"
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
- });