@ngrx/eslint-plugin 20.0.1 → 21.0.0-beta.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 (168) hide show
  1. package/package.json +1 -2
  2. package/schematics/ng-add/schema.json +15 -0
  3. package/scripts/generate-config.js +61 -72
  4. package/scripts/generate-config.js.map +1 -1
  5. package/scripts/generate-docs.js +21 -22
  6. package/scripts/generate-docs.js.map +1 -1
  7. package/scripts/generate-overview.js +63 -56
  8. package/scripts/generate-overview.js.map +1 -1
  9. package/spec/utils/from-fixture.js.map +1 -1
  10. package/spec/utils/rule-tester.d.ts +1 -4
  11. package/spec/utils/rule-tester.js +7 -9
  12. package/spec/utils/rule-tester.js.map +1 -1
  13. package/src/configs/all.js +0 -9
  14. package/src/configs/all.js.map +1 -1
  15. package/src/configs/all.json +0 -8
  16. package/src/configs/allTypeChecked.d.ts +7 -0
  17. package/src/configs/allTypeChecked.js +61 -0
  18. package/src/configs/allTypeChecked.js.map +1 -0
  19. package/src/configs/allTypeChecked.json +41 -0
  20. package/src/configs/component-store.js +0 -1
  21. package/src/configs/component-store.js.map +1 -1
  22. package/src/configs/effects.js +0 -8
  23. package/src/configs/effects.js.map +1 -1
  24. package/src/configs/effects.json +0 -7
  25. package/src/configs/effectsTypeChecked.d.ts +7 -0
  26. package/src/configs/effectsTypeChecked.js +33 -0
  27. package/src/configs/effectsTypeChecked.js.map +1 -0
  28. package/src/configs/effectsTypeChecked.json +13 -0
  29. package/src/configs/operators.js +0 -1
  30. package/src/configs/operators.js.map +1 -1
  31. package/src/configs/signals.js +0 -7
  32. package/src/configs/signals.js.map +1 -1
  33. package/src/configs/signals.json +1 -7
  34. package/src/configs/signalsTypeChecked.d.ts +7 -0
  35. package/src/configs/signalsTypeChecked.js +31 -0
  36. package/src/configs/signalsTypeChecked.js.map +1 -0
  37. package/src/configs/signalsTypeChecked.json +11 -0
  38. package/src/configs/store.js +0 -1
  39. package/src/configs/store.js.map +1 -1
  40. package/src/index.d.ts +35 -56
  41. package/src/rule-creator.d.ts +7 -23
  42. package/src/rule-creator.js +22 -18
  43. package/src/rule-creator.js.map +1 -1
  44. package/src/rules/component-store/avoid-combining-component-store-selectors.d.ts +1 -1
  45. package/src/rules/component-store/avoid-combining-component-store-selectors.js +1 -1
  46. package/src/rules/component-store/avoid-combining-component-store-selectors.js.map +1 -1
  47. package/src/rules/component-store/avoid-mapping-component-store-selectors.d.ts +1 -1
  48. package/src/rules/component-store/avoid-mapping-component-store-selectors.js +1 -1
  49. package/src/rules/component-store/avoid-mapping-component-store-selectors.js.map +1 -1
  50. package/src/rules/component-store/require-super-ondestroy.d.ts +1 -1
  51. package/src/rules/component-store/require-super-ondestroy.js +1 -1
  52. package/src/rules/component-store/require-super-ondestroy.js.map +1 -1
  53. package/src/rules/component-store/updater-explicit-return-type.d.ts +1 -1
  54. package/src/rules/component-store/updater-explicit-return-type.js +1 -1
  55. package/src/rules/component-store/updater-explicit-return-type.js.map +1 -1
  56. package/src/rules/effects/avoid-cyclic-effects.d.ts +1 -1
  57. package/src/rules/effects/avoid-cyclic-effects.js +1 -1
  58. package/src/rules/effects/avoid-cyclic-effects.js.map +1 -1
  59. package/src/rules/effects/no-dispatch-in-effects.d.ts +1 -1
  60. package/src/rules/effects/no-dispatch-in-effects.js +1 -1
  61. package/src/rules/effects/no-dispatch-in-effects.js.map +1 -1
  62. package/src/rules/effects/no-effects-in-providers.d.ts +1 -1
  63. package/src/rules/effects/no-effects-in-providers.js +1 -1
  64. package/src/rules/effects/no-effects-in-providers.js.map +1 -1
  65. package/src/rules/effects/no-multiple-actions-in-effects.d.ts +1 -1
  66. package/src/rules/effects/no-multiple-actions-in-effects.js +1 -1
  67. package/src/rules/effects/no-multiple-actions-in-effects.js.map +1 -1
  68. package/src/rules/effects/prefer-action-creator-in-of-type.d.ts +1 -1
  69. package/src/rules/effects/prefer-action-creator-in-of-type.js +1 -1
  70. package/src/rules/effects/prefer-action-creator-in-of-type.js.map +1 -1
  71. package/src/rules/effects/prefer-effect-callback-in-block-statement.d.ts +1 -1
  72. package/src/rules/effects/prefer-effect-callback-in-block-statement.js +1 -1
  73. package/src/rules/effects/prefer-effect-callback-in-block-statement.js.map +1 -1
  74. package/src/rules/effects/use-effects-lifecycle-interface.d.ts +1 -1
  75. package/src/rules/effects/use-effects-lifecycle-interface.js +1 -1
  76. package/src/rules/effects/use-effects-lifecycle-interface.js.map +1 -1
  77. package/src/rules/index.d.ts +35 -35
  78. package/src/rules/operators/prefer-concat-latest-from.d.ts +1 -1
  79. package/src/rules/operators/prefer-concat-latest-from.js +1 -1
  80. package/src/rules/operators/prefer-concat-latest-from.js.map +1 -1
  81. package/src/rules/signals/enforce-type-call.d.ts +1 -1
  82. package/src/rules/signals/enforce-type-call.js +1 -1
  83. package/src/rules/signals/enforce-type-call.js.map +1 -1
  84. package/src/rules/signals/prefer-protected-state.d.ts +1 -1
  85. package/src/rules/signals/prefer-protected-state.js +1 -1
  86. package/src/rules/signals/prefer-protected-state.js.map +1 -1
  87. package/src/rules/signals/signal-state-no-arrays-at-root-level.d.ts +1 -1
  88. package/src/rules/signals/signal-state-no-arrays-at-root-level.js +1 -1
  89. package/src/rules/signals/signal-state-no-arrays-at-root-level.js.map +1 -1
  90. package/src/rules/signals/signal-store-feature-should-use-generic-type.d.ts +1 -1
  91. package/src/rules/signals/signal-store-feature-should-use-generic-type.js +1 -1
  92. package/src/rules/signals/signal-store-feature-should-use-generic-type.js.map +1 -1
  93. package/src/rules/signals/with-state-no-arrays-at-root-level.d.ts +1 -1
  94. package/src/rules/signals/with-state-no-arrays-at-root-level.js +1 -1
  95. package/src/rules/signals/with-state-no-arrays-at-root-level.js.map +1 -1
  96. package/src/rules/store/avoid-combining-selectors.d.ts +1 -1
  97. package/src/rules/store/avoid-combining-selectors.js +1 -1
  98. package/src/rules/store/avoid-combining-selectors.js.map +1 -1
  99. package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.d.ts +1 -1
  100. package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js +1 -1
  101. package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js.map +1 -1
  102. package/src/rules/store/avoid-duplicate-actions-in-reducer.d.ts +1 -1
  103. package/src/rules/store/avoid-duplicate-actions-in-reducer.js +1 -1
  104. package/src/rules/store/avoid-duplicate-actions-in-reducer.js.map +1 -1
  105. package/src/rules/store/avoid-mapping-selectors.d.ts +1 -1
  106. package/src/rules/store/avoid-mapping-selectors.js +1 -1
  107. package/src/rules/store/avoid-mapping-selectors.js.map +1 -1
  108. package/src/rules/store/good-action-hygiene.d.ts +1 -1
  109. package/src/rules/store/good-action-hygiene.js +1 -1
  110. package/src/rules/store/good-action-hygiene.js.map +1 -1
  111. package/src/rules/store/no-multiple-global-stores.d.ts +1 -1
  112. package/src/rules/store/no-multiple-global-stores.js +1 -1
  113. package/src/rules/store/no-multiple-global-stores.js.map +1 -1
  114. package/src/rules/store/no-reducer-in-key-names.d.ts +1 -1
  115. package/src/rules/store/no-reducer-in-key-names.js +1 -1
  116. package/src/rules/store/no-reducer-in-key-names.js.map +1 -1
  117. package/src/rules/store/no-store-subscription.d.ts +1 -1
  118. package/src/rules/store/no-store-subscription.js +1 -1
  119. package/src/rules/store/no-store-subscription.js.map +1 -1
  120. package/src/rules/store/no-typed-global-store.d.ts +1 -1
  121. package/src/rules/store/no-typed-global-store.js +1 -1
  122. package/src/rules/store/no-typed-global-store.js.map +1 -1
  123. package/src/rules/store/on-function-explicit-return-type.d.ts +1 -1
  124. package/src/rules/store/on-function-explicit-return-type.js +1 -1
  125. package/src/rules/store/on-function-explicit-return-type.js.map +1 -1
  126. package/src/rules/store/prefer-action-creator-in-dispatch.d.ts +1 -1
  127. package/src/rules/store/prefer-action-creator-in-dispatch.js +1 -1
  128. package/src/rules/store/prefer-action-creator-in-dispatch.js.map +1 -1
  129. package/src/rules/store/prefer-action-creator.d.ts +1 -1
  130. package/src/rules/store/prefer-action-creator.js +1 -1
  131. package/src/rules/store/prefer-action-creator.js.map +1 -1
  132. package/src/rules/store/prefer-inline-action-props.d.ts +1 -1
  133. package/src/rules/store/prefer-inline-action-props.js +1 -1
  134. package/src/rules/store/prefer-inline-action-props.js.map +1 -1
  135. package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.d.ts +1 -1
  136. package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js +1 -1
  137. package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js.map +1 -1
  138. package/src/rules/store/prefer-selector-in-select.d.ts +1 -1
  139. package/src/rules/store/prefer-selector-in-select.js +1 -1
  140. package/src/rules/store/prefer-selector-in-select.js.map +1 -1
  141. package/src/rules/store/prefix-selectors-with-select.d.ts +1 -1
  142. package/src/rules/store/prefix-selectors-with-select.js +121 -25
  143. package/src/rules/store/prefix-selectors-with-select.js.map +1 -1
  144. package/src/rules/store/select-style.d.ts +1 -1
  145. package/src/rules/store/select-style.js +1 -1
  146. package/src/rules/store/select-style.js.map +1 -1
  147. package/src/rules/store/use-consistent-global-store-name.d.ts +1 -1
  148. package/src/rules/store/use-consistent-global-store-name.js +1 -1
  149. package/src/rules/store/use-consistent-global-store-name.js.map +1 -1
  150. package/src/utils/helper-functions/index.d.ts +0 -2
  151. package/src/utils/helper-functions/index.js +0 -2
  152. package/src/utils/helper-functions/index.js.map +1 -1
  153. package/src/utils/helper-functions/rules.d.ts +1 -2
  154. package/src/utils/helper-functions/rules.js +5 -4
  155. package/src/utils/helper-functions/rules.js.map +1 -1
  156. package/src/utils/helper-functions/utils.js.map +1 -1
  157. package/v9/index.d.ts +6 -0
  158. package/v9/index.js +6 -0
  159. package/v9/index.js.map +1 -1
  160. package/jest.config.d.ts +0 -15
  161. package/jest.config.js +0 -25
  162. package/jest.config.js.map +0 -1
  163. package/src/utils/helper-functions/docs.d.ts +0 -1
  164. package/src/utils/helper-functions/docs.js +0 -6
  165. package/src/utils/helper-functions/docs.js.map +0 -1
  166. package/src/utils/helper-functions/versions.d.ts +0 -1
  167. package/src/utils/helper-functions/versions.js +0 -78
  168. package/src/utils/helper-functions/versions.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"avoid-dispatching-multiple-actions-sequentially.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/avoid-dispatching-multiple-actions-sequentially.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAA2E;AAE9D,QAAA,SAAS,GAAG,6CAA6C,CAAC;AAKvE,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,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,4DAA4D;SAC1E;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,0FAA0F;SAC7F;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,qBAAa,EAAC,OAAO,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,mBAAmB,GAA8B,EAAE,CAAC;QAE1D,OAAO;YACL,CAAC,0CAA0C,IAAA,0BAAkB,EAC3D,UAAU,CACX,EAAE,CAAC,CAAC,IAA6B;gBAChC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC;YACD,qBAAqB;gBACnB,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CACvD,mBAAmB,CAAC,IAAI,CACtB,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAC7D,CACF,CAAC;gBACF,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC9B,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;wBAClC,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI;4BACJ,SAAS,EAAT,iBAAS;yBACV,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;gBAED,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC;YACjC,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 { asPattern, dispatchExpression, getNgRxStores } from '../../utils';\n\nexport const messageId = 'avoidDispatchingMultipleActionsSequentially';\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: 'store',\n docs: {\n description: 'It is recommended to only dispatch one `Action` at a time.',\n },\n schema: [],\n messages: {\n [messageId]:\n 'Avoid dispatching many actions in a row to accomplish a larger conceptual \"transaction\".',\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 const collectedDispatches: TSESTree.CallExpression[] = [];\n\n return {\n [`BlockStatement > ExpressionStatement > ${dispatchExpression(\n storeNames\n )}`](node: TSESTree.CallExpression) {\n collectedDispatches.push(node);\n },\n 'BlockStatement:exit'() {\n const withSameParent = collectedDispatches.filter((d1) =>\n collectedDispatches.some(\n (d2) => d2 !== d1 && d2.parent?.parent === d1.parent?.parent\n )\n );\n if (withSameParent.length > 1) {\n for (const node of withSameParent) {\n context.report({\n node,\n messageId,\n });\n }\n }\n\n collectedDispatches.length = 0;\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"avoid-dispatching-multiple-actions-sequentially.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/avoid-dispatching-multiple-actions-sequentially.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAA2E;AAE9D,QAAA,SAAS,GAAG,6CAA6C,CAAC;AAKvE,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,4DAA4D;YACzE,UAAU,EAAE,OAAO;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,0FAA0F;SAC7F;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,qBAAa,EAAC,OAAO,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,mBAAmB,GAA8B,EAAE,CAAC;QAE1D,OAAO;YACL,CAAC,0CAA0C,IAAA,0BAAkB,EAC3D,UAAU,CACX,EAAE,CAAC,CAAC,IAA6B;gBAChC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC;YACD,qBAAqB;gBACnB,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CACvD,mBAAmB,CAAC,IAAI,CACtB,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAC7D,CACF,CAAC;gBACF,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC9B,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;wBAClC,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI;4BACJ,SAAS,EAAT,iBAAS;yBACV,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;gBAED,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC;YACjC,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 { asPattern, dispatchExpression, getNgRxStores } from '../../utils';\n\nexport const messageId = 'avoidDispatchingMultipleActionsSequentially';\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 docs: {\n description: 'It is recommended to only dispatch one `Action` at a time.',\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [messageId]:\n 'Avoid dispatching many actions in a row to accomplish a larger conceptual \"transaction\".',\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 const collectedDispatches: TSESTree.CallExpression[] = [];\n\n return {\n [`BlockStatement > ExpressionStatement > ${dispatchExpression(\n storeNames\n )}`](node: TSESTree.CallExpression) {\n collectedDispatches.push(node);\n },\n 'BlockStatement:exit'() {\n const withSameParent = collectedDispatches.filter((d1) =>\n collectedDispatches.some(\n (d2) => d2 !== d1 && d2.parent?.parent === d1.parent?.parent\n )\n );\n if (withSameParent.length > 1) {\n for (const node of withSameParent) {\n context.report({\n node,\n messageId,\n });\n }\n }\n\n collectedDispatches.length = 0;\n },\n };\n },\n});\n"]}
