@angular-eslint/eslint-plugin 22.2.1-alpha.3 → 22.2.1-alpha.5
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-implicit-take-until-destroyed.d.ts","sourceRoot":"","sources":["../../src/rules/no-implicit-take-until-destroyed.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,8BAA8B,CAAC;AACxD,eAAO,MAAM,SAAS,qCAAqC,CAAC;;;;AAO5D,wBAgCG;
|
|
1
|
+
{"version":3,"file":"no-implicit-take-until-destroyed.d.ts","sourceRoot":"","sources":["../../src/rules/no-implicit-take-until-destroyed.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,8BAA8B,CAAC;AACxD,eAAO,MAAM,SAAS,qCAAqC,CAAC;;;;AAO5D,wBAgCG;AAiNH,eAAO,MAAM,mBAAmB;;CAE/B,CAAC"}
|
|
@@ -89,16 +89,26 @@ function isMethodCalledFromInjectionContext(method, classDeclaration) {
|
|
|
89
89
|
return false;
|
|
90
90
|
}
|
|
91
91
|
const isPrivateField = method.key.type === utils_2.AST_NODE_TYPES.PrivateIdentifier;
|
|
92
|
+
let isCalledFromInjectionContext = false;
|
|
92
93
|
for (const member of classDeclaration.body.body) {
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
// Ignore recursive calls from the method to itself
|
|
95
|
+
if (member === method) {
|
|
95
96
|
continue;
|
|
96
97
|
}
|
|
97
|
-
if (containsCallToMethod(member, methodName, isPrivateField)) {
|
|
98
|
-
|
|
98
|
+
if (!containsCallToMethod(member, methodName, isPrivateField)) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (isConstructorMethod(member) || utils_1.ASTUtils.isPropertyDefinition(member)) {
|
|
102
|
+
isCalledFromInjectionContext = true;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
// The method is also called from somewhere that is not an injection
|
|
106
|
+
// context (e.g. a lifecycle hook or a regular method), so we cannot
|
|
107
|
+
// assume that `takeUntilDestroyed()` will always run within one.
|
|
108
|
+
return false;
|
|
99
109
|
}
|
|
100
110
|
}
|
|
101
|
-
return
|
|
111
|
+
return isCalledFromInjectionContext;
|
|
102
112
|
}
|
|
103
113
|
function isASTNode(value) {
|
|
104
114
|
return (value !== null &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-eslint/eslint-plugin",
|
|
3
|
-
"version": "22.2.1-alpha.
|
|
3
|
+
"version": "22.2.1-alpha.5",
|
|
4
4
|
"description": "ESLint plugin for Angular applications, following https://angular.dev/style-guide",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"LICENSE"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@angular-eslint/bundled-angular-compiler": "22.2.1-alpha.
|
|
23
|
-
"@angular-eslint/utils": "22.2.1-alpha.
|
|
22
|
+
"@angular-eslint/bundled-angular-compiler": "22.2.1-alpha.5",
|
|
23
|
+
"@angular-eslint/utils": "22.2.1-alpha.5",
|
|
24
24
|
"ts-api-utils": "^2.1.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@angular-eslint/test-utils": "22.2.1-alpha.
|
|
27
|
+
"@angular-eslint/test-utils": "22.2.1-alpha.5"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@typescript-eslint/utils": "^8.0.0",
|