eslint-plugin-rxjs-x 0.2.0 → 0.2.2
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 +6 -1
- package/dist/index.js +19 -19
- package/dist/index.mjs +12 -12
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Almost all of these rules require the TypeScript parser for ESLint and are indic
|
|
|
17
17
|
|
|
18
18
|
See [typescript-eslint's Getting Started](https://typescript-eslint.io/getting-started) for a full ESLint setup guide.
|
|
19
19
|
|
|
20
|
-
Then use the `recommended` configuration in your `eslint.config.mjs
|
|
20
|
+
Then use the `recommended` configuration in your `eslint.config.mjs` and enable typed linting:
|
|
21
21
|
|
|
22
22
|
```js
|
|
23
23
|
// @ts-check
|
|
@@ -26,6 +26,7 @@ import rxjsX from 'eslint-plugin-rxjs-x';
|
|
|
26
26
|
|
|
27
27
|
export default tseslint.config({
|
|
28
28
|
extends: [
|
|
29
|
+
...tseslint.configs.recommended,
|
|
29
30
|
rxjsX.configs.recommended,
|
|
30
31
|
],
|
|
31
32
|
languageOptions: {
|
|
@@ -36,6 +37,10 @@ export default tseslint.config({
|
|
|
36
37
|
});
|
|
37
38
|
```
|
|
38
39
|
|
|
40
|
+
The above example uses `typescript-eslint`'s built-in config to set up the TypeScript parser for us.
|
|
41
|
+
Enabling `projectService` then turns on typed linting.
|
|
42
|
+
See [Linting with Type Information](https://typescript-eslint.io/getting-started/typed-linting/) for details.
|
|
43
|
+
|
|
39
44
|
## Configs
|
|
40
45
|
|
|
41
46
|
<!-- begin auto-generated configs list -->
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// package.json
|
|
2
2
|
var name = "eslint-plugin-rxjs-x";
|
|
3
|
-
var version = "0.2.
|
|
3
|
+
var version = "0.2.2";
|
|
4
4
|
|
|
5
5
|
// src/configs/recommended.ts
|
|
6
6
|
var createRecommendedConfig = (plugin2) => ({
|
|
@@ -187,7 +187,7 @@ var banOperatorsRule = ruleCreator({
|
|
|
187
187
|
|
|
188
188
|
|
|
189
189
|
// src/etc/could-be-function.ts
|
|
190
|
-
var _typescript = require('typescript'); var
|
|
190
|
+
var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);
|
|
191
191
|
|
|
192
192
|
// src/etc/could-be-type.ts
|
|
193
193
|
var _tsapiutils = require('ts-api-utils'); var tsutils = _interopRequireWildcard(_tsapiutils); var tsutils2 = _interopRequireWildcard(_tsapiutils); var tsutils3 = _interopRequireWildcard(_tsapiutils); var tsutils4 = _interopRequireWildcard(_tsapiutils);
|
|
@@ -226,11 +226,11 @@ function couldImplement(type, name2, qualified) {
|
|
|
226
226
|
const { symbol } = type;
|
|
227
227
|
if (symbol) {
|
|
228
228
|
const { valueDeclaration } = symbol;
|
|
229
|
-
if (valueDeclaration &&
|
|
229
|
+
if (valueDeclaration && _typescript2.default.isClassDeclaration(valueDeclaration)) {
|
|
230
230
|
const { heritageClauses } = valueDeclaration;
|
|
231
231
|
if (heritageClauses) {
|
|
232
232
|
const implemented = heritageClauses.some(
|
|
233
|
-
({ token, types }) => token ===
|
|
233
|
+
({ token, types }) => token === _typescript2.default.SyntaxKind.ImplementsKeyword && types.some((node) => isMatchingNode(node, name2, qualified))
|
|
234
234
|
);
|
|
235
235
|
if (implemented) {
|
|
236
236
|
return true;
|
|
@@ -259,7 +259,7 @@ function isMatchingNode(node, name2, qualified) {
|
|
|
259
259
|
|
|
260
260
|
// src/etc/could-be-function.ts
|
|
261
261
|
function couldBeFunction(type) {
|
|
262
|
-
return type.getCallSignatures().length > 0 || couldBeType(type, "Function") || couldBeType(type, "ArrowFunction") || couldBeType(type,
|
|
262
|
+
return type.getCallSignatures().length > 0 || couldBeType(type, "Function") || couldBeType(type, "ArrowFunction") || couldBeType(type, _typescript2.default.InternalSymbolName.Function);
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
// src/etc/find-parent.ts
|
|
@@ -285,8 +285,8 @@ function findParent(node, ...args) {
|
|
|
285
285
|
|
|
286
286
|
function getLoc(node) {
|
|
287
287
|
const sourceFile = node.getSourceFile();
|
|
288
|
-
const start =
|
|
289
|
-
const end =
|
|
288
|
+
const start = _typescript2.default.getLineAndCharacterOfPosition(sourceFile, node.getStart());
|
|
289
|
+
const end = _typescript2.default.getLineAndCharacterOfPosition(sourceFile, node.getEnd());
|
|
290
290
|
return {
|
|
291
291
|
start: {
|
|
292
292
|
line: start.line + 1,
|
|
@@ -369,9 +369,9 @@ function getTypeServices(context) {
|
|
|
369
369
|
var _a;
|
|
370
370
|
let tsTypeNode;
|
|
371
371
|
const tsNode = esTreeNodeToTSNodeMap.get(node);
|
|
372
|
-
if (
|
|
372
|
+
if (_typescript2.default.isArrowFunction(tsNode) || _typescript2.default.isFunctionDeclaration(tsNode) || _typescript2.default.isMethodDeclaration(tsNode) || _typescript2.default.isFunctionExpression(tsNode)) {
|
|
373
373
|
tsTypeNode = (_a = tsNode.type) != null ? _a : tsNode.body;
|
|
374
|
-
} else if (
|
|
374
|
+
} else if (_typescript2.default.isCallSignatureDeclaration(tsNode) || _typescript2.default.isMethodSignature(tsNode)) {
|
|
375
375
|
tsTypeNode = tsNode.type;
|
|
376
376
|
}
|
|
377
377
|
return Boolean(
|
|
@@ -518,7 +518,7 @@ var finnishRule = ruleCreator({
|
|
|
518
518
|
});
|
|
519
519
|
} : () => {
|
|
520
520
|
};
|
|
521
|
-
if (couldBeObservable(typeNode
|
|
521
|
+
if (couldBeObservable(typeNode != null ? typeNode : nameNode) || couldReturnObservable(typeNode != null ? typeNode : nameNode)) {
|
|
522
522
|
for (const name2 of names) {
|
|
523
523
|
const { regExp, validate: validate2 } = name2;
|
|
524
524
|
if (regExp.test(text) && !validate2) {
|
|
@@ -528,7 +528,7 @@ var finnishRule = ruleCreator({
|
|
|
528
528
|
}
|
|
529
529
|
for (const type of types) {
|
|
530
530
|
const { regExp, validate: validate2 } = type;
|
|
531
|
-
if ((couldBeType2(typeNode
|
|
531
|
+
if ((couldBeType2(typeNode != null ? typeNode : nameNode, regExp) || couldReturnType(typeNode != null ? typeNode : nameNode, regExp)) && !validate2) {
|
|
532
532
|
shouldNotBeFinnish();
|
|
533
533
|
return;
|
|
534
534
|
}
|
|
@@ -969,7 +969,7 @@ var noCyclicActionRule = ruleCreator({
|
|
|
969
969
|
const operatorType = getType(operatorCallExpression);
|
|
970
970
|
const [signature] = typeChecker.getSignaturesOfType(
|
|
971
971
|
operatorType,
|
|
972
|
-
|
|
972
|
+
_typescript2.default.SignatureKind.Call
|
|
973
973
|
);
|
|
974
974
|
if (!signature) {
|
|
975
975
|
return;
|
|
@@ -1201,7 +1201,7 @@ var noFinnishRule = ruleCreator({
|
|
|
1201
1201
|
const { esTreeNodeToTSNodeMap } = _utils.ESLintUtils.getParserServices(context);
|
|
1202
1202
|
const { couldBeObservable, couldReturnObservable } = getTypeServices(context);
|
|
1203
1203
|
function checkNode(nameNode, typeNode) {
|
|
1204
|
-
if (couldBeObservable(typeNode
|
|
1204
|
+
if (couldBeObservable(typeNode != null ? typeNode : nameNode) || couldReturnObservable(typeNode != null ? typeNode : nameNode)) {
|
|
1205
1205
|
const tsNode = esTreeNodeToTSNodeMap.get(nameNode);
|
|
1206
1206
|
if (/[$]+$/.test(tsNode.getText())) {
|
|
1207
1207
|
context.report({
|
|
@@ -2424,17 +2424,17 @@ var noUnsafeSubjectNext = ruleCreator({
|
|
|
2424
2424
|
const type = getType(node.callee.object);
|
|
2425
2425
|
if (tsutils3.isTypeReference(type) && couldBeType(type, "Subject")) {
|
|
2426
2426
|
const [typeArg] = typeChecker.getTypeArguments(type);
|
|
2427
|
-
if (tsutils3.isTypeFlagSet(typeArg,
|
|
2427
|
+
if (tsutils3.isTypeFlagSet(typeArg, _typescript2.default.TypeFlags.Any)) {
|
|
2428
2428
|
return;
|
|
2429
2429
|
}
|
|
2430
|
-
if (tsutils3.isTypeFlagSet(typeArg,
|
|
2430
|
+
if (tsutils3.isTypeFlagSet(typeArg, _typescript2.default.TypeFlags.Unknown)) {
|
|
2431
2431
|
return;
|
|
2432
2432
|
}
|
|
2433
|
-
if (tsutils3.isTypeFlagSet(typeArg,
|
|
2433
|
+
if (tsutils3.isTypeFlagSet(typeArg, _typescript2.default.TypeFlags.Void)) {
|
|
2434
2434
|
return;
|
|
2435
2435
|
}
|
|
2436
2436
|
if (tsutils3.isUnionType(typeArg) && typeArg.types.some(
|
|
2437
|
-
(t) => tsutils3.isTypeFlagSet(t,
|
|
2437
|
+
(t) => tsutils3.isTypeFlagSet(t, _typescript2.default.TypeFlags.Void)
|
|
2438
2438
|
)) {
|
|
2439
2439
|
return;
|
|
2440
2440
|
}
|
|
@@ -2838,10 +2838,10 @@ var suffixSubjectsRule = ruleCreator({
|
|
|
2838
2838
|
function checkNode(nameNode, typeNode) {
|
|
2839
2839
|
const tsNode = esTreeNodeToTSNodeMap.get(nameNode);
|
|
2840
2840
|
const text = tsNode.getText();
|
|
2841
|
-
if (!suffixRegex.test(text) && couldBeType2(typeNode
|
|
2841
|
+
if (!suffixRegex.test(text) && couldBeType2(typeNode != null ? typeNode : nameNode, "Subject")) {
|
|
2842
2842
|
for (const type of types) {
|
|
2843
2843
|
const { regExp, validate: validate2 } = type;
|
|
2844
|
-
if (couldBeType2(typeNode
|
|
2844
|
+
if (couldBeType2(typeNode != null ? typeNode : nameNode, regExp) && !validate2) {
|
|
2845
2845
|
return;
|
|
2846
2846
|
}
|
|
2847
2847
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var name = "eslint-plugin-rxjs-x";
|
|
3
|
-
var version = "0.2.
|
|
3
|
+
var version = "0.2.2";
|
|
4
4
|
|
|
5
5
|
// src/configs/recommended.ts
|
|
6
6
|
var createRecommendedConfig = (plugin2) => ({
|
|
@@ -187,11 +187,11 @@ var banOperatorsRule = ruleCreator({
|
|
|
187
187
|
import { AST_NODE_TYPES as AST_NODE_TYPES5, ESLintUtils as ESLintUtils3 } from "@typescript-eslint/utils";
|
|
188
188
|
|
|
189
189
|
// src/etc/could-be-function.ts
|
|
190
|
-
import
|
|
190
|
+
import ts2 from "typescript";
|
|
191
191
|
|
|
192
192
|
// src/etc/could-be-type.ts
|
|
193
193
|
import * as tsutils from "ts-api-utils";
|
|
194
|
-
import
|
|
194
|
+
import ts from "typescript";
|
|
195
195
|
function couldBeType(type, name2, qualified) {
|
|
196
196
|
if (tsutils.isTypeReference(type)) {
|
|
197
197
|
type = type.target;
|
|
@@ -282,7 +282,7 @@ function findParent(node, ...args) {
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
// src/etc/get-loc.ts
|
|
285
|
-
import
|
|
285
|
+
import ts3 from "typescript";
|
|
286
286
|
function getLoc(node) {
|
|
287
287
|
const sourceFile = node.getSourceFile();
|
|
288
288
|
const start = ts3.getLineAndCharacterOfPosition(sourceFile, node.getStart());
|
|
@@ -302,7 +302,7 @@ function getLoc(node) {
|
|
|
302
302
|
// src/etc/get-type-services.ts
|
|
303
303
|
import { ESLintUtils as ESLintUtils2 } from "@typescript-eslint/utils";
|
|
304
304
|
import * as tsutils2 from "ts-api-utils";
|
|
305
|
-
import
|
|
305
|
+
import ts4 from "typescript";
|
|
306
306
|
|
|
307
307
|
// src/etc/is.ts
|
|
308
308
|
import { AST_NODE_TYPES as AST_NODE_TYPES3 } from "@typescript-eslint/utils";
|
|
@@ -518,7 +518,7 @@ var finnishRule = ruleCreator({
|
|
|
518
518
|
});
|
|
519
519
|
} : () => {
|
|
520
520
|
};
|
|
521
|
-
if (couldBeObservable(typeNode
|
|
521
|
+
if (couldBeObservable(typeNode != null ? typeNode : nameNode) || couldReturnObservable(typeNode != null ? typeNode : nameNode)) {
|
|
522
522
|
for (const name2 of names) {
|
|
523
523
|
const { regExp, validate: validate2 } = name2;
|
|
524
524
|
if (regExp.test(text) && !validate2) {
|
|
@@ -528,7 +528,7 @@ var finnishRule = ruleCreator({
|
|
|
528
528
|
}
|
|
529
529
|
for (const type of types) {
|
|
530
530
|
const { regExp, validate: validate2 } = type;
|
|
531
|
-
if ((couldBeType2(typeNode
|
|
531
|
+
if ((couldBeType2(typeNode != null ? typeNode : nameNode, regExp) || couldReturnType(typeNode != null ? typeNode : nameNode, regExp)) && !validate2) {
|
|
532
532
|
shouldNotBeFinnish();
|
|
533
533
|
return;
|
|
534
534
|
}
|
|
@@ -920,7 +920,7 @@ var noCreateRule = ruleCreator({
|
|
|
920
920
|
|
|
921
921
|
// src/rules/no-cyclic-action.ts
|
|
922
922
|
import { stripIndent as stripIndent3 } from "common-tags";
|
|
923
|
-
import
|
|
923
|
+
import ts5 from "typescript";
|
|
924
924
|
|
|
925
925
|
// src/constants.ts
|
|
926
926
|
var defaultObservable = String.raw`[Aa]ction(s|s\$|\$)$`;
|
|
@@ -1201,7 +1201,7 @@ var noFinnishRule = ruleCreator({
|
|
|
1201
1201
|
const { esTreeNodeToTSNodeMap } = ESLintUtils4.getParserServices(context);
|
|
1202
1202
|
const { couldBeObservable, couldReturnObservable } = getTypeServices(context);
|
|
1203
1203
|
function checkNode(nameNode, typeNode) {
|
|
1204
|
-
if (couldBeObservable(typeNode
|
|
1204
|
+
if (couldBeObservable(typeNode != null ? typeNode : nameNode) || couldReturnObservable(typeNode != null ? typeNode : nameNode)) {
|
|
1205
1205
|
const tsNode = esTreeNodeToTSNodeMap.get(nameNode);
|
|
1206
1206
|
if (/[$]+$/.test(tsNode.getText())) {
|
|
1207
1207
|
context.report({
|
|
@@ -2400,7 +2400,7 @@ var noUnsafeFirstRule = ruleCreator({
|
|
|
2400
2400
|
|
|
2401
2401
|
// src/rules/no-unsafe-subject-next.ts
|
|
2402
2402
|
import * as tsutils3 from "ts-api-utils";
|
|
2403
|
-
import
|
|
2403
|
+
import ts6 from "typescript";
|
|
2404
2404
|
var noUnsafeSubjectNext = ruleCreator({
|
|
2405
2405
|
defaultOptions: [],
|
|
2406
2406
|
meta: {
|
|
@@ -2838,10 +2838,10 @@ var suffixSubjectsRule = ruleCreator({
|
|
|
2838
2838
|
function checkNode(nameNode, typeNode) {
|
|
2839
2839
|
const tsNode = esTreeNodeToTSNodeMap.get(nameNode);
|
|
2840
2840
|
const text = tsNode.getText();
|
|
2841
|
-
if (!suffixRegex.test(text) && couldBeType2(typeNode
|
|
2841
|
+
if (!suffixRegex.test(text) && couldBeType2(typeNode != null ? typeNode : nameNode, "Subject")) {
|
|
2842
2842
|
for (const type of types) {
|
|
2843
2843
|
const { regExp, validate: validate2 } = type;
|
|
2844
|
-
if (couldBeType2(typeNode
|
|
2844
|
+
if (couldBeType2(typeNode != null ? typeNode : nameNode, regExp) && !validate2) {
|
|
2845
2845
|
return;
|
|
2846
2846
|
}
|
|
2847
2847
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-rxjs-x",
|
|
3
3
|
"type": "commonjs",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"packageManager": "yarn@4.5.1+sha512.341db9396b6e289fecc30cd7ab3af65060e05ebff4b3b47547b278b9e67b08f485ecd8c79006b405446262142c7a38154445ef7f17c1d5d1de7d90bf9ce7054d",
|
|
6
6
|
"description": "ESLint v9+ plugin for RxJS",
|
|
7
7
|
"author": "Jason Weinzierl <weinzierljason@gmail.com>",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"typecheck": "tsc --noEmit"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
57
|
-
"@typescript-eslint/utils": "^8.
|
|
56
|
+
"@typescript-eslint/scope-manager": "^8.1.0",
|
|
57
|
+
"@typescript-eslint/utils": "^8.1.0",
|
|
58
58
|
"common-tags": "^1.8.0",
|
|
59
59
|
"decamelize": "^5.0.1",
|
|
60
60
|
"ts-api-utils": "^1.3.0",
|
|
@@ -63,31 +63,31 @@
|
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"eslint": "^8.57.0 || ^9.0.0",
|
|
65
65
|
"rxjs": ">=7.0.0",
|
|
66
|
-
"typescript": ">=4.
|
|
66
|
+
"typescript": ">=4.7.4"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@eslint/js": "^9.
|
|
69
|
+
"@eslint/js": "^9.14.0",
|
|
70
70
|
"@stylistic/eslint-plugin": "^2.10.1",
|
|
71
71
|
"@types/common-tags": "^1.8.4",
|
|
72
72
|
"@types/node": "^18.18.0",
|
|
73
|
-
"@typescript-eslint/rule-tester": "^8.
|
|
73
|
+
"@typescript-eslint/rule-tester": "^8.13.0",
|
|
74
74
|
"@typescript/vfs": "^1.6.0",
|
|
75
75
|
"@vitest/coverage-v8": "^2.1.4",
|
|
76
76
|
"@vitest/eslint-plugin": "^1.1.7",
|
|
77
77
|
"bumpp": "^9.8.0",
|
|
78
|
-
"eslint": "^9.
|
|
78
|
+
"eslint": "^9.14.0",
|
|
79
79
|
"eslint-config-flat-gitignore": "^0.3.0",
|
|
80
80
|
"eslint-doc-generator": "^1.7.1",
|
|
81
81
|
"eslint-import-resolver-typescript": "^3.6.3",
|
|
82
82
|
"eslint-plugin-eslint-plugin": "^6.3.1",
|
|
83
83
|
"eslint-plugin-import-x": "^4.4.0",
|
|
84
|
-
"eslint-plugin-n": "^17.
|
|
84
|
+
"eslint-plugin-n": "^17.13.1",
|
|
85
85
|
"markdownlint-cli2": "^0.14.0",
|
|
86
86
|
"rxjs": "^7.0.0",
|
|
87
87
|
"tsup": "^8.3.5",
|
|
88
88
|
"tsx": "^4.19.2",
|
|
89
89
|
"typescript": "~5.6.3",
|
|
90
|
-
"typescript-eslint": "^8.
|
|
90
|
+
"typescript-eslint": "^8.13.0",
|
|
91
91
|
"vitest": "^2.1.4"
|
|
92
92
|
},
|
|
93
93
|
"engines": {
|