eslint-plugin-rxjs-x 0.8.4 → 0.9.0
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/LICENSE +1 -1
- package/README.md +62 -51
- package/dist/index.d.mts +31 -2
- package/dist/index.d.ts +31 -2
- package/dist/index.js +146 -89
- package/dist/index.mjs +176 -119
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
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.
|
|
3
|
+
var version = "0.9.0";
|
|
4
4
|
|
|
5
5
|
// src/configs/recommended.ts
|
|
6
6
|
var createRecommendedConfig = (plugin2) => ({
|
|
7
|
+
...baseConfig,
|
|
7
8
|
name: "rxjs-x/recommended",
|
|
8
9
|
plugins: {
|
|
9
10
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- "A type annotation is necessary."
|
|
10
11
|
"rxjs-x": plugin2
|
|
11
|
-
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
var createLegacyRecommendedConfig = () => ({
|
|
15
|
+
...baseConfig,
|
|
16
|
+
plugins: ["rxjs-x"]
|
|
17
|
+
});
|
|
18
|
+
var baseConfig = {
|
|
12
19
|
rules: {
|
|
13
20
|
"rxjs-x/no-async-subscribe": "error",
|
|
14
21
|
"rxjs-x/no-create": "error",
|
|
@@ -31,7 +38,7 @@ var createRecommendedConfig = (plugin2) => ({
|
|
|
31
38
|
"rxjs-x/prefer-root-operators": "error",
|
|
32
39
|
"rxjs-x/throw-error": "error"
|
|
33
40
|
}
|
|
34
|
-
}
|
|
41
|
+
};
|
|
35
42
|
|
|
36
43
|
// src/configs/strict.ts
|
|
37
44
|
var createStrictConfig = (plugin2) => ({
|
|
@@ -104,7 +111,7 @@ function escapeRegExp(text) {
|
|
|
104
111
|
var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);
|
|
105
112
|
|
|
106
113
|
// src/etc/could-be-type.ts
|
|
107
|
-
var _tsapiutils = require('ts-api-utils'); var tsutils = _interopRequireWildcard(_tsapiutils); var tsutils2 = _interopRequireWildcard(_tsapiutils); var tsutils3 = _interopRequireWildcard(_tsapiutils); var tsutils4 = _interopRequireWildcard(_tsapiutils);
|
|
114
|
+
var _tsapiutils = require('ts-api-utils'); var tsutils = _interopRequireWildcard(_tsapiutils); var tsutils2 = _interopRequireWildcard(_tsapiutils); var tsutils3 = _interopRequireWildcard(_tsapiutils); var tsutils4 = _interopRequireWildcard(_tsapiutils); var tsutils5 = _interopRequireWildcard(_tsapiutils); var tsutils6 = _interopRequireWildcard(_tsapiutils);
|
|
108
115
|
|
|
109
116
|
function couldBeType(type, name2, qualified) {
|
|
110
117
|
if (tsutils.isTypeReference(type)) {
|
|
@@ -301,7 +308,7 @@ function isUnionType(node) {
|
|
|
301
308
|
// src/etc/get-type-services.ts
|
|
302
309
|
function getTypeServices(context) {
|
|
303
310
|
const services = _utils.ESLintUtils.getParserServices(context);
|
|
304
|
-
const {
|
|
311
|
+
const { program, getTypeAtLocation } = services;
|
|
305
312
|
const typeChecker = program.getTypeChecker();
|
|
306
313
|
const couldBeType2 = (node, name2, qualified) => {
|
|
307
314
|
const type = getTypeAtLocation(node);
|
|
@@ -312,30 +319,18 @@ function getTypeServices(context) {
|
|
|
312
319
|
);
|
|
313
320
|
};
|
|
314
321
|
const couldReturnType = (node, name2, qualified) => {
|
|
315
|
-
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
if (
|
|
319
|
-
|
|
320
|
-
} else if (tsNode.body && _typescript2.default.isBlock(tsNode.body)) {
|
|
321
|
-
const returnStatement = tsNode.body.statements.find(_typescript2.default.isReturnStatement);
|
|
322
|
-
if (returnStatement == null ? void 0 : returnStatement.expression) {
|
|
323
|
-
tsTypeNode = returnStatement.expression;
|
|
324
|
-
}
|
|
325
|
-
} else {
|
|
326
|
-
tsTypeNode = tsNode.body;
|
|
327
|
-
}
|
|
328
|
-
} else if (_typescript2.default.isCallSignatureDeclaration(tsNode) || _typescript2.default.isMethodSignature(tsNode)) {
|
|
329
|
-
tsTypeNode = tsNode.type;
|
|
330
|
-
} else if (_typescript2.default.isPropertySignature(tsNode)) {
|
|
331
|
-
}
|
|
332
|
-
return Boolean(
|
|
333
|
-
tsTypeNode && couldBeType(
|
|
334
|
-
typeChecker.getTypeAtLocation(tsTypeNode),
|
|
322
|
+
const type = getTypeAtLocation(node);
|
|
323
|
+
for (const signature of tsutils2.getCallSignaturesOfType(type)) {
|
|
324
|
+
const returnType = signature.getReturnType();
|
|
325
|
+
if (couldBeType(
|
|
326
|
+
returnType,
|
|
335
327
|
name2,
|
|
336
328
|
qualified ? { ...qualified, typeChecker } : void 0
|
|
337
|
-
)
|
|
338
|
-
|
|
329
|
+
)) {
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return false;
|
|
339
334
|
};
|
|
340
335
|
return {
|
|
341
336
|
couldBeBehaviorSubject: (node) => couldBeType2(node, "BehaviorSubject"),
|
|
@@ -682,21 +677,30 @@ var finnishRule = ruleCreator({
|
|
|
682
677
|
});
|
|
683
678
|
} : () => {
|
|
684
679
|
};
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
680
|
+
const nameWithoutDollar = text.endsWith("$") ? text.slice(0, -1) : text;
|
|
681
|
+
for (const name2 of names) {
|
|
682
|
+
const { regExp, validate: validate2 } = name2;
|
|
683
|
+
if (regExp.test(text) || regExp.test(nameWithoutDollar)) {
|
|
684
|
+
if (validate2) {
|
|
685
|
+
shouldBeFinnish();
|
|
686
|
+
} else {
|
|
689
687
|
shouldNotBeFinnish();
|
|
690
|
-
return;
|
|
691
688
|
}
|
|
689
|
+
return;
|
|
692
690
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
691
|
+
}
|
|
692
|
+
for (const type of types) {
|
|
693
|
+
const { regExp, validate: validate2 } = type;
|
|
694
|
+
if (couldBeType2(typeNode != null ? typeNode : nameNode, regExp) || couldReturnType(typeNode != null ? typeNode : nameNode, regExp)) {
|
|
695
|
+
if (validate2) {
|
|
696
|
+
shouldBeFinnish();
|
|
697
|
+
} else {
|
|
696
698
|
shouldNotBeFinnish();
|
|
697
|
-
return;
|
|
698
699
|
}
|
|
700
|
+
return;
|
|
699
701
|
}
|
|
702
|
+
}
|
|
703
|
+
if (couldBeObservable(typeNode != null ? typeNode : nameNode) || couldReturnObservable(typeNode != null ? typeNode : nameNode)) {
|
|
700
704
|
shouldBeFinnish();
|
|
701
705
|
} else {
|
|
702
706
|
shouldNotBeFinnish();
|
|
@@ -1203,11 +1207,14 @@ var noCyclicActionRule = ruleCreator({
|
|
|
1203
1207
|
});
|
|
1204
1208
|
|
|
1205
1209
|
// src/rules/no-explicit-generics.ts
|
|
1210
|
+
|
|
1211
|
+
|
|
1206
1212
|
var noExplicitGenericsRule = ruleCreator({
|
|
1207
1213
|
defaultOptions: [],
|
|
1208
1214
|
meta: {
|
|
1209
1215
|
docs: {
|
|
1210
|
-
description: "Disallow unnecessary explicit generic type arguments."
|
|
1216
|
+
description: "Disallow unnecessary explicit generic type arguments.",
|
|
1217
|
+
requiresTypeChecking: true
|
|
1211
1218
|
},
|
|
1212
1219
|
messages: {
|
|
1213
1220
|
forbidden: "Explicit generic type arguments are forbidden."
|
|
@@ -1223,6 +1230,17 @@ var noExplicitGenericsRule = ruleCreator({
|
|
|
1223
1230
|
node
|
|
1224
1231
|
});
|
|
1225
1232
|
}
|
|
1233
|
+
function isUnion(node) {
|
|
1234
|
+
if (!node) {
|
|
1235
|
+
return false;
|
|
1236
|
+
}
|
|
1237
|
+
if (isUnionType(node)) {
|
|
1238
|
+
return true;
|
|
1239
|
+
}
|
|
1240
|
+
const { getTypeAtLocation } = _utils.ESLintUtils.getParserServices(context);
|
|
1241
|
+
const type = getTypeAtLocation(node);
|
|
1242
|
+
return tsutils3.isUnionOrIntersectionType(type);
|
|
1243
|
+
}
|
|
1226
1244
|
function checkBehaviorSubjects(node) {
|
|
1227
1245
|
var _a;
|
|
1228
1246
|
const parent = node.parent;
|
|
@@ -1230,7 +1248,7 @@ var noExplicitGenericsRule = ruleCreator({
|
|
|
1230
1248
|
arguments: [value]
|
|
1231
1249
|
} = parent;
|
|
1232
1250
|
const typeArgs = (_a = parent.typeArguments) == null ? void 0 : _a.params[0];
|
|
1233
|
-
if (isArrayExpression(value) || isObjectExpression(value) ||
|
|
1251
|
+
if (isArrayExpression(value) || isObjectExpression(value) || isUnion(typeArgs)) {
|
|
1234
1252
|
return;
|
|
1235
1253
|
}
|
|
1236
1254
|
report(node);
|
|
@@ -1242,7 +1260,7 @@ var noExplicitGenericsRule = ruleCreator({
|
|
|
1242
1260
|
arguments: [, value]
|
|
1243
1261
|
} = parent;
|
|
1244
1262
|
const typeArgs = (_a = parent.typeArguments) == null ? void 0 : _a.params[0];
|
|
1245
|
-
if (isArrayExpression(value) || isObjectExpression(value) ||
|
|
1263
|
+
if (isArrayExpression(value) || isObjectExpression(value) || isUnion(typeArgs)) {
|
|
1246
1264
|
return;
|
|
1247
1265
|
}
|
|
1248
1266
|
report(node);
|
|
@@ -1779,6 +1797,37 @@ var noIgnoredNotifierRule = ruleCreator({
|
|
|
1779
1797
|
}
|
|
1780
1798
|
});
|
|
1781
1799
|
|
|
1800
|
+
// src/rules/no-ignored-observable.ts
|
|
1801
|
+
var noIgnoredObservableRule = ruleCreator({
|
|
1802
|
+
defaultOptions: [],
|
|
1803
|
+
meta: {
|
|
1804
|
+
deprecated: true,
|
|
1805
|
+
docs: {
|
|
1806
|
+
description: "Disallow ignoring of observables returned by functions."
|
|
1807
|
+
},
|
|
1808
|
+
messages: {
|
|
1809
|
+
forbidden: "Ignoring a returned Observable is forbidden."
|
|
1810
|
+
},
|
|
1811
|
+
replacedBy: ["no-floating-observables"],
|
|
1812
|
+
schema: [],
|
|
1813
|
+
type: "problem"
|
|
1814
|
+
},
|
|
1815
|
+
name: "no-ignored-observable",
|
|
1816
|
+
create: (context) => {
|
|
1817
|
+
const { couldBeObservable } = getTypeServices(context);
|
|
1818
|
+
return {
|
|
1819
|
+
"ExpressionStatement > CallExpression": (node) => {
|
|
1820
|
+
if (couldBeObservable(node)) {
|
|
1821
|
+
context.report({
|
|
1822
|
+
messageId: "forbidden",
|
|
1823
|
+
node
|
|
1824
|
+
});
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
};
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1830
|
+
|
|
1782
1831
|
// src/rules/no-ignored-replay-buffer.ts
|
|
1783
1832
|
var noIgnoredReplayBufferRule = ruleCreator({
|
|
1784
1833
|
defaultOptions: [],
|
|
@@ -2023,10 +2072,11 @@ var noImplicitAnyCatchRule = ruleCreator({
|
|
|
2023
2072
|
fixable: "code",
|
|
2024
2073
|
hasSuggestions: true,
|
|
2025
2074
|
messages: {
|
|
2026
|
-
explicitAny: "Explicit `any` in
|
|
2027
|
-
implicitAny: "Implicit `any` in
|
|
2075
|
+
explicitAny: "Explicit `any` in error callback.",
|
|
2076
|
+
implicitAny: "Implicit `any` in error callback.",
|
|
2028
2077
|
narrowed: "Error type must be `unknown` or `any`.",
|
|
2029
|
-
suggestExplicitUnknown: "Use `unknown` instead
|
|
2078
|
+
suggestExplicitUnknown: "Use `unknown` instead to explicitly and safely assert the type is correct.",
|
|
2079
|
+
suggestExplicitAny: "Use `any` instead to explicitly opt out of type safety."
|
|
2030
2080
|
},
|
|
2031
2081
|
schema: [
|
|
2032
2082
|
{
|
|
@@ -2049,6 +2099,22 @@ var noImplicitAnyCatchRule = ruleCreator({
|
|
|
2049
2099
|
const { allowExplicitAny = true } = config;
|
|
2050
2100
|
const { couldBeObservable } = getTypeServices(context);
|
|
2051
2101
|
const sourceCode = context.sourceCode;
|
|
2102
|
+
function createReplacerFix(typeAnnotation, replaceWith) {
|
|
2103
|
+
return function fix(fixer) {
|
|
2104
|
+
return fixer.replaceText(typeAnnotation, `: ${replaceWith}`);
|
|
2105
|
+
};
|
|
2106
|
+
}
|
|
2107
|
+
function createInserterFix(param, annotateWith, { hasRestParams = false } = {}) {
|
|
2108
|
+
return function fix(fixer) {
|
|
2109
|
+
if (hasRestParams || isParenthesised(sourceCode, param)) {
|
|
2110
|
+
return fixer.insertTextAfter(param, `: ${annotateWith}`);
|
|
2111
|
+
}
|
|
2112
|
+
return [
|
|
2113
|
+
fixer.insertTextBefore(param, "("),
|
|
2114
|
+
fixer.insertTextAfter(param, `: ${annotateWith})`)
|
|
2115
|
+
];
|
|
2116
|
+
};
|
|
2117
|
+
}
|
|
2052
2118
|
function checkCallback(callback) {
|
|
2053
2119
|
if (isArrowFunctionExpression(callback) || isFunctionExpression(callback)) {
|
|
2054
2120
|
const [param, ...restParams] = callback.params;
|
|
@@ -2061,61 +2127,51 @@ var noImplicitAnyCatchRule = ruleCreator({
|
|
|
2061
2127
|
typeAnnotation: { type }
|
|
2062
2128
|
} = typeAnnotation;
|
|
2063
2129
|
if (type === _utils.AST_NODE_TYPES.TSAnyKeyword) {
|
|
2064
|
-
let fix2 = function(fixer) {
|
|
2065
|
-
return fixer.replaceText(typeAnnotation, ": unknown");
|
|
2066
|
-
};
|
|
2067
|
-
var fix = fix2;
|
|
2068
2130
|
if (allowExplicitAny) {
|
|
2069
2131
|
return;
|
|
2070
2132
|
}
|
|
2071
2133
|
context.report({
|
|
2072
|
-
fix: fix2,
|
|
2073
2134
|
messageId: "explicitAny",
|
|
2074
2135
|
node: param,
|
|
2075
2136
|
suggest: [
|
|
2076
2137
|
{
|
|
2077
2138
|
messageId: "suggestExplicitUnknown",
|
|
2078
|
-
fix:
|
|
2139
|
+
fix: createReplacerFix(typeAnnotation, "unknown")
|
|
2079
2140
|
}
|
|
2080
2141
|
]
|
|
2081
2142
|
});
|
|
2082
2143
|
} else if (type !== _utils.AST_NODE_TYPES.TSUnknownKeyword) {
|
|
2083
|
-
let fix2 = function(fixer) {
|
|
2084
|
-
return fixer.replaceText(typeAnnotation, ": unknown");
|
|
2085
|
-
};
|
|
2086
|
-
var fix = fix2;
|
|
2087
2144
|
context.report({
|
|
2088
2145
|
messageId: "narrowed",
|
|
2089
2146
|
node: param,
|
|
2090
2147
|
suggest: [
|
|
2091
2148
|
{
|
|
2092
2149
|
messageId: "suggestExplicitUnknown",
|
|
2093
|
-
fix:
|
|
2094
|
-
}
|
|
2095
|
-
|
|
2150
|
+
fix: createReplacerFix(typeAnnotation, "unknown")
|
|
2151
|
+
},
|
|
2152
|
+
allowExplicitAny ? {
|
|
2153
|
+
messageId: "suggestExplicitAny",
|
|
2154
|
+
fix: createReplacerFix(typeAnnotation, "any")
|
|
2155
|
+
} : null
|
|
2156
|
+
].filter((x) => !!x)
|
|
2096
2157
|
});
|
|
2097
2158
|
}
|
|
2098
2159
|
} else {
|
|
2099
|
-
|
|
2100
|
-
if (isParenthesised(sourceCode, param) || restParams.length > 0) {
|
|
2101
|
-
return fixer.insertTextAfter(param, ": unknown");
|
|
2102
|
-
}
|
|
2103
|
-
return [
|
|
2104
|
-
fixer.insertTextBefore(param, "("),
|
|
2105
|
-
fixer.insertTextAfter(param, ": unknown)")
|
|
2106
|
-
];
|
|
2107
|
-
};
|
|
2108
|
-
var fix = fix2;
|
|
2160
|
+
const hasRestParams = restParams.length > 0;
|
|
2109
2161
|
context.report({
|
|
2110
|
-
fix:
|
|
2162
|
+
fix: allowExplicitAny ? createInserterFix(param, "any", { hasRestParams }) : void 0,
|
|
2111
2163
|
messageId: "implicitAny",
|
|
2112
2164
|
node: param,
|
|
2113
2165
|
suggest: [
|
|
2114
2166
|
{
|
|
2115
2167
|
messageId: "suggestExplicitUnknown",
|
|
2116
|
-
fix:
|
|
2117
|
-
}
|
|
2118
|
-
|
|
2168
|
+
fix: createInserterFix(param, "unknown", { hasRestParams })
|
|
2169
|
+
},
|
|
2170
|
+
allowExplicitAny ? {
|
|
2171
|
+
messageId: "suggestExplicitAny",
|
|
2172
|
+
fix: createInserterFix(param, "any", { hasRestParams })
|
|
2173
|
+
} : null
|
|
2174
|
+
].filter((x) => !!x)
|
|
2119
2175
|
});
|
|
2120
2176
|
}
|
|
2121
2177
|
}
|
|
@@ -2552,7 +2608,7 @@ function voidFunctionArguments(checker, tsNode) {
|
|
|
2552
2608
|
}
|
|
2553
2609
|
const voidReturnIndices = /* @__PURE__ */ new Set();
|
|
2554
2610
|
const type = checker.getTypeAtLocation(tsNode.expression);
|
|
2555
|
-
for (const subType of
|
|
2611
|
+
for (const subType of tsutils4.unionConstituents(type)) {
|
|
2556
2612
|
const signatures = _typescript2.default.isCallExpression(tsNode) ? subType.getCallSignatures() : subType.getConstructSignatures();
|
|
2557
2613
|
for (const signature of signatures) {
|
|
2558
2614
|
for (const [index, parameter] of signature.parameters.entries()) {
|
|
@@ -2567,13 +2623,13 @@ function voidFunctionArguments(checker, tsNode) {
|
|
|
2567
2623
|
}
|
|
2568
2624
|
function isVoidReturningFunctionType(type) {
|
|
2569
2625
|
let hasVoidReturn = false;
|
|
2570
|
-
for (const subType of
|
|
2626
|
+
for (const subType of tsutils4.unionConstituents(type)) {
|
|
2571
2627
|
for (const signature of subType.getCallSignatures()) {
|
|
2572
2628
|
const returnType = signature.getReturnType();
|
|
2573
2629
|
if (couldBeType(returnType, "Observable")) {
|
|
2574
2630
|
return false;
|
|
2575
2631
|
}
|
|
2576
|
-
hasVoidReturn || (hasVoidReturn =
|
|
2632
|
+
hasVoidReturn || (hasVoidReturn = tsutils4.isTypeFlagSet(returnType, _typescript2.default.TypeFlags.Void));
|
|
2577
2633
|
}
|
|
2578
2634
|
}
|
|
2579
2635
|
return hasVoidReturn;
|
|
@@ -2586,7 +2642,7 @@ function getMemberIfExists(type, memberName) {
|
|
|
2586
2642
|
var _a, _b;
|
|
2587
2643
|
const escapedMemberName = _typescript2.default.escapeLeadingUnderscores(memberName);
|
|
2588
2644
|
const symbolMemberMatch = (_b = (_a = type.getSymbol()) == null ? void 0 : _a.members) == null ? void 0 : _b.get(escapedMemberName);
|
|
2589
|
-
return symbolMemberMatch != null ? symbolMemberMatch :
|
|
2645
|
+
return symbolMemberMatch != null ? symbolMemberMatch : tsutils4.getPropertyOfType(type, escapedMemberName);
|
|
2590
2646
|
}
|
|
2591
2647
|
function isStaticMember(node) {
|
|
2592
2648
|
return (isMethodDefinition(node) || isPropertyDefinition(node) || isAccessorProperty(node)) && node.static;
|
|
@@ -2608,7 +2664,7 @@ function getPropertyContextualType(checker, tsNode) {
|
|
|
2608
2664
|
if (objType == null) {
|
|
2609
2665
|
return;
|
|
2610
2666
|
}
|
|
2611
|
-
const propertySymbol = checker.getPropertyOfType(
|
|
2667
|
+
const propertySymbol = tsutils4.unionConstituents(objType).map((t) => checker.getPropertyOfType(t, tsNode.name.getText())).find((p) => p);
|
|
2612
2668
|
if (propertySymbol == null) {
|
|
2613
2669
|
return;
|
|
2614
2670
|
}
|
|
@@ -3071,8 +3127,6 @@ var noSubscribeInPipeRule = ruleCreator({
|
|
|
3071
3127
|
recommended: "recommended",
|
|
3072
3128
|
requiresTypeChecking: true
|
|
3073
3129
|
},
|
|
3074
|
-
fixable: void 0,
|
|
3075
|
-
hasSuggestions: false,
|
|
3076
3130
|
messages: {
|
|
3077
3131
|
forbidden: "Subscribe calls within pipe operators are forbidden."
|
|
3078
3132
|
},
|
|
@@ -3564,19 +3618,19 @@ var noUnsafeSubjectNext = ruleCreator({
|
|
|
3564
3618
|
[`CallExpression[callee.property.name='next']`]: (node) => {
|
|
3565
3619
|
if (node.arguments.length === 0 && isMemberExpression(node.callee)) {
|
|
3566
3620
|
const type = getTypeAtLocation(node.callee.object);
|
|
3567
|
-
if (
|
|
3621
|
+
if (tsutils5.isTypeReference(type) && couldBeType(type, "Subject")) {
|
|
3568
3622
|
const [typeArg] = typeChecker.getTypeArguments(type);
|
|
3569
|
-
if (
|
|
3623
|
+
if (tsutils5.isTypeFlagSet(typeArg, _typescript2.default.TypeFlags.Any)) {
|
|
3570
3624
|
return;
|
|
3571
3625
|
}
|
|
3572
|
-
if (
|
|
3626
|
+
if (tsutils5.isTypeFlagSet(typeArg, _typescript2.default.TypeFlags.Unknown)) {
|
|
3573
3627
|
return;
|
|
3574
3628
|
}
|
|
3575
|
-
if (
|
|
3629
|
+
if (tsutils5.isTypeFlagSet(typeArg, _typescript2.default.TypeFlags.Void)) {
|
|
3576
3630
|
return;
|
|
3577
3631
|
}
|
|
3578
|
-
if (
|
|
3579
|
-
(t) =>
|
|
3632
|
+
if (tsutils5.isUnionType(typeArg) && typeArg.types.some(
|
|
3633
|
+
(t) => tsutils5.isTypeFlagSet(t, _typescript2.default.TypeFlags.Void)
|
|
3580
3634
|
)) {
|
|
3581
3635
|
return;
|
|
3582
3636
|
}
|
|
@@ -3794,7 +3848,8 @@ var preferObserverRule = ruleCreator({
|
|
|
3794
3848
|
fixable: "code",
|
|
3795
3849
|
hasSuggestions: true,
|
|
3796
3850
|
messages: {
|
|
3797
|
-
forbidden: "Passing separate handlers is forbidden; pass an observer instead."
|
|
3851
|
+
forbidden: "Passing separate handlers is forbidden; pass an observer instead.",
|
|
3852
|
+
suggest: "Replace with observer object."
|
|
3798
3853
|
},
|
|
3799
3854
|
schema: [
|
|
3800
3855
|
{
|
|
@@ -3845,7 +3900,7 @@ var preferObserverRule = ruleCreator({
|
|
|
3845
3900
|
fix,
|
|
3846
3901
|
suggest: [
|
|
3847
3902
|
{
|
|
3848
|
-
messageId: "
|
|
3903
|
+
messageId: "suggest",
|
|
3849
3904
|
fix
|
|
3850
3905
|
}
|
|
3851
3906
|
]
|
|
@@ -3859,7 +3914,7 @@ var preferObserverRule = ruleCreator({
|
|
|
3859
3914
|
fix,
|
|
3860
3915
|
suggest: [
|
|
3861
3916
|
{
|
|
3862
|
-
messageId: "
|
|
3917
|
+
messageId: "suggest",
|
|
3863
3918
|
fix
|
|
3864
3919
|
}
|
|
3865
3920
|
]
|
|
@@ -4262,10 +4317,10 @@ var throwErrorRule = ruleCreator({
|
|
|
4262
4317
|
const body = tsNode.body;
|
|
4263
4318
|
type = program.getTypeChecker().getTypeAtLocation(annotation != null ? annotation : body);
|
|
4264
4319
|
}
|
|
4265
|
-
if (allowThrowingAny &&
|
|
4320
|
+
if (allowThrowingAny && tsutils6.isIntrinsicAnyType(type)) {
|
|
4266
4321
|
return;
|
|
4267
4322
|
}
|
|
4268
|
-
if (allowThrowingUnknown &&
|
|
4323
|
+
if (allowThrowingUnknown && tsutils6.isIntrinsicUnknownType(type)) {
|
|
4269
4324
|
return;
|
|
4270
4325
|
}
|
|
4271
4326
|
if (couldBeType(type, /^Error$/)) {
|
|
@@ -4319,6 +4374,7 @@ var allRules = {
|
|
|
4319
4374
|
"no-ignored-default-value": noIgnoredDefaultValueRule,
|
|
4320
4375
|
"no-ignored-error": noIgnoredErrorRule,
|
|
4321
4376
|
"no-ignored-notifier": noIgnoredNotifierRule,
|
|
4377
|
+
"no-ignored-observable": noIgnoredObservableRule,
|
|
4322
4378
|
"no-ignored-replay-buffer": noIgnoredReplayBufferRule,
|
|
4323
4379
|
"no-ignored-subscribe": noIgnoredSubscribeRule,
|
|
4324
4380
|
"no-ignored-subscription": noIgnoredSubscriptionRule,
|
|
@@ -4362,8 +4418,9 @@ var plugin = {
|
|
|
4362
4418
|
var rxjsX = {
|
|
4363
4419
|
...plugin,
|
|
4364
4420
|
configs: {
|
|
4365
|
-
recommended: createRecommendedConfig(plugin),
|
|
4366
|
-
strict: createStrictConfig(plugin)
|
|
4421
|
+
"recommended": createRecommendedConfig(plugin),
|
|
4422
|
+
"strict": createStrictConfig(plugin),
|
|
4423
|
+
"recommended-legacy": createLegacyRecommendedConfig()
|
|
4367
4424
|
}
|
|
4368
4425
|
};
|
|
4369
4426
|
var index_default = rxjsX;
|