@angular-eslint/eslint-plugin 22.1.1-alpha.4 → 22.1.1-alpha.6
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-duplicates-in-metadata-arrays.d.ts","sourceRoot":"","sources":["../../src/rules/no-duplicates-in-metadata-arrays.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,8BAA8B,CAAC;AACxD,eAAO,MAAM,SAAS,qCAAqC,CAAC;;;;AAE5D,
|
|
1
|
+
{"version":3,"file":"no-duplicates-in-metadata-arrays.d.ts","sourceRoot":"","sources":["../../src/rules/no-duplicates-in-metadata-arrays.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,8BAA8B,CAAC;AACxD,eAAO,MAAM,SAAS,qCAAqC,CAAC;;;;AAE5D,wBA+CG;AA2BH,eAAO,MAAM,mBAAmB;;CAG/B,CAAC"}
|
|
@@ -30,6 +30,9 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
30
30
|
// https://angular.dev/api/core/Component
|
|
31
31
|
`${utils_1.Selectors.COMPONENT_CLASS_DECORATOR} Property[key.name=${(0, utils_1.toPattern)([
|
|
32
32
|
'imports',
|
|
33
|
+
'providers',
|
|
34
|
+
'viewProviders',
|
|
35
|
+
'styleUrls',
|
|
33
36
|
])}] > ArrayExpression`,
|
|
34
37
|
// https://angular.dev/api/core/Directive
|
|
35
38
|
`${utils_1.Selectors.DIRECTIVE_CLASS_DECORATOR} Property[key.name=${(0, utils_1.toPattern)([
|
|
@@ -49,15 +52,17 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
49
52
|
},
|
|
50
53
|
});
|
|
51
54
|
function getDuplicateItems(elements) {
|
|
52
|
-
const items = elements.filter(utils_2.ASTUtils.isIdentifier)
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
+
const items = elements.filter((element) => utils_2.ASTUtils.isIdentifier(element) ||
|
|
56
|
+
(element?.type === 'Literal' && typeof element.value === 'string'));
|
|
57
|
+
const uniqueItemKeys = new Set();
|
|
58
|
+
const duplicateItems = new Array();
|
|
55
59
|
items.forEach((item) => {
|
|
56
|
-
|
|
60
|
+
const key = item.type === 'Identifier' ? item.name : item.value;
|
|
61
|
+
if (uniqueItemKeys.has(key)) {
|
|
57
62
|
duplicateItems.push(item);
|
|
58
63
|
}
|
|
59
64
|
else {
|
|
60
|
-
|
|
65
|
+
uniqueItemKeys.add(key);
|
|
61
66
|
}
|
|
62
67
|
});
|
|
63
68
|
return duplicateItems;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-eslint/eslint-plugin",
|
|
3
|
-
"version": "22.1.1-alpha.
|
|
3
|
+
"version": "22.1.1-alpha.6",
|
|
4
4
|
"description": "ESLint plugin for Angular applications, following https://angular.dev/style-guide",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"ts-api-utils": "^2.1.0",
|
|
23
|
-
"@angular-eslint/
|
|
24
|
-
"@angular-eslint/
|
|
23
|
+
"@angular-eslint/bundled-angular-compiler": "22.1.1-alpha.6",
|
|
24
|
+
"@angular-eslint/utils": "22.1.1-alpha.6"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@angular-eslint/test-utils": "22.1.1-alpha.
|
|
27
|
+
"@angular-eslint/test-utils": "22.1.1-alpha.6"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@typescript-eslint/utils": "^8.0.0",
|