@ngrx/eslint-plugin 15.4.0 → 16.0.0-rc.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.
Files changed (93) hide show
  1. package/jest.config.js +17 -14
  2. package/jest.config.js.map +1 -1
  3. package/package.json +1 -1
  4. package/schematics/ng-add/index.js +6 -6
  5. package/schematics/ng-add/index.js.map +1 -1
  6. package/schematics/ng-add/schema.js +1 -1
  7. package/scripts/generate-config.js +2 -2
  8. package/scripts/generate-docs.js +2 -2
  9. package/scripts/generate-overview.js +1 -1
  10. package/spec/utils/index.js +3 -3
  11. package/src/configs/all-requiring-type-checking.js +3 -3
  12. package/src/configs/all.js +2 -2
  13. package/src/configs/component-store-strict.js +1 -1
  14. package/src/configs/component-store.js +1 -1
  15. package/src/configs/effects-requiring-type-checking.js +3 -3
  16. package/src/configs/effects-strict-requiring-type-checking.js +3 -3
  17. package/src/configs/effects-strict.js +2 -2
  18. package/src/configs/effects.js +2 -2
  19. package/src/configs/index.js +3 -3
  20. package/src/configs/index.js.map +1 -1
  21. package/src/configs/recommended-requiring-type-checking.js +3 -3
  22. package/src/configs/recommended.js +2 -2
  23. package/src/configs/store-strict.js +2 -2
  24. package/src/configs/store.js +2 -2
  25. package/src/configs/strict-requiring-type-checking.js +3 -3
  26. package/src/configs/strict.js +2 -2
  27. package/src/index.js +1 -1
  28. package/src/rule-creator.js +1 -1
  29. package/src/rules/component-store/updater-explicit-return-type.js +6 -6
  30. package/src/rules/component-store/updater-explicit-return-type.js.map +1 -1
  31. package/src/rules/effects/avoid-cyclic-effects.js +8 -8
  32. package/src/rules/effects/avoid-cyclic-effects.js.map +1 -1
  33. package/src/rules/effects/no-dispatch-in-effects.js +7 -7
  34. package/src/rules/effects/no-dispatch-in-effects.js.map +1 -1
  35. package/src/rules/effects/no-effects-in-providers.js +7 -7
  36. package/src/rules/effects/no-effects-in-providers.js.map +1 -1
  37. package/src/rules/effects/no-multiple-actions-in-effects.js +6 -6
  38. package/src/rules/effects/no-multiple-actions-in-effects.js.map +1 -1
  39. package/src/rules/effects/prefer-action-creator-in-of-type.js +6 -6
  40. package/src/rules/effects/prefer-action-creator-in-of-type.js.map +1 -1
  41. package/src/rules/effects/prefer-concat-latest-from.js +13 -13
  42. package/src/rules/effects/prefer-concat-latest-from.js.map +1 -1
  43. package/src/rules/effects/prefer-effect-callback-in-block-statement.js +6 -6
  44. package/src/rules/effects/prefer-effect-callback-in-block-statement.js.map +1 -1
  45. package/src/rules/effects/use-effects-lifecycle-interface.js +9 -9
  46. package/src/rules/effects/use-effects-lifecycle-interface.js.map +1 -1
  47. package/src/rules/index.js +3 -3
  48. package/src/rules/index.js.map +1 -1
  49. package/src/rules/store/avoid-combining-selectors.js +7 -7
  50. package/src/rules/store/avoid-combining-selectors.js.map +1 -1
  51. package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js +7 -7
  52. package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js.map +1 -1
  53. package/src/rules/store/avoid-duplicate-actions-in-reducer.js +10 -10
  54. package/src/rules/store/avoid-duplicate-actions-in-reducer.js.map +1 -1
  55. package/src/rules/store/avoid-mapping-selectors.js +6 -6
  56. package/src/rules/store/avoid-mapping-selectors.js.map +1 -1
  57. package/src/rules/store/good-action-hygiene.js +7 -7
  58. package/src/rules/store/good-action-hygiene.js.map +1 -1
  59. package/src/rules/store/no-multiple-global-stores.js +10 -10
  60. package/src/rules/store/no-multiple-global-stores.js.map +1 -1
  61. package/src/rules/store/no-reducer-in-key-names.js +7 -7
  62. package/src/rules/store/no-reducer-in-key-names.js.map +1 -1
  63. package/src/rules/store/no-store-subscription.js +6 -6
  64. package/src/rules/store/no-store-subscription.js.map +1 -1
  65. package/src/rules/store/no-typed-global-store.js +9 -9
  66. package/src/rules/store/no-typed-global-store.js.map +1 -1
  67. package/src/rules/store/on-function-explicit-return-type.js +7 -7
  68. package/src/rules/store/on-function-explicit-return-type.js.map +1 -1
  69. package/src/rules/store/prefer-action-creator-in-dispatch.js +6 -6
  70. package/src/rules/store/prefer-action-creator-in-dispatch.js.map +1 -1
  71. package/src/rules/store/prefer-action-creator.js +6 -6
  72. package/src/rules/store/prefer-action-creator.js.map +1 -1
  73. package/src/rules/store/prefer-inline-action-props.js +7 -7
  74. package/src/rules/store/prefer-inline-action-props.js.map +1 -1
  75. package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js +7 -7
  76. package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js.map +1 -1
  77. package/src/rules/store/prefer-selector-in-select.js +7 -7
  78. package/src/rules/store/prefer-selector-in-select.js.map +1 -1
  79. package/src/rules/store/prefix-selectors-with-select.js +9 -9
  80. package/src/rules/store/prefix-selectors-with-select.js.map +1 -1
  81. package/src/rules/store/select-style.js +12 -12
  82. package/src/rules/store/select-style.js.map +1 -1
  83. package/src/rules/store/use-consistent-global-store-name.js +10 -10
  84. package/src/rules/store/use-consistent-global-store-name.js.map +1 -1
  85. package/src/utils/helper-functions/docs.js +1 -1
  86. package/src/utils/helper-functions/folder.js +4 -4
  87. package/src/utils/helper-functions/guards.js +1 -1
  88. package/src/utils/helper-functions/index.js +1 -1
  89. package/src/utils/helper-functions/ngrx-modules.js +1 -1
  90. package/src/utils/helper-functions/utils.js +3 -3
  91. package/src/utils/helper-functions/versions.js +1 -1
  92. package/src/utils/index.js +1 -1
  93. package/src/utils/selectors/index.js +1 -1
@@ -23,14 +23,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  var _a;
26
- exports.__esModule = true;
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.noDispatchInEffectsSuggest = exports.noDispatchInEffects = void 0;
28
28
  var path = __importStar(require("path"));
29
29
  var rule_creator_1 = require("../../rule-creator");
30
30
  var utils_1 = require("../../utils");
31
31
  exports.noDispatchInEffects = 'noDispatchInEffects';
32
32
  exports.noDispatchInEffectsSuggest = 'noDispatchInEffectsSuggest';
33
- exports["default"] = (0, rule_creator_1.createRule)({
33
+ exports.default = (0, rule_creator_1.createRule)({
34
34
  name: path.parse(__filename).name,
35
35
  meta: {
36
36
  type: 'suggestion',
@@ -39,13 +39,13 @@ exports["default"] = (0, rule_creator_1.createRule)({
39
39
  docs: {
40
40
  description: '`Effect` should not call `store.dispatch`.',
41
41
  recommended: 'warn',
42
- suggestion: true
42
+ suggestion: true,
43
43
  },
44
44
  schema: [],
45
45
  messages: (_a = {},
46
46
  _a[exports.noDispatchInEffects] = 'Calling `store.dispatch` in `Effect` is forbidden.',
47
47
  _a[exports.noDispatchInEffectsSuggest] = 'Remove `store.dispatch`.',
48
- _a)
48
+ _a),
49
49
  },
50
50
  defaultOptions: [],
51
51
  create: function (context) {
@@ -64,13 +64,13 @@ exports["default"] = (0, rule_creator_1.createRule)({
64
64
  suggest: [
65
65
  {
66
66
  messageId: exports.noDispatchInEffectsSuggest,
67
- fix: function (fixer) { return fixer.remove(nodeToReport); }
67
+ fix: function (fixer) { return fixer.remove(nodeToReport); },
68
68
  },
69
- ]
69
+ ],
70
70
  });
71
71
  },
72
72
  _a;
73
- }
73
+ },
74
74
  });
