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/dist/index.mjs CHANGED
@@ -1,14 +1,21 @@
1
1
  // package.json
2
2
  var name = "eslint-plugin-rxjs-x";
3
- var version = "0.8.4";
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) => ({
@@ -215,7 +222,7 @@ function getLoc(node) {
215
222
 
216
223
  // src/etc/get-type-services.ts
217
224
  import { ESLintUtils } from "@typescript-eslint/utils";
218
- import ts4 from "typescript";
225
+ import * as tsutils2 from "ts-api-utils";
219
226
 
220
227
  // src/etc/is.ts
221
228
  import { AST_NODE_TYPES } from "@typescript-eslint/utils";
@@ -301,7 +308,7 @@ function isUnionType(node) {
301
308
  // src/etc/get-type-services.ts
302
309
  function getTypeServices(context) {
303
310
  const services = ESLintUtils.getParserServices(context);
304
- const { esTreeNodeToTSNodeMap, program, getTypeAtLocation } = services;
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
- let tsTypeNode;
316
- const tsNode = esTreeNodeToTSNodeMap.get(node);
317
- if (ts4.isArrowFunction(tsNode) || ts4.isFunctionDeclaration(tsNode) || ts4.isMethodDeclaration(tsNode) || ts4.isFunctionExpression(tsNode)) {
318
- if (tsNode.type) {
319
- tsTypeNode = tsNode.type;
320
- } else if (tsNode.body && ts4.isBlock(tsNode.body)) {
321
- const returnStatement = tsNode.body.statements.find(ts4.isReturnStatement);
322
- if (returnStatement == null ? void 0 : returnStatement.expression) {
323
- tsTypeNode = returnStatement.expression;
324
- }
325
- } else {
326
- tsTypeNode = tsNode.body;
327
- }
328
- } else if (ts4.isCallSignatureDeclaration(tsNode) || ts4.isMethodSignature(tsNode)) {
329
- tsTypeNode = tsNode.type;
330
- } else if (ts4.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
- if (couldBeObservable(typeNode != null ? typeNode : nameNode) || couldReturnObservable(typeNode != null ? typeNode : nameNode)) {
686
- for (const name2 of names) {
687
- const { regExp, validate: validate2 } = name2;
688
- if (regExp.test(text) && !validate2) {
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
- for (const type of types) {
694
- const { regExp, validate: validate2 } = type;
695
- if ((couldBeType2(typeNode != null ? typeNode : nameNode, regExp) || couldReturnType(typeNode != null ? typeNode : nameNode, regExp)) && !validate2) {
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();
@@ -1099,7 +1103,7 @@ var noCreateRule = ruleCreator({
1099
1103
  // src/rules/no-cyclic-action.ts
1100
1104
  import { ESLintUtils as ESLintUtils4 } from "@typescript-eslint/utils";
1101
1105
  import { stripIndent as stripIndent3 } from "common-tags";
1102
- import ts5 from "typescript";
1106
+ import ts4 from "typescript";
1103
1107
  function isTypeReference2(type) {
1104
1108
  return Boolean(type.target);
1105
1109
  }
@@ -1144,7 +1148,7 @@ var noCyclicActionRule = ruleCreator({
1144
1148
  const operatorType = getTypeAtLocation(operatorCallExpression);
1145
1149
  const [signature] = typeChecker.getSignaturesOfType(
1146
1150
  operatorType,
1147
- ts5.SignatureKind.Call
1151
+ ts4.SignatureKind.Call
1148
1152
  );
1149
1153
  if (!signature) {
1150
1154
  return;
@@ -1203,11 +1207,14 @@ var noCyclicActionRule = ruleCreator({
1203
1207
  });
1204
1208
 
1205
1209
  // src/rules/no-explicit-generics.ts
1210
+ import { ESLintUtils as ESLintUtils5 } from "@typescript-eslint/utils";
1211
+ import * as tsutils3 from "ts-api-utils";
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 } = ESLintUtils5.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) || typeArgs && isUnionType(typeArgs)) {
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) || typeArgs && isUnionType(typeArgs)) {
1263
+ if (isArrayExpression(value) || isObjectExpression(value) || isUnion(typeArgs)) {
1246
1264
  return;
1247
1265
  }
1248
1266
  report(node);
@@ -1362,7 +1380,7 @@ var noExposedSubjectsRule = ruleCreator({
1362
1380
  });
1363
1381
 
1364
1382
  // src/rules/no-finnish.ts
1365
- import { ESLintUtils as ESLintUtils5 } from "@typescript-eslint/utils";
1383
+ import { ESLintUtils as ESLintUtils6 } from "@typescript-eslint/utils";
1366
1384
  var noFinnishRule = ruleCreator({
1367
1385
  defaultOptions: [],
1368
1386
  meta: {
@@ -1378,7 +1396,7 @@ var noFinnishRule = ruleCreator({
1378
1396
  },
1379
1397
  name: "no-finnish",
1380
1398
  create: (context) => {
1381
- const { esTreeNodeToTSNodeMap } = ESLintUtils5.getParserServices(context);
1399
+ const { esTreeNodeToTSNodeMap } = ESLintUtils6.getParserServices(context);
1382
1400
  const { couldBeObservable, couldReturnObservable } = getTypeServices(context);
1383
1401
  function checkNode(nameNode, typeNode) {
1384
1402
  if (couldBeObservable(typeNode != null ? typeNode : nameNode) || couldReturnObservable(typeNode != null ? typeNode : nameNode)) {
@@ -1539,7 +1557,7 @@ var noFloatingObservablesRule = ruleCreator({
1539
1557
  });
1540
1558
 
1541
1559
  // src/rules/no-ignored-default-value.ts
1542
- import { ESLintUtils as ESLintUtils6 } from "@typescript-eslint/utils";
1560
+ import { ESLintUtils as ESLintUtils7 } from "@typescript-eslint/utils";
1543
1561
  var noIgnoredDefaultValueRule = ruleCreator({
1544
1562
  defaultOptions: [],
1545
1563
  meta: {
@@ -1556,7 +1574,7 @@ var noIgnoredDefaultValueRule = ruleCreator({
1556
1574
  },
1557
1575
  name: "no-ignored-default-value",
1558
1576
  create: (context) => {
1559
- const { getTypeAtLocation } = ESLintUtils6.getParserServices(context);
1577
+ const { getTypeAtLocation } = ESLintUtils7.getParserServices(context);
1560
1578
  const { couldBeObservable, couldBeType: couldBeType2 } = getTypeServices(context);
1561
1579
  function checkConfigObj(configArg) {
1562
1580
  if (!configArg.properties.some((p) => isProperty(p) && isIdentifier(p.key) && p.key.name === "defaultValue")) {
@@ -1642,7 +1660,7 @@ var noIgnoredDefaultValueRule = ruleCreator({
1642
1660
  });
1643
1661
 
1644
1662
  // src/rules/no-ignored-error.ts
1645
- import { ESLintUtils as ESLintUtils7 } from "@typescript-eslint/utils";
1663
+ import { ESLintUtils as ESLintUtils8 } from "@typescript-eslint/utils";
1646
1664
  var noIgnoredErrorRule = ruleCreator({
1647
1665
  defaultOptions: [],
1648
1666
  meta: {
@@ -1659,7 +1677,7 @@ var noIgnoredErrorRule = ruleCreator({
1659
1677
  },
1660
1678
  name: "no-ignored-error",
1661
1679
  create: (context) => {
1662
- const { getTypeAtLocation } = ESLintUtils7.getParserServices(context);
1680
+ const { getTypeAtLocation } = ESLintUtils8.getParserServices(context);
1663
1681
  const { couldBeObservable, couldBeFunction: couldBeFunction2 } = getTypeServices(context);
1664
1682
  function isMissingErrorCallback(callExpression) {
1665
1683
  if (callExpression.arguments.length >= 2) {
@@ -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 `catchError`.",
2027
- implicitAny: "Implicit `any` in `catchError`.",
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, this will force you to explicitly and safely assert the type is correct."
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 === AST_NODE_TYPES5.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: fix2
2139
+ fix: createReplacerFix(typeAnnotation, "unknown")
2079
2140
  }
2080
2141
  ]
2081
2142
  });
2082
2143
  } else if (type !== AST_NODE_TYPES5.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: fix2
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
- let fix2 = function(fixer) {
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: fix2,
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: fix2
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
  }
@@ -2253,10 +2309,10 @@ var noInternalRule = ruleCreator({
2253
2309
  });
2254
2310
 
2255
2311
  // src/rules/no-misused-observables.ts
2256
- import { AST_NODE_TYPES as AST_NODE_TYPES6, ESLintUtils as ESLintUtils8 } from "@typescript-eslint/utils";
2312
+ import { AST_NODE_TYPES as AST_NODE_TYPES6, ESLintUtils as ESLintUtils9 } from "@typescript-eslint/utils";
2257
2313
  import { getFunctionHeadLocation, isFunction } from "@typescript-eslint/utils/ast-utils";
2258
- import * as tsutils2 from "ts-api-utils";
2259
- import ts6 from "typescript";
2314
+ import * as tsutils4 from "ts-api-utils";
2315
+ import ts5 from "typescript";
2260
2316
  function parseChecksVoidReturn(checksVoidReturn) {
2261
2317
  var _a, _b, _c, _d, _e, _f;
2262
2318
  switch (checksVoidReturn) {
@@ -2337,7 +2393,7 @@ var noMisusedObservablesRule = ruleCreator({
2337
2393
  },
2338
2394
  name: "no-misused-observables",
2339
2395
  create: (context) => {
2340
- const { program, esTreeNodeToTSNodeMap, getTypeAtLocation } = ESLintUtils8.getParserServices(context);
2396
+ const { program, esTreeNodeToTSNodeMap, getTypeAtLocation } = ESLintUtils9.getParserServices(context);
2341
2397
  const checker = program.getTypeChecker();
2342
2398
  const { couldBeObservable, couldReturnObservable } = getTypeServices(context);
2343
2399
  const [config = {}] = context.options;
@@ -2552,8 +2608,8 @@ 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 tsutils2.unionTypeParts(type)) {
2556
- const signatures = ts6.isCallExpression(tsNode) ? subType.getCallSignatures() : subType.getConstructSignatures();
2611
+ for (const subType of tsutils4.unionConstituents(type)) {
2612
+ const signatures = ts5.isCallExpression(tsNode) ? subType.getCallSignatures() : subType.getConstructSignatures();
2557
2613
  for (const signature of signatures) {
2558
2614
  for (const [index, parameter] of signature.parameters.entries()) {
2559
2615
  const type2 = checker.getTypeOfSymbolAtLocation(parameter, tsNode.expression);
@@ -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 tsutils2.unionTypeParts(type)) {
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 = tsutils2.isTypeFlagSet(returnType, ts6.TypeFlags.Void));
2632
+ hasVoidReturn || (hasVoidReturn = tsutils4.isTypeFlagSet(returnType, ts5.TypeFlags.Void));
2577
2633
  }
2578
2634
  }
2579
2635
  return hasVoidReturn;
@@ -2584,31 +2640,31 @@ function getHeritageTypes(checker, tsNode) {
2584
2640
  }
2585
2641
  function getMemberIfExists(type, memberName) {
2586
2642
  var _a, _b;
2587
- const escapedMemberName = ts6.escapeLeadingUnderscores(memberName);
2643
+ const escapedMemberName = ts5.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 : tsutils2.getPropertyOfType(type, escapedMemberName);
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;
2593
2649
  }
2594
2650
  function getPropertyContextualType(checker, tsNode) {
2595
- if (ts6.isPropertyAssignment(tsNode)) {
2651
+ if (ts5.isPropertyAssignment(tsNode)) {
2596
2652
  return checker.getContextualType(tsNode.initializer);
2597
- } else if (ts6.isShorthandPropertyAssignment(tsNode)) {
2653
+ } else if (ts5.isShorthandPropertyAssignment(tsNode)) {
2598
2654
  return checker.getContextualType(tsNode.name);
2599
- } else if (ts6.isMethodDeclaration(tsNode)) {
2600
- if (ts6.isComputedPropertyName(tsNode.name)) {
2655
+ } else if (ts5.isMethodDeclaration(tsNode)) {
2656
+ if (ts5.isComputedPropertyName(tsNode.name)) {
2601
2657
  return;
2602
2658
  }
2603
2659
  const obj = tsNode.parent;
2604
- if (!ts6.isObjectLiteralExpression(obj)) {
2660
+ if (!ts5.isObjectLiteralExpression(obj)) {
2605
2661
  return;
2606
2662
  }
2607
2663
  const objType = checker.getContextualType(obj);
2608
2664
  if (objType == null) {
2609
2665
  return;
2610
2666
  }
2611
- const propertySymbol = checker.getPropertyOfType(objType, tsNode.name.text);
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
  },
@@ -3243,7 +3297,7 @@ import { ${functionName} } from ${quote}rxjs${quote};`
3243
3297
  });
3244
3298
 
3245
3299
  // src/rules/no-unbound-methods.ts
3246
- import { ESLintUtils as ESLintUtils9 } from "@typescript-eslint/utils";
3300
+ import { ESLintUtils as ESLintUtils10 } from "@typescript-eslint/utils";
3247
3301
  var defaultOptions12 = [];
3248
3302
  var noUnboundMethodsRule = ruleCreator({
3249
3303
  defaultOptions: defaultOptions12,
@@ -3268,7 +3322,7 @@ var noUnboundMethodsRule = ruleCreator({
3268
3322
  },
3269
3323
  name: "no-unbound-methods",
3270
3324
  create: (context) => {
3271
- const { getTypeAtLocation } = ESLintUtils9.getParserServices(context);
3325
+ const { getTypeAtLocation } = ESLintUtils10.getParserServices(context);
3272
3326
  const { couldBeObservable, couldBeSubscription } = getTypeServices(context);
3273
3327
  const nodeMap = /* @__PURE__ */ new WeakMap();
3274
3328
  const [config = {}] = context.options;
@@ -3539,9 +3593,9 @@ var noUnsafeFirstRule = ruleCreator({
3539
3593
  });
3540
3594
 
3541
3595
  // src/rules/no-unsafe-subject-next.ts
3542
- import { ESLintUtils as ESLintUtils10 } from "@typescript-eslint/utils";
3543
- import * as tsutils3 from "ts-api-utils";
3544
- import ts7 from "typescript";
3596
+ import { ESLintUtils as ESLintUtils11 } from "@typescript-eslint/utils";
3597
+ import * as tsutils5 from "ts-api-utils";
3598
+ import ts6 from "typescript";
3545
3599
  var noUnsafeSubjectNext = ruleCreator({
3546
3600
  defaultOptions: [],
3547
3601
  meta: {
@@ -3558,25 +3612,25 @@ var noUnsafeSubjectNext = ruleCreator({
3558
3612
  },
3559
3613
  name: "no-unsafe-subject-next",
3560
3614
  create: (context) => {
3561
- const { getTypeAtLocation, program } = ESLintUtils10.getParserServices(context);
3615
+ const { getTypeAtLocation, program } = ESLintUtils11.getParserServices(context);
3562
3616
  const typeChecker = program.getTypeChecker();
3563
3617
  return {
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 (tsutils3.isTypeReference(type) && couldBeType(type, "Subject")) {
3621
+ if (tsutils5.isTypeReference(type) && couldBeType(type, "Subject")) {
3568
3622
  const [typeArg] = typeChecker.getTypeArguments(type);
3569
- if (tsutils3.isTypeFlagSet(typeArg, ts7.TypeFlags.Any)) {
3623
+ if (tsutils5.isTypeFlagSet(typeArg, ts6.TypeFlags.Any)) {
3570
3624
  return;
3571
3625
  }
3572
- if (tsutils3.isTypeFlagSet(typeArg, ts7.TypeFlags.Unknown)) {
3626
+ if (tsutils5.isTypeFlagSet(typeArg, ts6.TypeFlags.Unknown)) {
3573
3627
  return;
3574
3628
  }
3575
- if (tsutils3.isTypeFlagSet(typeArg, ts7.TypeFlags.Void)) {
3629
+ if (tsutils5.isTypeFlagSet(typeArg, ts6.TypeFlags.Void)) {
3576
3630
  return;
3577
3631
  }
3578
- if (tsutils3.isUnionType(typeArg) && typeArg.types.some(
3579
- (t) => tsutils3.isTypeFlagSet(t, ts7.TypeFlags.Void)
3632
+ if (tsutils5.isUnionType(typeArg) && typeArg.types.some(
3633
+ (t) => tsutils5.isTypeFlagSet(t, ts6.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: "forbidden",
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: "forbidden",
3917
+ messageId: "suggest",
3863
3918
  fix
3864
3919
  }
3865
3920
  ]
@@ -4019,7 +4074,7 @@ var preferRootOperatorsRule = ruleCreator({
4019
4074
  });
4020
4075
 
4021
4076
  // src/rules/suffix-subjects.ts
4022
- import { AST_NODE_TYPES as AST_NODE_TYPES9, ESLintUtils as ESLintUtils11 } from "@typescript-eslint/utils";
4077
+ import { AST_NODE_TYPES as AST_NODE_TYPES9, ESLintUtils as ESLintUtils12 } from "@typescript-eslint/utils";
4023
4078
  var defaultOptions18 = [];
4024
4079
  var suffixSubjectsRule = ruleCreator({
4025
4080
  defaultOptions: defaultOptions18,
@@ -4047,7 +4102,7 @@ var suffixSubjectsRule = ruleCreator({
4047
4102
  },
4048
4103
  name: "suffix-subjects",
4049
4104
  create: (context) => {
4050
- const { esTreeNodeToTSNodeMap } = ESLintUtils11.getParserServices(context);
4105
+ const { esTreeNodeToTSNodeMap } = ESLintUtils12.getParserServices(context);
4051
4106
  const { couldBeType: couldBeType2 } = getTypeServices(context);
4052
4107
  const [config = {}] = context.options;
4053
4108
  const validate = {
@@ -4217,8 +4272,8 @@ var suffixSubjectsRule = ruleCreator({
4217
4272
  });
4218
4273
 
4219
4274
  // src/rules/throw-error.ts
4220
- import { ESLintUtils as ESLintUtils12 } from "@typescript-eslint/utils";
4221
- import * as tsutils4 from "ts-api-utils";
4275
+ import { ESLintUtils as ESLintUtils13 } from "@typescript-eslint/utils";
4276
+ import * as tsutils6 from "ts-api-utils";
4222
4277
  var defaultOptions19 = [];
4223
4278
  var throwErrorRule = ruleCreator({
4224
4279
  defaultOptions: defaultOptions19,
@@ -4247,7 +4302,7 @@ var throwErrorRule = ruleCreator({
4247
4302
  },
4248
4303
  name: "throw-error",
4249
4304
  create: (context) => {
4250
- const { esTreeNodeToTSNodeMap, program, getTypeAtLocation } = ESLintUtils12.getParserServices(context);
4305
+ const { esTreeNodeToTSNodeMap, program, getTypeAtLocation } = ESLintUtils13.getParserServices(context);
4251
4306
  const { couldBeObservable, couldBeSubject } = getTypeServices(context);
4252
4307
  const [config = {}] = context.options;
4253
4308
  const { allowThrowingAny = true, allowThrowingUnknown = true } = config;
@@ -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 && tsutils4.isIntrinsicAnyType(type)) {
4320
+ if (allowThrowingAny && tsutils6.isIntrinsicAnyType(type)) {
4266
4321
  return;
4267
4322
  }
4268
- if (allowThrowingUnknown && tsutils4.isIntrinsicUnknownType(type)) {
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;