@angular-eslint/eslint-plugin 17.3.1-alpha.12 → 17.3.1-alpha.14
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 +2 -1
- package/dist/configs/all.json +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/rules/no-duplicates-in-metadata-arrays.d.ts +5 -0
- package/dist/rules/no-duplicates-in-metadata-arrays.d.ts.map +1 -0
- package/dist/rules/no-duplicates-in-metadata-arrays.js +64 -0
- package/dist/rules/sort-ngmodule-metadata-arrays.d.ts.map +1 -1
- package/dist/rules/sort-ngmodule-metadata-arrays.js +1 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
| [`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.io/styleguide#style-02-03 | :white_check_mark: | | |
|
|
49
49
|
| [`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.io/guide/styleguide#style-02-06 and https://angular.io/guide/styleguide#style-02-08. | | | |
|
|
50
50
|
| [`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. | | | |
|
|
51
|
+
| [`no-duplicates-in-metadata-arrays`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-duplicates-in-metadata-arrays.md) | Ensures that metadata arrays do not contain duplicate entries. | | | |
|
|
51
52
|
| [`no-empty-lifecycle-method`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-empty-lifecycle-method.md) | Disallows declaring empty lifecycle methods | :white_check_mark: | | :bulb: |
|
|
52
53
|
| [`no-forward-ref`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-forward-ref.md) | Disallows usage of `forwardRef` references for DI | | | |
|
|
53
54
|
| [`no-host-metadata-property`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-host-metadata-property.md) | Disallows usage of the `host` metadata property. See more at https://angular.io/styleguide#style-06-03 | :white_check_mark: | | |
|
|
@@ -67,7 +68,6 @@
|
|
|
67
68
|
| [`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: | |
|
|
68
69
|
| [`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.io/styleguide#style-05-04 | | | |
|
|
69
70
|
| [`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. | | | |
|
|
70
|
-
| [`sort-ngmodule-metadata-arrays`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/sort-ngmodule-metadata-arrays.md) | Ensures ASC alphabetical order for `NgModule` metadata arrays for easy visual scanning | | :wrench: | |
|
|
71
71
|
| [`use-component-selector`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/use-component-selector.md) | Component selector must be declared | | | |
|
|
72
72
|
| [`use-component-view-encapsulation`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/use-component-view-encapsulation.md) | Disallows using `ViewEncapsulation.None` | | | :bulb: |
|
|
73
73
|
| [`use-injectable-provided-in`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/use-injectable-provided-in.md) | Using the `providedIn` property makes `Injectables` tree-shakable | | | :bulb: |
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
| Rule | Replaced by |
|
|
90
90
|
| --- | --- |
|
|
91
91
|
| [`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) |
|
|
92
|
+
| [`sort-ngmodule-metadata-arrays`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/sort-ngmodule-metadata-arrays.md) | |
|
|
92
93
|
<!-- prettier-ignore-end -->
|
|
93
94
|
|
|
94
95
|
<!-- end deprecated rule list -->
|
package/dist/configs/all.json
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"@angular-eslint/no-async-lifecycle-method": "error",
|
|
14
14
|
"@angular-eslint/no-attribute-decorator": "error",
|
|
15
15
|
"@angular-eslint/no-conflicting-lifecycle": "error",
|
|
16
|
+
"@angular-eslint/no-duplicates-in-metadata-arrays": "error",
|
|
16
17
|
"@angular-eslint/no-empty-lifecycle-method": "error",
|
|
17
18
|
"@angular-eslint/no-forward-ref": "error",
|
|
18
19
|
"@angular-eslint/no-host-metadata-property": "error",
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ declare const _default: {
|
|
|
15
15
|
"@angular-eslint/no-async-lifecycle-method": string;
|
|
16
16
|
"@angular-eslint/no-attribute-decorator": string;
|
|
17
17
|
"@angular-eslint/no-conflicting-lifecycle": string;
|
|
18
|
+
"@angular-eslint/no-duplicates-in-metadata-arrays": string;
|
|
18
19
|
"@angular-eslint/no-empty-lifecycle-method": string;
|
|
19
20
|
"@angular-eslint/no-forward-ref": string;
|
|
20
21
|
"@angular-eslint/no-host-metadata-property": string;
|
|
@@ -84,6 +85,7 @@ declare const _default: {
|
|
|
84
85
|
"no-async-lifecycle-method": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noAsyncLifecycleMethod", [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
85
86
|
"no-attribute-decorator": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noAttributeDecorator", [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
86
87
|
"no-conflicting-lifecycle": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/no-conflicting-lifecycle").MessageIds, [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
88
|
+
"no-duplicates-in-metadata-arrays": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noDuplicatesInMetadataArrays", [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
87
89
|
"no-empty-lifecycle-method": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/no-empty-lifecycle-method").MessageIds, [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
88
90
|
"no-forward-ref": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noForwardRef", [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
89
91
|
"no-host-metadata-property": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noHostMetadataProperty", [{
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyHA,kBA+CE"}
|
package/dist/index.js
CHANGED
|
@@ -65,6 +65,7 @@ const use_component_view_encapsulation_1 = __importStar(require("./rules/use-com
|
|
|
65
65
|
const use_injectable_provided_in_1 = __importStar(require("./rules/use-injectable-provided-in"));
|
|
66
66
|
const use_lifecycle_interface_1 = __importStar(require("./rules/use-lifecycle-interface"));
|
|
67
67
|
const use_pipe_transform_interface_1 = __importStar(require("./rules/use-pipe-transform-interface"));
|
|
68
|
+
const no_duplicates_in_metadata_arrays_1 = __importStar(require("./rules/no-duplicates-in-metadata-arrays"));
|
|
68
69
|
module.exports = {
|
|
69
70
|
configs: {
|
|
70
71
|
all: all_json_1.default,
|
|
@@ -82,6 +83,7 @@ module.exports = {
|
|
|
82
83
|
[no_async_lifecycle_method_1.RULE_NAME]: no_async_lifecycle_method_1.default,
|
|
83
84
|
[no_attribute_decorator_1.RULE_NAME]: no_attribute_decorator_1.default,
|
|
84
85
|
[no_conflicting_lifecycle_1.RULE_NAME]: no_conflicting_lifecycle_1.default,
|
|
86
|
+
[no_duplicates_in_metadata_arrays_1.RULE_NAME]: no_duplicates_in_metadata_arrays_1.default,
|
|
85
87
|
[no_empty_lifecycle_method_1.RULE_NAME]: no_empty_lifecycle_method_1.default,
|
|
86
88
|
[no_forward_ref_1.RULE_NAME]: no_forward_ref_1.default,
|
|
87
89
|
[no_host_metadata_property_1.RULE_NAME]: no_host_metadata_property_1.default,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type MessageIds = 'noDuplicatesInMetadataArrays';
|
|
2
|
+
export declare const RULE_NAME = "no-duplicates-in-metadata-arrays";
|
|
3
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noDuplicatesInMetadataArrays", [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
4
|
+
export default _default;
|
|
5
|
+
//# sourceMappingURL=no-duplicates-in-metadata-arrays.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-duplicates-in-metadata-arrays.d.ts","sourceRoot":"","sources":["../../src/rules/no-duplicates-in-metadata-arrays.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,UAAU,GAAG,8BAA8B,CAAC;AACxD,eAAO,MAAM,SAAS,qCAAqC,CAAC;;AAE5D,wBA4CG"}
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
const utils_2 = require("@typescript-eslint/utils");
|
|
7
|
+
exports.RULE_NAME = 'no-duplicates-in-metadata-arrays';
|
|
8
|
+
exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
9
|
+
name: exports.RULE_NAME,
|
|
10
|
+
meta: {
|
|
11
|
+
type: 'suggestion',
|
|
12
|
+
docs: {
|
|
13
|
+
description: 'Ensures that metadata arrays do not contain duplicate entries.',
|
|
14
|
+
},
|
|
15
|
+
schema: [],
|
|
16
|
+
messages: {
|
|
17
|
+
noDuplicatesInMetadataArrays: 'Entry is duplicated in metadata array',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
defaultOptions: [],
|
|
21
|
+
create(context) {
|
|
22
|
+
const selectors = [
|
|
23
|
+
// https://angular.io/api/core/NgModule
|
|
24
|
+
`${utils_1.Selectors.MODULE_CLASS_DECORATOR} Property[key.name=${(0, utils_1.toPattern)([
|
|
25
|
+
'providers',
|
|
26
|
+
'declarations',
|
|
27
|
+
'imports',
|
|
28
|
+
'exports',
|
|
29
|
+
])}] > ArrayExpression`,
|
|
30
|
+
// https://angular.io/api/core/Component
|
|
31
|
+
`${utils_1.Selectors.COMPONENT_CLASS_DECORATOR} Property[key.name=${(0, utils_1.toPattern)([
|
|
32
|
+
'imports',
|
|
33
|
+
])}] > ArrayExpression`,
|
|
34
|
+
// https://angular.io/api/core/Directive
|
|
35
|
+
`${utils_1.Selectors.DIRECTIVE_CLASS_DECORATOR} Property[key.name=${(0, utils_1.toPattern)([
|
|
36
|
+
'providers',
|
|
37
|
+
])}] > ArrayExpression`,
|
|
38
|
+
].join(',');
|
|
39
|
+
return {
|
|
40
|
+
[selectors]({ elements }) {
|
|
41
|
+
getDuplicateItems(elements).forEach((duplicateImport) => {
|
|
42
|
+
context.report({
|
|
43
|
+
node: duplicateImport,
|
|
44
|
+
messageId: 'noDuplicatesInMetadataArrays',
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
function getDuplicateItems(elements) {
|
|
52
|
+
const items = elements.filter(utils_2.ASTUtils.isIdentifier);
|
|
53
|
+
const uniqueItemNames = new Set();
|
|
54
|
+
const duplicateItems = [];
|
|
55
|
+
items.forEach((item) => {
|
|
56
|
+
if (uniqueItemNames.has(item.name)) {
|
|
57
|
+
duplicateItems.push(item);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
uniqueItemNames.add(item.name);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return duplicateItems;
|
|
64
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort-ngmodule-metadata-arrays.d.ts","sourceRoot":"","sources":["../../src/rules/sort-ngmodule-metadata-arrays.ts"],"names":[],"mappings":"AAKA,KAAK,OAAO,GAAG;IACb;QACE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB;CACF,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,4BAA4B,CAAC;AACtD,eAAO,MAAM,SAAS,kCAAkC,CAAC;;AAGzD,
|
|
1
|
+
{"version":3,"file":"sort-ngmodule-metadata-arrays.d.ts","sourceRoot":"","sources":["../../src/rules/sort-ngmodule-metadata-arrays.ts"],"names":[],"mappings":"AAKA,KAAK,OAAO,GAAG;IACb;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"}
|
|
@@ -10,6 +10,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
10
10
|
name: exports.RULE_NAME,
|
|
11
11
|
meta: {
|
|
12
12
|
type: 'suggestion',
|
|
13
|
+
deprecated: true,
|
|
13
14
|
docs: {
|
|
14
15
|
description: 'Ensures ASC alphabetical order for `NgModule` metadata arrays for easy visual scanning',
|
|
15
16
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-eslint/eslint-plugin",
|
|
3
|
-
"version": "17.3.1-alpha.
|
|
3
|
+
"version": "17.3.1-alpha.14",
|
|
4
4
|
"description": "ESLint plugin for Angular applications, following angular.io/styleguide",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"LICENSE"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@angular-eslint/bundled-angular-compiler": "17.3.1-alpha.
|
|
22
|
-
"@angular-eslint/utils": "17.3.1-alpha.
|
|
23
|
-
"@typescript-eslint/utils": "7.
|
|
21
|
+
"@angular-eslint/bundled-angular-compiler": "17.3.1-alpha.14",
|
|
22
|
+
"@angular-eslint/utils": "17.3.1-alpha.14",
|
|
23
|
+
"@typescript-eslint/utils": "7.8.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"eslint": "^7.20.0 || ^8.0.0",
|