75
75
  function getNodeToReport(node) {
76
76
  var parent = node.parent;
@@ -1 +1 @@
1
- {"version":3,"file":"no-dispatch-in-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/no-dispatch-in-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAMqB;AAER,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAC5C,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AAUvE,qBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE,SAAS;QACrB,cAAc,EAAE,IAAI;QACpB,IAAI,EAAE;Y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C,MAAM,CAAC;AACb,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n dispatchInEffects,\n getNgRxStores,\n isArrowFunctionExpression,\n isReturnStatement,\n} from '../../utils';\n\nexport const noDispatchInEffects = 'noDispatchInEffects';\nexport const noDispatchInEffectsSuggest = 'noDispatchInEffectsSuggest';\n\ntype MessageIds =\n | typeof noDispatchInEffects\n | typeof noDispatchInEffectsSuggest;\ntype Options = readonly [];\ntype MemberExpressionWithinCallExpression = TSESTree.MemberExpression & {\n parent: TSESTree.CallExpression;\n};\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'effects',\n hasSuggestions: true,\n docs: {\n description: '`Effect` should not call `store.dispatch`.',\n recommended: 'warn',\n suggestion: true,\n },\n schema: [],\n messages: {\n [noDispatchInEffects]:\n 'Calling `store.dispatch` in `Effect` is forbidden.',\n [noDispatchInEffectsSuggest]: 'Remove `store.dispatch`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!storeNames) {\n return {};\n }\n\n return {\n [dispatchInEffects(storeNames)](\n node: MemberExpressionWithinCallExpression\n ) {\n const nodeToReport = getNodeToReport(node);\n context.report({\n node: nodeToReport,\n messageId: noDispatchInEffects,\n suggest: [\n {\n messageId: noDispatchInEffectsSuggest,\n fix: (fixer) => fixer.remove(nodeToReport),\n },\n ],\n });\n },\n };\n },\n});\n\nfunction getNodeToReport(node: MemberExpressionWithinCallExpression) {\n const { parent } = node;\n const { parent: grandParent } = parent;\n return grandParent &&\n (isArrowFunctionExpression(grandParent) || isReturnStatement(grandParent))\n ? node\n : parent;\n}\n"]}
1
+ {"version":3,"file":"no-dispatch-in-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects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AAK,OAAA,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,EAA1B,CAA0B;yBAC3C;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,eAAe,CAAC,IAA0C;IACzD,IAAA,MAAM,GAAK,IAAI,OAAT,CAAU;IAChB,IAAQ,WAAW,GAAK,MAAM,OAAX,CAAY;IACvC,OAAO,WAAW;QAChB,CAAC,IAAA,iCAAyB,EAAC,WAAW,CAAC,IAAI,IAAA,yBAAiB,EAAC,WAAW,CAAC,CAAC;QAC1E,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,MAAM,CAAC;AACb,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n dispatchInEffects,\n getNgRxStores,\n isArrowFunctionExpression,\n isReturnStatement,\n} from '../../utils';\n\nexport const noDispatchInEffects = 'noDispatchInEffects';\nexport const noDispatchInEffectsSuggest = 'noDispatchInEffectsSuggest';\n\ntype MessageIds =\n | typeof noDispatchInEffects\n | typeof noDispatchInEffectsSuggest;\ntype Options = readonly [];\ntype MemberExpressionWithinCallExpression = TSESTree.MemberExpression & {\n parent: TSESTree.CallExpression;\n};\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'effects',\n hasSuggestions: true,\n docs: {\n description: '`Effect` should not call `store.dispatch`.',\n recommended: 'warn',\n suggestion: true,\n },\n schema: [],\n messages: {\n [noDispatchInEffects]:\n 'Calling `store.dispatch` in `Effect` is forbidden.',\n [noDispatchInEffectsSuggest]: 'Remove `store.dispatch`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!storeNames) {\n return {};\n }\n\n return {\n [dispatchInEffects(storeNames)](\n node: MemberExpressionWithinCallExpression\n ) {\n const nodeToReport = getNodeToReport(node);\n context.report({\n node: nodeToReport,\n messageId: noDispatchInEffects,\n suggest: [\n {\n messageId: noDispatchInEffectsSuggest,\n fix: (fixer) => fixer.remove(nodeToReport),\n },\n ],\n });\n },\n };\n },\n});\n\nfunction getNodeToReport(node: MemberExpressionWithinCallExpression) {\n const { parent } = node;\n const { parent: grandParent } = parent;\n return grandParent &&\n (isArrowFunctionExpression(grandParent) || isReturnStatement(grandParent))\n ? node\n : parent;\n}\n"]}
@@ -34,26 +34,26 @@ var __values = (this && this.__values) || function(o) {
34
34
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
35
35
  };
36
36
  var _a;
37
- exports.__esModule = true;
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
38
  exports.messageId = void 0;
39
39
  var path = __importStar(require("path"));
40
40
  var rule_creator_1 = require("../../rule-creator");
41
41
  var utils_1 = require("../../utils");
42
42
  exports.messageId = 'noEffectsInProviders';
