Skip to content

Commit 8753aec

Browse files
committed
chore: Update dependencies.
1 parent 1440ea9 commit 8753aec

File tree

5 files changed

+155
-208
lines changed

5 files changed

+155
-208
lines changed

package.json

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
"url": "https://github.com/cartant/eslint-plugin-rxjs-angular/issues"
55
},
66
"dependencies": {
7-
"@typescript-eslint/experimental-utils": "^4.0.0",
7+
"@typescript-eslint/experimental-utils": "^5.0.0",
88
"common-tags": "^1.8.0",
9-
"eslint-etc": "^4.0.4",
9+
"eslint-etc": "^5.0.0",
1010
"requireindex": "~1.2.0",
1111
"tslib": "^2.0.0"
1212
},
1313
"description": "ESLint rules for RxJS and Angular",
1414
"devDependencies": {
15-
"@cartant/eslint-config": "^2.0.0",
15+
"@cartant/eslint-config": "^3.0.0",
1616
"@types/chai": "^4.2.0",
1717
"@types/common-tags": "^1.8.0",
1818
"@types/eslint": "^7.0.0",
1919
"@types/mocha": "^9.0.0",
2020
"@types/node": "^16.0.0",
21-
"@typescript-eslint/parser": "^4.0.0",
21+
"@typescript-eslint/parser": "^5.0.0",
2222
"chai": "^4.2.0",
23-
"eslint": "^7.0.0",
23+
"eslint": "^8.0.0",
2424
"husky": "^7.0.0",
2525
"lint-staged": "^11.0.0",
2626
"mocha": "^9.0.0",
@@ -29,9 +29,6 @@
2929
"ts-node": "^10.0.0",
3030
"typescript": "~4.4.2"
3131
},
32-
"engines": {
33-
"node": ">=12.0.0"
34-
},
3532
"files": [
3633
"dist",
3734
"docs"
@@ -52,8 +49,8 @@
5249
"name": "eslint-plugin-rxjs-angular",
5350
"optionalDependencies": {},
5451
"peerDependencies": {
55-
"eslint": "^5.0.0 || ^6.0.0 || ^7.0.0",
56-
"typescript": "^3.0.0 || ^4.0.0"
52+
"eslint": "^8.0.0",
53+
"typescript": "^4.0.0"
5754
},
5855
"private": false,
5956
"publishConfig": {

source/rules/prefer-async-pipe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ const rule = ruleCreator({
1111
defaultOptions: [],
1212
meta: {
1313
docs: {
14-
category: "Best Practices",
1514
description:
1615
"Forbids the calling of `subscribe` within Angular components.",
1716
recommended: false,
1817
},
1918
fixable: undefined,
19+
hasSuggestions: false,
2020
messages: {
2121
forbidden:
2222
"Calling `subscribe` in a component is forbidden; use an `async` pipe instead.",

source/rules/prefer-composition.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ const rule = ruleCreator({
2424
defaultOptions,
2525
meta: {
2626
docs: {
27-
category: "Best Practices",
2827
description:
2928
"Forbids `subscribe` calls that are not composed within Angular components (and, optionally, within services, directives, and pipes).",
3029
recommended: false,
3130
},
3231
fixable: undefined,
32+
hasSuggestions: false,
3333
messages: {
3434
notComposed: "Subscription not composed.",
3535
notDeclared: "Composed subscription `{{name}}` not a class property.",
@@ -58,7 +58,7 @@ const rule = ruleCreator({
5858
type Entry = {
5959
addCallExpressions: es.CallExpression[];
6060
classDeclaration: es.ClassDeclaration;
61-
classProperties: es.ClassProperty[];
61+
propertyDefinitions: es.PropertyDefinition[];
6262
hasDecorator: boolean;
6363
ngOnDestroyDefinition?: es.MethodDefinition;
6464
subscribeCallExpressions: es.CallExpression[];
@@ -70,7 +70,7 @@ const rule = ruleCreator({
7070
function checkEntry(record: Entry) {
7171
const {
7272
classDeclaration,
73-
classProperties,
73+
propertyDefinitions,
7474
ngOnDestroyDefinition,
7575
subscribeCallExpressions,
7676
subscriptions,
@@ -106,10 +106,11 @@ const rule = ruleCreator({
106106
}
107107

108108
subscriptions.forEach((subscription) => {
109-
const classProperty = classProperties.find(
110-
(classProperty: any) => classProperty.key.name === subscription
109+
const propertyDefinition = propertyDefinitions.find(
110+
(propertyDefinition: any) =>
111+
propertyDefinition.key.name === subscription
111112
);
112-
if (!classProperty) {
113+
if (!propertyDefinition) {
113114
context.report({
114115
data: { name: subscription },
115116
messageId: "notDeclared",
@@ -128,7 +129,7 @@ const rule = ruleCreator({
128129
context.report({
129130
data: { name: subscription },
130131
messageId: "notUnsubscribed",
131-
node: classProperty.key,
132+
node: propertyDefinition.key,
132133
});
133134
return;
134135
}
@@ -260,7 +261,7 @@ const rule = ruleCreator({
260261
entries.push({
261262
addCallExpressions: [],
262263
classDeclaration: node,
263-
classProperties: [],
264+
propertyDefinitions: [],
264265
hasDecorator: hasDecorator(node),
265266
subscribeCallExpressions: [],
266267
subscriptions: new Set<string>(),
@@ -273,10 +274,10 @@ const rule = ruleCreator({
273274
checkEntry(entry);
274275
}
275276
},
276-
ClassProperty: (node: es.ClassProperty) => {
277+
PropertyDefinition: (node: es.PropertyDefinition) => {
277278
const entry = getEntry();
278279
if (entry && entry.hasDecorator) {
279-
entry.classProperties.push(node);
280+
entry.propertyDefinitions.push(node);
280281
}
281282
},
282283
"MethodDefinition[key.name='ngOnDestroy'][kind='method']": (
@@ -287,14 +288,13 @@ const rule = ruleCreator({
287288
entry.ngOnDestroyDefinition = node;
288289
}
289290
},
290-
"MethodDefinition[key.name='ngOnDestroy'][kind='method'] CallExpression[callee.property.name='unsubscribe']": (
291-
node: es.CallExpression
292-
) => {
293-
const entry = getEntry();
294-
if (entry && entry.hasDecorator) {
295-
entry.unsubscribeCallExpressions.push(node);
296-
}
297-
},
291+
"MethodDefinition[key.name='ngOnDestroy'][kind='method'] CallExpression[callee.property.name='unsubscribe']":
292+
(node: es.CallExpression) => {
293+
const entry = getEntry();
294+
if (entry && entry.hasDecorator) {
295+
entry.unsubscribeCallExpressions.push(node);
296+
}
297+
},
298298
};
299299
},
300300
});

source/rules/prefer-takeuntil.ts

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ const rule = ruleCreator({
3737
defaultOptions,
3838
meta: {
3939
docs: {
40-
category: "Best Practices",
4140
description:
4241
"Forbids `subscribe` calls without an accompanying `takeUntil` within Angular components (and, optionally, within services, directives, and pipes).",
4342
recommended: false,
4443
},
4544
fixable: undefined,
45+
hasSuggestions: false,
4646
messages,
4747
schema: [
4848
{
@@ -82,7 +82,7 @@ const rule = ruleCreator({
8282

8383
type Entry = {
8484
classDeclaration: es.ClassDeclaration;
85-
classProperties: es.Node[];
85+
propertyDefinitions: es.PropertyDefinition[];
8686
completeCallExpressions: es.CallExpression[];
8787
hasDecorator: boolean;
8888
nextCallExpressions: es.CallExpression[];
@@ -240,11 +240,11 @@ const rule = ruleCreator({
240240
}
241241

242242
function checkSubjectProperty(name: string, entry: Entry) {
243-
const { classProperties } = entry;
244-
const classProperty = classProperties.find(
245-
(classProperty: any) => classProperty.key.name === name
243+
const { propertyDefinitions } = entry;
244+
const propertyDefinition = propertyDefinitions.find(
245+
(propertyDefinition: any) => propertyDefinition.key.name === name
246246
);
247-
return Boolean(classProperty);
247+
return Boolean(propertyDefinition);
248248
}
249249

250250
function checkSubscribe(callExpression: es.CallExpression, entry: Entry) {
@@ -321,7 +321,7 @@ const rule = ruleCreator({
321321
ClassDeclaration: (node: es.ClassDeclaration) => {
322322
entries.push({
323323
classDeclaration: node,
324-
classProperties: [],
324+
propertyDefinitions: [],
325325
completeCallExpressions: [],
326326
nextCallExpressions: [],
327327
hasDecorator: hasDecorator(node),
@@ -338,10 +338,10 @@ const rule = ruleCreator({
338338
checkEntry(entry);
339339
}
340340
},
341-
ClassProperty: (node: es.Node) => {
341+
PropertyDefinition: (node: es.PropertyDefinition) => {
342342
const entry = getEntry();
343343
if (entry && entry.hasDecorator) {
344-
entry.classProperties.push(node);
344+
entry.propertyDefinitions.push(node);
345345
}
346346
},
347347
"MethodDefinition[key.name='ngOnDestroy'][kind='method']": (
@@ -352,22 +352,20 @@ const rule = ruleCreator({
352352
entry.ngOnDestroyDefinition = node;
353353
}
354354
},
355-
"MethodDefinition[key.name='ngOnDestroy'][kind='method'] CallExpression[callee.property.name='next']": (
356-
node: es.CallExpression
357-
) => {
358-
const entry = getEntry();
359-
if (entry && entry.hasDecorator) {
360-
entry.nextCallExpressions.push(node);
361-
}
362-
},
363-
"MethodDefinition[key.name='ngOnDestroy'][kind='method'] CallExpression[callee.property.name='complete']": (
364-
node: es.CallExpression
365-
) => {
366-
const entry = getEntry();
367-
if (entry && entry.hasDecorator) {
368-
entry.completeCallExpressions.push(node);
369-
}
370-
},
355+
"MethodDefinition[key.name='ngOnDestroy'][kind='method'] CallExpression[callee.property.name='next']":
356+
(node: es.CallExpression) => {
357+
const entry = getEntry();
358+
if (entry && entry.hasDecorator) {
359+
entry.nextCallExpressions.push(node);
360+
}
361+
},
362+
"MethodDefinition[key.name='ngOnDestroy'][kind='method'] CallExpression[callee.property.name='complete']":
363+
(node: es.CallExpression) => {
364+
const entry = getEntry();
365+
if (entry && entry.hasDecorator) {
366+
entry.completeCallExpressions.push(node);
367+
}
368+
},
371369
};
372370
},
373371
});

0 commit comments

Comments
 (0)