@ngrx/eslint-plugin 18.0.0-beta.1 → 18.0.0-rc.1

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 (205) hide show
  1. package/jest.config.d.ts +15 -0
  2. package/package.json +4 -5
  3. package/schematics/ng-add/index.d.ts +3 -0
  4. package/schematics/ng-add/index.js +32 -20
  5. package/schematics/ng-add/index.js.map +1 -1
  6. package/schematics/ng-add/schema.d.ts +3 -0
  7. package/schematics/ng-add/schema.js.map +1 -1
  8. package/schematics/ng-add/schema.json +16 -51
  9. package/scripts/generate-config.d.ts +1 -0
  10. package/scripts/generate-config.js +73 -73
  11. package/scripts/generate-config.js.map +1 -1
  12. package/scripts/generate-docs.d.ts +1 -0
  13. package/scripts/generate-docs.js +33 -65
  14. package/scripts/generate-docs.js.map +1 -1
  15. package/scripts/generate-overview.d.ts +1 -0
  16. package/scripts/generate-overview.js +43 -75
  17. package/scripts/generate-overview.js.map +1 -1
  18. package/spec/utils/from-fixture.d.ts +8 -0
  19. package/spec/utils/from-fixture.js +62 -0
  20. package/spec/utils/from-fixture.js.map +1 -0
  21. package/spec/utils/index.d.ts +2 -0
  22. package/spec/utils/index.js +16 -19
  23. package/spec/utils/index.js.map +1 -1
  24. package/spec/utils/rule-tester.d.ts +5 -0
  25. package/spec/utils/rule-tester.js +23 -0
  26. package/spec/utils/rule-tester.js.map +1 -0
  27. package/src/configs/all.d.ts +7 -0
  28. package/src/configs/all.js +56 -32
  29. package/src/configs/all.js.map +1 -1
  30. package/src/configs/all.json +42 -0
  31. package/src/configs/component-store.d.ts +7 -0
  32. package/src/configs/component-store.js +23 -8
  33. package/src/configs/component-store.js.map +1 -1
  34. package/src/configs/component-store.json +9 -0
  35. package/src/configs/effects.d.ts +7 -0
  36. package/src/configs/effects.js +32 -11
  37. package/src/configs/effects.js.map +1 -1
  38. package/src/configs/effects.json +18 -0
  39. package/src/configs/operators.d.ts +7 -0
  40. package/src/configs/operators.js +28 -0
  41. package/src/configs/operators.js.map +1 -0
  42. package/src/configs/operators.json +7 -0
  43. package/src/configs/signals.d.ts +7 -0
  44. package/src/configs/signals.js +34 -0
  45. package/src/configs/signals.js.map +1 -0
  46. package/src/configs/signals.json +13 -0
  47. package/src/configs/store.d.ts +7 -0
  48. package/src/configs/store.js +38 -23
  49. package/src/configs/store.js.map +1 -1
  50. package/src/configs/store.json +24 -0
  51. package/src/index.d.ts +153 -0
  52. package/src/index.js +18 -3
  53. package/src/index.js.map +1 -1
  54. package/src/rule-creator.d.ts +24 -0
  55. package/src/rule-creator.js +12 -58
  56. package/src/rule-creator.js.map +1 -1
  57. package/src/rules/component-store/avoid-combining-component-store-selectors.d.ts +3 -0
  58. package/src/rules/component-store/avoid-combining-component-store-selectors.js +22 -47
  59. package/src/rules/component-store/avoid-combining-component-store-selectors.js.map +1 -1
  60. package/src/rules/component-store/avoid-mapping-component-store-selectors.d.ts +3 -0
  61. package/src/rules/component-store/avoid-mapping-component-store-selectors.js +17 -20
  62. package/src/rules/component-store/avoid-mapping-component-store-selectors.js.map +1 -1
  63. package/src/rules/component-store/updater-explicit-return-type.d.ts +3 -0
  64. package/src/rules/component-store/updater-explicit-return-type.js +17 -20
  65. package/src/rules/component-store/updater-explicit-return-type.js.map +1 -1
  66. package/src/rules/effects/avoid-cyclic-effects.d.ts +4 -0
  67. package/src/rules/effects/avoid-cyclic-effects.js +47 -109
  68. package/src/rules/effects/avoid-cyclic-effects.js.map +1 -1
  69. package/src/rules/effects/no-dispatch-in-effects.d.ts +5 -0
  70. package/src/rules/effects/no-dispatch-in-effects.js +17 -21
  71. package/src/rules/effects/no-dispatch-in-effects.js.map +1 -1
  72. package/src/rules/effects/no-effects-in-providers.d.ts +3 -0
  73. package/src/rules/effects/no-effects-in-providers.js +18 -49
  74. package/src/rules/effects/no-effects-in-providers.js.map +1 -1
  75. package/src/rules/effects/no-multiple-actions-in-effects.d.ts +5 -0
  76. package/src/rules/effects/no-multiple-actions-in-effects.js +31 -24
  77. package/src/rules/effects/no-multiple-actions-in-effects.js.map +1 -1
  78. package/src/rules/effects/prefer-action-creator-in-of-type.d.ts +3 -0
  79. package/src/rules/effects/prefer-action-creator-in-of-type.js +10 -13
  80. package/src/rules/effects/prefer-action-creator-in-of-type.js.map +1 -1
  81. package/src/rules/effects/prefer-effect-callback-in-block-statement.d.ts +4 -0
  82. package/src/rules/effects/prefer-effect-callback-in-block-statement.js +24 -43
  83. package/src/rules/effects/prefer-effect-callback-in-block-statement.js.map +1 -1
  84. package/src/rules/effects/use-effects-lifecycle-interface.d.ts +3 -0
  85. package/src/rules/effects/use-effects-lifecycle-interface.js +21 -24
  86. package/src/rules/effects/use-effects-lifecycle-interface.js.map +1 -1
  87. package/src/rules/index.d.ts +35 -0
  88. package/src/rules/index.js +74 -53
  89. package/src/rules/index.js.map +1 -1
  90. package/src/rules/operators/prefer-concat-latest-from.d.ts +7 -0
  91. package/src/rules/operators/prefer-concat-latest-from.js +123 -0
  92. package/src/rules/operators/prefer-concat-latest-from.js.map +1 -0
  93. package/src/rules/signals/signal-state-no-arrays-at-root-level.d.ts +3 -0
  94. package/src/rules/signals/signal-state-no-arrays-at-root-level.js +59 -0
  95. package/src/rules/signals/signal-state-no-arrays-at-root-level.js.map +1 -0
  96. package/src/rules/signals/with-state-no-arrays-at-root-level.d.ts +4 -0
  97. package/src/rules/signals/with-state-no-arrays-at-root-level.js +72 -0
  98. package/src/rules/signals/with-state-no-arrays-at-root-level.js.map +1 -0
  99. package/src/rules/store/avoid-combining-selectors.d.ts +3 -0
  100. package/src/rules/store/avoid-combining-selectors.js +20 -45
  101. package/src/rules/store/avoid-combining-selectors.js.map +1 -1
  102. package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.d.ts +3 -0
  103. package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js +20 -47
  104. package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js.map +1 -1
  105. package/src/rules/store/avoid-duplicate-actions-in-reducer.d.ts +5 -0
  106. package/src/rules/store/avoid-duplicate-actions-in-reducer.js +33 -101
  107. package/src/rules/store/avoid-duplicate-actions-in-reducer.js.map +1 -1
  108. package/src/rules/store/avoid-mapping-selectors.d.ts +3 -0
  109. package/src/rules/store/avoid-mapping-selectors.js +24 -30
  110. package/src/rules/store/avoid-mapping-selectors.js.map +1 -1
  111. package/src/rules/store/good-action-hygiene.d.ts +3 -0
  112. package/src/rules/store/good-action-hygiene.js +14 -34
  113. package/src/rules/store/good-action-hygiene.js.map +1 -1
  114. package/src/rules/store/no-multiple-global-stores.d.ts +6 -0
  115. package/src/rules/store/no-multiple-global-stores.js +34 -96
  116. package/src/rules/store/no-multiple-global-stores.js.map +1 -1
  117. package/src/rules/store/no-reducer-in-key-names.d.ts +5 -0
  118. package/src/rules/store/no-reducer-in-key-names.js +16 -20
  119. package/src/rules/store/no-reducer-in-key-names.js.map +1 -1
  120. package/src/rules/store/no-store-subscription.d.ts +3 -0
  121. package/src/rules/store/no-store-subscription.js +13 -16
  122. package/src/rules/store/no-store-subscription.js.map +1 -1
  123. package/src/rules/store/no-typed-global-store.d.ts +5 -0
  124. package/src/rules/store/no-typed-global-store.js +29 -70
  125. package/src/rules/store/no-typed-global-store.js.map +1 -1
  126. package/src/rules/store/on-function-explicit-return-type.d.ts +6 -0
  127. package/src/rules/store/on-function-explicit-return-type.js +23 -43
  128. package/src/rules/store/on-function-explicit-return-type.js.map +1 -1
  129. package/src/rules/store/prefer-action-creator-in-dispatch.d.ts +3 -0
  130. package/src/rules/store/prefer-action-creator-in-dispatch.js +15 -18
  131. package/src/rules/store/prefer-action-creator-in-dispatch.js.map +1 -1
  132. package/src/rules/store/prefer-action-creator.d.ts +3 -0
  133. package/src/rules/store/prefer-action-creator.js +10 -13
  134. package/src/rules/store/prefer-action-creator.js.map +1 -1
  135. package/src/rules/store/prefer-inline-action-props.d.ts +5 -0
  136. package/src/rules/store/prefer-inline-action-props.js +14 -18
  137. package/src/rules/store/prefer-inline-action-props.js.map +1 -1
  138. package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.d.ts +5 -0
  139. package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js +16 -37
  140. package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js.map +1 -1
  141. package/src/rules/store/prefer-selector-in-select.d.ts +3 -0
  142. package/src/rules/store/prefer-selector-in-select.js +21 -46
  143. package/src/rules/store/prefer-selector-in-select.js.map +1 -1
  144. package/src/rules/store/prefix-selectors-with-select.d.ts +5 -0
  145. package/src/rules/store/prefix-selectors-with-select.js +26 -39
  146. package/src/rules/store/prefix-selectors-with-select.js.map +1 -1
  147. package/src/rules/store/select-style.d.ts +11 -0
  148. package/src/rules/store/select-style.js +53 -108
  149. package/src/rules/store/select-style.js.map +1 -1
  150. package/src/rules/store/use-consistent-global-store-name.d.ts +6 -0
  151. package/src/rules/store/use-consistent-global-store-name.js +24 -80
  152. package/src/rules/store/use-consistent-global-store-name.js.map +1 -1
  153. package/src/utils/helper-functions/docs.d.ts +1 -0
  154. package/src/utils/helper-functions/docs.js +1 -3
  155. package/src/utils/helper-functions/docs.js.map +1 -1
  156. package/src/utils/helper-functions/folder.d.ts +5 -0
  157. package/src/utils/helper-functions/folder.js +16 -88
  158. package/src/utils/helper-functions/folder.js.map +1 -1
  159. package/src/utils/helper-functions/guards.d.ts +97 -0
  160. package/src/utils/helper-functions/guards.js +27 -31
  161. package/src/utils/helper-functions/guards.js.map +1 -1
  162. package/src/utils/helper-functions/index.d.ts +6 -0
  163. package/src/utils/helper-functions/ngrx-modules.d.ts +8 -0
  164. package/src/utils/helper-functions/ngrx-modules.js +7 -6
  165. package/src/utils/helper-functions/ngrx-modules.js.map +1 -1
  166. package/src/utils/helper-functions/rules.d.ts +3 -0
  167. package/src/utils/helper-functions/rules.js +47 -0
  168. package/src/utils/helper-functions/rules.js.map +1 -0
  169. package/src/utils/helper-functions/utils.d.ts +48 -0
  170. package/src/utils/helper-functions/utils.js +68 -143
  171. package/src/utils/helper-functions/utils.js.map +1 -1
  172. package/src/utils/helper-functions/versions.d.ts +1 -0
  173. package/src/utils/helper-functions/versions.js +10 -11
  174. package/src/utils/helper-functions/versions.js.map +1 -1
  175. package/src/utils/index.d.ts +2 -0
  176. package/src/utils/selectors/index.d.ts +29 -0
  177. package/src/utils/selectors/index.js +30 -44
  178. package/src/utils/selectors/index.js.map +1 -1
  179. package/v9/index.d.ts +29 -0
  180. package/v9/index.js +38 -0
  181. package/v9/index.js.map +1 -0
  182. package/src/configs/all-requiring-type-checking.js +0 -46
  183. package/src/configs/all-requiring-type-checking.js.map +0 -1
  184. package/src/configs/component-store-strict.js +0 -15
  185. package/src/configs/component-store-strict.js.map +0 -1
  186. package/src/configs/effects-requiring-type-checking.js +0 -25
  187. package/src/configs/effects-requiring-type-checking.js.map +0 -1
  188. package/src/configs/effects-strict-requiring-type-checking.js +0 -25
  189. package/src/configs/effects-strict-requiring-type-checking.js.map +0 -1
  190. package/src/configs/effects-strict.js +0 -18
  191. package/src/configs/effects-strict.js.map +0 -1
  192. package/src/configs/index.js +0 -33
  193. package/src/configs/index.js.map +0 -1
  194. package/src/configs/recommended-requiring-type-checking.js +0 -46
  195. package/src/configs/recommended-requiring-type-checking.js.map +0 -1
  196. package/src/configs/recommended.js +0 -39
  197. package/src/configs/recommended.js.map +0 -1
  198. package/src/configs/store-strict.js +0 -30
  199. package/src/configs/store-strict.js.map +0 -1
  200. package/src/configs/strict-requiring-type-checking.js +0 -46
  201. package/src/configs/strict-requiring-type-checking.js.map +0 -1
  202. package/src/configs/strict.js +0 -39
  203. package/src/configs/strict.js.map +0 -1
  204. package/src/rules/effects/prefer-concat-latest-from.js +0 -153
  205. package/src/rules/effects/prefer-concat-latest-from.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"rule-creator.js","sourceRoot":"","sources":["../../../../modules/eslint-plugin/src/rule-creator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4EAAoE;AAEpE,iCAA2E;AAiB3E,SAAgB,UAAU,CAIxB,MAQE;;IAEF,IAAM,eAAe,yBAChB,MAAM,KACT,MAAM,EAAE,UACN,OAA8D,EAC9D,kBAAsC;YAGpC,IAAA,KACE,MAAM,KADqB,EAArB,UAAU,gBAAA,EAAE,OAAO,aAAE,CACpB;YACX,IACE,OAAO,KAAK,SAAS;gBACrB,CAAC,IAAA,4BAAoB,EAAC,yBAAiB,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,EAC7D,CAAC;gBACD,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QACpD,CAAC,GACF,CAAC;;QAEF,KAA6B,IAAA,KAAA,SAAA,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA,gBAAA,4BAAE,CAAC;YAAlE,IAAA,KAAA,mBAAc,EAAb,GAAG,QAAA,EAAE,OAAO,QAAA;YACrB,eAAe,CAAC,IAAI,CAAC,QAAgB,CAAC,GAAG,CAAC,GAAG,UAAG,OAAO,eAAK,IAAA,eAAO,EAClE,MAAM,CAAC,IAAI,CACZ,MAAG,CAAC;QACP,CAAC;;;;;;;;;IAED,OAAO,gCAAW,CAAC,WAAW,CAAC,eAAO,CAAC,CAAC,eAAe,CAAC,CAAC;AAC3D,CAAC;AAzCD,gCAyCC","sourcesContent":["import type { TSESLint } from '@typescript-eslint/experimental-utils';\nimport { ESLintUtils } from '@typescript-eslint/experimental-utils';\nimport type { NGRX_MODULE } from './utils';\nimport { docsUrl, ngrxVersionSatisfies, NGRX_MODULE_PATHS } from './utils';\n\ntype Meta<TMessageIds extends string> =\n | TSESLint.RuleMetaData<TMessageIds> & {\n ngrxModule: NGRX_MODULE;\n version?: string;\n };\ntype CreateRuleMeta<TMessageIds extends string> = {\n docs: Omit<TSESLint.RuleMetaDataDocs, 'url'>;\n} & Omit<Meta<TMessageIds>, 'docs'>;\nexport type NgRxRuleModule<\n TOptions extends readonly unknown[],\n TMessageIds extends string\n> = Omit<TSESLint.RuleModule<TMessageIds, TOptions>, 'meta'> & {\n meta: Meta<TMessageIds>;\n};\n\nexport function createRule<\n TOptions extends readonly unknown[],\n TMessageIds extends string\n>(\n config: Readonly<{\n name: string;\n meta: CreateRuleMeta<TMessageIds>;\n defaultOptions: Readonly<TOptions>;\n create: (\n context: Readonly<TSESLint.RuleContext<TMessageIds, TOptions>>,\n optionsWithDefault: Readonly<TOptions>\n ) => TSESLint.RuleListener;\n }>\n): TSESLint.RuleModule<TMessageIds, TOptions> {\n const configOverwrite = {\n ...config,\n create: (\n context: Readonly<TSESLint.RuleContext<TMessageIds, TOptions>>,\n optionsWithDefault: Readonly<TOptions>\n ) => {\n const {\n meta: { ngrxModule, version },\n } = config;\n if (\n version !== undefined &&\n !ngrxVersionSatisfies(NGRX_MODULE_PATHS[ngrxModule], version)\n ) {\n return {};\n }\n\n return config.create(context, optionsWithDefault);\n },\n };\n\n for (const [key, message] of Object.entries(configOverwrite.meta.messages)) {\n (configOverwrite.meta.messages as any)[key] = `${message} (${docsUrl(\n config.name\n )})`;\n }\n\n return ESLintUtils.RuleCreator(docsUrl)(configOverwrite);\n}\n"]}