43
- exports["default"] = (0, rule_creator_1.createRule)({
43
+ exports.default = (0, rule_creator_1.createRule)({
44
44
  name: path.parse(__filename).name,
45
45
  meta: {
46
46
  type: 'problem',
47
47
  ngrxModule: 'effects',
48
48
  docs: {
49
49
  description: '`Effect` should not be listed as a provider if it is added to the `EffectsModule`.',
50
- recommended: 'error'
50
+ recommended: 'error',
51
51
  },
52
52
  fixable: 'code',
53
53
  schema: [],
54
54
  messages: (_a = {},
55
55
  _a[exports.messageId] = '`Effect` should not be listed as a provider if it is added to the `EffectsModule`.',
56
- _a)
56
+ _a),
57
57
  },
58
58
  defaultOptions: [],
59
59
  create: function (context) {
@@ -80,7 +80,7 @@ exports["default"] = (0, rule_creator_1.createRule)({
80
80
  messageId: exports.messageId,
81
81
  fix: function (fixer) {
82
82
  return (0, utils_1.getNodeToCommaRemoveFix)(sourceCode, fixer, effectInProvider);
83
- }
83
+ },
84
84
  });
85
85
  };
86
86
  try {
@@ -92,7 +92,7 @@ exports["default"] = (0, rule_creator_1.createRule)({
92
92
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
93
93
  finally {
94
94
  try {
95
- if (effectsInProviders_1_1 && !effectsInProviders_1_1.done && (_a = effectsInProviders_1["return"])) _a.call(effectsInProviders_1);
95
+ if (effectsInProviders_1_1 && !effectsInProviders_1_1.done && (_a = effectsInProviders_1.return)) _a.call(effectsInProviders_1);
96
96
  }
97
97
  finally { if (e_1) throw e_1.error; }
98
98
  }
@@ -100,6 +100,6 @@ exports["default"] = (0, rule_creator_1.createRule)({
100
100
  effectsInProviders.clear();
101
101
  },
102
102
  _a;
103
- }
103
+ },
104
104
  });
105
105
  //# sourceMappingURL=no-effects-in-providers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"no-effects-in-providers.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/no-effects-in-providers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAKqB;AAER,QAAA,SAAS,GAAG,sBAAsB,CAAC;AAKhD,qBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,UAAU,EAAE,SAAS;QACrB,IAAI,EAAE;YACJ,WAAW,EACT,oFAAoF;YACtF,WAAW,EAAE,OAAO;SACrB;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IACR,oFAAoF;eACvF;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACd,IAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAC3C,IAAM,kBAAkB,GAAG,IAAI,GAAG,EAAuB,CAAC;QAC1D,IAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;QAE3C;YACE,GAAC,kCAA0B,IAA3B,UAA6B,IAAyB;gBACpD,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;YACD,GAAC,gCAAwB,IAAzB,UAA2B,EAA6B;oBAA3B,IAAI,UAAA;gBAC/B,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;YACD,GAAC,UAAG,yBAAiB,UAAO,IAA5B;;wCACa,gBAAgB;oBACzB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE;;qBAEjD;oBAED,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,gBAAgB;wBACtB,SAAS,mBAAA;wBACT,GAAG,EAAE,UAAC,KAAK;4BACT,OAAA,IAAA,+BAAuB,EAAC,UAAU,EAAE,KAAK,EAAE,gBAAgB,CAAC;wBAA5D,CAA4D;qBAC/D,CAAC,CAAC;;;oBAVL,KAA+B,IAAA,uBAAA,SAAA,kBAAkB,CAAA,sDAAA;wBAA5C,IAAM,gBAAgB,+BAAA;gCAAhB,gBAAgB;qBAW1B;;;;;;;;;gBAED,gBAAgB,CAAC,KAAK,EAAE,CAAC;gBACzB,kBAAkB,CAAC,KAAK,EAAE,CAAC;YAC7B,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n effectsInNgModuleImports,\n effectsInNgModuleProviders,\n getNodeToCommaRemoveFix,\n ngModuleDecorator,\n} from '../../utils';\n\nexport const messageId = 'noEffectsInProviders';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n ngrxModule: 'effects',\n docs: {\n description:\n '`Effect` should not be listed as a provider if it is added to the `EffectsModule`.',\n recommended: 'error',\n },\n fixable: 'code',\n schema: [],\n messages: {\n [messageId]:\n '`Effect` should not be listed as a provider if it is added to the `EffectsModule`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const sourceCode = context.getSourceCode();\n const effectsInProviders = new Set<TSESTree.Identifier>();\n const effectsInImports = new Set<string>();\n\n return {\n [effectsInNgModuleProviders](node: TSESTree.Identifier) {\n effectsInProviders.add(node);\n },\n [effectsInNgModuleImports]({ name }: TSESTree.Identifier) {\n effectsInImports.add(name);\n },\n [`${ngModuleDecorator}:exit`]() {\n for (const effectInProvider of effectsInProviders) {\n if (!effectsInImports.has(effectInProvider.name)) {\n continue;\n }\n\n context.report({\n node: effectInProvider,\n messageId,\n fix: (fixer) =>\n getNodeToCommaRemoveFix(sourceCode, fixer, effectInProvider),\n });\n }\n\n effectsInImports.clear();\n effectsInProviders.clear();\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"no-effects-in-providers.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/no-effects-in-providers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAKqB;AAER,QAAA,SAAS,GAAG,sBAAsB,CAAC;AAKhD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,UAAU,EAAE,SAAS;QACrB,IAAI,EAAE;YACJ,WAAW,EACT,oFAAoF;YACtF,WAAW,EAAE,OAAO;SACrB;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IACR,oFAAoF;eACvF;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACd,IAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAC3C,IAAM,kBAAkB,GAAG,IAAI,GAAG,EAAuB,CAAC;QAC1D,IAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;QAE3C;YACE,GAAC,kCAA0B,IAA3B,UAA6B,IAAyB;gBACpD,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;YACD,GAAC,gCAAwB,IAAzB,UAA2B,EAA6B;oBAA3B,IAAI,UAAA;gBAC/B,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;YACD,GAAC,UAAG,yBAAiB,UAAO,IAA5B;;wCACa,gBAAgB;oBACzB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE;;qBAEjD;oBAED,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,gBAAgB;wBACtB,SAAS,mBAAA;wBACT,GAAG,EAAE,UAAC,KAAK;4BACT,OAAA,IAAA,+BAAuB,EAAC,UAAU,EAAE,KAAK,EAAE,gBAAgB,CAAC;wBAA5D,CAA4D;qBAC/D,CAAC,CAAC;;;oBAVL,KAA+B,IAAA,uBAAA,SAAA,kBAAkB,CAAA,sDAAA;wBAA5C,IAAM,gBAAgB,+BAAA;gCAAhB,gBAAgB;qBAW1B;;;;;;;;;gBAED,gBAAgB,CAAC,KAAK,EAAE,CAAC;gBACzB,kBAAkB,CAAC,KAAK,EAAE,CAAC;YAC7B,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n effectsInNgModuleImports,\n effectsInNgModuleProviders,\n getNodeToCommaRemoveFix,\n ngModuleDecorator,\n} from '../../utils';\n\nexport const messageId = 'noEffectsInProviders';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n ngrxModule: 'effects',\n docs: {\n description:\n '`Effect` should not be listed as a provider if it is added to the `EffectsModule`.',\n recommended: 'error',\n },\n fixable: 'code',\n schema: [],\n messages: {\n [messageId]:\n '`Effect` should not be listed as a provider if it is added to the `EffectsModule`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const sourceCode = context.getSourceCode();\n const effectsInProviders = new Set<TSESTree.Identifier>();\n const effectsInImports = new Set<string>();\n\n return {\n [effectsInNgModuleProviders](node: TSESTree.Identifier) {\n effectsInProviders.add(node);\n },\n [effectsInNgModuleImports]({ name }: TSESTree.Identifier) {\n effectsInImports.add(name);\n },\n [`${ngModuleDecorator}:exit`]() {\n for (const effectInProvider of effectsInProviders) {\n if (!effectsInImports.has(effectInProvider.name)) {\n continue;\n }\n\n context.report({\n node: effectInProvider,\n messageId,\n fix: (fixer) =>\n getNodeToCommaRemoveFix(sourceCode, fixer, effectInProvider),\n });\n }\n\n effectsInImports.clear();\n effectsInProviders.clear();\n },\n };\n },\n});\n"]}
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  var _a;
26
- exports.__esModule = true;
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.messageId = void 0;
28
28
  var experimental_utils_1 = require("@typescript-eslint/experimental-utils");
29
29
  var eslint_etc_1 = require("eslint-etc");
@@ -31,7 +31,7 @@ var path = __importStar(require("path"));
31
31
  var rule_creator_1 = require("../../rule-creator");
32
32
  var utils_1 = require("../../utils");
33
33
  exports.messageId = 'noMultipleActionsInEffects';
34
- exports["default"] = (0, rule_creator_1.createRule)({
34
+ exports.default = (0, rule_creator_1.createRule)({
35
35
  name: path.parse(__filename).name,
36
36
  meta: {
37
37
  type: 'problem',
@@ -39,12 +39,12 @@ exports["default"] = (0, rule_creator_1.createRule)({
39
39
  docs: {
40
40
  description: '`Effect` should not return multiple actions.',
41
41
  recommended: 'warn',
42
- requiresTypeChecking: true
42
+ requiresTypeChecking: true,
43
43
  },
44
44
  schema: [],
45
45
  messages: (_a = {},
46
46
  _a[exports.messageId] = '`Effect` should return a single action.',
47
- _a)
47
+ _a),
48
48
  },
49
49
  defaultOptions: [],
50
50
  create: function (context) {
@@ -58,11 +58,11 @@ exports["default"] = (0, rule_creator_1.createRule)({
58
58
  }
59
59
  context.report({
60
60
  node: nodeToReport,
61
- messageId: exports.messageId
61
+ messageId: exports.messageId,
62
62
  });
63
63
  },
64
64
  _a;
65
- }
65
+ },
66
66
  });
67
67
  function getNodeToReport(node) {
68
68
  switch (node.type) {
@@ -1 +1 @@
1
- {"version":3,"file":"no-multiple-actions-in-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/no-multiple-actions-in-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4EAAuE;AACvE,yCAA6C;AAC7C,yCAA6B;AAC7B,mDAAgD;AAChD,qCAIqB;AAER,QAAA,SAAS,GAAG,4BAA4B,CAAC;AAStD,qBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,UAAU,EAAE,SAAS;QACrB,IAAI,EAAE;YACJ,WAAW,EAAE,8CAA8C;YAC3D,WAAW,EAAE,MAAM;YACnB,oBAAoB,EAAE,IAAI;SAC3B;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IAAG,yCAAyC;eACvD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACd;YACE,GAAC,UAAG,8BAAsB,uBAAa,sCAA8B,eAAK,sCAA8B,MAAG,IAA3G,UACE,IAAmC;gBAEnC,IAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;gBAE3C,IACE,CAAC,YAAY;oBACb,CAAC,IAAA,4BAAe,EAAC,OAAO,CAAC,CAAC,WAAW,CAAC,YAAY,EAAE,OAAO,CAAC,EAC5D;oBACA,OAAO;iBACR;gBAED,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,EAAE,YAAY;oBAClB,SAAS,mBAAA;iBACV,CAAC,CAAC;YACL,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,eAAe,CAAC,IAAmC;IAC1D,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,mCAAc,CAAC,uBAAuB;YACzC,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,KAAK,mCAAc,CAAC,cAAc;YAChC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B;YACE,OAAO,IAAI,CAAC,QAAQ,CAAC;KACxB;AACH,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport { AST_NODE_TYPES } from '@typescript-eslint/experimental-utils';\nimport { getTypeServices } from 'eslint-etc';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n createEffectExpression,\n mapLikeOperatorsExplicitReturn,\n mapLikeOperatorsImplicitReturn,\n} from '../../utils';\n\nexport const messageId = 'noMultipleActionsInEffects';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\ntype EffectsMapLikeOperatorsReturn =\n | TSESTree.ArrowFunctionExpression\n | TSESTree.CallExpression\n | TSESTree.ReturnStatement;\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n ngrxModule: 'effects',\n docs: {\n description: '`Effect` should not return multiple actions.',\n recommended: 'warn',\n requiresTypeChecking: true,\n },\n schema: [],\n messages: {\n [messageId]: '`Effect` should return a single action.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`${createEffectExpression} :matches(${mapLikeOperatorsImplicitReturn}, ${mapLikeOperatorsExplicitReturn})`](\n node: EffectsMapLikeOperatorsReturn\n ) {\n const nodeToReport = getNodeToReport(node);\n\n if (\n !nodeToReport ||\n !getTypeServices(context).couldBeType(nodeToReport, 'Array')\n ) {\n return;\n }\n\n context.report({\n node: nodeToReport,\n messageId,\n });\n },\n };\n },\n});\n\nfunction getNodeToReport(node: EffectsMapLikeOperatorsReturn) {\n switch (node.type) {\n case AST_NODE_TYPES.ArrowFunctionExpression:\n return node.body;\n case AST_NODE_TYPES.CallExpression:\n return node.arguments[0];\n default:\n return node.argument;\n }\n}\n"]}
1
+ {"version":3,"file":"no-multiple-actions-in-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/no-multiple-actions-in-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4EAAuE;AACvE,yCAA6C;AAC7C,yCAA6B;AAC7B,mDAAgD;AAChD,qCAIqB;AAER,QAAA,SAAS,GAAG,4BAA4B,CAAC;AAStD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,UAAU,EAAE,SAAS;QACrB,IAAI,EAAE;YACJ,WAAW,EAAE,8CAA8C;YAC3D,WAAW,EAAE,MAAM;YACnB,oBAAoB,EAAE,IAAI;SAC3B;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IAAG,yCAAyC;eACvD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACd;YACE,GAAC,UAAG,8BAAsB,uBAAa,sCAA8B,eAAK,sCAA8B,MAAG,IAA3G,UACE,IAAmC;gBAEnC,IAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;gBAE3C,IACE,CAAC,YAAY;oBACb,CAAC,IAAA,4BAAe,EAAC,OAAO,CAAC,CAAC,WAAW,CAAC,YAAY,EAAE,OAAO,CAAC,EAC5D;oBACA,OAAO;iBACR;gBAED,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,EAAE,YAAY;oBAClB,SAAS,mBAAA;iBACV,CAAC,CAAC;YACL,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,eAAe,CAAC,IAAmC;IAC1D,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,mCAAc,CAAC,uBAAuB;YACzC,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,KAAK,mCAAc,CAAC,cAAc;YAChC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B;YACE,OAAO,IAAI,CAAC,QAAQ,CAAC;KACxB;AACH,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport { AST_NODE_TYPES } from '@typescript-eslint/experimental-utils';\nimport { getTypeServices } from 'eslint-etc';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n createEffectExpression,\n mapLikeOperatorsExplicitReturn,\n mapLikeOperatorsImplicitReturn,\n} from '../../utils';\n\nexport const messageId = 'noMultipleActionsInEffects';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\ntype EffectsMapLikeOperatorsReturn =\n | TSESTree.ArrowFunctionExpression\n | TSESTree.CallExpression\n | TSESTree.ReturnStatement;\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n ngrxModule: 'effects',\n docs: {\n description: '`Effect` should not return multiple actions.',\n recommended: 'warn',\n requiresTypeChecking: true,\n },\n schema: [],\n messages: {\n [messageId]: '`Effect` should return a single action.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`${createEffectExpression} :matches(${mapLikeOperatorsImplicitReturn}, ${mapLikeOperatorsExplicitReturn})`](\n node: EffectsMapLikeOperatorsReturn\n ) {\n const nodeToReport = getNodeToReport(node);\n\n if (\n !nodeToReport ||\n !getTypeServices(context).couldBeType(nodeToReport, 'Array')\n ) {\n return;\n }\n\n context.report({\n node: nodeToReport,\n messageId,\n });\n },\n };\n },\n});\n\nfunction getNodeToReport(node: EffectsMapLikeOperatorsReturn) {\n switch (node.type) {\n case AST_NODE_TYPES.ArrowFunctionExpression:\n return node.body;\n case AST_NODE_TYPES.CallExpression:\n return node.arguments[0];\n default:\n return node.argument;\n }\n}\n"]}
@@ -23,24 +23,24 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  var _a;
26
- exports.__esModule = true;
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.messageId = void 0;
28
28
  var path = __importStar(require("path"));
29
29
  var rule_creator_1 = require("../../rule-creator");
30
30
  exports.messageId = 'preferActionCreatorInOfType';
31
- exports["default"] = (0, rule_creator_1.createRule)({
31
+ exports.default = (0, rule_creator_1.createRule)({
32
32
  name: path.parse(__filename).name,
33
33
  meta: {
34
34
  type: 'suggestion',
35
35
  ngrxModule: 'effects',
36
36
  docs: {
37
37
  description: 'Using `action creator` in `ofType` is preferred over `string`.',
38
- recommended: 'warn'
38
+ recommended: 'warn',
39
39
  },
40
40
  schema: [],
41
41
  messages: (_a = {},
42
42
  _a[exports.messageId] = 'Using `string` is forbidden. Use `action creator` instead.',
43
- _a)
43
+ _a),
44
44
  },
45
45
  defaultOptions: [],
46
46
  create: function (context) {
@@ -49,10 +49,10 @@ exports["default"] = (0, rule_creator_1.createRule)({
49
49
  _a["CallExpression[callee.name='ofType'] Literal"] = function (node) {
50
50
  context.report({
51
51
  node: node,
52
- messageId: exports.messageId
52
+ messageId: exports.messageId,
53
53
  });
54
54
  },
55
55
  _a;
56
- }
56
+ },
57
57
  });
58
58
  //# sourceMappingURL=prefer-action-creator-in-of-type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-action-creator-in-of-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/prefer-action-creator-in-of-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6B;AAC7B,mDAAgD;AAEnC,QAAA,SAAS,GAAG,6BAA6B,CAAC;AAKvD,qBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE,SAAS;QACrB,IAAI,EAAE;YACJ,WAAW,EACT,gEAAgE;YAClE,WAAW,EAAE,MAAM;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IAAG,4DAA4D;eAC1E;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACd;YACE,GAAC,8CAA8C,IAA/C,UAAiD,IAAsB;gBACrE,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,MAAA;oBACJ,SAAS,mBAAA;iBACV,CAAC,CAAC;YACL,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\n\nexport const messageId = 'preferActionCreatorInOfType';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'effects',\n docs: {\n description:\n 'Using `action creator` in `ofType` is preferred over `string`.',\n recommended: 'warn',\n },\n schema: [],\n messages: {\n [messageId]: 'Using `string` is forbidden. Use `action creator` instead.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`CallExpression[callee.name='ofType'] Literal`](node: TSESTree.Literal) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"prefer-action-creator-in-of-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/prefer-action-creator-in-of-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6B;AAC7B,mDAAgD;AAEnC,QAAA,SAAS,GAAG,6BAA6B,CAAC;AAKvD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE,SAAS;QACrB,IAAI,EAAE;YACJ,WAAW,EACT,gEAAgE;YAClE,WAAW,EAAE,MAAM;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IAAG,4DAA4D;eAC1E;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACd;YACE,GAAC,8CAA8C,IAA/C,UAAiD,IAAsB;gBACrE,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,MAAA;oBACJ,SAAS,mBAAA;iBACV,CAAC,CAAC;YACL,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\n\nexport const messageId = 'preferActionCreatorInOfType';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'effects',\n docs: {\n description:\n 'Using `action creator` in `ofType` is preferred over `string`.',\n recommended: 'warn',\n },\n schema: [],\n messages: {\n [messageId]: 'Using `string` is forbidden. Use `action creator` instead.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`CallExpression[callee.name='ofType'] Literal`](node: TSESTree.Literal) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
@@ -48,7 +48,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
48
48
  return to.concat(ar || Array.prototype.slice.call(from));
49
49
  };
50
50
  var _a;
51
- exports.__esModule = true;
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
52
  exports.messageId = void 0;
53
53
  var eslint_etc_1 = require("eslint-etc");
54
54
  var path = __importStar(require("path"));
@@ -58,7 +58,7 @@ exports.messageId = 'preferConcatLatestFrom';
58
58
  var defaultOptions = { strict: false };
59
59
  var concatLatestFromKeyword = 'concatLatestFrom';
60
60
  var withLatestFromKeyword = 'withLatestFrom';
61
- exports["default"] = (0, rule_creator_1.createRule)({
61
+ exports.default = (0, rule_creator_1.createRule)({
62
62
  name: path.parse(__filename).name,
63
63
  meta: {
64
64
  type: 'problem',
@@ -66,7 +66,7 @@ exports["default"] = (0, rule_creator_1.createRule)({
66
66
  version: '>=12.0.0',
67
67
  docs: {
68
68
  description: "Use `".concat(concatLatestFromKeyword, "` instead of `").concat(withLatestFromKeyword, "` to prevent the selector from firing until the correct `Action` is dispatched."),
69
- recommended: 'warn'
69
+ recommended: 'warn',
70
70
  },
71
71
  fixable: 'code',
72
72
  schema: [
@@ -75,15 +75,15 @@ exports["default"] = (0, rule_creator_1.createRule)({
75
75
  properties: {
76
76
  strict: {
77
77
  type: 'boolean',
78
- "default": defaultOptions.strict
79
- }
78
+ default: defaultOptions.strict,
79
+ },
80
80
  },
81
- additionalProperties: false
81
+ additionalProperties: false,
82
82
  },
83
83
  ],
84
84
  messages: (_a = {},
85
85
  _a[exports.messageId] = "Use `".concat(concatLatestFromKeyword, "` instead of `").concat(withLatestFromKeyword, "`."),
86
- _a)
86
+ _a),
87
87
  },
88
88
  defaultOptions: [defaultOptions],
89
89
  create: function (context, _a) {
@@ -95,7 +95,7 @@ exports["default"] = (0, rule_creator_1.createRule)({
95
95
  context.report({
96
96
  node: node,
97
97
  messageId: exports.messageId,
98
- fix: function (fixer) { return getFixes(context.getSourceCode(), fixer, node); }
98
+ fix: function (fixer) { return getFixes(context.getSourceCode(), fixer, node); },
99
99
  });
100
100
  },
101
101
  _b;
@@ -110,17 +110,17 @@ exports["default"] = (0, rule_creator_1.createRule)({
110
110
  context.report({
111
111
  node: node,
112
112
  messageId: exports.messageId,
113
- fix: function (fixer) { return getFixes(sourceCode, fixer, node); }
113
+ fix: function (fixer) { return getFixes(sourceCode, fixer, node); },
114
114
  });
115
115
  },
116
116
  _c["".concat(utils_1.createEffectExpression, " ").concat((0, utils_1.namedExpression)(actionsNames), " > CallExpression[arguments.length>1] > Identifier[name='").concat(withLatestFromKeyword, "']")] = function (node) {
117
117
  context.report({
118
118
  node: node,
119
- messageId: exports.messageId
119
+ messageId: exports.messageId,
120
120
  });
121
121
  },
122
122
  _c;
123
- }
123
+ },
124
124
  });
125
125
  function getFixes(sourceCode, fixer, node) {
126
126
  var _a;
@@ -137,14 +137,14 @@ function getFixes(sourceCode, fixer, node) {
137
137
  fixer: fixer,
138
138
  importName: concatLatestFromKeyword,
139
139
  moduleName: utils_1.NGRX_MODULE_PATHS.effects,
140
- node: node
140
+ node: node,
141
141
  })], __read((isUsingDeprecatedProjectorArgument && nextToken
142
142
  ? [
143
143
  (0, utils_1.getImportAddFix)({
144
144
  fixer: fixer,
145
145
  importName: 'map',
146
146
  moduleName: 'rxjs/operators',
147
- node: node
147
+ node: node,
148
148
  }),
149
149
  fixer.insertTextAfterRange(nextToken.range, '), map('),
150
150
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-concat-latest-from.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/prefer-concat-latest-from.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAuD;AACvD,yCAA6B;AAC7B,mDAAgD;AAChD,qCAOqB;AAER,QAAA,SAAS,GAAG,wBAAwB,CAAC;AAQlD,IAAM,cAAc,GAAoB,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC1D,IAAM,uBAAuB,GAAG,kBAAkB,CAAC;AACnD,IAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAE/C,qBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,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AAK,OAAA;YACL,UAAU,EAAE,uBAAuB;YACnC,UAAU,EAAE,yBAAiB,CAAC,OAAO;YACrC,IAAI,MAAA;SACL,CAAC,UACC,CAAC,kCAAkC,IAAI,SAAS;QACjD,CAAC,CAAC;YACE,IAAA,uBAAe,EAAC;gBACd,KAAK,OAAA;gBACL,UAAU,EAAE,KAAK;gBACjB,UAAU,EAAE,gBAAgB;gBAC5B,IAAI,MAAA;aACL,CAAC;YACF,KAAK,CAAC,oBAAoB,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC;SACvD;QACH,CAAC,CAAC,EAAE,CAAC,WACP;AACJ,CAAC","sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';\nimport { isArrowFunctionExpression } from 'eslint-etc';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n createEffectExpression,\n getImportAddFix,\n getNgRxEffectActions,\n namedExpression,\n NGRX_MODULE_PATHS,\n} from '../../utils';\n\nexport const messageId = 'preferConcatLatestFrom';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [{ readonly strict: boolean }];\ntype WithLatestFromIdentifier = TSESTree.Identifier & {\n parent: TSESTree.CallExpression;\n};\n\nconst defaultOptions: Options[number] = { strict: false };\nconst concatLatestFromKeyword = 'concatLatestFrom';\nconst withLatestFromKeyword = 'withLatestFrom';\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n ngrxModule: 'effects',\n version: '>=12.0.0',\n docs: {\n description: `Use \\`${concatLatestFromKeyword}\\` instead of \\`${withLatestFromKeyword}\\` to prevent the selector from firing until the correct \\`Action\\` is dispatched.`,\n recommended: 'warn',\n },\n fixable: 'code',\n schema: [\n {\n type: 'object',\n properties: {\n strict: {\n type: 'boolean',\n default: defaultOptions.strict,\n },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n [messageId]: `Use \\`${concatLatestFromKeyword}\\` instead of \\`${withLatestFromKeyword}\\`.`,\n },\n },\n defaultOptions: [defaultOptions],\n create: (context, [options]) => {\n if (options.strict) {\n return {\n [`${createEffectExpression} CallExpression > Identifier[name='withLatestFrom']`](\n node: WithLatestFromIdentifier\n ) {\n context.report({\n node,\n messageId,\n fix: (fixer) => getFixes(context.getSourceCode(), fixer, node),\n });\n },\n };\n }\n\n const { identifiers = [], sourceCode } = getNgRxEffectActions(context);\n const actionsNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!actionsNames) {\n return {};\n }\n\n return {\n [`${createEffectExpression} ${namedExpression(\n actionsNames\n )} > CallExpression[arguments.length=1] > Identifier[name='${withLatestFromKeyword}']`](\n node: WithLatestFromIdentifier\n ) {\n context.report({\n node,\n messageId,\n fix: (fixer) => getFixes(sourceCode, fixer, node),\n });\n },\n [`${createEffectExpression} ${namedExpression(\n actionsNames\n )} > CallExpression[arguments.length>1] > Identifier[name='${withLatestFromKeyword}']`](\n node: WithLatestFromIdentifier\n ) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n\nfunction getFixes(\n sourceCode: Readonly<TSESLint.SourceCode>,\n fixer: TSESLint.RuleFixer,\n node: WithLatestFromIdentifier\n) {\n const { parent } = node;\n const isUsingDeprecatedProjectorArgument = parent.arguments.length > 1;\n const [firstArgument] = parent.arguments;\n const nextToken =\n isUsingDeprecatedProjectorArgument &&\n sourceCode.getTokenAfter(firstArgument);\n return [\n fixer.replaceText(node, concatLatestFromKeyword),\n ...(isArrowFunctionExpression(firstArgument)\n ? []\n : [fixer.insertTextBefore(firstArgument, '() => ')]),\n ].concat(\n getImportAddFix({\n fixer,\n importName: concatLatestFromKeyword,\n moduleName: NGRX_MODULE_PATHS.effects,\n node,\n }),\n ...(isUsingDeprecatedProjectorArgument && nextToken\n ? [\n getImportAddFix({\n fixer,\n importName: 'map',\n moduleName: 'rxjs/operators',\n node,\n }),\n fixer.insertTextAfterRange(nextToken.range, '), map('),\n ]\n : [])\n );\n}\n"]}
1
+ {"version":3,"file":"prefer-concat-latest-from.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/prefer-concat-latest-from.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAuD;AACvD,yCAA6B;AAC7B,mDAAgD;AAChD,qCAOqB;AAER,QAAA,SAAS,GAAG,wBAAwB,CAAC;AAQlD,IAAM,cAAc,GAAoB,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC1D,IAAM,uBAAuB,GAAG,kBAAkB,CAAC;AACnD,IAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAE/C,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,UAAU,EAAE,SAAS;QACrB,OAAO,EAAE,UAAU;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,eAAS,uBAAuB,2BAAmB,qBAAqB,oFAAoF;YACzK,WAAW,EAAE,MAAM;SACpB;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,MAAM,EAAE;wBACN,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,cAAc,CAAC,MAAM;qBAC/B;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;QACD,QAAQ;YACN,GAAC,iBAAS,IAAG,eAAS,uBAAuB,2BAAmB,qBAAqB,OAAK;eAC3F;KACF;IACD,cAAc,EAAE,CAAC,cAAc,CAAC;IAChC,MAAM,EAAE,UAAC,OAAO,EAAE,EAAS;;YAAT,KAAA,aAAS,EAAR,OAAO,QAAA;QACxB,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB;gBACE,GAAC,UAAG,8BAAsB,wDAAqD,IAA/E,UACE,IAA8B;oBAE9B,OAAO,CAAC,MAAM,CA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,CAAC,MAAM,GAAG,CAAC,CAAC;IACjE,IAAA,KAAA,OAAkB,MAAM,CAAC,SAAS,IAAA,EAAjC,aAAa,QAAoB,CAAC;IACzC,IAAM,SAAS,GACb,kCAAkC;QAClC,UAAU,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;IAC1C,OAAO,CAAA;QACL,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,uBAAuB,CAAC;cAC7C,CAAC,IAAA,sCAAyB,EAAC,aAAa,CAAC;QAC1C,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC,SACvD,CAAA,CAAC,MAAM,0BACN,IAAA,uBAAe,EAAC;YACd,KAAK,OAAA;YACL,UAAU,EAAE,uBAAuB;YACnC,UAAU,EAAE,yBAAiB,CAAC,OAAO;YACrC,IAAI,MAAA;SACL,CAAC,UACC,CAAC,kCAAkC,IAAI,SAAS;QACjD,CAAC,CAAC;YACE,IAAA,uBAAe,EAAC;gBACd,KAAK,OAAA;gBACL,UAAU,EAAE,KAAK;gBACjB,UAAU,EAAE,gBAAgB;gBAC5B,IAAI,MAAA;aACL,CAAC;YACF,KAAK,CAAC,oBAAoB,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC;SACvD;QACH,CAAC,CAAC,EAAE,CAAC,WACP;AACJ,CAAC","sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';\nimport { isArrowFunctionExpression } from 'eslint-etc';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n createEffectExpression,\n getImportAddFix,\n getNgRxEffectActions,\n namedExpression,\n NGRX_MODULE_PATHS,\n} from '../../utils';\n\nexport const messageId = 'preferConcatLatestFrom';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [{ readonly strict: boolean }];\ntype WithLatestFromIdentifier = TSESTree.Identifier & {\n parent: TSESTree.CallExpression;\n};\n\nconst defaultOptions: Options[number] = { strict: false };\nconst concatLatestFromKeyword = 'concatLatestFrom';\nconst withLatestFromKeyword = 'withLatestFrom';\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n ngrxModule: 'effects',\n version: '>=12.0.0',\n docs: {\n description: `Use \\`${concatLatestFromKeyword}\\` instead of \\`${withLatestFromKeyword}\\` to prevent the selector from firing until the correct \\`Action\\` is dispatched.`,\n recommended: 'warn',\n },\n fixable: 'code',\n schema: [\n {\n type: 'object',\n properties: {\n strict: {\n type: 'boolean',\n default: defaultOptions.strict,\n },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n [messageId]: `Use \\`${concatLatestFromKeyword}\\` instead of \\`${withLatestFromKeyword}\\`.`,\n },\n },\n defaultOptions: [defaultOptions],\n create: (context, [options]) => {\n if (options.strict) {\n return {\n [`${createEffectExpression} CallExpression > Identifier[name='withLatestFrom']`](\n node: WithLatestFromIdentifier\n ) {\n context.report({\n node,\n messageId,\n fix: (fixer) => getFixes(context.getSourceCode(), fixer, node),\n });\n },\n };\n }\n\n const { identifiers = [], sourceCode } = getNgRxEffectActions(context);\n const actionsNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!actionsNames) {\n return {};\n }\n\n return {\n [`${createEffectExpression} ${namedExpression(\n actionsNames\n )} > CallExpression[arguments.length=1] > Identifier[name='${withLatestFromKeyword}']`](\n node: WithLatestFromIdentifier\n ) {\n context.report({\n node,\n messageId,\n fix: (fixer) => getFixes(sourceCode, fixer, node),\n });\n },\n [`${createEffectExpression} ${namedExpression(\n actionsNames\n )} > CallExpression[arguments.length>1] > Identifier[name='${withLatestFromKeyword}']`](\n node: WithLatestFromIdentifier\n ) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n\nfunction getFixes(\n sourceCode: Readonly<TSESLint.SourceCode>,\n fixer: TSESLint.RuleFixer,\n node: WithLatestFromIdentifier\n) {\n const { parent } = node;\n const isUsingDeprecatedProjectorArgument = parent.arguments.length > 1;\n const [firstArgument] = parent.arguments;\n const nextToken =\n isUsingDeprecatedProjectorArgument &&\n sourceCode.getTokenAfter(firstArgument);\n return [\n fixer.replaceText(node, concatLatestFromKeyword),\n ...(isArrowFunctionExpression(firstArgument)\n ? []\n : [fixer.insertTextBefore(firstArgument, '() => ')]),\n ].concat(\n getImportAddFix({\n fixer,\n importName: concatLatestFromKeyword,\n moduleName: NGRX_MODULE_PATHS.effects,\n node,\n }),\n ...(isUsingDeprecatedProjectorArgument && nextToken\n ? [\n getImportAddFix({\n fixer,\n importName: 'map',\n moduleName: 'rxjs/operators',\n node,\n }),\n fixer.insertTextAfterRange(nextToken.range, '), map('),\n ]\n : [])\n );\n}\n"]}
@@ -39,27 +39,27 @@ var __read = (this && this.__read) || function (o, n) {
39
39
  return ar;
40
40
  };
41
41
  var _a;
42
- exports.__esModule = true;
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
43
  exports.messageId = void 0;
44
44
  var experimental_utils_1 = require("@typescript-eslint/experimental-utils");
45
45
  var path = __importStar(require("path"));
46
46
  var rule_creator_1 = require("../../rule-creator");
47
47
  var utils_1 = require("../../utils");
48
48
  exports.messageId = 'preferEffectCallbackInBlockStatement';
49
- exports["default"] = (0, rule_creator_1.createRule)({
49
+ exports.default = (0, rule_creator_1.createRule)({
50
50
  name: path.parse(__filename).name,
51
51
  meta: {
52
52
  type: 'suggestion',
53
53
  ngrxModule: 'effects',
54
54
  docs: {
55
55
  description: 'A block statement is easier to troubleshoot.',
56
- recommended: 'warn'
56
+ recommended: 'warn',
57
57
  },
58
58
  schema: [],
59
59
  messages: (_a = {},
60
60
  _a[exports.messageId] = 'The callback of `Effect` should be wrapped in a block statement.',
61
61
  _a),
62
- fixable: 'code'
62
+ fixable: 'code',
63
63
  },
64
64
  defaultOptions: [],
65
65
  create: function (context) {
@@ -79,11 +79,11 @@ exports["default"] = (0, rule_creator_1.createRule)({
79
79
  fixer.insertTextBefore(previousNode, "{ return "),
80
80
  fixer.insertTextAfter(nextNode, " }"),
81
81
  ];
82
- }
82
+ },
83
83
  });
84
84
  },
85
85
  _a;
86
- }
86
+ },
87
87
  });
88
88
  function getSafeNodesToApplyFix(sourceCode, node) {
89
89
  var previousToken = sourceCode.getTokenBefore(node);
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-effect-callback-in-block-statement.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/prefer-effect-callback-in-block-statement.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4EAAiE;AACjE,yCAA6B;AAC7B,mDAAgD;AAChD,qCAAqD;AAExC,QAAA,SAAS,GAAG,sCAAsC,CAAC;AAKhE,qBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE,SAAS;QACrB,IAAI,EAAE;YACJ,WAAW,EAAE,8CAA8C;YAC3D,WAAW,EAAE,MAAM;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IACR,kEAAkE;eACrE;QACD,OAAO,EAAE,MAAM;KAChB;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACd,IAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAC3C,IAAM,qBAAqB,GACzB,UAAG,8BAAsB,2FAAiG,CAAC;QAC7H,IAAM,kBAAkB,GACtB,UAAG,8BAAsB,yFAA+F,CAAC;QAC3H,IAAM,sCAAsC,GAC1C,UAAG,8BAAsB,4HAAkI,CAAC;QAE9J;YACE,GAAC,UAAG,qBAAqB,eAAK,kBAAkB,eAAK,sCAAsC,CAAE,IAA7F,UACE,IAA8C;gBAE9C,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,MAAA;oBACJ,SAAS,mBAAA;oBACT,GAAG,EAAE,UAAC,KAAK;wBACH,IAAA,KAAA,OAA2B,sBAAsB,CACrD,UAAU,EACV,IAAI,CACL,IAAA,EAHM,YAAY,QAAA,EAAE,QAAQ,QAG5B,CAAC;wBACF,OAAO;4BACL,KAAK,CAAC,gBAAgB,CAAC,YAAY,EAAE,WAAW,CAAC;4BACjD,KAAK,CAAC,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC;yBACtC,CAAC;oBACJ,CAAC;iBACF,CAAC,CAAC;YACL,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,sBAAsB,CAC7B,UAAyC,EACzC,IAAmB;IAEnB,IAAM,aAAa,GAAG,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACtD,IAAM,SAAS,GAAG,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAEjD,IACE,aAAa;QACb,6BAAQ,CAAC,mBAAmB,CAAC,aAAa,CAAC;QAC3C,SAAS;QACT,6BAAQ,CAAC,mBAAmB,CAAC,SAAS,CAAC,EACvC;QACA,OAAO,CAAC,aAAa,EAAE,SAAS,CAAU,CAAC;KAC5C;IAED,OAAO,CAAC,IAAI,EAAE,IAAI,CAAU,CAAC;AAC/B,CAAC","sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';\nimport { ASTUtils } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { createEffectExpression } from '../../utils';\n\nexport const messageId = 'preferEffectCallbackInBlockStatement';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'effects',\n docs: {\n description: 'A block statement is easier to troubleshoot.',\n recommended: 'warn',\n },\n schema: [],\n messages: {\n [messageId]:\n 'The callback of `Effect` should be wrapped in a block statement.',\n },\n fixable: 'code',\n },\n defaultOptions: [],\n create: (context) => {\n const sourceCode = context.getSourceCode();\n const nonParametrizedEffect =\n `${createEffectExpression} > ArrowFunctionExpression > .body[type!=/^(ArrowFunctionExpression|BlockStatement)$/]` as const;\n const parametrizedEffect =\n `${createEffectExpression} > ArrowFunctionExpression > ArrowFunctionExpression > .body[type!='BlockStatement']` as const;\n const parametrizedEffectWithinBlockStatement =\n `${createEffectExpression} > ArrowFunctionExpression > BlockStatement > ReturnStatement > ArrowFunctionExpression > .body[type!='BlockStatement']` as const;\n\n return {\n [`${nonParametrizedEffect}, ${parametrizedEffect}, ${parametrizedEffectWithinBlockStatement}`](\n node: TSESTree.ArrowFunctionExpression['body']\n ) {\n context.report({\n node,\n messageId,\n fix: (fixer) => {\n const [previousNode, nextNode] = getSafeNodesToApplyFix(\n sourceCode,\n node\n );\n return [\n fixer.insertTextBefore(previousNode, `{ return `),\n fixer.insertTextAfter(nextNode, ` }`),\n ];\n },\n });\n },\n };\n },\n});\n\nfunction getSafeNodesToApplyFix(\n sourceCode: Readonly<TSESLint.SourceCode>,\n node: TSESTree.Node\n) {\n const previousToken = sourceCode.getTokenBefore(node);\n const nextToken = sourceCode.getTokenAfter(node);\n\n if (\n previousToken &&\n ASTUtils.isOpeningParenToken(previousToken) &&\n nextToken &&\n ASTUtils.isClosingParenToken(nextToken)\n ) {\n return [previousToken, nextToken] as const;\n }\n\n return [node, node] as const;\n}\n"]}
1
+ {"version":3,"file":"prefer-effect-callback-in-block-statement.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/prefer-effect-callback-in-block-statement.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4EAAiE;AACjE,yCAA6B;AAC7B,mDAAgD;AAChD,qCAAqD;AAExC,QAAA,SAAS,GAAG,sCAAsC,CAAC;AAKhE,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IAC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QACb,6BAAQ,CAAC,mBAAmB,CAAC,aAAa,CAAC;QAC3C,SAAS;QACT,6BAAQ,CAAC,mBAAmB,CAAC,SAAS,CAAC,EACvC;QACA,OAAO,CAAC,aAAa,EAAE,SAAS,CAAU,CAAC;KAC5C;IAED,OAAO,CAAC,IAAI,EAAE,IAAI,CAAU,CAAC;AAC/B,CAAC","sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';\nimport { ASTUtils } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { createEffectExpression } from '../../utils';\n\nexport const messageId = 'preferEffectCallbackInBlockStatement';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'effects',\n docs: {\n description: 'A block statement is easier to troubleshoot.',\n recommended: 'warn',\n },\n schema: [],\n messages: {\n [messageId]:\n 'The callback of `Effect` should be wrapped in a block statement.',\n },\n fixable: 'code',\n },\n defaultOptions: [],\n create: (context) => {\n const sourceCode = context.getSourceCode();\n const nonParametrizedEffect =\n `${createEffectExpression} > ArrowFunctionExpression > .body[type!=/^(ArrowFunctionExpression|BlockStatement)$/]` as const;\n const parametrizedEffect =\n `${createEffectExpression} > ArrowFunctionExpression > ArrowFunctionExpression > .body[type!='BlockStatement']` as const;\n const parametrizedEffectWithinBlockStatement =\n `${createEffectExpression} > ArrowFunctionExpression > BlockStatement > ReturnStatement > ArrowFunctionExpression > .body[type!='BlockStatement']` as const;\n\n return {\n [`${nonParametrizedEffect}, ${parametrizedEffect}, ${parametrizedEffectWithinBlockStatement}`](\n node: TSESTree.ArrowFunctionExpression['body']\n ) {\n context.report({\n node,\n messageId,\n fix: (fixer) => {\n const [previousNode, nextNode] = getSafeNodesToApplyFix(\n sourceCode,\n node\n );\n return [\n fixer.insertTextBefore(previousNode, `{ return `),\n fixer.insertTextAfter(nextNode, ` }`),\n ];\n },\n });\n },\n };\n },\n});\n\nfunction getSafeNodesToApplyFix(\n sourceCode: Readonly<TSESLint.SourceCode>,\n node: TSESTree.Node\n) {\n const previousToken = sourceCode.getTokenBefore(node);\n const nextToken = sourceCode.getTokenAfter(node);\n\n if (\n previousToken &&\n ASTUtils.isOpeningParenToken(previousToken) &&\n nextToken &&\n ASTUtils.isClosingParenToken(nextToken)\n ) {\n return [previousToken, nextToken] as const;\n }\n\n return [node, node] as const;\n}\n"]}
@@ -23,26 +23,26 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  var _a;
26
- exports.__esModule = true;
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.messageId = void 0;
28
28
  var path = __importStar(require("path"));
29
29
  var rule_creator_1 = require("../../rule-creator");
30
30
  var utils_1 = require("../../utils");
31
31
  exports.messageId = 'useEffectsLifecycleInterface';
32
- exports["default"] = (0, rule_creator_1.createRule)({
32
+ exports.default = (0, rule_creator_1.createRule)({
33
33
  name: path.parse(__filename).name,
34
34
  meta: {
35
35
  type: 'suggestion',
36
36
  ngrxModule: 'effects',
37
37
  docs: {
38
38
  description: 'Ensures classes implement lifecycle interfaces corresponding to the declared lifecycle methods.',
39
- recommended: 'warn'
39
+ recommended: 'warn',
40
40
  },
41
41
  fixable: 'code',
42
42
  schema: [],
43
43
  messages: (_a = {},
44
44
  _a[exports.messageId] = 'Lifecycle interface `{{ interfaceName }}` should be implemented for method `{{ methodName }}`.',
45
- _a)
45
+ _a),
46
46
  },
47
47
  defaultOptions: [],
48
48
  create: function (context) {
@@ -50,7 +50,7 @@ exports["default"] = (0, rule_creator_1.createRule)({
50
50
  var lifecycleMapper = {
51
51
  ngrxOnIdentifyEffects: 'OnIdentifyEffects',
52
52
  ngrxOnInitEffects: 'OnInitEffects',
53
- ngrxOnRunEffects: 'OnRunEffects'
53
+ ngrxOnRunEffects: 'OnRunEffects',
54
54
  };
55
55
  var lifecyclesPattern = Object.keys(lifecycleMapper).join('|');
56
56
  return _a = {},
@@ -71,18 +71,18 @@ exports["default"] = (0, rule_creator_1.createRule)({
71
71
  fixer: fixer,
72
72
  importName: interfaceName,
73
73
  moduleName: utils_1.NGRX_MODULE_PATHS.effects,
74
- node: classDeclaration
74
+ node: classDeclaration,
75
75
  }));
76
76
  },
77
77
  node: node,
78
78
  messageId: exports.messageId,
79
79
  data: {
80
80
  interfaceName: interfaceName,
81
- methodName: methodName
82
- }
81
+ methodName: methodName,
82
+ },
83
83
  });
84
84
  },
85
85
  _a;
86
- }
86
+ },
87
87
  });
88
88
  //# sourceMappingURL=use-effects-lifecycle-interface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-effects-lifecycle-interface.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/use-effects-lifecycle-interface.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAKqB;AAER,QAAA,SAAS,GAAG,8BAA8B,CAAC;AAKxD,qBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE,SAAS;QACrB,IAAI,EAAE;YACJ,WAAW,EACT,iGAAiG;YACnG,WAAW,EAAE,MAAM;SACpB;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IACR,gGAAgG;eACnG;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACd,IAAM,eAAe,GAAG;YACtB,qBAAqB,EAAE,mBAAmB;YAC1C,iBAAiB,EAAE,eAAe;YAClC,gBAAgB,EAAE,cAAc;SACxB,CAAC;QACX,IAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEjE;YACE,GAAC,6EAAsE,iBAAiB,OAAI,IAA5F,UACE,IAKC;gBAED,IAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;gBACnD,IAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC;gBAC7B,IAAM,aAAa,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;gBAElD,IAAI,IAAA,oBAAY,EAAC,gBAAgB,EAAE,aAAa,CAAC,EAAE;oBACjD,OAAO;iBACR;gBAED,OAAO,CAAC,MAAM,CAAC;oBACb,GAAG,EAAE,UAAC,KAAK;wBACH,IAAA,KACJ,IAAA,gCAAwB,EAAC,gBAAgB,EAAE,aAAa,CAAC,EADnD,qBAAqB,2BAAA,EAAE,qBAAqB,2BACO,CAAC;wBAC5D,OAAO;4BACL,KAAK,CAAC,eAAe,CACnB,qBAAqB,EACrB,qBAAqB,CACtB;yBACF,CAAC,MAAM,CACN,IAAA,uBAAe,EAAC;4BACd,4BAA4B,EAAE,IAAI;4BAClC,KAAK,OAAA;4BACL,UAAU,EAAE,aAAa;4BACzB,UAAU,EAAE,yBAAiB,CAAC,OAAO;4BACrC,IAAI,EAAE,gBAAgB;yBACvB,CAAC,CACH,CAAC;oBACJ,CAAC;oBACD,IAAI,MAAA;oBACJ,SAAS,mBAAA;oBACT,IAAI,EAAE;wBACJ,aAAa,eAAA;wBACb,UAAU,YAAA;qBACX;iBACF,CAAC,CAAC;YACL,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n getImplementsSchemaFixer,\n getImportAddFix,\n getInterface,\n NGRX_MODULE_PATHS,\n} from '../../utils';\n\nexport const messageId = 'useEffectsLifecycleInterface';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'effects',\n docs: {\n description:\n 'Ensures classes implement lifecycle interfaces corresponding to the declared lifecycle methods.',\n recommended: 'warn',\n },\n fixable: 'code',\n schema: [],\n messages: {\n [messageId]:\n 'Lifecycle interface `{{ interfaceName }}` should be implemented for method `{{ methodName }}`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const lifecycleMapper = {\n ngrxOnIdentifyEffects: 'OnIdentifyEffects',\n ngrxOnInitEffects: 'OnInitEffects',\n ngrxOnRunEffects: 'OnRunEffects',\n } as const;\n const lifecyclesPattern = Object.keys(lifecycleMapper).join('|');\n\n return {\n [`ClassDeclaration > ClassBody > MethodDefinition > Identifier[name=/${lifecyclesPattern}/]`](\n node: TSESTree.Identifier & {\n name: keyof typeof lifecycleMapper;\n parent: TSESTree.MethodDefinition & {\n parent: TSESTree.ClassBody & { parent: TSESTree.ClassDeclaration };\n };\n }\n ) {\n const classDeclaration = node.parent.parent.parent;\n const methodName = node.name;\n const interfaceName = lifecycleMapper[methodName];\n\n if (getInterface(classDeclaration, interfaceName)) {\n return;\n }\n\n context.report({\n fix: (fixer) => {\n const { implementsNodeReplace, implementsTextReplace } =\n getImplementsSchemaFixer(classDeclaration, interfaceName);\n return [\n fixer.insertTextAfter(\n implementsNodeReplace,\n implementsTextReplace\n ),\n ].concat(\n getImportAddFix({\n compatibleWithTypeOnlyImport: true,\n fixer,\n importName: interfaceName,\n moduleName: NGRX_MODULE_PATHS.effects,\n node: classDeclaration,\n })\n );\n },\n node,\n messageId,\n data: {\n interfaceName,\n methodName,\n },\n });\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"use-effects-lifecycle-interface.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/use-effects-lifecycle-interface.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAKqB;AAER,QAAA,SAAS,GAAG,8BAA8B,CA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,4BAA4B,EAAE,IAAI;4BAClC,KAAK,OAAA;4BACL,UAAU,EAAE,aAAa;4BACzB,UAAU,EAAE,yBAAiB,CAAC,OAAO;4BACrC,IAAI,EAAE,gBAAgB;yBACvB,CAAC,CACH,CAAC;oBACJ,CAAC;oBACD,IAAI,MAAA;oBACJ,SAAS,mBAAA;oBACT,IAAI,EAAE;wBACJ,aAAa,eAAA;wBACb,UAAU,YAAA;qBACX;iBACF,CAAC,CAAC;YACL,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n getImplementsSchemaFixer,\n getImportAddFix,\n getInterface,\n NGRX_MODULE_PATHS,\n} from '../../utils';\n\nexport const messageId = 'useEffectsLifecycleInterface';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'effects',\n docs: {\n description:\n 'Ensures classes implement lifecycle interfaces corresponding to the declared lifecycle methods.',\n recommended: 'warn',\n },\n fixable: 'code',\n schema: [],\n messages: {\n [messageId]:\n 'Lifecycle interface `{{ interfaceName }}` should be implemented for method `{{ methodName }}`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const lifecycleMapper = {\n ngrxOnIdentifyEffects: 'OnIdentifyEffects',\n ngrxOnInitEffects: 'OnInitEffects',\n ngrxOnRunEffects: 'OnRunEffects',\n } as const;\n const lifecyclesPattern = Object.keys(lifecycleMapper).join('|');\n\n return {\n [`ClassDeclaration > ClassBody > MethodDefinition > Identifier[name=/${lifecyclesPattern}/]`](\n node: TSESTree.Identifier & {\n name: keyof typeof lifecycleMapper;\n parent: TSESTree.MethodDefinition & {\n parent: TSESTree.ClassBody & { parent: TSESTree.ClassDeclaration };\n };\n }\n ) {\n const classDeclaration = node.parent.parent.parent;\n const methodName = node.name;\n const interfaceName = lifecycleMapper[methodName];\n\n if (getInterface(classDeclaration, interfaceName)) {\n return;\n }\n\n context.report({\n fix: (fixer) => {\n const { implementsNodeReplace, implementsTextReplace } =\n getImplementsSchemaFixer(classDeclaration, interfaceName);\n return [\n fixer.insertTextAfter(\n implementsNodeReplace,\n implementsTextReplace\n ),\n ].concat(\n getImportAddFix({\n compatibleWithTypeOnlyImport: true,\n fixer,\n importName: interfaceName,\n moduleName: NGRX_MODULE_PATHS.effects,\n node: classDeclaration,\n })\n );\n },\n node,\n messageId,\n data: {\n interfaceName,\n methodName,\n },\n });\n },\n };\n },\n});\n"]}
@@ -33,18 +33,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
33
33
  __setModuleDefault(result, mod);
34
34
  return result;
35
35
  };
36
- exports.__esModule = true;
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.rules = void 0;
38
38
  var path = __importStar(require("path"));
39
39
  var utils_1 = require("../utils");
40
40
  // Copied from https://github.com/jest-community/eslint-plugin-jest/blob/main/src/index.ts
41
41
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
42
  var interopRequireDefault = function (obj) {
43
- return (obj === null || obj === void 0 ? void 0 : obj.__esModule) ? obj : { "default": obj };
43
+ return (obj === null || obj === void 0 ? void 0 : obj.__esModule) ? obj : { default: obj };
44
44
  };
45
45
  var importDefault = function (moduleName) {
46
46
  // eslint-disable-next-line @typescript-eslint/no-var-requires
47
- return interopRequireDefault(require(moduleName))["default"];
47
+ return interopRequireDefault(require(moduleName)).default;
48
48
  };
49
49
  var rulesDir = __dirname;
50
50
  var excludedFiles = ['index'];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA6B;AAG7B,kCAA0C;AAE1C,0FAA0F;AAE1F,8DAA8D;AAC9D,IAAM,qBAAqB,GAAG,UAAC,GAAQ;IACrC,OAAA,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,UAAU,EAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,SAAO,EAAE,GAAG,EAAE;AAAxC,CAAwC,CAAC;AAE3C,IAAM,aAAa,GAAG,UAAC,UAAkB;IACvC,8DAA8D;IAC9D,OAAA,qBAAqB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,SAAO,CAAA;AAAlD,CAAkD,CAAC;AAErD,IAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,IAAM,aAAa,GAAG,CAAC,OAAO,CAAC,CAAC;AAEnB,QAAA,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAA,sBAAc,EAAC,QAAQ,CAAC,CAAC;KACtD,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAlC,CAAkC,CAAC;KACpD,MAAM,CAA6C,UAAC,QAAQ,EAAE,IAAI;;IACjE,IAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAA+B,CAAC;IAC1E,UAAU,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,QAAQ,CACxC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CACT,CAAC;IACjB,6BACK,QAAQ,gBACV,IAAI,CAAC,IAAI,IAAG,UAAU,OACvB;AACJ,CAAC,EAAE,EAAE,CAAC,CAAC","sourcesContent":["import * as path from 'path';\nimport type { NgRxRuleModule } from '../rule-creator';\nimport type { NGRX_MODULE } from '../utils';\nimport { traverseFolder } from '../utils';\n\n// Copied from https://github.com/jest-community/eslint-plugin-jest/blob/main/src/index.ts\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst interopRequireDefault = (obj: any): { default: unknown } =>\n obj?.__esModule ? obj : { default: obj };\n\nconst importDefault = (moduleName: string) =>\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n interopRequireDefault(require(moduleName)).default;\n\nconst rulesDir = __dirname;\nconst excludedFiles = ['index'];\n\nexport const rules = Array.from(traverseFolder(rulesDir))\n .filter((rule) => !excludedFiles.includes(rule.file))\n .reduce<Record<string, NgRxRuleModule<[], string>>>((allRules, rule) => {\n const ruleModule = importDefault(rule.path) as NgRxRuleModule<[], string>;\n ruleModule.meta.ngrxModule = path.basename(\n path.dirname(rule.path)\n ) as NGRX_MODULE;\n return {\n ...allRules,\n [rule.file]: ruleModule,\n };\n }, {});\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA6B;AAG7B,kCAA0C;AAE1C,0FAA0F;AAE1F,8DAA8D;AAC9D,IAAM,qBAAqB,GAAG,UAAC,GAAQ;IACrC,OAAA,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,UAAU,EAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE;AAAxC,CAAwC,CAAC;AAE3C,IAAM,aAAa,GAAG,UAAC,UAAkB;IACvC,8DAA8D;IAC9D,OAAA,qBAAqB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO;AAAlD,CAAkD,CAAC;AAErD,IAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,IAAM,aAAa,GAAG,CAAC,OAAO,CAAC,CAAC;AAEnB,QAAA,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAA,sBAAc,EAAC,QAAQ,CAAC,CAAC;KACtD,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAlC,CAAkC,CAAC;KACpD,MAAM,CAA6C,UAAC,QAAQ,EAAE,IAAI;;IACjE,IAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAA+B,CAAC;IAC1E,UAAU,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,QAAQ,CACxC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CACT,CAAC;IACjB,6BACK,QAAQ,gBACV,IAAI,CAAC,IAAI,IAAG,UAAU,OACvB;AACJ,CAAC,EAAE,EAAE,CAAC,CAAC","sourcesContent":["import * as path from 'path';\nimport type { NgRxRuleModule } from '../rule-creator';\nimport type { NGRX_MODULE } from '../utils';\nimport { traverseFolder } from '../utils';\n\n// Copied from https://github.com/jest-community/eslint-plugin-jest/blob/main/src/index.ts\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst interopRequireDefault = (obj: any): { default: unknown } =>\n obj?.__esModule ? obj : { default: obj };\n\nconst importDefault = (moduleName: string) =>\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n interopRequireDefault(require(moduleName)).default;\n\nconst rulesDir = __dirname;\nconst excludedFiles = ['index'];\n\nexport const rules = Array.from(traverseFolder(rulesDir))\n .filter((rule) => !excludedFiles.includes(rule.file))\n .reduce<Record<string, NgRxRuleModule<[], string>>>((allRules, rule) => {\n const ruleModule = importDefault(rule.path) as NgRxRuleModule<[], string>;\n ruleModule.meta.ngrxModule = path.basename(\n path.dirname(rule.path)\n ) as NGRX_MODULE;\n return {\n ...allRules,\n [rule.file]: ruleModule,\n };\n }, {});\n"]}