@@ -1,5 +1,5 @@
1
1
  export declare const avoidDuplicateActionsInReducer = "avoidDuplicateActionsInReducer";
2
2
  export declare const avoidDuplicateActionsInReducerSuggest = "avoidDuplicateActionsInReducerSuggest";
3
3
  type MessageIds = typeof avoidDuplicateActionsInReducer | typeof avoidDuplicateActionsInReducerSuggest;
4
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
4
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], import("../../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
5
5
  export default _default;
@@ -44,9 +44,9 @@ exports.default = (0, rule_creator_1.createRule)({
44
44
  meta: {
45
45
  type: 'suggestion',
46
46
  hasSuggestions: true,
47
- ngrxModule: 'store',
48
47
  docs: {
49
48
  description: 'A `Reducer` should handle an `Action` once.',
49
+ ngrxModule: 'store',
50
50
  },
51
51
  schema: [],
52
52
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"avoid-duplicate-actions-in-reducer.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/avoid-duplicate-actions-in-reducer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAqE;AAExD,QAAA,8BAA8B,GAAG,gCAAgC,CAAC;AAClE,QAAA,qCAAqC,GAChD,uCAAuC,CAAC;AAQ1C,kBAAe,IAAA,yBAAU,EAAsB;IAC7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EACrB,OAAO,CAAC,UAAU,EAClB,KAAK,EACL,IAAI,CAAC,MAAM,CACZ;iCACJ;6BACF;yBACF,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;gBAED,gBAAgB,CAAC,KAAK,EAAE,CAAC;YAC3B,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 { createReducer, getNodeToCommaRemoveFix } from '../../utils';\n\nexport const avoidDuplicateActionsInReducer = 'avoidDuplicateActionsInReducer';\nexport const avoidDuplicateActionsInReducerSuggest =\n 'avoidDuplicateActionsInReducerSuggest';\n\ntype MessageIds =\n | typeof avoidDuplicateActionsInReducer\n | typeof avoidDuplicateActionsInReducerSuggest;\ntype Options = readonly [];\ntype Action = TSESTree.Identifier & { parent: TSESTree.CallExpression };\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n ngrxModule: 'store',\n docs: {\n description: 'A `Reducer` should handle an `Action` once.',\n },\n schema: [],\n messages: {\n [avoidDuplicateActionsInReducer]:\n 'The `Reducer` handles a duplicate `Action` `{{ actionName }}`.',\n [avoidDuplicateActionsInReducerSuggest]: 'Remove this duplication.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const collectedActions = new Map<string, Action[]>();\n\n return {\n [`${createReducer} > CallExpression[callee.name='on'][arguments.0.type='Identifier']`]({\n arguments: [action],\n }: TSESTree.CallExpression & {\n arguments: Action[];\n }) {\n const actions = collectedActions.get(action.name) ?? [];\n collectedActions.set(action.name, [...actions, action]);\n },\n [`${createReducer}:exit`]() {\n for (const [actionName, identifiers] of collectedActions) {\n if (identifiers.length <= 1) {\n break;\n }\n\n for (const node of identifiers) {\n context.report({\n node,\n messageId: avoidDuplicateActionsInReducer,\n data: {\n actionName,\n },\n suggest: [\n {\n messageId: avoidDuplicateActionsInReducerSuggest,\n fix: (fixer) =>\n getNodeToCommaRemoveFix(\n context.sourceCode,\n fixer,\n node.parent\n ),\n },\n ],\n });\n }\n }\n\n collectedActions.clear();\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"avoid-duplicate-actions-in-reducer.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/avoid-duplicate-actions-in-reducer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAqE;AAExD,QAAA,8BAA8B,GAAG,gCAAgC,CAAC;AAClE,QAAA,qCAAqC,GAChD,uCAAuC,CAAC;AAQ1C,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,IAAI,EAAE;YACJ,WAAW,EAAE,6CAA6C;YAC1D,UAAU,EAAE,OAAO;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,sCAA8B,CAAC,EAC9B,gEAAgE;YAClE,CAAC,6CAAqC,CAAC,EAAE,0BAA0B;SACpE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAoB,CAAC;QAErD,OAAO;YACL,CAAC,GAAG,qBAAa,oEAAoE,CAAC,CAAC,EACrF,SAAS,EAAE,CAAC,MAAM,CAAC,GAGpB;gBACC,MAAM,OAAO,GAAG,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACxD,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;YAC1D,CAAC;YACD,CAAC,GAAG,qBAAa,OAAO,CAAC;gBACvB,KAAK,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,gBAAgB,EAAE,CAAC;oBACzD,IAAI,WAAW,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;wBAC5B,MAAM;oBACR,CAAC;oBAED,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;wBAC/B,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI;4BACJ,SAAS,EAAE,sCAA8B;4BACzC,IAAI,EAAE;gCACJ,UAAU;6BACX;4BACD,OAAO,EAAE;gCACP;oCACE,SAAS,EAAE,6CAAqC;oCAChD,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CACb,IAAA,+BAAuB,EACrB,OAAO,CAAC,UAAU,EAClB,KAAK,EACL,IAAI,CAAC,MAAM,CACZ;iCACJ;6BACF;yBACF,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;gBAED,gBAAgB,CAAC,KAAK,EAAE,CAAC;YAC3B,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 { createReducer, getNodeToCommaRemoveFix } from '../../utils';\n\nexport const avoidDuplicateActionsInReducer = 'avoidDuplicateActionsInReducer';\nexport const avoidDuplicateActionsInReducerSuggest =\n 'avoidDuplicateActionsInReducerSuggest';\n\ntype MessageIds =\n | typeof avoidDuplicateActionsInReducer\n | typeof avoidDuplicateActionsInReducerSuggest;\ntype Options = readonly [];\ntype Action = TSESTree.Identifier & { parent: TSESTree.CallExpression };\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n docs: {\n description: 'A `Reducer` should handle an `Action` once.',\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [avoidDuplicateActionsInReducer]:\n 'The `Reducer` handles a duplicate `Action` `{{ actionName }}`.',\n [avoidDuplicateActionsInReducerSuggest]: 'Remove this duplication.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const collectedActions = new Map<string, Action[]>();\n\n return {\n [`${createReducer} > CallExpression[callee.name='on'][arguments.0.type='Identifier']`]({\n arguments: [action],\n }: TSESTree.CallExpression & {\n arguments: Action[];\n }) {\n const actions = collectedActions.get(action.name) ?? [];\n collectedActions.set(action.name, [...actions, action]);\n },\n [`${createReducer}:exit`]() {\n for (const [actionName, identifiers] of collectedActions) {\n if (identifiers.length <= 1) {\n break;\n }\n\n for (const node of identifiers) {\n context.report({\n node,\n messageId: avoidDuplicateActionsInReducer,\n data: {\n actionName,\n },\n suggest: [\n {\n messageId: avoidDuplicateActionsInReducerSuggest,\n fix: (fixer) =>\n getNodeToCommaRemoveFix(\n context.sourceCode,\n fixer,\n node.parent\n ),\n },\n ],\n });\n }\n }\n\n collectedActions.clear();\n },\n };\n },\n});\n"]}
@@ -1,3 +1,3 @@
1
1
  export declare const messageId = "avoidMapppingSelectors";
2
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidMapppingSelectors", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidMapppingSelectors", readonly [], import("../../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
3
3
  export default _default;
@@ -42,9 +42,9 @@ exports.default = (0, rule_creator_1.createRule)({
42
42
  name: path.parse(__filename).name,
43
43
  meta: {
44
44
  type: 'suggestion',
45
- ngrxModule: 'store',
46
45
  docs: {
47
46
  description: 'Avoid mapping logic outside the selector level.',
47
+ ngrxModule: 'store',
48
48
  },
49
49
  schema: [],
50
50
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"avoid-mapping-selectors.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/avoid-mapping-selectors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;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AAM,GAAG,MAAM,CAAC,MAAM,CAAC;YACzB,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,qBAAqB,GAAG,KAAK,CAAC;QAElC,MAAM,aAAa,GAAG,YAAY,cAAc,KAAK,4BAA4B,GAAG,CAAC;QACrF,OAAO;YACL,CAAC,GAAG,aAAa,uCAAuC,CAAC,CACvD,KAA8B;gBAE9B,qBAAqB,GAAG,IAAI,CAAC;YAC/B,CAAC;YACD,CAAC,GAAG,aAAa,kCAAkC,CAAC,CAClD,IAA6B;gBAE7B,IAAI,qBAAqB,EAAE,CAAC;oBAC1B,qBAAqB,GAAG,KAAK,CAAC;oBAC9B,OAAO;gBACT,CAAC;gBAED,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC3B,OAAO;gBACT,CAAC;gBAED,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;gBACjC,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAChC,CAAC,QAAQ,EAAE,EAAE,CACX,IAAA,wBAAgB,EAAC,QAAQ,CAAC;oBAC1B,IAAA,oBAAY,EAAC,QAAQ,CAAC,MAAM,CAAC;oBAC7B,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,CACjC,CAAC;gBACF,IAAI,WAAW,EAAE,CAAC;oBAChB,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,WAAW;wBACjB,SAAS,EAAT,iBAAS;qBACV,CAAC,CAAC;gBACL,CAAC;YACH,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 getNgRxStores,\n isCallExpression,\n isIdentifier,\n namedCallableExpression,\n pipeExpression,\n} from '../../utils';\n\nexport const messageId = 'avoidMapppingSelectors';\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: '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 = [] } = getNgRxStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!storeNames) {\n return {};\n }\n\n const pipeWithSelectAndMapSelector = `${pipeExpression(\n storeNames\n )}:has(CallExpression[callee.name='select'] ~ CallExpression[callee.name='map'])` as const;\n const selectSelector = `${namedCallableExpression(\n storeNames\n )}[callee.object.callee.property.name='select']` as const;\n\n function isInCreateEffect(node: TSESTree.CallExpression) {\n let parent: TSESTree.Node | undefined = node.parent;\n while (parent) {\n if (\n isCallExpression(parent) &&\n isIdentifier(parent.callee) &&\n parent.callee.name === 'createEffect'\n ) {\n return true;\n }\n parent = parent.parent;\n }\n return false;\n }\n\n let pipeHasThisExpression = false;\n\n const selectorQuery = `:matches(${selectSelector}, ${pipeWithSelectAndMapSelector})`;\n return {\n [`${selectorQuery} > CallExpression:has(ThisExpression)`](\n _node: TSESTree.CallExpression\n ) {\n pipeHasThisExpression = true;\n },\n [`${selectorQuery}[callee.property.name=pipe]:exit`](\n node: TSESTree.CallExpression\n ) {\n if (pipeHasThisExpression) {\n pipeHasThisExpression = false;\n return;\n }\n\n if (isInCreateEffect(node)) {\n return;\n }\n\n const operators = node.arguments;\n const mapOperator = operators.find(\n (operator) =>\n isCallExpression(operator) &&\n isIdentifier(operator.callee) &&\n operator.callee.name === 'map'\n );\n if (mapOperator) {\n context.report({\n node: mapOperator,\n messageId,\n });\n }\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"avoid-mapping-selectors.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/avoid-mapping-selectors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;A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AAC;YACzB,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,qBAAqB,GAAG,KAAK,CAAC;QAElC,MAAM,aAAa,GAAG,YAAY,cAAc,KAAK,4BAA4B,GAAG,CAAC;QACrF,OAAO;YACL,CAAC,GAAG,aAAa,uCAAuC,CAAC,CACvD,KAA8B;gBAE9B,qBAAqB,GAAG,IAAI,CAAC;YAC/B,CAAC;YACD,CAAC,GAAG,aAAa,kCAAkC,CAAC,CAClD,IAA6B;gBAE7B,IAAI,qBAAqB,EAAE,CAAC;oBAC1B,qBAAqB,GAAG,KAAK,CAAC;oBAC9B,OAAO;gBACT,CAAC;gBAED,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC3B,OAAO;gBACT,CAAC;gBAED,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;gBACjC,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAChC,CAAC,QAAQ,EAAE,EAAE,CACX,IAAA,wBAAgB,EAAC,QAAQ,CAAC;oBAC1B,IAAA,oBAAY,EAAC,QAAQ,CAAC,MAAM,CAAC;oBAC7B,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,CACjC,CAAC;gBACF,IAAI,WAAW,EAAE,CAAC;oBAChB,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,WAAW;wBACjB,SAAS,EAAT,iBAAS;qBACV,CAAC,CAAC;gBACL,CAAC;YACH,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 getNgRxStores,\n isCallExpression,\n isIdentifier,\n namedCallableExpression,\n pipeExpression,\n} from '../../utils';\n\nexport const messageId = 'avoidMapppingSelectors';\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 docs: {\n description: 'Avoid mapping logic outside the selector level.',\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [messageId]: 'Map logic at the selector level instead.',\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 const pipeWithSelectAndMapSelector = `${pipeExpression(\n storeNames\n )}:has(CallExpression[callee.name='select'] ~ CallExpression[callee.name='map'])` as const;\n const selectSelector = `${namedCallableExpression(\n storeNames\n )}[callee.object.callee.property.name='select']` as const;\n\n function isInCreateEffect(node: TSESTree.CallExpression) {\n let parent: TSESTree.Node | undefined = node.parent;\n while (parent) {\n if (\n isCallExpression(parent) &&\n isIdentifier(parent.callee) &&\n parent.callee.name === 'createEffect'\n ) {\n return true;\n }\n parent = parent.parent;\n }\n return false;\n }\n\n let pipeHasThisExpression = false;\n\n const selectorQuery = `:matches(${selectSelector}, ${pipeWithSelectAndMapSelector})`;\n return {\n [`${selectorQuery} > CallExpression:has(ThisExpression)`](\n _node: TSESTree.CallExpression\n ) {\n pipeHasThisExpression = true;\n },\n [`${selectorQuery}[callee.property.name=pipe]:exit`](\n node: TSESTree.CallExpression\n ) {\n if (pipeHasThisExpression) {\n pipeHasThisExpression = false;\n return;\n }\n\n if (isInCreateEffect(node)) {\n return;\n }\n\n const operators = node.arguments;\n const mapOperator = operators.find(\n (operator) =>\n isCallExpression(operator) &&\n isIdentifier(operator.callee) &&\n operator.callee.name === 'map'\n );\n if (mapOperator) {\n context.report({\n node: mapOperator,\n messageId,\n });\n }\n },\n };\n },\n});\n"]}
@@ -1,3 +1,3 @@
1
1
  export declare const messageId = "goodActionHygiene";
2
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"goodActionHygiene", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"goodActionHygiene", readonly [], import("../../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
3
3
  export default _default;
@@ -42,9 +42,9 @@ exports.default = (0, rule_creator_1.createRule)({
42
42
  name: path.parse(__filename).name,
43
43
  meta: {
44
44
  type: 'suggestion',
45
- ngrxModule: 'store',
46
45
  docs: {
47
46
  description: 'Ensures the use of good action hygiene.',
47
+ ngrxModule: 'store',
48
48
  },
49
49
  schema: [],
50
50
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"good-action-hygiene.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/good-action-hygiene.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAuD;AAE1C,QAAA,SAAS,GAAG,mBAAmB,CAAC;AAK7C,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,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,yCAAyC;SACvD;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,0IAA0I;SAC7I;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,kBAAkB,GAAG,eAAe,CAAC;QAE3C,OAAO;YACL,CAAC,gCAAwB,CAAC,CAAC,EACzB,SAAS,EAAE,CAAC,IAAI,CAAC,GAGlB;gBACC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;gBAEnC,IAAI,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;oBACxC,OAAO;gBACT,CAAC;gBAED,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAT,iBAAS;oBACT,IAAI,EAAE;wBACJ,UAAU;qBACX;iBACF,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 { actionCreatorWithLiteral } from '../../utils';\n\nexport const messageId = 'goodActionHygiene';\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: 'store',\n docs: {\n description: 'Ensures the use of good action hygiene.',\n },\n schema: [],\n messages: {\n [messageId]:\n 'Action type `{{ actionType }}` does not follow the good action hygiene practice, use \"[Source] {{ actionType }}\" to define action types.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const sourceEventPattern = /[[].*[\\]]\\s.*/;\n\n return {\n [actionCreatorWithLiteral]({\n arguments: [node],\n }: Omit<TSESTree.CallExpression, 'arguments'> & {\n arguments: TSESTree.StringLiteral[];\n }) {\n const { value: actionType } = node;\n\n if (sourceEventPattern.test(actionType)) {\n return;\n }\n\n context.report({\n node,\n messageId,\n data: {\n actionType,\n },\n });\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"good-action-hygiene.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/good-action-hygiene.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAuD;AAE1C,QAAA,SAAS,GAAG,mBAAmB,CAAC;AAK7C,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,yCAAyC;YACtD,UAAU,EAAE,OAAO;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,0IAA0I;SAC7I;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,kBAAkB,GAAG,eAAe,CAAC;QAE3C,OAAO;YACL,CAAC,gCAAwB,CAAC,CAAC,EACzB,SAAS,EAAE,CAAC,IAAI,CAAC,GAGlB;gBACC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;gBAEnC,IAAI,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;oBACxC,OAAO;gBACT,CAAC;gBAED,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAT,iBAAS;oBACT,IAAI,EAAE;wBACJ,UAAU;qBACX;iBACF,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 { actionCreatorWithLiteral } from '../../utils';\n\nexport const messageId = 'goodActionHygiene';\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 docs: {\n description: 'Ensures the use of good action hygiene.',\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [messageId]:\n 'Action type `{{ actionType }}` does not follow the good action hygiene practice, use \"[Source] {{ actionType }}\" to define action types.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const sourceEventPattern = /[[].*[\\]]\\s.*/;\n\n return {\n [actionCreatorWithLiteral]({\n arguments: [node],\n }: Omit<TSESTree.CallExpression, 'arguments'> & {\n arguments: TSESTree.StringLiteral[];\n }) {\n const { value: actionType } = node;\n\n if (sourceEventPattern.test(actionType)) {\n return;\n }\n\n context.report({\n node,\n messageId,\n data: {\n actionType,\n },\n });\n },\n };\n },\n});\n"]}
@@ -2,5 +2,5 @@ import type { TSESLint } from '@typescript-eslint/utils';
2
2
  export declare const noMultipleGlobalStores = "noMultipleGlobalStores";
3
3
  export declare const noMultipleGlobalStoresSuggest = "noMultipleGlobalStoresSuggest";
4
4
  type MessageIds = typeof noMultipleGlobalStores | typeof noMultipleGlobalStoresSuggest;
5
- declare const _default: TSESLint.RuleModule<MessageIds, readonly [], unknown, TSESLint.RuleListener>;
5
+ declare const _default: TSESLint.RuleModule<MessageIds, readonly [], import("../../rule-creator").NgRxRuleDocs, TSESLint.RuleListener>;
6
6
  export default _default;
@@ -44,9 +44,9 @@ exports.default = (0, rule_creator_1.createRule)({
44
44
  meta: {
45
45
  type: 'suggestion',
46
46
  hasSuggestions: true,
47
- ngrxModule: 'store',
48
47
  docs: {
49
48
  description: 'There should only be one global store injected.',
49
+ ngrxModule: 'store',
50
50
  },
51
51
  schema: [],
52
52
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"no-multiple-global-stores.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-multiple-global-stores.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAIqB;AAER,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AAClD,QAAA,6BAA6B,GAAG,+BAA+B,CAAC;AAO7E,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,iDAAiD;SAC/D;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,8BAAsB,CAAC,EAAE,4CAA4C;YACtE,CAAC,qCA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C,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7E,OAAO,IAAA,+BAAuB,EAAC,UAAU,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;AAClE,CAAC;AAID,SAAS,OAAO,CAAC,WAAwB;IACvC,OAAO,WAAW,CAAC,MAAM,CACvB,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE;QAC1B,MAAM,MAAM,GAAG,IAAA,6BAAqB,EAAC,UAAU,CAAC,MAAM,CAAC;YACrD,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM;YAC1B,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;QACtB,MAAM,oBAAoB,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrD,OAAO,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE;YAC7B,GAAG,CAAC,oBAAoB,IAAI,EAAE,CAAC;YAC/B,UAAU;SACX,CAAC,CAAC;IACL,CAAC,EACD,IAAI,GAAG,EAAE,CACV,CAAC;AACJ,CAAC","sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n getNgRxStores,\n getNodeToCommaRemoveFix,\n isTSParameterProperty,\n} from '../../utils';\n\nexport const noMultipleGlobalStores = 'noMultipleGlobalStores';\nexport const noMultipleGlobalStoresSuggest = 'noMultipleGlobalStoresSuggest';\n\ntype MessageIds =\n | typeof noMultipleGlobalStores\n | typeof noMultipleGlobalStoresSuggest;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n ngrxModule: 'store',\n docs: {\n description: 'There should only be one global store injected.',\n },\n schema: [],\n messages: {\n [noMultipleGlobalStores]: 'Global store should be injected only once.',\n [noMultipleGlobalStoresSuggest]: 'Remove this reference.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n Program() {\n const { identifiers = [], sourceCode } = getNgRxStores(context);\n const flattenedIdentifiers = groupBy(identifiers).values();\n\n for (const identifiers of flattenedIdentifiers) {\n if (identifiers.length <= 1) {\n continue;\n }\n\n for (const node of identifiers) {\n const nodeToReport = getNodeToReport(node);\n context.report({\n node: nodeToReport,\n messageId: noMultipleGlobalStores,\n suggest: [\n {\n messageId: noMultipleGlobalStoresSuggest,\n fix: (fixer) => getFixes(sourceCode, fixer, nodeToReport),\n },\n ],\n });\n }\n }\n },\n };\n },\n});\n\nfunction getNodeToReport(node: TSESTree.Node) {\n return node.parent && isTSParameterProperty(node.parent) ? node.parent : node;\n}\n\nfunction getFixes(\n sourceCode: Readonly<TSESLint.SourceCode>,\n fixer: TSESLint.RuleFixer,\n node: TSESTree.Node\n) {\n const { parent } = node;\n const nodeToRemove = parent && isTSParameterProperty(parent) ? parent : node;\n return getNodeToCommaRemoveFix(sourceCode, fixer, nodeToRemove);\n}\n\ntype Identifiers = NonNullable<ReturnType<typeof getNgRxStores>['identifiers']>;\n\nfunction groupBy(identifiers: Identifiers): Map<TSESTree.Node, Identifiers> {\n return identifiers.reduce<Map<TSESTree.Node, Identifiers>>(\n (accumulator, identifier) => {\n const parent = isTSParameterProperty(identifier.parent)\n ? identifier.parent.parent\n : identifier.parent;\n const collectedIdentifiers = accumulator.get(parent);\n return accumulator.set(parent, [\n ...(collectedIdentifiers ?? []),\n identifier,\n ]);\n },\n new Map()\n );\n}\n"]}
1
+ {"version":3,"file":"no-multiple-global-stores.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-multiple-global-stores.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAIqB;AAER,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AAClD,QAAA,6BAA6B,GAAG,+BAA+B,CAAC;AAO7E,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EA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,IAAI,IAAA,6BAAqB,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AAChF,CAAC;AAED,SAAS,QAAQ,CACf,UAAyC,EACzC,KAAyB,EACzB,IAAmB;IAEnB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACxB,MAAM,YAAY,GAAG,MAAM,IAAI,IAAA,6BAAqB,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7E,OAAO,IAAA,+BAAuB,EAAC,UAAU,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;AAClE,CAAC;AAID,SAAS,OAAO,CAAC,WAAwB;IACvC,OAAO,WAAW,CAAC,MAAM,CACvB,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE;QAC1B,MAAM,MAAM,GAAG,IAAA,6BAAqB,EAAC,UAAU,CAAC,MAAM,CAAC;YACrD,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM;YAC1B,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;QACtB,MAAM,oBAAoB,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrD,OAAO,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE;YAC7B,GAAG,CAAC,oBAAoB,IAAI,EAAE,CAAC;YAC/B,UAAU;SACX,CAAC,CAAC;IACL,CAAC,EACD,IAAI,GAAG,EAAE,CACV,CAAC;AACJ,CAAC","sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n getNgRxStores,\n getNodeToCommaRemoveFix,\n isTSParameterProperty,\n} from '../../utils';\n\nexport const noMultipleGlobalStores = 'noMultipleGlobalStores';\nexport const noMultipleGlobalStoresSuggest = 'noMultipleGlobalStoresSuggest';\n\ntype MessageIds =\n | typeof noMultipleGlobalStores\n | typeof noMultipleGlobalStoresSuggest;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n docs: {\n description: 'There should only be one global store injected.',\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [noMultipleGlobalStores]: 'Global store should be injected only once.',\n [noMultipleGlobalStoresSuggest]: 'Remove this reference.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n Program() {\n const { identifiers = [], sourceCode } = getNgRxStores(context);\n const flattenedIdentifiers = groupBy(identifiers).values();\n\n for (const identifiers of flattenedIdentifiers) {\n if (identifiers.length <= 1) {\n continue;\n }\n\n for (const node of identifiers) {\n const nodeToReport = getNodeToReport(node);\n context.report({\n node: nodeToReport,\n messageId: noMultipleGlobalStores,\n suggest: [\n {\n messageId: noMultipleGlobalStoresSuggest,\n fix: (fixer) => getFixes(sourceCode, fixer, nodeToReport),\n },\n ],\n });\n }\n }\n },\n };\n },\n});\n\nfunction getNodeToReport(node: TSESTree.Node) {\n return node.parent && isTSParameterProperty(node.parent) ? node.parent : node;\n}\n\nfunction getFixes(\n sourceCode: Readonly<TSESLint.SourceCode>,\n fixer: TSESLint.RuleFixer,\n node: TSESTree.Node\n) {\n const { parent } = node;\n const nodeToRemove = parent && isTSParameterProperty(parent) ? parent : node;\n return getNodeToCommaRemoveFix(sourceCode, fixer, nodeToRemove);\n}\n\ntype Identifiers = NonNullable<ReturnType<typeof getNgRxStores>['identifiers']>;\n\nfunction groupBy(identifiers: Identifiers): Map<TSESTree.Node, Identifiers> {\n return identifiers.reduce<Map<TSESTree.Node, Identifiers>>(\n (accumulator, identifier) => {\n const parent = isTSParameterProperty(identifier.parent)\n ? identifier.parent.parent\n : identifier.parent;\n const collectedIdentifiers = accumulator.get(parent);\n return accumulator.set(parent, [\n ...(collectedIdentifiers ?? []),\n identifier,\n ]);\n },\n new Map()\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  export declare const noReducerInKeyNames = "noReducerInKeyNames";
2
2
  export declare const noReducerInKeyNamesSuggest = "noReducerInKeyNamesSuggest";
3
3
  type MessageIds = typeof noReducerInKeyNames | typeof noReducerInKeyNamesSuggest;
4
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
4
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], import("../../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
5
5
  export default _default;
@@ -45,9 +45,9 @@ exports.default = (0, rule_creator_1.createRule)({
45
45
  meta: {
46
46
  type: 'suggestion',
47
47
  hasSuggestions: true,
48
- ngrxModule: 'store',
49
48
  docs: {
50
49
  description: `Avoid the word "${reducerKeyword}" in the key names.`,
50
+ ngrxModule: 'store',
51
51
  },
52
52
  schema: [],
53
53
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"no-reducer-in-key-names.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-reducer-in-key-names.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAC5C,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AAOvE,MAAM,cAAc,GAAG,SAAS,CAAC;AAEjC,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,mBAAmB,cAAc,qBAAqB;SACpE;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,2BAAmB,CAAC,EAAE,mBAAmB,cAAc,mDAAmD;YAC3G,CAAC,kCAA0B,CAAC,EAAE,oBAAoB,cAAc,IAAI;SACrE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,YAAY,6BAAqB,KAAK,wBAAgB,OAAO,IAAA,wBAAgB,EAC5E,UAAU,CACX,SAAS,CAAC,CAAC,IAA8B;gBACxC,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,2BAAmB;oBAC9B,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,kCAA0B;4BACrC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;gCACb,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,IAAI,CAAC,CAAC;gCAEjC,IAAI,CAAC,OAAO,EAAE,CAAC;oCACb,OAAO,IAAI,CAAC;gCACd,CAAC;gCAED,OAAO,KAAK,CAAC,WAAW,CACtB,IAAI,EACJ,OAAO,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,cAAc,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CACrD,CAAC;4BACJ,CAAC;yBACF;qBACF;iBACF,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 actionReducerMap,\n getRawText,\n metadataProperty,\n storeActionReducerMap,\n} from '../../utils';\n\nexport const noReducerInKeyNames = 'noReducerInKeyNames';\nexport const noReducerInKeyNamesSuggest = 'noReducerInKeyNamesSuggest';\n\ntype MessageIds =\n | typeof noReducerInKeyNames\n | typeof noReducerInKeyNamesSuggest;\ntype Options = readonly [];\n\nconst reducerKeyword = 'reducer';\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n ngrxModule: 'store',\n docs: {\n description: `Avoid the word \"${reducerKeyword}\" in the key names.`,\n },\n schema: [],\n messages: {\n [noReducerInKeyNames]: `Avoid the word \"${reducerKeyword}\" in the key names to better represent the state.`,\n [noReducerInKeyNamesSuggest]: `Remove the word \"${reducerKeyword}\".`,\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`:matches(${storeActionReducerMap}, ${actionReducerMap}) > ${metadataProperty(\n /reducer/i\n )} > .key`](node: TSESTree.Property['key']) {\n context.report({\n node,\n messageId: noReducerInKeyNames,\n suggest: [\n {\n messageId: noReducerInKeyNamesSuggest,\n fix: (fixer) => {\n const keyName = getRawText(node);\n\n if (!keyName) {\n return null;\n }\n\n return fixer.replaceText(\n node,\n keyName.replace(new RegExp(reducerKeyword, 'i'), '')\n );\n },\n },\n ],\n });\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"no-reducer-in-key-names.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-reducer-in-key-names.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAC5C,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AAOvE,MAAM,cAAc,GAAG,SAAS,CAAC;AAEjC,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,IAAI,EAAE;YACJ,WAAW,EAAE,mBAAmB,cAAc,qBAAqB;YACnE,UAAU,EAAE,OAAO;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,2BAAmB,CAAC,EAAE,mBAAmB,cAAc,mDAAmD;YAC3G,CAAC,kCAA0B,CAAC,EAAE,oBAAoB,cAAc,IAAI;SACrE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,YAAY,6BAAqB,KAAK,wBAAgB,OAAO,IAAA,wBAAgB,EAC5E,UAAU,CACX,SAAS,CAAC,CAAC,IAA8B;gBACxC,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,2BAAmB;oBAC9B,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,kCAA0B;4BACrC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;gCACb,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,IAAI,CAAC,CAAC;gCAEjC,IAAI,CAAC,OAAO,EAAE,CAAC;oCACb,OAAO,IAAI,CAAC;gCACd,CAAC;gCAED,OAAO,KAAK,CAAC,WAAW,CACtB,IAAI,EACJ,OAAO,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,cAAc,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CACrD,CAAC;4BACJ,CAAC;yBACF;qBACF;iBACF,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 actionReducerMap,\n getRawText,\n metadataProperty,\n storeActionReducerMap,\n} from '../../utils';\n\nexport const noReducerInKeyNames = 'noReducerInKeyNames';\nexport const noReducerInKeyNamesSuggest = 'noReducerInKeyNamesSuggest';\n\ntype MessageIds =\n | typeof noReducerInKeyNames\n | typeof noReducerInKeyNamesSuggest;\ntype Options = readonly [];\n\nconst reducerKeyword = 'reducer';\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n docs: {\n description: `Avoid the word \"${reducerKeyword}\" in the key names.`,\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [noReducerInKeyNames]: `Avoid the word \"${reducerKeyword}\" in the key names to better represent the state.`,\n [noReducerInKeyNamesSuggest]: `Remove the word \"${reducerKeyword}\".`,\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`:matches(${storeActionReducerMap}, ${actionReducerMap}) > ${metadataProperty(\n /reducer/i\n )} > .key`](node: TSESTree.Property['key']) {\n context.report({\n node,\n messageId: noReducerInKeyNames,\n suggest: [\n {\n messageId: noReducerInKeyNamesSuggest,\n fix: (fixer) => {\n const keyName = getRawText(node);\n\n if (!keyName) {\n return null;\n }\n\n return fixer.replaceText(\n node,\n keyName.replace(new RegExp(reducerKeyword, 'i'), '')\n );\n },\n },\n ],\n });\n },\n };\n },\n});\n"]}
@@ -1,3 +1,3 @@
1
1
  export declare const messageId = "noStoreSubscription";
2
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noStoreSubscription", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noStoreSubscription", readonly [], import("../../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
3
3
  export default _default;
@@ -42,9 +42,9 @@ exports.default = (0, rule_creator_1.createRule)({
42
42
  name: path.parse(__filename).name,
43
43
  meta: {
44
44
  type: 'suggestion',
45
- ngrxModule: 'store',
46
45
  docs: {
47
46
  description: 'Using the `async` pipe is preferred over `store` subscription.',
47
+ ngrxModule: 'store',
48
48
  },
49
49
  schema: [],
50
50
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"no-store-subscription.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-store-subscription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAgF;AAEnE,QAAA,SAAS,GAAG,qBAAqB,CAAC;AAK/C,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,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EACT,gEAAgE;SACnE;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,kEAAkE;SACrE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,qBAAa,EAAC,OAAO,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO;YACL,CAAC,GAAG,IAAA,+BAAuB,EACzB,UAAU,CACX,oDAAoD,CAAC,CACpD,IAAyB;gBAEzB,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 { asPattern, getNgRxStores, namedCallableExpression } from '../../utils';\n\nexport const messageId = 'noStoreSubscription';\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: 'store',\n docs: {\n description:\n 'Using the `async` pipe is preferred over `store` subscription.',\n },\n schema: [],\n messages: {\n [messageId]:\n '`Store` subscription is forbidden. Use the `async` pipe instead.',\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 [`${namedCallableExpression(\n storeNames\n )} > MemberExpression > Identifier[name='subscribe']`](\n node: TSESTree.Identifier\n ) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"no-store-subscription.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-store-subscription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAgF;AAEnE,QAAA,SAAS,GAAG,qBAAqB,CAAC;AAK/C,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EACT,gEAAgE;YAClE,UAAU,EAAE,OAAO;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,kEAAkE;SACrE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,qBAAa,EAAC,OAAO,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO;YACL,CAAC,GAAG,IAAA,+BAAuB,EACzB,UAAU,CACX,oDAAoD,CAAC,CACpD,IAAyB;gBAEzB,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 { asPattern, getNgRxStores, namedCallableExpression } from '../../utils';\n\nexport const messageId = 'noStoreSubscription';\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 docs: {\n description:\n 'Using the `async` pipe is preferred over `store` subscription.',\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [messageId]:\n '`Store` subscription is forbidden. Use the `async` pipe instead.',\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 [`${namedCallableExpression(\n storeNames\n )} > MemberExpression > Identifier[name='subscribe']`](\n node: TSESTree.Identifier\n ) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
@@ -1,5 +1,5 @@
1
1
  export declare const noTypedStore = "noTypedStore";
2
2
  export declare const noTypedStoreSuggest = "noTypedStoreSuggest";
3
3
  type MessageIds = typeof noTypedStore | typeof noTypedStoreSuggest;
4
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
4
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], import("../../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
5
5
  export default _default;
@@ -44,9 +44,9 @@ exports.default = (0, rule_creator_1.createRule)({
44
44
  meta: {
45
45
  type: 'suggestion',
46
46
  hasSuggestions: true,
47
- ngrxModule: 'store',
48
47
  docs: {
49
48
  description: 'The global store should not be typed.',
49
+ ngrxModule: 'store',
50
50
  },
51
51
  schema: [],
52
52
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"no-typed-global-store.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-typed-global-store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAMqB;AAGR,QAAA,YAAY,GAAG,cAAc,CAAC;AAC9B,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAKzD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,uCAAuC;SACrD;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,oBAAY,CAAC,EACZ,qEAAqE;YACvE,CAAC,2BAAmB,CAAC,EAAE,8BAA8B;SACtD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,OAAO;gBACL,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,qBAAa,EAAC,OAAO,CAAC,CAAC;gBAEpD,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;oBACrC,iBAAiB;oBACjB,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;wBAC/B,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;wBAC9B,IACE,IAAA,4BAAoB,EAAC,MAAM,CAAC;4BAC5B,MAAM,CAAC,KAAK;4BACZ,IAAA,wBAAgB,EAAC,MAAM,CAAC,KAAK,CAAC;4BAC9B,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAC7B,CAAC;4BACD,MAAM,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;4BAC/C,IAAI,IAAA,mCAA2B,EAAC,aAAa,CAAC,EAAE,CAAC;gCAC/C,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;4BACtC,CAAC;wBACH,CAAC;wBAED,SAAS;oBACX,CAAC;oBAED,IACE,CAAC,IAAA,yBAAiB,EAAC,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC;wBAC5D,CAAC,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC,aAAa,EACvD,CAAC;wBACD,SAAS;oBACX,CAAC;oBAED,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;gBACjE,CAAC;YACH,CAAC;SACF,CAAC;QAEF,SAAS,MAAM,CAAC,aAAoD;YAClE,OAAO,CAAC,MAAM,CAAC;gBACb,IAAI,EAAE,aAAa;gBACnB,SAAS,EAAE,oBAAY;gBACvB,OAAO,EAAE;oBACP;wBACE,SAAS,EAAE,2BAAmB;wBAC9B,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC;qBAC5C;iBACF;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC,CAAC","sourcesContent":["import * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n getNgRxStores,\n isPropertyDefinition,\n isTSTypeReference,\n isCallExpression,\n isTSInstantiationExpression,\n} from '../../utils';\nimport type { TSESTree } from '@typescript-eslint/utils';\n\nexport const noTypedStore = 'noTypedStore';\nexport const noTypedStoreSuggest = 'noTypedStoreSuggest';\n\ntype MessageIds = typeof noTypedStore | typeof noTypedStoreSuggest;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n ngrxModule: 'store',\n docs: {\n description: 'The global store should not be typed.',\n },\n schema: [],\n messages: {\n [noTypedStore]:\n '`Store` should not be typed, use `Store` (without generic) instead.',\n [noTypedStoreSuggest]: 'Remove generic from `Store`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n Program() {\n const { identifiers = [] } = getNgRxStores(context);\n\n for (const identifier of identifiers) {\n // using inject()\n if (!identifier.typeAnnotation) {\n const { parent } = identifier;\n if (\n isPropertyDefinition(parent) &&\n parent.value &&\n isCallExpression(parent.value) &&\n parent.value.arguments.length\n ) {\n const [storeArgument] = parent.value.arguments;\n if (isTSInstantiationExpression(storeArgument)) {\n report(storeArgument.typeArguments);\n }\n }\n\n continue;\n }\n\n if (\n !isTSTypeReference(identifier.typeAnnotation.typeAnnotation) ||\n !identifier.typeAnnotation.typeAnnotation.typeArguments\n ) {\n continue;\n }\n\n report(identifier.typeAnnotation.typeAnnotation.typeArguments);\n }\n },\n };\n\n function report(typeArguments: TSESTree.TSTypeParameterInstantiation) {\n context.report({\n node: typeArguments,\n messageId: noTypedStore,\n suggest: [\n {\n messageId: noTypedStoreSuggest,\n fix: (fixer) => fixer.remove(typeArguments),\n },\n ],\n });\n }\n },\n});\n"]}
1
+ {"version":3,"file":"no-typed-global-store.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-typed-global-store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAMqB;AAGR,QAAA,YAAY,GAAG,cAAc,CAAC;AAC9B,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAKzD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,IAAI,EAAE;YACJ,WAAW,EAAE,uCAAuC;YACpD,UAAU,EAA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CAAC;gBACb,IAAI,EAAE,aAAa;gBACnB,SAAS,EAAE,oBAAY;gBACvB,OAAO,EAAE;oBACP;wBACE,SAAS,EAAE,2BAAmB;wBAC9B,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC;qBAC5C;iBACF;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC,CAAC","sourcesContent":["import * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n getNgRxStores,\n isPropertyDefinition,\n isTSTypeReference,\n isCallExpression,\n isTSInstantiationExpression,\n} from '../../utils';\nimport type { TSESTree } from '@typescript-eslint/utils';\n\nexport const noTypedStore = 'noTypedStore';\nexport const noTypedStoreSuggest = 'noTypedStoreSuggest';\n\ntype MessageIds = typeof noTypedStore | typeof noTypedStoreSuggest;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n docs: {\n description: 'The global store should not be typed.',\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [noTypedStore]:\n '`Store` should not be typed, use `Store` (without generic) instead.',\n [noTypedStoreSuggest]: 'Remove generic from `Store`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n Program() {\n const { identifiers = [] } = getNgRxStores(context);\n\n for (const identifier of identifiers) {\n // using inject()\n if (!identifier.typeAnnotation) {\n const { parent } = identifier;\n if (\n isPropertyDefinition(parent) &&\n parent.value &&\n isCallExpression(parent.value) &&\n parent.value.arguments.length\n ) {\n const [storeArgument] = parent.value.arguments;\n if (isTSInstantiationExpression(storeArgument)) {\n report(storeArgument.typeArguments);\n }\n }\n\n continue;\n }\n\n if (\n !isTSTypeReference(identifier.typeAnnotation.typeAnnotation) ||\n !identifier.typeAnnotation.typeAnnotation.typeArguments\n ) {\n continue;\n }\n\n report(identifier.typeAnnotation.typeAnnotation.typeArguments);\n }\n },\n };\n\n function report(typeArguments: TSESTree.TSTypeParameterInstantiation) {\n context.report({\n node: typeArguments,\n messageId: noTypedStore,\n suggest: [\n {\n messageId: noTypedStoreSuggest,\n fix: (fixer) => fixer.remove(typeArguments),\n },\n ],\n });\n }\n },\n});\n"]}
@@ -2,5 +2,5 @@ import type { TSESLint } from '@typescript-eslint/utils';
2
2
  export declare const onFunctionExplicitReturnType = "onFunctionExplicitReturnType";
3
3
  export declare const onFunctionExplicitReturnTypeSuggest = "onFunctionExplicitReturnTypeSuggest";
4
4
  type MessageIds = typeof onFunctionExplicitReturnType | typeof onFunctionExplicitReturnTypeSuggest;
5
- declare const _default: TSESLint.RuleModule<MessageIds, readonly [], unknown, TSESLint.RuleListener>;
5
+ declare const _default: TSESLint.RuleModule<MessageIds, readonly [], import("../../rule-creator").NgRxRuleDocs, TSESLint.RuleListener>;
6
6
  export default _default;
@@ -45,9 +45,9 @@ exports.default = (0, rule_creator_1.createRule)({
45
45
  meta: {
46
46
  type: 'suggestion',
47
47
  hasSuggestions: true,
48
- ngrxModule: 'store',
49
48
  docs: {
50
49
  description: '`On` function should have an explicit return type.',
50
+ ngrxModule: 'store',
51
51
  },
52
52
  schema: [],
53
53
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"on-function-explicit-return-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/on-function-explicit-return-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAAoD;AACpD,2CAA6B;AAC7B,qDAAgD;AAChD,uCAA6D;AAEhD,QAAA,4BAA4B,GAAG,8BAA8B,CAAC;AAC9D,QAAA,mCAAmC,GAC9C,qCAAqC,CAAC;AAOxC,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,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CAAC;QACpB,MAAM,SAAS,GAAG,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,eAAe,CAAC,SAAS,IAAI,SAAS,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC;IAED,OAAO;QACL,KAAK,CAAC,gBAAgB,CAAC,UAAU,EAAE,GAAG,CAAC;QACvC,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,UAAU,CAAC;KACpC,CAAC;AACb,CAAC","sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/utils';\nimport { ASTUtils } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { getLast, onFunctionWithoutType } from '../../utils';\n\nexport const onFunctionExplicitReturnType = 'onFunctionExplicitReturnType';\nexport const onFunctionExplicitReturnTypeSuggest =\n 'onFunctionExplicitReturnTypeSuggest';\n\ntype MessageIds =\n | typeof onFunctionExplicitReturnType\n | typeof onFunctionExplicitReturnTypeSuggest;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n ngrxModule: 'store',\n docs: {\n description: '`On` function should have an explicit return type.',\n },\n schema: [],\n messages: {\n [onFunctionExplicitReturnType]:\n '`On` functions should have an explicit return type when using arrow functions: `on(action, (state): State => {}`.',\n [onFunctionExplicitReturnTypeSuggest]:\n 'Add the explicit return type `State` (if the interface/type is named differently you need to manually correct the return type).',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [onFunctionWithoutType](node: TSESTree.ArrowFunctionExpression) {\n context.report({\n node,\n messageId: onFunctionExplicitReturnType,\n suggest: [\n {\n messageId: onFunctionExplicitReturnTypeSuggest,\n fix: (fixer) => getFixes(node, context.sourceCode, fixer),\n },\n ],\n });\n },\n };\n },\n});\n\nfunction getFixes(\n node: TSESTree.ArrowFunctionExpression,\n sourceCode: Readonly<TSESLint.SourceCode>,\n fixer: TSESLint.RuleFixer\n) {\n const { params } = node;\n\n if (params.length === 0) {\n const [, closingParen] = sourceCode.getTokens(node);\n return fixer.insertTextAfter(closingParen, ': State');\n }\n\n const [firstParam] = params;\n const lastParam = getLast(params);\n const previousToken = sourceCode.getTokenBefore(firstParam);\n const isParenthesized =\n previousToken && ASTUtils.isOpeningParenToken(previousToken);\n\n if (isParenthesized) {\n const nextToken = sourceCode.getTokenAfter(lastParam);\n return fixer.insertTextAfter(nextToken ?? lastParam, ': State');\n }\n\n return [\n fixer.insertTextBefore(firstParam, '('),\n fixer.insertTextAfter(lastParam, '): State'),\n ] as const;\n}\n"]}
1
+ {"version":3,"file":"on-function-explicit-return-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/on-function-explicit-return-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAAoD;AACpD,2CAA6B;AAC7B,qDAAgD;AAChD,uCAA6D;AAEhD,QAAA,4BAA4B,GAAG,8BAA8B,CAAC;AAC9D,QAAA,mCAAmC,GAC9C,qCAAqC,CAAC;AAOxC,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,IAAI,EAAE;YACJ,WAAW,EAAE,oDAAoD;YACjE,UAAU,EAAE,OAAO;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,oCAA4B,CAAC,EAC5B,mHAAmH;YACrH,CAAC,2CAAmC,CAAC,EACnC,iIAAiI;SACpI;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,6BAAqB,CAAC,CAAC,IAAsC;gBAC5D,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,E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from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { getLast, onFunctionWithoutType } from '../../utils';\n\nexport const onFunctionExplicitReturnType = 'onFunctionExplicitReturnType';\nexport const onFunctionExplicitReturnTypeSuggest =\n 'onFunctionExplicitReturnTypeSuggest';\n\ntype MessageIds =\n | typeof onFunctionExplicitReturnType\n | typeof onFunctionExplicitReturnTypeSuggest;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n docs: {\n description: '`On` function should have an explicit return type.',\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [onFunctionExplicitReturnType]:\n '`On` functions should have an explicit return type when using arrow functions: `on(action, (state): State => {}`.',\n [onFunctionExplicitReturnTypeSuggest]:\n 'Add the explicit return type `State` (if the interface/type is named differently you need to manually correct the return type).',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [onFunctionWithoutType](node: TSESTree.ArrowFunctionExpression) {\n context.report({\n node,\n messageId: onFunctionExplicitReturnType,\n suggest: [\n {\n messageId: onFunctionExplicitReturnTypeSuggest,\n fix: (fixer) => getFixes(node, context.sourceCode, fixer),\n },\n ],\n });\n },\n };\n },\n});\n\nfunction getFixes(\n node: TSESTree.ArrowFunctionExpression,\n sourceCode: Readonly<TSESLint.SourceCode>,\n fixer: TSESLint.RuleFixer\n) {\n const { params } = node;\n\n if (params.length === 0) {\n const [, closingParen] = sourceCode.getTokens(node);\n return fixer.insertTextAfter(closingParen, ': State');\n }\n\n const [firstParam] = params;\n const lastParam = getLast(params);\n const previousToken = sourceCode.getTokenBefore(firstParam);\n const isParenthesized =\n previousToken && ASTUtils.isOpeningParenToken(previousToken);\n\n if (isParenthesized) {\n const nextToken = sourceCode.getTokenAfter(lastParam);\n return fixer.insertTextAfter(nextToken ?? lastParam, ': State');\n }\n\n return [\n fixer.insertTextBefore(firstParam, '('),\n fixer.insertTextAfter(lastParam, '): State'),\n ] as const;\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  export declare const messageId = "preferActionCreatorInDispatch";
2
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreatorInDispatch", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreatorInDispatch", readonly [], import("../../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
3
3
  export default _default;
@@ -42,9 +42,9 @@ exports.default = (0, rule_creator_1.createRule)({
42
42
  name: path.parse(__filename).name,
43
43
  meta: {
44
44
  type: 'suggestion',
45
- ngrxModule: 'store',
46
45
  docs: {
47
46
  description: 'Using `action creator` in `dispatch` is preferred over `object` or old `Action`.',
47
+ ngrxModule: 'store',
48
48
  },
49
49
  schema: [],
50
50
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-action-creator-in-dispatch.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-action-creator-in-dispatch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAOqB;AAER,QAAA,SAAS,GAAG,+BAA+B,CAAC;AAKzD,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,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EACT,kFAAkF;SACrF;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,4EAA4E;SAC/E;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,qBAAa,EAAC,OAAO,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO;YACL,CAAC,GAAG,IAAA,0BAAkB,EACpB,UAAU,CACX,kEAAkE,CAAC,CAClE,IAAwD;gBAExD,MAAM,0BAA0B,GAAG,IAAA,+BAAuB,EACxD,IAAI,EACJ,wBAAgB,CACjB,CAAC;gBACF,MAAM,8BAA8B,GAClC,0BAA0B,KAAK,SAAS;oBACxC,IAAA,4BAAoB,EAClB,0BAA0B,EAC1B,UAAU,EACV,UAAU,CACX,CAAC;gBAEJ,IAAI,CAAC,8BAA8B,EAAE,CAAC;oBACpC,OAAO;gBACT,CAAC;gBAED,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 dispatchExpression,\n getNearestUpperNodeFrom,\n getNgRxStores,\n isCallExpression,\n isCallExpressionWith,\n} from '../../utils';\n\nexport const messageId = 'preferActionCreatorInDispatch';\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: 'store',\n docs: {\n description:\n 'Using `action creator` in `dispatch` is preferred over `object` or old `Action`.',\n },\n schema: [],\n messages: {\n [messageId]:\n 'Using `object` or old `Action` is forbidden. Use `action creator` instead.',\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 [`${dispatchExpression(\n storeNames\n )} :matches(NewExpression, :not(NewExpression) > ObjectExpression)`](\n node: TSESTree.NewExpression | TSESTree.ObjectExpression\n ) {\n const nearestUpperCallExpression = getNearestUpperNodeFrom(\n node,\n isCallExpression\n );\n const isStoreDispatchImmediateParent =\n nearestUpperCallExpression !== undefined &&\n isCallExpressionWith(\n nearestUpperCallExpression,\n storeNames,\n 'dispatch'\n );\n\n if (!isStoreDispatchImmediateParent) {\n return;\n }\n\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"prefer-action-creator-in-dispatch.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-action-creator-in-dispatch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAOqB;AAER,QAAA,SAAS,GAAG,+BAA+B,CAAC;AAKzD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EACT,kFAAkF;YACpF,UAAU,EAAE,OAAO;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,4EAA4E;SAC/E;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,qBAAa,EAAC,OAAO,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO;YACL,CAAC,GAAG,IAAA,0BAAkB,EACpB,UAAU,CACX,kEAAkE,CAAC,CAClE,IAAwD;gBAExD,MAAM,0BAA0B,GAAG,IAAA,+BAAuB,EACxD,IAAI,EACJ,wBAAgB,CACjB,CAAC;gBACF,MAAM,8BAA8B,GAClC,0BAA0B,KAAK,SAAS;oBACxC,IAAA,4BAAoB,EAClB,0BAA0B,EAC1B,UAAU,EACV,UAAU,CACX,CAAC;gBAEJ,IAAI,CAAC,8BAA8B,EAAE,CAAC;oBACpC,OAAO;gBACT,CAAC;gBAED,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 dispatchExpression,\n getNearestUpperNodeFrom,\n getNgRxStores,\n isCallExpression,\n isCallExpressionWith,\n} from '../../utils';\n\nexport const messageId = 'preferActionCreatorInDispatch';\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 docs: {\n description:\n 'Using `action creator` in `dispatch` is preferred over `object` or old `Action`.',\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [messageId]:\n 'Using `object` or old `Action` is forbidden. Use `action creator` instead.',\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 [`${dispatchExpression(\n storeNames\n )} :matches(NewExpression, :not(NewExpression) > ObjectExpression)`](\n node: TSESTree.NewExpression | TSESTree.ObjectExpression\n ) {\n const nearestUpperCallExpression = getNearestUpperNodeFrom(\n node,\n isCallExpression\n );\n const isStoreDispatchImmediateParent =\n nearestUpperCallExpression !== undefined &&\n isCallExpressionWith(\n nearestUpperCallExpression,\n storeNames,\n 'dispatch'\n );\n\n if (!isStoreDispatchImmediateParent) {\n return;\n }\n\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
@@ -1,3 +1,3 @@
1
1
  export declare const messageId = "preferActionCreator";
2
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreator", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreator", readonly [], import("../../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
3
3
  export default _default;
@@ -41,9 +41,9 @@ exports.default = (0, rule_creator_1.createRule)({
41
41
  name: path.parse(__filename).name,
42
42
  meta: {
43
43
  type: 'suggestion',
44
- ngrxModule: 'store',
45
44
  docs: {
46
45
  description: 'Using `action creator` is preferred over `Action class`.',
46
+ ngrxModule: 'store',
47
47
  },
48
48
  schema: [],
49
49
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-action-creator.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-action-creator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAEnC,QAAA,SAAS,GAAG,qBAAqB,CAAC;AAK/C,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,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,0DAA0D;SACxE;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,kEAAkE;SACrE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,2JAA2J,CAAC,CAC3J,IAA+B;gBAE/B,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';\n\nexport const messageId = 'preferActionCreator';\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: 'store',\n docs: {\n description: 'Using `action creator` is preferred over `Action class`.',\n },\n schema: [],\n messages: {\n [messageId]:\n 'Using `Action class` is forbidden. Use `action creator` instead.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`ClassDeclaration:has(TSClassImplements:matches([expression.name='Action'], [expression.property.name='Action'])):has(PropertyDefinition[key.name='type'])`](\n node: TSESTree.ClassDeclaration\n ) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"prefer-action-creator.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-action-creator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAEnC,QAAA,SAAS,GAAG,qBAAqB,CAAC;AAK/C,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,0DAA0D;YACvE,UAAU,EAAE,OAAO;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,kEAAkE;SACrE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,2JAA2J,CAAC,CAC3J,IAA+B;gBAE/B,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';\n\nexport const messageId = 'preferActionCreator';\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 docs: {\n description: 'Using `action creator` is preferred over `Action class`.',\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [messageId]:\n 'Using `Action class` is forbidden. Use `action creator` instead.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`ClassDeclaration:has(TSClassImplements:matches([expression.name='Action'], [expression.property.name='Action'])):has(PropertyDefinition[key.name='type'])`](\n node: TSESTree.ClassDeclaration\n ) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
@@ -1,5 +1,5 @@
1
1
  export declare const preferInlineActionProps = "preferInlineActionProps";
2
2
  export declare const preferInlineActionPropsSuggest = "preferInlineActionPropsSuggest";
3
3
  type MessageIds = typeof preferInlineActionProps | typeof preferInlineActionPropsSuggest;
4
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
4
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], import("../../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
5
5
  export default _default;
@@ -44,9 +44,9 @@ exports.default = (0, rule_creator_1.createRule)({
44
44
  meta: {
45
45
  type: 'suggestion',
46
46
  hasSuggestions: true,
47
- ngrxModule: 'store',
48
47
  docs: {
49
48
  description: 'Prefer using inline types instead of interfaces, types or classes.',
49
+ ngrxModule: 'store',
50
50
  },
51
51
  schema: [],
52
52
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-inline-action-props.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-inline-action-props.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAyD;AAE5C,QAAA,uBAAuB,GAAG,yBAAyB,CAAC;AACpD,QAAA,8BAA8B,GAAG,gCAAgC,CAAC;AAO/E,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EACT,oEAAoE;SACvE;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,+BAAuB,CAAC,EACvB,2DAA2D;YAC7D,CAAC,sCAA8B,CAAC,EAAE,yBAAyB;SAC5D;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,kCAA0B,CAAC,CAAC,IAA8B;gBACzD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,+BAAuB;oBAClC,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,sCAA8B;4BACzC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC;gCACd,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC;gCACvC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC;6BACjC;yBACF;qBACF;iBACF,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 { actionCreatorPropsComputed } from '../../utils';\n\nexport const preferInlineActionProps = 'preferInlineActionProps';\nexport const preferInlineActionPropsSuggest = 'preferInlineActionPropsSuggest';\n\ntype MessageIds =\n | typeof preferInlineActionProps\n | typeof preferInlineActionPropsSuggest;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n ngrxModule: 'store',\n docs: {\n description:\n 'Prefer using inline types instead of interfaces, types or classes.',\n },\n schema: [],\n messages: {\n [preferInlineActionProps]:\n 'Use inline types instead of interfaces, types or classes.',\n [preferInlineActionPropsSuggest]: 'Change to inline types.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [actionCreatorPropsComputed](node: TSESTree.TSTypeReference) {\n context.report({\n node,\n messageId: preferInlineActionProps,\n suggest: [\n {\n messageId: preferInlineActionPropsSuggest,\n fix: (fixer) => [\n fixer.insertTextBefore(node, '{name: '),\n fixer.insertTextAfter(node, '}'),\n ],\n },\n ],\n });\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"prefer-inline-action-props.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-inline-action-props.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAyD;AAE5C,QAAA,uBAAuB,GAAG,yBAAyB,CAAC;AACpD,QAAA,8BAA8B,GAAG,gCAAgC,CAAC;AAO/E,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,IAAI,EAAE;YACJ,WAAW,EACT,oEAAoE;YACtE,UAAU,EAAE,OAAO;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,+BAAuB,CAAC,EACvB,2DAA2D;YAC7D,CAAC,sCAA8B,CAAC,EAAE,yBAAyB;SAC5D;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,kCAA0B,CAAC,CAAC,IAA8B;gBACzD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,+BAAuB;oBAClC,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,sCAA8B;4BACzC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC;gCACd,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC;gCACvC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC;6BACjC;yBACF;qBACF;iBACF,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 { actionCreatorPropsComputed } from '../../utils';\n\nexport const preferInlineActionProps = 'preferInlineActionProps';\nexport const preferInlineActionPropsSuggest = 'preferInlineActionPropsSuggest';\n\ntype MessageIds =\n | typeof preferInlineActionProps\n | typeof preferInlineActionPropsSuggest;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n docs: {\n description:\n 'Prefer using inline types instead of interfaces, types or classes.',\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [preferInlineActionProps]:\n 'Use inline types instead of interfaces, types or classes.',\n [preferInlineActionPropsSuggest]: 'Change to inline types.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [actionCreatorPropsComputed](node: TSESTree.TSTypeReference) {\n context.report({\n node,\n messageId: preferInlineActionProps,\n suggest: [\n {\n messageId: preferInlineActionPropsSuggest,\n fix: (fixer) => [\n fixer.insertTextBefore(node, '{name: '),\n fixer.insertTextAfter(node, '}'),\n ],\n },\n ],\n });\n },\n };\n },\n});\n"]}
@@ -1,5 +1,5 @@
1
1
  export declare const preferOneGenericInCreateForFeatureSelector = "preferOneGenericInCreateForFeatureSelector";
2
2
  export declare const preferOneGenericInCreateForFeatureSelectorSuggest = "preferOneGenericInCreateForFeatureSelectorSuggest";
3
3
  type MessageIds = typeof preferOneGenericInCreateForFeatureSelector | typeof preferOneGenericInCreateForFeatureSelectorSuggest;
4
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
4
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], import("../../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
5
5
  export default _default;
@@ -43,9 +43,9 @@ exports.default = (0, rule_creator_1.createRule)({
43
43
  meta: {
44
44
  type: 'suggestion',
45
45
  hasSuggestions: true,
46
- ngrxModule: 'store',
47
46
  docs: {
48
47
  description: 'Prefer using a single generic to define the feature state.',
48
+ ngrxModule: 'store',
49
49
  },
50
50
  schema: [],
51
51
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-one-generic-in-create-for-feature-selector.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-one-generic-in-create-for-feature-selector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAEnC,QAAA,0CAA0C,GACrD,4CAA4C,CAAC;AAClC,QAAA,iDAAiD,GAC5D,mDAAmD,CAAC;AAOtD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,4DAA4D;SAC1E;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,kDAA0C,CAAC,EAC1C,mDAAmD;YACrD,CAAC,yDAAiD,CAAC,EACjD,kCAAkC;SACrC;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,qGAAqG,CAAC,CACrG,IAA2C;gBAE3C,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,kDAA0C;oBACrD,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,yDAAiD;4BAC5D,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;gCACb,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;gCAClC,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;gCAChE,OAAO,KAAK,CAAC,WAAW,CAAC;oCACvB,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;oCACpB,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;iCAChD,CAAC,CAAC;4BACL,CAAC;yBACF;qBACF;iBACF,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';\n\nexport const preferOneGenericInCreateForFeatureSelector =\n 'preferOneGenericInCreateForFeatureSelector';\nexport const preferOneGenericInCreateForFeatureSelectorSuggest =\n 'preferOneGenericInCreateForFeatureSelectorSuggest';\n\ntype MessageIds =\n | typeof preferOneGenericInCreateForFeatureSelector\n | typeof preferOneGenericInCreateForFeatureSelectorSuggest;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n ngrxModule: 'store',\n docs: {\n description: 'Prefer using a single generic to define the feature state.',\n },\n schema: [],\n messages: {\n [preferOneGenericInCreateForFeatureSelector]:\n 'Use a single generic to define the feature state.',\n [preferOneGenericInCreateForFeatureSelectorSuggest]:\n 'Remove the global state generic.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`CallExpression[callee.name='createFeatureSelector'] > TSTypeParameterInstantiation[params.length>1]`](\n node: TSESTree.TSTypeParameterInstantiation\n ) {\n context.report({\n node,\n messageId: preferOneGenericInCreateForFeatureSelector,\n suggest: [\n {\n messageId: preferOneGenericInCreateForFeatureSelectorSuggest,\n fix: (fixer) => {\n const [globalState] = node.params;\n const nextToken = context.sourceCode.getTokenAfter(globalState);\n return fixer.removeRange([\n globalState.range[0],\n nextToken?.range[1] ?? globalState.range[1] + 1,\n ]);\n },\n },\n ],\n });\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"prefer-one-generic-in-create-for-feature-selector.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-one-generic-in-create-for-feature-selector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAEnC,QAAA,0CAA0C,GACrD,4CAA4C,CAAC;AAClC,QAAA,iDAAiD,GAC5D,mDAAmD,CAAC;AAOtD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,IAAI,EAAE;YACJ,WAAW,EAAE,4DAA4D;YACzE,UAAU,EAAE,OAAO;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,kDAA0C,CAAC,EAC1C,mDAAmD;YACrD,CAAC,yDAAiD,CAAC,EACjD,kCAAkC;SACrC;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,qGAAqG,CAAC,CACrG,IAA2C;gBAE3C,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,kDAA0C;oBACrD,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,yDAAiD;4BAC5D,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;gCACb,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;gCAClC,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;gCAChE,OAAO,KAAK,CAAC,WAAW,CAAC;oCACvB,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;oCACpB,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;iCAChD,CAAC,CAAC;4BACL,CAAC;yBACF;qBACF;iBACF,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';\n\nexport const preferOneGenericInCreateForFeatureSelector =\n 'preferOneGenericInCreateForFeatureSelector';\nexport const preferOneGenericInCreateForFeatureSelectorSuggest =\n 'preferOneGenericInCreateForFeatureSelectorSuggest';\n\ntype MessageIds =\n | typeof preferOneGenericInCreateForFeatureSelector\n | typeof preferOneGenericInCreateForFeatureSelectorSuggest;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n docs: {\n description: 'Prefer using a single generic to define the feature state.',\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [preferOneGenericInCreateForFeatureSelector]:\n 'Use a single generic to define the feature state.',\n [preferOneGenericInCreateForFeatureSelectorSuggest]:\n 'Remove the global state generic.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`CallExpression[callee.name='createFeatureSelector'] > TSTypeParameterInstantiation[params.length>1]`](\n node: TSESTree.TSTypeParameterInstantiation\n ) {\n context.report({\n node,\n messageId: preferOneGenericInCreateForFeatureSelector,\n suggest: [\n {\n messageId: preferOneGenericInCreateForFeatureSelectorSuggest,\n fix: (fixer) => {\n const [globalState] = node.params;\n const nextToken = context.sourceCode.getTokenAfter(globalState);\n return fixer.removeRange([\n globalState.range[0],\n nextToken?.range[1] ?? globalState.range[1] + 1,\n ]);\n },\n },\n ],\n });\n },\n };\n },\n});\n"]}
@@ -1,3 +1,3 @@
1
1
  export declare const messageId = "preferSelectorInSelect";
2
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferSelectorInSelect", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
2
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferSelectorInSelect", readonly [], import("../../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
3
3
  export default _default;
@@ -42,9 +42,9 @@ exports.default = (0, rule_creator_1.createRule)({
42
42
  name: path.parse(__filename).name,
43
43
  meta: {
44
44
  type: 'suggestion',
45
- ngrxModule: 'store',
46
45
  docs: {
47
46
  description: 'Using a selector in the `select` is preferred over `string` or `props drilling`.',
47
+ ngrxModule: 'store',
48
48
  },
49
49
  schema: [],
50
50
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-selector-in-select.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-selector-in-select.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAQqB;AAER,QAAA,SAAS,GAAG,wBAAwB,CAAC;AAKlD,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,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EACT,kFAAkF;SACrF;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,0EAA0E;SAC7E;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,qBAAa,EAAC,OAAO,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO;YACL,CAAC,GAAG,IAAA,sBAAc,EAAC,UAAU,CAAC,KAAK,IAAA,wBAAgB,EAAC,UAAU,CAAC,EAAE,CAAC,CAChE,IAA6B;gBAE7B,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;oBACtC,IACE,CAAC,IAAA,iBAAS,EAAC,QAAQ,CAAC;wBACpB,CAAC,IAAA,iCAAyB,EAAC,QAAQ,CAAC;wBACpC,CAAC,IAAA,4BAAoB,EAAC,QAAQ,CAAC,EAC/B,CAAC;wBACD,MAAM;oBACR,CAAC;oBAED,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,QAAQ;wBACd,SAAS,EAAT,iBAAS;qBACV,CAAC,CAAC;gBACL,CAAC;YACH,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 getNgRxStores,\n isArrowFunctionExpression,\n isFunctionExpression,\n isLiteral,\n pipeableSelect,\n selectExpression,\n} from '../../utils';\n\nexport const messageId = 'preferSelectorInSelect';\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: 'store',\n docs: {\n description:\n 'Using a selector in the `select` is preferred over `string` or `props drilling`.',\n },\n schema: [],\n messages: {\n [messageId]:\n 'Using `string` or `props drilling` is forbidden. Use a selector instead.',\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 [`${pipeableSelect(storeNames)}, ${selectExpression(storeNames)}`](\n node: TSESTree.CallExpression\n ) {\n for (const argument of node.arguments) {\n if (\n !isLiteral(argument) &&\n !isArrowFunctionExpression(argument) &&\n !isFunctionExpression(argument)\n ) {\n break;\n }\n\n context.report({\n node: argument,\n messageId,\n });\n }\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"prefer-selector-in-select.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-selector-in-select.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAQqB;AAER,QAAA,SAAS,GAAG,wBAAwB,CAAC;AAKlD,kBAAe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';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n getNgRxStores,\n isArrowFunctionExpression,\n isFunctionExpression,\n isLiteral,\n pipeableSelect,\n selectExpression,\n} from '../../utils';\n\nexport const messageId = 'preferSelectorInSelect';\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 docs: {\n description:\n 'Using a selector in the `select` is preferred over `string` or `props drilling`.',\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [messageId]:\n 'Using `string` or `props drilling` is forbidden. Use a selector instead.',\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 [`${pipeableSelect(storeNames)}, ${selectExpression(storeNames)}`](\n node: TSESTree.CallExpression\n ) {\n for (const argument of node.arguments) {\n if (\n !isLiteral(argument) &&\n !isArrowFunctionExpression(argument) &&\n !isFunctionExpression(argument)\n ) {\n break;\n }\n\n context.report({\n node: argument,\n messageId,\n });\n }\n },\n };\n },\n});\n"]}
@@ -1,5 +1,5 @@
1
1
  export declare const prefixSelectorsWithSelect = "prefixSelectorsWithSelect";
2
2
  export declare const prefixSelectorsWithSelectSuggest = "prefixSelectorsWithSelectSuggest";
3
3
  type MessageIds = typeof prefixSelectorsWithSelect | typeof prefixSelectorsWithSelectSuggest;
4
- declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
4
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], import("../../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
5
5
  export default _default;