1
+ {"version":3,"file":"rule-creator.js","sourceRoot":"","sources":["../../../../modules/eslint-plugin/src/rule-creator.ts"],"names":[],"mappings":";;;AACA,oDAAuD;AAEvD,mCAA2E;AAwB3E,SAAgB,UAAU,CAIxB,MAQE;IAEF,MAAM,eAAe,GAAG;QACtB,GAAG,MAAM;QACT,MAAM,EAAE,CACN,OAA8D,EAC9D,kBAAsC,EACtC,EAAE;YACF,MAAM,EACJ,IAAI,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,GAC9B,GAAG,MAAM,CAAC;YACX,IACE,OAAO,KAAK,SAAS;gBACrB,CAAC,IAAA,4BAAoB,EAAC,yBAAiB,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,EAC7D,CAAC;gBACD,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QACpD,CAAC;KACF,CAAC;IAEF,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1E,eAAe,CAAC,IAAI,CAAC,QAAgB,CAAC,GAAG,CAAC,GAAG,GAAG,OAAO,KAAK,IAAA,eAAO,EAClE,MAAM,CAAC,IAAI,CACZ,GAAG,CAAC;IACP,CAAC;IAED,OAAO,mBAAW,CAAC,WAAW,CAAC,eAAO,CAAC,CAAC,eAAe,CAAC,CAAC;AAC3D,CAAC;AAzCD,gCAyCC","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\nimport { ESLintUtils } from '@typescript-eslint/utils';\nimport type { NGRX_MODULE } from './utils';\nimport { docsUrl, ngrxVersionSatisfies, NGRX_MODULE_PATHS } from './utils';\n\ntype Meta<TMessageIds extends string, TOptions extends readonly unknown[]> =\n | TSESLint.RuleMetaData<TMessageIds, TOptions> & {\n ngrxModule: NGRX_MODULE;\n version?: string;\n docs: { requiresTypeChecking?: boolean };\n };\n\ntype CreateRuleMeta<\n TMessageIds extends string,\n TOptions extends readonly unknown[]\n> = {\n docs: Omit<TSESLint.RuleMetaDataDocs, 'url'> & {\n requiresTypeChecking?: boolean;\n };\n} & Omit<Meta<TMessageIds, TOptions>, 'docs'>;\nexport type NgRxRuleModule<\n TOptions extends readonly unknown[],\n TMessageIds extends string\n> = Omit<TSESLint.RuleModule<TMessageIds, TOptions>, 'meta'> & {\n meta: Meta<TMessageIds, TOptions>;\n};\n\nexport function createRule<\n TOptions extends readonly unknown[],\n TMessageIds extends string\n>(\n config: Readonly<{\n name: string;\n meta: CreateRuleMeta<TMessageIds, TOptions>;\n defaultOptions: Readonly<TOptions>;\n create: (\n context: Readonly<TSESLint.RuleContext<TMessageIds, TOptions>>,\n optionsWithDefault: Readonly<TOptions>\n ) => TSESLint.RuleListener;\n }>\n): TSESLint.RuleModule<TMessageIds, TOptions> {\n const configOverwrite = {\n ...config,\n create: (\n context: Readonly<TSESLint.RuleContext<TMessageIds, TOptions>>,\n optionsWithDefault: Readonly<TOptions>\n ) => {\n const {\n meta: { ngrxModule, version },\n } = config;\n if (\n version !== undefined &&\n !ngrxVersionSatisfies(NGRX_MODULE_PATHS[ngrxModule], version)\n ) {\n return {};\n }\n\n return config.create(context, optionsWithDefault);\n },\n };\n\n for (const [key, message] of Object.entries(configOverwrite.meta.messages)) {\n (configOverwrite.meta.messages as any)[key] = `${message} (${docsUrl(\n config.name\n )})`;\n }\n\n return ESLintUtils.RuleCreator(docsUrl)(configOverwrite);\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const messageId = "avoidCombiningComponentStoreSelectors";
2
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCombiningComponentStoreSelectors", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
3
+ export default _default;
@@ -22,23 +22,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __values = (this && this.__values) || function(o) {
26
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
27
- if (m) return m.call(o);
28
- if (o && typeof o.length === "number") return {
29
- next: function () {
30
- if (o && i >= o.length) o = void 0;
31
- return { value: o && o[i++], done: !o };
32
- }
33
- };
34
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
35
- };
36
- var _a;
37
25
  Object.defineProperty(exports, "__esModule", { value: true });
38
26
  exports.messageId = void 0;
39
- var path = __importStar(require("path"));
40
- var rule_creator_1 = require("../../rule-creator");
41
- var utils_1 = require("../../utils");
27
+ const path = __importStar(require("path"));
28
+ const rule_creator_1 = require("../../rule-creator");
29
+ const utils_1 = require("../../utils");
42
30
  exports.messageId = 'avoidCombiningComponentStoreSelectors';
43
31
  exports.default = (0, rule_creator_1.createRule)({
44
32
  name: path.parse(__filename).name,
@@ -47,49 +35,36 @@ exports.default = (0, rule_creator_1.createRule)({
47
35
  ngrxModule: 'component-store',
48
36
  docs: {
49
37
  description: 'Prefer combining selectors at the selector level.',
50
- recommended: 'warn',
51
38
  },
52
39
  schema: [],
53
- messages: (_a = {},
54
- _a[exports.messageId] = 'Combine selectors at the selector level.',
55
- _a),
40
+ messages: {
41
+ [exports.messageId]: 'Combine selectors at the selector level.',
42
+ },
56
43
  },
57
44
  defaultOptions: [],
58
- create: function (context) {
59
- var _a;
60
- var _b = (0, utils_1.getNgRxComponentStores)(context).identifiers, identifiers = _b === void 0 ? [] : _b;
61
- var storeNames = identifiers.length > 0 ? (0, utils_1.asPattern)(identifiers) : null;
62
- var thisSelects = "CallExpression[callee.object.type='ThisExpression'][callee.property.name='select']";
63
- var storeSelects = storeNames ? (0, utils_1.namedExpression)(storeNames) : null;
64
- var selectsInArray = [];
65
- return _a = {},
66
- _a["ClassDeclaration[superClass.name=/Store/] CallExpression[callee.name='combineLatest'] ".concat(thisSelects, " ~ ").concat(thisSelects)] = function (node) {
45
+ create: (context) => {
46
+ const { identifiers = [] } = (0, utils_1.getNgRxComponentStores)(context);
47
+ const storeNames = identifiers.length > 0 ? (0, utils_1.asPattern)(identifiers) : null;
48
+ const thisSelects = `CallExpression[callee.object.type='ThisExpression'][callee.property.name='select']`;
49
+ const storeSelects = storeNames ? (0, utils_1.namedExpression)(storeNames) : null;
50
+ const selectsInArray = [];
51
+ return {
52
+ [`ClassDeclaration[superClass.name=/Store/] CallExpression[callee.name='combineLatest'] ${thisSelects} ~ ${thisSelects}`](node) {
67
53
  selectsInArray.push(node);
68
54
  },
69
- _a["CallExpression[callee.name='combineLatest'] ".concat(storeSelects, " ~ ").concat(storeSelects)] = function (node) {
55
+ [`CallExpression[callee.name='combineLatest'] ${storeSelects} ~ ${storeSelects}`](node) {
70
56
  selectsInArray.push(node);
71
57
  },
72
- _a["CallExpression[callee.name='combineLatest']:exit"] = function () {
73
- var e_1, _a;
74
- try {
75
- for (var selectsInArray_1 = __values(selectsInArray), selectsInArray_1_1 = selectsInArray_1.next(); !selectsInArray_1_1.done; selectsInArray_1_1 = selectsInArray_1.next()) {
76
- var node = selectsInArray_1_1.value;
77
- context.report({
78
- node: node,
79
- messageId: exports.messageId,
80
- });
81
- }
82
- }
83
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
84
- finally {
85
- try {
86
- if (selectsInArray_1_1 && !selectsInArray_1_1.done && (_a = selectsInArray_1.return)) _a.call(selectsInArray_1);
87
- }
88
- finally { if (e_1) throw e_1.error; }
58
+ [`CallExpression[callee.name='combineLatest']:exit`]() {
59
+ for (const node of selectsInArray) {
60
+ context.report({
61
+ node,
62
+ messageId: exports.messageId,
63
+ });
89
64
  }
90
65
  selectsInArray.length = 0;
91
66
  },
92
- _a;
67
+ };
93
68
  },
94
69
  });
95
70
  //# sourceMappingURL=avoid-combining-component-store-selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"avoid-combining-component-store-selectors.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/avoid-combining-component-store-selectors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAIqB;AACR,QAAA,SAAS,GAAG,uCAAuC,CAAC;AAIjE,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,iBAAiB;QAC7B,IAAI,EAAE;YACJ,WAAW,EAAE,mDAAmD;YAChE,WAAW,EAAE,MAAM;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IAAG,0CAA0C;eACxD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACN,IAAA,KAAqB,IAAA,8BAAsB,EAAC,OAAO,CAAC,YAApC,EAAhB,WAAW,mBAAG,EAAE,KAAA,CAAqC;QAC7D,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E,IAAM,WAAW,GAAG,oFAAoF,CAAC;QACzG,IAAM,YAAY,GAAG,UAAU,CAAC,CAAC,CAAC,IAAA,uBAAe,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAErE,IAAM,cAAc,GAA8B,EAAE,CAAC;QACrD;YACE,GAAC,gGAAyF,WAAW,gBAAM,WAAW,CAAE,IAAxH,UACE,IAA6B;gBAE7B,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC;YACD,GAAC,sDAA+C,YAAY,gBAAM,YAAY,CAAE,IAAhF,UACE,IAA6B;gBAE7B,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC;YACD,GAAC,kDAAkD,IAAnD;;;oBACE,KAAmB,IAAA,mBAAA,SAAA,cAAc,CAAA,8CAAA,0EAAE,CAAC;wBAA/B,IAAM,IAAI,2BAAA;wBACb,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI,MAAA;4BACJ,SAAS,mBAAA;yBACV,CAAC,CAAC;oBACL,CAAC;;;;;;;;;gBACD,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;YAC5B,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 asPattern,\n getNgRxComponentStores,\n namedExpression,\n} from '../../utils';\nexport const messageId = 'avoidCombiningComponentStoreSelectors';\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: 'component-store',\n docs: {\n description: 'Prefer combining selectors at the selector level.',\n recommended: 'warn',\n },\n schema: [],\n messages: {\n [messageId]: 'Combine selectors at the selector level.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxComponentStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n const thisSelects = `CallExpression[callee.object.type='ThisExpression'][callee.property.name='select']`;\n const storeSelects = storeNames ? namedExpression(storeNames) : null;\n\n const selectsInArray: TSESTree.CallExpression[] = [];\n return {\n [`ClassDeclaration[superClass.name=/Store/] CallExpression[callee.name='combineLatest'] ${thisSelects} ~ ${thisSelects}`](\n node: TSESTree.CallExpression\n ) {\n selectsInArray.push(node);\n },\n [`CallExpression[callee.name='combineLatest'] ${storeSelects} ~ ${storeSelects}`](\n node: TSESTree.CallExpression\n ) {\n selectsInArray.push(node);\n },\n [`CallExpression[callee.name='combineLatest']:exit`]() {\n for (const node of selectsInArray) {\n context.report({\n node,\n messageId,\n });\n }\n selectsInArray.length = 0;\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"avoid-combining-component-store-selectors.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/avoid-combining-component-store-selectors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAIqB;AACR,QAAA,SAAS,GAAG,uCAAuC,CAAC;AAIjE,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,iBAAiB;QAC7B,IAAI,EAAE;YACJ,WAAW,EAAE,mDAAmD;SACjE;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EAAE,0CAA0C;SACxD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,8BAAsB,EAAC,OAAO,CAAC,CAAC;QAC7D,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E,MAAM,WAAW,GAAG,oFAAoF,CAAC;QACzG,MAAM,YAAY,GAAG,UAAU,CAAC,CAAC,CAAC,IAAA,uBAAe,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAErE,MAAM,cAAc,GAA8B,EAAE,CAAC;QACrD,OAAO;YACL,CAAC,yFAAyF,WAAW,MAAM,WAAW,EAAE,CAAC,CACvH,IAA6B;gBAE7B,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC;YACD,CAAC,+CAA+C,YAAY,MAAM,YAAY,EAAE,CAAC,CAC/E,IAA6B;gBAE7B,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC;YACD,CAAC,kDAAkD,CAAC;gBAClD,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;oBAClC,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI;wBACJ,SAAS,EAAT,iBAAS;qBACV,CAAC,CAAC;gBACL,CAAC;gBACD,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;YAC5B,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n getNgRxComponentStores,\n namedExpression,\n} from '../../utils';\nexport const messageId = 'avoidCombiningComponentStoreSelectors';\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: 'component-store',\n docs: {\n description: 'Prefer combining selectors at the selector level.',\n },\n schema: [],\n messages: {\n [messageId]: 'Combine selectors at the selector level.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxComponentStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n const thisSelects = `CallExpression[callee.object.type='ThisExpression'][callee.property.name='select']`;\n const storeSelects = storeNames ? namedExpression(storeNames) : null;\n\n const selectsInArray: TSESTree.CallExpression[] = [];\n return {\n [`ClassDeclaration[superClass.name=/Store/] CallExpression[callee.name='combineLatest'] ${thisSelects} ~ ${thisSelects}`](\n node: TSESTree.CallExpression\n ) {\n selectsInArray.push(node);\n },\n [`CallExpression[callee.name='combineLatest'] ${storeSelects} ~ ${storeSelects}`](\n node: TSESTree.CallExpression\n ) {\n selectsInArray.push(node);\n },\n [`CallExpression[callee.name='combineLatest']:exit`]() {\n for (const node of selectsInArray) {\n context.report({\n node,\n messageId,\n });\n }\n selectsInArray.length = 0;\n },\n };\n },\n});\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const messageId = "avoidMappingComponentStoreSelectors";
2
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidMappingComponentStoreSelectors", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
3
+ export default _default;
@@ -22,12 +22,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var _a;
26
25
  Object.defineProperty(exports, "__esModule", { value: true });
27
26
  exports.messageId = void 0;
28
- var path = __importStar(require("path"));
29
- var rule_creator_1 = require("../../rule-creator");
30
- var utils_1 = require("../../utils");
27
+ const path = __importStar(require("path"));
28
+ const rule_creator_1 = require("../../rule-creator");
29
+ const utils_1 = require("../../utils");
31
30
  exports.messageId = 'avoidMappingComponentStoreSelectors';
32
31
  exports.default = (0, rule_creator_1.createRule)({
33
32
  name: path.parse(__filename).name,
@@ -36,34 +35,32 @@ exports.default = (0, rule_creator_1.createRule)({
36
35
  ngrxModule: 'component-store',
37
36
  docs: {
38
37
  description: 'Avoid mapping logic outside the selector level.',
39
- recommended: 'warn',
40
38
  },
41
39
  schema: [],
42
- messages: (_a = {},
43
- _a[exports.messageId] = 'Map logic at the selector level instead.',
44
- _a),
40
+ messages: {
41
+ [exports.messageId]: 'Map logic at the selector level instead.',
42
+ },
45
43
  },
46
44
  defaultOptions: [],
47
- create: function (context) {
48
- var _a;
49
- var _b = (0, utils_1.getNgRxComponentStores)(context).identifiers, identifiers = _b === void 0 ? [] : _b;
50
- var storeNames = identifiers.length > 0 ? (0, utils_1.asPattern)(identifiers) : null;
51
- var mapOperatorSelector = "[callee.property.name=pipe] > CallExpression[callee.name=map]";
52
- var selectors = [
53
- "ClassDeclaration[superClass.name=/Store/] CallExpression:has(CallExpression[callee.object.type='ThisExpression'][callee.property.name='select'])".concat(mapOperatorSelector),
45
+ create: (context) => {
46
+ const { identifiers = [] } = (0, utils_1.getNgRxComponentStores)(context);
47
+ const storeNames = identifiers.length > 0 ? (0, utils_1.asPattern)(identifiers) : null;
48
+ const mapOperatorSelector = `[callee.property.name=pipe] > CallExpression[callee.name=map]`;
49
+ const selectors = [
50
+ `ClassDeclaration[superClass.name=/Store/] CallExpression:has(CallExpression[callee.object.type='ThisExpression'][callee.property.name='select'])${mapOperatorSelector}`,
54
51
  storeNames &&
55
- "".concat((0, utils_1.namedCallableExpression)(storeNames)).concat(mapOperatorSelector),
52
+ `${(0, utils_1.namedCallableExpression)(storeNames)}${mapOperatorSelector}`,
56
53
  ]
57
54
  .filter(Boolean)
58
55
  .join(',');
59
- return _a = {},
60
- _a[selectors] = function (node) {
56
+ return {
57
+ [selectors](node) {
61
58
  context.report({
62
- node: node,
59
+ node,
63
60
  messageId: exports.messageId,
64
61
  });
65
62
  },
66
- _a;
63
+ };
67
64
  },
68
65
  });
69
66
  //# sourceMappingURL=avoid-mapping-component-store-selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"avoid-mapping-component-store-selectors.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/avoid-mapping-component-store-selectors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAIqB;AAER,QAAA,SAAS,GAAG,qCAAqC,CAAC;AAK/D,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,iBAAiB;QAC7B,IAAI,EAAE;YACJ,WAAW,EAAE,iDAAiD;YAC9D,WAAW,EAAE,MAAM;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IAAG,0CAA0C;eACxD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACN,IAAA,KAAqB,IAAA,8BAAsB,EAAC,OAAO,CAAC,YAApC,EAAhB,WAAW,mBAAG,EAAE,KAAA,CAAqC;QAC7D,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E,IAAM,mBAAmB,GAAG,+DAA+D,CAAC;QAC5F,IAAM,SAAS,GAAG;YAChB,0JAAmJ,mBAAmB,CAAE;YACxK,UAAU;gBACR,UAAG,IAAA,+BAAuB,EAAC,UAAU,CAAC,SAAG,mBAAmB,CAAE;SACjE;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb;YACE,GAAC,SAAS,IAAV,UAAY,IAAsC;gBAChD,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';\nimport {\n asPattern,\n getNgRxComponentStores,\n namedCallableExpression,\n} from '../../utils';\n\nexport const messageId = 'avoidMappingComponentStoreSelectors';\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: 'component-store',\n docs: {\n description: 'Avoid mapping logic outside the selector level.',\n recommended: 'warn',\n },\n schema: [],\n messages: {\n [messageId]: 'Map logic at the selector level instead.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxComponentStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n const mapOperatorSelector = `[callee.property.name=pipe] > CallExpression[callee.name=map]`;\n const selectors = [\n `ClassDeclaration[superClass.name=/Store/] CallExpression:has(CallExpression[callee.object.type='ThisExpression'][callee.property.name='select'])${mapOperatorSelector}`,\n storeNames &&\n `${namedCallableExpression(storeNames)}${mapOperatorSelector}`,\n ]\n .filter(Boolean)\n .join(',');\n\n return {\n [selectors](node: TSESTree.ArrowFunctionExpression) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"avoid-mapping-component-store-selectors.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/avoid-mapping-component-store-selectors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAIqB;AAER,QAAA,SAAS,GAAG,qCAAqC,CAAC;AAK/D,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,iBAAiB;QAC7B,IAAI,EAAE;YACJ,WAAW,EAAE,iDAAiD;SAC/D;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EAAE,0CAA0C;SACxD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,8BAAsB,EAAC,OAAO,CAAC,CAAC;QAC7D,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E,MAAM,mBAAmB,GAAG,+DAA+D,CAAC;QAC5F,MAAM,SAAS,GAAG;YAChB,mJAAmJ,mBAAmB,EAAE;YACxK,UAAU;gBACR,GAAG,IAAA,+BAAuB,EAAC,UAAU,CAAC,GAAG,mBAAmB,EAAE;SACjE;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,OAAO;YACL,CAAC,SAAS,CAAC,CAAC,IAAsC;gBAChD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAT,iBAAS;iBACV,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n getNgRxComponentStores,\n namedCallableExpression,\n} from '../../utils';\n\nexport const messageId = 'avoidMappingComponentStoreSelectors';\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: 'component-store',\n docs: {\n description: 'Avoid mapping logic outside the selector level.',\n },\n schema: [],\n messages: {\n [messageId]: 'Map logic at the selector level instead.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxComponentStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n const mapOperatorSelector = `[callee.property.name=pipe] > CallExpression[callee.name=map]`;\n const selectors = [\n `ClassDeclaration[superClass.name=/Store/] CallExpression:has(CallExpression[callee.object.type='ThisExpression'][callee.property.name='select'])${mapOperatorSelector}`,\n storeNames &&\n `${namedCallableExpression(storeNames)}${mapOperatorSelector}`,\n ]\n .filter(Boolean)\n .join(',');\n\n return {\n [selectors](node: TSESTree.ArrowFunctionExpression) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const messageId = "updaterExplicitReturnType";
2
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"updaterExplicitReturnType", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
3
+ export default _default;
@@ -22,12 +22,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var _a;
26
25
  Object.defineProperty(exports, "__esModule", { value: true });
27
26
  exports.messageId = void 0;
28
- var path = __importStar(require("path"));
29
- var rule_creator_1 = require("../../rule-creator");
30
- var utils_1 = require("../../utils");
27
+ const path = __importStar(require("path"));
28
+ const rule_creator_1 = require("../../rule-creator");
29
+ const utils_1 = require("../../utils");
31
30
  exports.messageId = 'updaterExplicitReturnType';
32
31
  exports.default = (0, rule_creator_1.createRule)({
33
32
  name: path.parse(__filename).name,
@@ -36,34 +35,32 @@ exports.default = (0, rule_creator_1.createRule)({
36
35
  ngrxModule: 'component-store',
37
36
  docs: {
38
37
  description: '`Updater` should have an explicit return type.',
39
- recommended: 'warn',
40
38
  },
41
39
  schema: [],
42
- messages: (_a = {},
43
- _a[exports.messageId] = '`Updater` should have an explicit return type when using arrow functions: `this.store.updater((state, value): State => {}`.',
44
- _a),
40
+ messages: {
41
+ [exports.messageId]: '`Updater` should have an explicit return type when using arrow functions: `this.store.updater((state, value): State => {}`.',
42
+ },
45
43
  },
46
44
  defaultOptions: [],
47
- create: function (context) {
48
- var _a;
49
- var _b = (0, utils_1.getNgRxComponentStores)(context).identifiers, identifiers = _b === void 0 ? [] : _b;
50
- var storeNames = identifiers.length > 0 ? (0, utils_1.asPattern)(identifiers) : null;
51
- var withoutTypeAnnotation = "ArrowFunctionExpression:not([returnType.typeAnnotation])";
52
- var selectors = [
53
- "ClassDeclaration[superClass.name=/Store/] CallExpression[callee.object.type='ThisExpression'][callee.property.name='updater'] > ".concat(withoutTypeAnnotation),
45
+ create: (context) => {
46
+ const { identifiers = [] } = (0, utils_1.getNgRxComponentStores)(context);
47
+ const storeNames = identifiers.length > 0 ? (0, utils_1.asPattern)(identifiers) : null;
48
+ const withoutTypeAnnotation = `ArrowFunctionExpression:not([returnType.typeAnnotation])`;
49
+ const selectors = [
50
+ `ClassDeclaration[superClass.name=/Store/] CallExpression[callee.object.type='ThisExpression'][callee.property.name='updater'] > ${withoutTypeAnnotation}`,
54
51
  storeNames &&
55
- "".concat((0, utils_1.namedExpression)(storeNames), "[callee.property.name='updater'] > ").concat(withoutTypeAnnotation),
52
+ `${(0, utils_1.namedExpression)(storeNames)}[callee.property.name='updater'] > ${withoutTypeAnnotation}`,
56
53
  ]
57
54
  .filter(Boolean)
58
55
  .join(',');
59
- return _a = {},
60
- _a[selectors] = function (node) {
56
+ return {
57
+ [selectors](node) {
61
58
  context.report({
62
- node: node,
59
+ node,
63
60
  messageId: exports.messageId,
64
61
  });
65
62
  },
66
- _a;
63
+ };
67
64
  },
68
65
  });
69
66
  //# sourceMappingURL=updater-explicit-return-type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"updater-explicit-return-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/updater-explicit-return-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAIqB;AAER,QAAA,SAAS,GAAG,2BAA2B,CAAC;AAKrD,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,iBAAiB;QAC7B,IAAI,EAAE;YACJ,WAAW,EAAE,gDAAgD;YAC7D,WAAW,EAAE,MAAM;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IACR,6HAA6H;eAChI;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACN,IAAA,KAAqB,IAAA,8BAAsB,EAAC,OAAO,CAAC,YAApC,EAAhB,WAAW,mBAAG,EAAE,KAAA,CAAqC;QAC7D,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1E,IAAM,qBAAqB,GAAG,0DAA0D,CAAC;QACzF,IAAM,SAAS,GAAG;YAChB,0IAAmI,qBAAqB,CAAE;YAC1J,UAAU;gBACR,UAAG,IAAA,uBAAe,EAChB,UAAU,CACX,gDAAsC,qBAAqB,CAAE;SACjE;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb;YACE,GAAC,SAAS,IAAV,UAAY,IAAsC;gBAChD,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';\nimport {\n asPattern,\n getNgRxComponentStores,\n namedExpression,\n} from '../../utils';\n\nexport const messageId = 'updaterExplicitReturnType';\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: 'component-store',\n docs: {\n description: '`Updater` should have an explicit return type.',\n recommended: 'warn',\n },\n schema: [],\n messages: {\n [messageId]:\n '`Updater` should have an explicit return type when using arrow functions: `this.store.updater((state, value): State => {}`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxComponentStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n const withoutTypeAnnotation = `ArrowFunctionExpression:not([returnType.typeAnnotation])`;\n const selectors = [\n `ClassDeclaration[superClass.name=/Store/] CallExpression[callee.object.type='ThisExpression'][callee.property.name='updater'] > ${withoutTypeAnnotation}`,\n storeNames &&\n `${namedExpression(\n storeNames\n )}[callee.property.name='updater'] > ${withoutTypeAnnotation}`,\n ]\n .filter(Boolean)\n .join(',');\n\n return {\n [selectors](node: TSESTree.ArrowFunctionExpression) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"updater-explicit-return-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/updater-explicit-return-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAIqB;AAER,QAAA,SAAS,GAAG,2BAA2B,CAAC;AAKrD,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,iBAAiB;QAC7B,IAAI,EAAE;YACJ,WAAW,EAAE,gDAAgD;SAC9D;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,6HAA6H;SAChI;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,8BAAsB,EAAC,OAAO,CAAC,CAAC;QAC7D,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1E,MAAM,qBAAqB,GAAG,0DAA0D,CAAC;QACzF,MAAM,SAAS,GAAG;YAChB,mIAAmI,qBAAqB,EAAE;YAC1J,UAAU;gBACR,GAAG,IAAA,uBAAe,EAChB,UAAU,CACX,sCAAsC,qBAAqB,EAAE;SACjE;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,OAAO;YACL,CAAC,SAAS,CAAC,CAAC,IAAsC;gBAChD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAT,iBAAS;iBACV,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n getNgRxComponentStores,\n namedExpression,\n} from '../../utils';\n\nexport const messageId = 'updaterExplicitReturnType';\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: 'component-store',\n docs: {\n description: '`Updater` should have an explicit return type.',\n },\n schema: [],\n messages: {\n [messageId]:\n '`Updater` should have an explicit return type when using arrow functions: `this.store.updater((state, value): State => {}`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxComponentStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n const withoutTypeAnnotation = `ArrowFunctionExpression:not([returnType.typeAnnotation])`;\n const selectors = [\n `ClassDeclaration[superClass.name=/Store/] CallExpression[callee.object.type='ThisExpression'][callee.property.name='updater'] > ${withoutTypeAnnotation}`,\n storeNames &&\n `${namedExpression(\n storeNames\n )}[callee.property.name='updater'] > ${withoutTypeAnnotation}`,\n ]\n .filter(Boolean)\n .join(',');\n\n return {\n [selectors](node: TSESTree.ArrowFunctionExpression) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
@@ -0,0 +1,4 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+ export declare const messageId = "avoidCyclicEffects";
3
+ declare const _default: ESLintUtils.RuleModule<"avoidCyclicEffects", readonly [], unknown, ESLintUtils.RuleListener>;
4
+ export default _default;
@@ -22,50 +22,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __read = (this && this.__read) || function (o, n) {
26
- var m = typeof Symbol === "function" && o[Symbol.iterator];
27
- if (!m) return o;
28
- var i = m.call(o), r, ar = [], e;
29
- try {
30
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
31
- }
32
- catch (error) { e = { error: error }; }
33
- finally {
34
- try {
35
- if (r && !r.done && (m = i["return"])) m.call(i);
36
- }
37
- finally { if (e) throw e.error; }
38
- }
39
- return ar;
40
- };
41
- var __values = (this && this.__values) || function(o) {
42
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
43
- if (m) return m.call(o);
44
- if (o && typeof o.length === "number") return {
45
- next: function () {
46
- if (o && i >= o.length) o = void 0;
47
- return { value: o && o[i++], done: !o };
48
- }
49
- };
50
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
51
- };
52
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
53
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
54
- if (ar || !(i in from)) {
55
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
56
- ar[i] = from[i];
57
- }
58
- }
59
- return to.concat(ar || Array.prototype.slice.call(from));
60
- };
61
- var _a;
62
25
  Object.defineProperty(exports, "__esModule", { value: true });
63
26
  exports.messageId = void 0;
64
- var eslint_etc_1 = require("eslint-etc");
65
- var path = __importStar(require("path"));
66
- var ts = __importStar(require("typescript"));
67
- var rule_creator_1 = require("../../rule-creator");
68
- var utils_1 = require("../../utils");
27
+ const utils_1 = require("@typescript-eslint/utils");
28
+ const path = __importStar(require("path"));
29
+ const ts = __importStar(require("typescript"));
30
+ const rule_creator_1 = require("../../rule-creator");
31
+ const utils_2 = require("../../utils");
69
32
  exports.messageId = 'avoidCyclicEffects';
70
33
  // This rule is a modified version (to support dispatch: false) from the eslint-plugin-rxjs plugin.
71
34
  // The original implementation can be found at https://github.com/cartant/eslint-plugin-rxjs/blob/main/source/rules/no-cyclic-action.ts
@@ -77,113 +40,88 @@ exports.default = (0, rule_creator_1.createRule)({
77
40
  ngrxModule: 'effects',
78
41
  docs: {
79
42
  description: 'Avoid `Effect` that re-emit filtered actions.',
80
- recommended: 'warn',
81
43
  requiresTypeChecking: true,
82
44
  },
83
45
  schema: [],
84
- messages: (_a = {},
85
- _a[exports.messageId] = '`Effect` that re-emit filtered actions are forbidden.',
86
- _a),
46
+ messages: {
47
+ [exports.messageId]: '`Effect` that re-emit filtered actions are forbidden.',
48
+ },
87
49
  },
88
50
  defaultOptions: [],
89
- create: function (context) {
90
- var _a;
91
- var _b = (0, utils_1.getNgRxEffectActions)(context).identifiers, identifiers = _b === void 0 ? [] : _b;
92
- var actionsNames = identifiers.length > 0 ? (0, utils_1.asPattern)(identifiers) : null;
51
+ create: (context) => {
52
+ const { identifiers = [] } = (0, utils_2.getNgRxEffectActions)(context);
53
+ const actionsNames = identifiers.length > 0 ? (0, utils_2.asPattern)(identifiers) : null;
93
54
  if (!actionsNames) {
94
55
  return {};
95
56
  }
96
- var _c = (0, eslint_etc_1.getTypeServices)(context), getType = _c.getType, typeChecker = _c.typeChecker;
57
+ const services = utils_1.ESLintUtils.getParserServices(context);
58
+ const typeChecker = services.program.getTypeChecker();
97
59
  function checkNode(pipeCallExpression) {
98
- var e_1, _a;
99
- var operatorCallExpression = pipeCallExpression.arguments.find(function (arg) {
100
- return (0, utils_1.isCallExpression)(arg) &&
101
- (0, utils_1.isIdentifier)(arg.callee) &&
102
- arg.callee.name === 'ofType';
103
- });
60
+ const operatorCallExpression = pipeCallExpression.arguments.find((arg) => (0, utils_2.isCallExpression)(arg) &&
61
+ (0, utils_2.isIdentifier)(arg.callee) &&
62
+ arg.callee.name === 'ofType');
104
63
  if (!operatorCallExpression) {
105
64
  return;
106
65
  }
107
- var operatorType = getType(operatorCallExpression);
108
- var _b = __read(typeChecker.getSignaturesOfType(operatorType, ts.SignatureKind.Call), 1), signature = _b[0];
66
+ const operatorType = services.getTypeAtLocation(operatorCallExpression);
67
+ const [signature] = typeChecker.getSignaturesOfType(operatorType, ts.SignatureKind.Call);
109
68
  if (!signature) {
110
69
  return;
111
70
  }
112
- var operatorReturnType = typeChecker.getReturnTypeOfSignature(signature);
113
- if (!(0, utils_1.isTypeReference)(operatorReturnType)) {
71
+ const operatorReturnType = typeChecker.getReturnTypeOfSignature(signature);
72
+ if (!(0, utils_2.isTypeReference)(operatorReturnType)) {
114
73
  return;
115
74
  }
116
- var _c = __read(typeChecker.getTypeArguments(operatorReturnType), 1), operatorElementType = _c[0];
75
+ const [operatorElementType] = typeChecker.getTypeArguments(operatorReturnType);
117
76
  if (!operatorElementType) {
118
77
  return;
119
78
  }
120
- var pipeType = getType(pipeCallExpression);
121
- if (!(0, utils_1.isTypeReference)(pipeType)) {
79
+ const pipeType = services.getTypeAtLocation(pipeCallExpression);
80
+ if (!(0, utils_2.isTypeReference)(pipeType)) {
122
81
  return;
123
82
  }
124
- var _d = __read(typeChecker.getTypeArguments(pipeType), 1), pipeElementType = _d[0];
83
+ const [pipeElementType] = typeChecker.getTypeArguments(pipeType);
125
84
  if (!pipeElementType) {
126
85
  return;
127
86
  }
128
- var operatorActionTypes = getActionTypes(operatorElementType);
129
- var pipeActionTypes = getActionTypes(pipeElementType);
130
- try {
131
- for (var operatorActionTypes_1 = __values(operatorActionTypes), operatorActionTypes_1_1 = operatorActionTypes_1.next(); !operatorActionTypes_1_1.done; operatorActionTypes_1_1 = operatorActionTypes_1.next()) {
132
- var actionType = operatorActionTypes_1_1.value;
133
- if (pipeActionTypes.includes(actionType)) {
134
- context.report({
135
- node: pipeCallExpression.callee,
136
- messageId: exports.messageId,
137
- });
138
- return;
139
- }
140
- }
141
- }
142
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
143
- finally {
144
- try {
145
- if (operatorActionTypes_1_1 && !operatorActionTypes_1_1.done && (_a = operatorActionTypes_1.return)) _a.call(operatorActionTypes_1);
87
+ const operatorActionTypes = getActionTypes(operatorElementType);
88
+ const pipeActionTypes = getActionTypes(pipeElementType);
89
+ for (const actionType of operatorActionTypes) {
90
+ if (pipeActionTypes.includes(actionType)) {
91
+ context.report({
92
+ node: pipeCallExpression.callee,
93
+ messageId: exports.messageId,
94
+ });
95
+ return;
146
96
  }
147
- finally { if (e_1) throw e_1.error; }
148
97
  }
149
98
  }
150
99
  function getActionType(symbol) {
151
- var valueDeclaration = symbol.valueDeclaration;
100
+ const { valueDeclaration } = symbol;
152
101
  if (!valueDeclaration) {
153
102
  return null;
154
103
  }
155
104
  if (valueDeclaration.kind === ts.SyntaxKind.PropertyDeclaration) {
156
- var parent_1 = symbol.parent;
157
- return parent_1.valueDeclaration
158
- ? typeChecker.getTypeOfSymbolAtLocation(parent_1, parent_1.valueDeclaration)
105
+ const { parent } = symbol;
106
+ return parent.valueDeclaration
107
+ ? typeChecker.getTypeOfSymbolAtLocation(parent, parent.valueDeclaration)
159
108
  : null;
160
109
  }
161
110
  return typeChecker.getTypeOfSymbolAtLocation(symbol, valueDeclaration);
162
111
  }
163
112
  function getActionTypes(type) {
164
- var e_2, _a;
165
113
  if (type.isUnion()) {
166
- var memberActionTypes = [];
167
- try {
168
- for (var _b = __values(type.types), _c = _b.next(); !_c.done; _c = _b.next()) {
169
- var memberType = _c.value;
170
- memberActionTypes.push.apply(memberActionTypes, __spreadArray([], __read(getActionTypes(memberType)), false));
171
- }
172
- }
173
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
174
- finally {
175
- try {
176
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
177
- }
178
- finally { if (e_2) throw e_2.error; }
114
+ const memberActionTypes = [];
115
+ for (const memberType of type.types) {
116
+ memberActionTypes.push(...getActionTypes(memberType));
179
117
  }
180
118
  return memberActionTypes;
181
119
  }
182
- var symbol = typeChecker.getPropertyOfType(type, 'type');
120
+ const symbol = typeChecker.getPropertyOfType(type, 'type');
183
121
  if (!symbol) {
184
122
  return [];
185
123
  }
186
- var actionType = getActionType(symbol);
124
+ const actionType = getActionType(symbol);
187
125
  if (!actionType) {
188
126
  return [];
189
127
  }
@@ -194,19 +132,19 @@ exports.default = (0, rule_creator_1.createRule)({
194
132
  }
195
133
  return [typeChecker.typeToString(actionType)];
196
134
  }
197
- var firstPipe = true;
198
- return _a = {},
199
- _a["".concat(utils_1.createEffectExpression, ":not([arguments.1]:has(Property[key.name='dispatch'][value.value=false])) CallExpression[callee.property.name='pipe'][callee.object.property.name=").concat(actionsNames, "]")] = function (node) {
135
+ let firstPipe = true;
136
+ return {
137
+ [`${utils_2.createEffectExpression}:not([arguments.1]:has(Property[key.name='dispatch'][value.value=false])) CallExpression[callee.property.name='pipe'][callee.object.property.name=${actionsNames}]`](node) {
200
138
  if (firstPipe) {
201
139
  checkNode(node);
202
140
  firstPipe = false;
203
141
  return;
204
142
  }
205
143
  },
206
- _a["".concat(utils_1.createEffectExpression, ":not([arguments.1]:has(Property[key.name='dispatch'][value.value=false])) CallExpression[callee.property.name='pipe']:exit")] = function () {
144
+ [`${utils_2.createEffectExpression}:not([arguments.1]:has(Property[key.name='dispatch'][value.value=false])) CallExpression[callee.property.name='pipe']:exit`]() {
207
145
  firstPipe = true;
208
146
  },
209
- _a;
147
+ };
210
148
  },
211
149
  });
212
150
  //# sourceMappingURL=avoid-cyclic-effects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"avoid-cyclic-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/avoid-cyclic-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6C;AAC7C,yCAA6B;AAC7B,6CAAiC;AACjC,mDAAgD;AAChD,qCAOqB;AAER,QAAA,SAAS,GAAG,oBAAoB,CAAC;AAK9C,mGAAmG;AACnG,uIAAuI;AACvI,0CAA0C;AAE1C,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,+CAA+C;YAC5D,WAAW,EAAE,MAAM;YACnB,oBAAoB,EAAE,IAAI;SAC3B;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IAAG,uDAAuD;eACrE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACN,IAAA,KAAqB,IAAA,4BAAoB,EAAC,OAAO,CAAC,YAAlC,EAAhB,WAAW,mBAAG,EAAE,KAAA,CAAmC;QAC3D,IAAM,YAAY,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE5E,IAAI,CAAC,YAAY,EAAE,CAAC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CAAC,KAAK,CAAA,gBAAA,4BAAE,CAAC;wBAAjC,IAAM,UAAU,WAAA;wBACnB,iBAAiB,CAAC,IAAI,OAAtB,iBAAiB,2BAAS,cAAc,CAAC,UAAU,CAAC,WAAE;oBACxD,CAAC;;;;;;;;;gBACD,OAAO,iBAAiB,CAAC;YAC3B,CAAC;YAED,IAAM,MAAM,GAAG,WAAW,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAE3D,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,IAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;YAEzC,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,gCAAgC;YAChC,iFAAiF;YACjF,IAAI,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACtD,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;QAChD,CAAC;QAED,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB;YACE,GAAC,UAAG,8BAAsB,+JAAqJ,YAAY,MAAG,IAA9L,UACE,IAAI;gBAEJ,IAAI,SAAS,EAAE,CAAC;oBACd,SAAS,CAAC,IAAI,CAAC,CAAC;oBAChB,SAAS,GAAG,KAAK,CAAC;oBAClB,OAAO;gBACT,CAAC;YACH,CAAC;YAED,GAAC,UAAG,8BAAsB,+HAA4H,IAAtJ;gBACE,SAAS,GAAG,IAAI,CAAC;YACnB,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport { getTypeServices } from 'eslint-etc';\nimport * as path from 'path';\nimport * as ts from 'typescript';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n createEffectExpression,\n getNgRxEffectActions,\n isCallExpression,\n isIdentifier,\n isTypeReference,\n} from '../../utils';\n\nexport const messageId = 'avoidCyclicEffects';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\n// This rule is a modified version (to support dispatch: false) from the eslint-plugin-rxjs plugin.\n// The original implementation can be found at https://github.com/cartant/eslint-plugin-rxjs/blob/main/source/rules/no-cyclic-action.ts\n// Thank you Nicholas Jamieson (@cartant).\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n ngrxModule: 'effects',\n docs: {\n description: 'Avoid `Effect` that re-emit filtered actions.',\n recommended: 'warn',\n requiresTypeChecking: true,\n },\n schema: [],\n messages: {\n [messageId]: '`Effect` that re-emit filtered actions are forbidden.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxEffectActions(context);\n const actionsNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!actionsNames) {\n return {};\n }\n\n const { getType, typeChecker } = getTypeServices(context);\n\n function checkNode(pipeCallExpression: TSESTree.CallExpression) {\n const operatorCallExpression = pipeCallExpression.arguments.find(\n (arg) =>\n isCallExpression(arg) &&\n isIdentifier(arg.callee) &&\n arg.callee.name === 'ofType'\n );\n if (!operatorCallExpression) {\n return;\n }\n const operatorType = getType(operatorCallExpression);\n const [signature] = typeChecker.getSignaturesOfType(\n operatorType,\n ts.SignatureKind.Call\n );\n\n if (!signature) {\n return;\n }\n const operatorReturnType =\n typeChecker.getReturnTypeOfSignature(signature);\n if (!isTypeReference(operatorReturnType)) {\n return;\n }\n const [operatorElementType] =\n typeChecker.getTypeArguments(operatorReturnType);\n if (!operatorElementType) {\n return;\n }\n\n const pipeType = getType(pipeCallExpression);\n if (!isTypeReference(pipeType)) {\n return;\n }\n const [pipeElementType] = typeChecker.getTypeArguments(pipeType);\n if (!pipeElementType) {\n return;\n }\n\n const operatorActionTypes = getActionTypes(operatorElementType);\n const pipeActionTypes = getActionTypes(pipeElementType);\n\n for (const actionType of operatorActionTypes) {\n if (pipeActionTypes.includes(actionType)) {\n context.report({\n node: pipeCallExpression.callee,\n messageId,\n });\n return;\n }\n }\n }\n\n function getActionType(symbol: ts.Symbol): ts.Type | null {\n const { valueDeclaration } = symbol;\n\n if (!valueDeclaration) {\n return null;\n }\n\n if (valueDeclaration.kind === ts.SyntaxKind.PropertyDeclaration) {\n const { parent } = symbol as typeof symbol & { parent: ts.Symbol };\n return parent.valueDeclaration\n ? typeChecker.getTypeOfSymbolAtLocation(\n parent,\n parent.valueDeclaration\n )\n : null;\n }\n\n return typeChecker.getTypeOfSymbolAtLocation(symbol, valueDeclaration);\n }\n\n function getActionTypes(type: ts.Type): string[] {\n if (type.isUnion()) {\n const memberActionTypes: string[] = [];\n for (const memberType of type.types) {\n memberActionTypes.push(...getActionTypes(memberType));\n }\n return memberActionTypes;\n }\n\n const symbol = typeChecker.getPropertyOfType(type, 'type');\n\n if (!symbol) {\n return [];\n }\n\n const actionType = getActionType(symbol);\n\n if (!actionType) {\n return [];\n }\n\n // TODO: support \"dynamic\" types\n // e.g. const genericFoo = createAction(`${subject} FOO`); (resolves to 'string')\n if (typeChecker.typeToString(actionType) === 'string') {\n return [];\n }\n return [typeChecker.typeToString(actionType)];\n }\n\n let firstPipe = true;\n return {\n [`${createEffectExpression}:not([arguments.1]:has(Property[key.name='dispatch'][value.value=false])) CallExpression[callee.property.name='pipe'][callee.object.property.name=${actionsNames}]`](\n node\n ) {\n if (firstPipe) {\n checkNode(node);\n firstPipe = false;\n return;\n }\n },\n\n [`${createEffectExpression}:not([arguments.1]:has(Property[key.name='dispatch'][value.value=false])) CallExpression[callee.property.name='pipe']:exit`]() {\n firstPipe = true;\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"avoid-cyclic-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/avoid-cyclic-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsE;AACtE,2CAA6B;AA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AW,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACtD,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;QAChD,CAAC;QAED,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,OAAO;YACL,CAAC,GAAG,8BAAsB,qJAAqJ,YAAY,GAAG,CAAC,CAC7L,IAAI;gBAEJ,IAAI,SAAS,EAAE,CAAC;oBACd,SAAS,CAAC,IAAI,CAAC,CAAC;oBAChB,SAAS,GAAG,KAAK,CAAC;oBAClB,OAAO;gBACT,CAAC;YACH,CAAC;YAED,CAAC,GAAG,8BAAsB,4HAA4H,CAAC;gBACrJ,SAAS,GAAG,IAAI,CAAC;YACnB,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { ESLintUtils, type TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport * as ts from 'typescript';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n createEffectExpression,\n getNgRxEffectActions,\n isCallExpression,\n isIdentifier,\n isTypeReference,\n} from '../../utils';\n\nexport const messageId = 'avoidCyclicEffects';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\n// This rule is a modified version (to support dispatch: false) from the eslint-plugin-rxjs plugin.\n// The original implementation can be found at https://github.com/cartant/eslint-plugin-rxjs/blob/main/source/rules/no-cyclic-action.ts\n// Thank you Nicholas Jamieson (@cartant).\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n ngrxModule: 'effects',\n docs: {\n description: 'Avoid `Effect` that re-emit filtered actions.',\n requiresTypeChecking: true,\n },\n schema: [],\n messages: {\n [messageId]: '`Effect` that re-emit filtered actions are forbidden.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxEffectActions(context);\n const actionsNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!actionsNames) {\n return {};\n }\n\n const services = ESLintUtils.getParserServices(context);\n const typeChecker = services.program.getTypeChecker();\n\n function checkNode(pipeCallExpression: TSESTree.CallExpression) {\n const operatorCallExpression = pipeCallExpression.arguments.find(\n (arg) =>\n isCallExpression(arg) &&\n isIdentifier(arg.callee) &&\n arg.callee.name === 'ofType'\n );\n if (!operatorCallExpression) {\n return;\n }\n const operatorType = services.getTypeAtLocation(operatorCallExpression);\n const [signature] = typeChecker.getSignaturesOfType(\n operatorType,\n ts.SignatureKind.Call\n );\n\n if (!signature) {\n return;\n }\n const operatorReturnType =\n typeChecker.getReturnTypeOfSignature(signature);\n if (!isTypeReference(operatorReturnType)) {\n return;\n }\n const [operatorElementType] =\n typeChecker.getTypeArguments(operatorReturnType);\n if (!operatorElementType) {\n return;\n }\n\n const pipeType = services.getTypeAtLocation(pipeCallExpression);\n if (!isTypeReference(pipeType)) {\n return;\n }\n const [pipeElementType] = typeChecker.getTypeArguments(pipeType);\n if (!pipeElementType) {\n return;\n }\n\n const operatorActionTypes = getActionTypes(operatorElementType);\n const pipeActionTypes = getActionTypes(pipeElementType);\n\n for (const actionType of operatorActionTypes) {\n if (pipeActionTypes.includes(actionType)) {\n context.report({\n node: pipeCallExpression.callee,\n messageId,\n });\n return;\n }\n }\n }\n\n function getActionType(symbol: ts.Symbol): ts.Type | null {\n const { valueDeclaration } = symbol;\n\n if (!valueDeclaration) {\n return null;\n }\n\n if (valueDeclaration.kind === ts.SyntaxKind.PropertyDeclaration) {\n const { parent } = symbol as typeof symbol & { parent: ts.Symbol };\n return parent.valueDeclaration\n ? typeChecker.getTypeOfSymbolAtLocation(\n parent,\n parent.valueDeclaration\n )\n : null;\n }\n\n return typeChecker.getTypeOfSymbolAtLocation(symbol, valueDeclaration);\n }\n\n function getActionTypes(type: ts.Type): string[] {\n if (type.isUnion()) {\n const memberActionTypes: string[] = [];\n for (const memberType of type.types) {\n memberActionTypes.push(...getActionTypes(memberType));\n }\n return memberActionTypes;\n }\n\n const symbol = typeChecker.getPropertyOfType(type, 'type');\n\n if (!symbol) {\n return [];\n }\n\n const actionType = getActionType(symbol);\n\n if (!actionType) {\n return [];\n }\n\n // TODO: support \"dynamic\" types\n // e.g. const genericFoo = createAction(`${subject} FOO`); (resolves to 'string')\n if (typeChecker.typeToString(actionType) === 'string') {\n return [];\n }\n return [typeChecker.typeToString(actionType)];\n }\n\n let firstPipe = true;\n return {\n [`${createEffectExpression}:not([arguments.1]:has(Property[key.name='dispatch'][value.value=false])) CallExpression[callee.property.name='pipe'][callee.object.property.name=${actionsNames}]`](\n node\n ) {\n if (firstPipe) {\n checkNode(node);\n firstPipe = false;\n return;\n }\n },\n\n [`${createEffectExpression}:not([arguments.1]:has(Property[key.name='dispatch'][value.value=false])) CallExpression[callee.property.name='pipe']:exit`]() {\n firstPipe = true;\n },\n };\n },\n});\n"]}