@angular-eslint/eslint-plugin 16.1.2-alpha.0 → 16.1.2-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.
|
@@ -66,6 +66,24 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
[utils_1.Selectors.OUTPUTS_METADATA_PROPERTY_LITERAL](node) {
|
|
69
|
+
var _a, _b, _c, _d;
|
|
70
|
+
const ancestorMaybeHostDirectiveAPI = (_d = (_c = (_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent) === null || _c === void 0 ? void 0 : _c.parent) === null || _d === void 0 ? void 0 : _d.parent;
|
|
71
|
+
if (ancestorMaybeHostDirectiveAPI &&
|
|
72
|
+
utils_1.ASTUtils.isProperty(ancestorMaybeHostDirectiveAPI)) {
|
|
73
|
+
/**
|
|
74
|
+
* Angular v15 introduced the directive composition API: https://angular.io/guide/directive-composition-api
|
|
75
|
+
* Renaming host directive outputs using this API is not a bad practice and should not be reported
|
|
76
|
+
*/
|
|
77
|
+
const hostDirectiveAPIPropertyName = 'hostDirectives';
|
|
78
|
+
if ((utils_1.ASTUtils.isLiteral(ancestorMaybeHostDirectiveAPI.key) &&
|
|
79
|
+
ancestorMaybeHostDirectiveAPI.key.value ===
|
|
80
|
+
hostDirectiveAPIPropertyName) ||
|
|
81
|
+
(utils_2.ASTUtils.isIdentifier(ancestorMaybeHostDirectiveAPI.key) &&
|
|
82
|
+
ancestorMaybeHostDirectiveAPI.key.name ===
|
|
83
|
+
hostDirectiveAPIPropertyName)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
69
87
|
const [propertyName, aliasName] = (0, utils_1.withoutBracketsAndWhitespaces)(utils_1.ASTUtils.getRawText(node)).split(':');
|
|
70
88
|
if (!aliasName)
|
|
71
89
|
return;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RULE_NAME = void 0;
|
|
4
4
|
const utils_1 = require("@angular-eslint/utils");
|
|
5
|
+
const utils_2 = require("@typescript-eslint/utils");
|
|
5
6
|
const create_eslint_rule_1 = require("../utils/create-eslint-rule");
|
|
6
7
|
exports.RULE_NAME = 'no-outputs-metadata-property';
|
|
7
8
|
const METADATA_PROPERTY_NAME = 'outputs';
|
|
@@ -23,6 +24,24 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
23
24
|
create(context) {
|
|
24
25
|
return {
|
|
25
26
|
[`${utils_1.Selectors.COMPONENT_OR_DIRECTIVE_CLASS_DECORATOR} ${utils_1.Selectors.metadataProperty(METADATA_PROPERTY_NAME)}`](node) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
/**
|
|
29
|
+
* Angular v15 introduced the directive composition API: https://angular.io/guide/directive-composition-api
|
|
30
|
+
* Using host directive outputs using this API is not a bad practice and should not be reported
|
|
31
|
+
*/
|
|
32
|
+
const ancestorMayBeHostDirectiveAPI = (_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent;
|
|
33
|
+
if (ancestorMayBeHostDirectiveAPI &&
|
|
34
|
+
utils_1.ASTUtils.isProperty(ancestorMayBeHostDirectiveAPI)) {
|
|
35
|
+
const hostDirectiveAPIPropertyName = 'hostDirectives';
|
|
36
|
+
if ((utils_1.ASTUtils.isLiteral(ancestorMayBeHostDirectiveAPI.key) &&
|
|
37
|
+
ancestorMayBeHostDirectiveAPI.key.value ===
|
|
38
|
+
hostDirectiveAPIPropertyName) ||
|
|
39
|
+
(utils_2.ASTUtils.isIdentifier(ancestorMayBeHostDirectiveAPI.key) &&
|
|
40
|
+
ancestorMayBeHostDirectiveAPI.key.name ===
|
|
41
|
+
hostDirectiveAPIPropertyName)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
26
45
|
context.report({
|
|
27
46
|
node,
|
|
28
47
|
messageId: 'noOutputsMetadataProperty',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-eslint/eslint-plugin",
|
|
3
|
-
"version": "16.1.2-alpha.
|
|
3
|
+
"version": "16.1.2-alpha.1+208bf25",
|
|
4
4
|
"description": "ESLint plugin for Angular applications, following angular.io/styleguide",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"LICENSE"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@angular-eslint/utils": "16.1.2-alpha.
|
|
20
|
+
"@angular-eslint/utils": "16.1.2-alpha.1+208bf25",
|
|
21
21
|
"@typescript-eslint/utils": "5.62.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"eslint": "^7.20.0 || ^8.0.0",
|
|
25
25
|
"typescript": "*"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "208bf25ec3662a1d6fdcaa32a27a9015ddf5e9ce"
|
|
28
28
|
}
|