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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/jest.config.d.ts +15 -0
  2. package/package.json +3 -5
  3. package/schematics/ng-add/index.d.ts +3 -0
  4. package/schematics/ng-add/index.js +32 -20
  5. package/schematics/ng-add/index.js.map +1 -1
  6. package/schematics/ng-add/schema.d.ts +3 -0
  7. package/schematics/ng-add/schema.js.map +1 -1
  8. package/schematics/ng-add/schema.json +16 -51
  9. package/scripts/generate-config.d.ts +1 -0
  10. package/scripts/generate-config.js +73 -73
  11. package/scripts/generate-config.js.map +1 -1
  12. package/scripts/generate-docs.d.ts +1 -0
  13. package/scripts/generate-docs.js +33 -65
  14. package/scripts/generate-docs.js.map +1 -1
  15. package/scripts/generate-overview.d.ts +1 -0
  16. package/scripts/generate-overview.js +43 -75
  17. package/scripts/generate-overview.js.map +1 -1
  18. package/spec/utils/from-fixture.d.ts +8 -0
  19. package/spec/utils/from-fixture.js +62 -0
  20. package/spec/utils/from-fixture.js.map +1 -0
  21. package/spec/utils/index.d.ts +2 -0
  22. package/spec/utils/index.js +16 -19
  23. package/spec/utils/index.js.map +1 -1
  24. package/spec/utils/rule-tester.d.ts +5 -0
  25. package/spec/utils/rule-tester.js +23 -0
  26. package/spec/utils/rule-tester.js.map +1 -0
  27. package/src/configs/all.d.ts +7 -0
  28. package/src/configs/all.js +56 -32
  29. package/src/configs/all.js.map +1 -1
  30. package/src/configs/all.json +42 -0
  31. package/src/configs/component-store.d.ts +7 -0
  32. package/src/configs/component-store.js +23 -8
  33. package/src/configs/component-store.js.map +1 -1
  34. package/src/configs/component-store.json +9 -0
  35. package/src/configs/effects.d.ts +7 -0
  36. package/src/configs/effects.js +32 -11
  37. package/src/configs/effects.js.map +1 -1
  38. package/src/configs/effects.json +13 -0
  39. package/src/configs/operators.d.ts +7 -0
  40. package/src/configs/operators.js +28 -0
  41. package/src/configs/operators.js.map +1 -0
  42. package/src/configs/operators.json +7 -0
  43. package/src/configs/signals.d.ts +7 -0
  44. package/src/configs/signals.js +34 -0
  45. package/src/configs/signals.js.map +1 -0
  46. package/src/configs/signals.json +8 -0
  47. package/src/configs/store.d.ts +7 -0
  48. package/src/configs/store.js +38 -23
  49. package/src/configs/store.js.map +1 -1
  50. package/src/configs/store.json +24 -0
  51. package/src/index.d.ts +141 -0
  52. package/src/index.js +18 -3
  53. package/src/index.js.map +1 -1
  54. package/src/rule-creator.d.ts +24 -0
  55. package/src/rule-creator.js +12 -58
  56. package/src/rule-creator.js.map +1 -1
  57. package/src/rules/component-store/avoid-combining-component-store-selectors.d.ts +3 -0
  58. package/src/rules/component-store/avoid-combining-component-store-selectors.js +22 -47
  59. package/src/rules/component-store/avoid-combining-component-store-selectors.js.map +1 -1
  60. package/src/rules/component-store/avoid-mapping-component-store-selectors.d.ts +3 -0
  61. package/src/rules/component-store/avoid-mapping-component-store-selectors.js +17 -20
  62. package/src/rules/component-store/avoid-mapping-component-store-selectors.js.map +1 -1
  63. package/src/rules/component-store/updater-explicit-return-type.d.ts +3 -0
  64. package/src/rules/component-store/updater-explicit-return-type.js +17 -20
  65. package/src/rules/component-store/updater-explicit-return-type.js.map +1 -1
  66. package/src/rules/effects/avoid-cyclic-effects.d.ts +4 -0
  67. package/src/rules/effects/avoid-cyclic-effects.js +47 -109
  68. package/src/rules/effects/avoid-cyclic-effects.js.map +1 -1
  69. package/src/rules/effects/no-dispatch-in-effects.d.ts +5 -0
  70. package/src/rules/effects/no-dispatch-in-effects.js +17 -21
  71. package/src/rules/effects/no-dispatch-in-effects.js.map +1 -1
  72. package/src/rules/effects/no-effects-in-providers.d.ts +3 -0
  73. package/src/rules/effects/no-effects-in-providers.js +18 -49
  74. package/src/rules/effects/no-effects-in-providers.js.map +1 -1
  75. package/src/rules/effects/no-multiple-actions-in-effects.d.ts +5 -0
  76. package/src/rules/effects/no-multiple-actions-in-effects.js +31 -24
  77. package/src/rules/effects/no-multiple-actions-in-effects.js.map +1 -1
  78. package/src/rules/effects/prefer-action-creator-in-of-type.d.ts +3 -0
  79. package/src/rules/effects/prefer-action-creator-in-of-type.js +10 -13
  80. package/src/rules/effects/prefer-action-creator-in-of-type.js.map +1 -1
  81. package/src/rules/effects/prefer-effect-callback-in-block-statement.d.ts +4 -0
  82. package/src/rules/effects/prefer-effect-callback-in-block-statement.js +24 -43
  83. package/src/rules/effects/prefer-effect-callback-in-block-statement.js.map +1 -1
  84. package/src/rules/effects/use-effects-lifecycle-interface.d.ts +3 -0
  85. package/src/rules/effects/use-effects-lifecycle-interface.js +21 -24
  86. package/src/rules/effects/use-effects-lifecycle-interface.js.map +1 -1
  87. package/src/rules/index.d.ts +33 -0
  88. package/src/rules/index.js +69 -53
  89. package/src/rules/index.js.map +1 -1
  90. package/src/rules/operators/prefer-concat-latest-from.d.ts +7 -0
  91. package/src/rules/operators/prefer-concat-latest-from.js +123 -0
  92. package/src/rules/operators/prefer-concat-latest-from.js.map +1 -0
  93. package/src/rules/signals/signal-state-no-arrays-at-root-level.d.ts +3 -0
  94. package/src/rules/signals/signal-state-no-arrays-at-root-level.js +59 -0
  95. package/src/rules/signals/signal-state-no-arrays-at-root-level.js.map +1 -0
  96. package/src/rules/signals/with-state-no-arrays-at-root-level.d.ts +4 -0
  97. package/src/rules/signals/with-state-no-arrays-at-root-level.js +72 -0
  98. package/src/rules/signals/with-state-no-arrays-at-root-level.js.map +1 -0
  99. package/src/rules/store/avoid-combining-selectors.d.ts +3 -0
  100. package/src/rules/store/avoid-combining-selectors.js +20 -45
  101. package/src/rules/store/avoid-combining-selectors.js.map +1 -1
  102. package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.d.ts +3 -0
  103. package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js +20 -47
  104. package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js.map +1 -1
  105. package/src/rules/store/avoid-duplicate-actions-in-reducer.d.ts +5 -0
  106. package/src/rules/store/avoid-duplicate-actions-in-reducer.js +33 -101
  107. package/src/rules/store/avoid-duplicate-actions-in-reducer.js.map +1 -1
  108. package/src/rules/store/avoid-mapping-selectors.d.ts +3 -0
  109. package/src/rules/store/avoid-mapping-selectors.js +24 -30
  110. package/src/rules/store/avoid-mapping-selectors.js.map +1 -1
  111. package/src/rules/store/good-action-hygiene.d.ts +3 -0
  112. package/src/rules/store/good-action-hygiene.js +14 -34
  113. package/src/rules/store/good-action-hygiene.js.map +1 -1
  114. package/src/rules/store/no-multiple-global-stores.d.ts +6 -0
  115. package/src/rules/store/no-multiple-global-stores.js +34 -96
  116. package/src/rules/store/no-multiple-global-stores.js.map +1 -1
  117. package/src/rules/store/no-reducer-in-key-names.d.ts +5 -0
  118. package/src/rules/store/no-reducer-in-key-names.js +16 -20
  119. package/src/rules/store/no-reducer-in-key-names.js.map +1 -1
  120. package/src/rules/store/no-store-subscription.d.ts +3 -0
  121. package/src/rules/store/no-store-subscription.js +13 -16
  122. package/src/rules/store/no-store-subscription.js.map +1 -1
  123. package/src/rules/store/no-typed-global-store.d.ts +5 -0
  124. package/src/rules/store/no-typed-global-store.js +29 -70
  125. package/src/rules/store/no-typed-global-store.js.map +1 -1
  126. package/src/rules/store/on-function-explicit-return-type.d.ts +6 -0
  127. package/src/rules/store/on-function-explicit-return-type.js +23 -43
  128. package/src/rules/store/on-function-explicit-return-type.js.map +1 -1
  129. package/src/rules/store/prefer-action-creator-in-dispatch.d.ts +3 -0
  130. package/src/rules/store/prefer-action-creator-in-dispatch.js +15 -18
  131. package/src/rules/store/prefer-action-creator-in-dispatch.js.map +1 -1
  132. package/src/rules/store/prefer-action-creator.d.ts +3 -0
  133. package/src/rules/store/prefer-action-creator.js +10 -13
  134. package/src/rules/store/prefer-action-creator.js.map +1 -1
  135. package/src/rules/store/prefer-inline-action-props.d.ts +5 -0
  136. package/src/rules/store/prefer-inline-action-props.js +14 -18
  137. package/src/rules/store/prefer-inline-action-props.js.map +1 -1
  138. package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.d.ts +5 -0
  139. package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js +16 -37
  140. package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js.map +1 -1
  141. package/src/rules/store/prefer-selector-in-select.d.ts +3 -0
  142. package/src/rules/store/prefer-selector-in-select.js +21 -46
  143. package/src/rules/store/prefer-selector-in-select.js.map +1 -1
  144. package/src/rules/store/prefix-selectors-with-select.d.ts +5 -0
  145. package/src/rules/store/prefix-selectors-with-select.js +26 -39
  146. package/src/rules/store/prefix-selectors-with-select.js.map +1 -1
  147. package/src/rules/store/select-style.d.ts +11 -0
  148. package/src/rules/store/select-style.js +53 -108
  149. package/src/rules/store/select-style.js.map +1 -1
  150. package/src/rules/store/use-consistent-global-store-name.d.ts +6 -0
  151. package/src/rules/store/use-consistent-global-store-name.js +24 -80
  152. package/src/rules/store/use-consistent-global-store-name.js.map +1 -1
  153. package/src/utils/helper-functions/docs.d.ts +1 -0
  154. package/src/utils/helper-functions/docs.js +1 -3
  155. package/src/utils/helper-functions/docs.js.map +1 -1
  156. package/src/utils/helper-functions/folder.d.ts +5 -0
  157. package/src/utils/helper-functions/folder.js +16 -88
  158. package/src/utils/helper-functions/folder.js.map +1 -1
  159. package/src/utils/helper-functions/guards.d.ts +97 -0
  160. package/src/utils/helper-functions/guards.js +27 -31
  161. package/src/utils/helper-functions/guards.js.map +1 -1
  162. package/src/utils/helper-functions/index.d.ts +6 -0
  163. package/src/utils/helper-functions/ngrx-modules.d.ts +8 -0
  164. package/src/utils/helper-functions/ngrx-modules.js +7 -6
  165. package/src/utils/helper-functions/ngrx-modules.js.map +1 -1
  166. package/src/utils/helper-functions/rules.d.ts +3 -0
  167. package/src/utils/helper-functions/rules.js +47 -0
  168. package/src/utils/helper-functions/rules.js.map +1 -0
  169. package/src/utils/helper-functions/utils.d.ts +48 -0
  170. package/src/utils/helper-functions/utils.js +68 -143
  171. package/src/utils/helper-functions/utils.js.map +1 -1
  172. package/src/utils/helper-functions/versions.d.ts +1 -0
  173. package/src/utils/helper-functions/versions.js +9 -10
  174. package/src/utils/helper-functions/versions.js.map +1 -1
  175. package/src/utils/index.d.ts +2 -0
  176. package/src/utils/selectors/index.d.ts +29 -0
  177. package/src/utils/selectors/index.js +30 -44
  178. package/src/utils/selectors/index.js.map +1 -1
  179. package/v9/index.d.ts +29 -0
  180. package/v9/index.js +38 -0
  181. package/v9/index.js.map +1 -0
  182. package/src/configs/all-requiring-type-checking.js +0 -46
  183. package/src/configs/all-requiring-type-checking.js.map +0 -1
  184. package/src/configs/component-store-strict.js +0 -15
  185. package/src/configs/component-store-strict.js.map +0 -1
  186. package/src/configs/effects-requiring-type-checking.js +0 -25
  187. package/src/configs/effects-requiring-type-checking.js.map +0 -1
  188. package/src/configs/effects-strict-requiring-type-checking.js +0 -25
  189. package/src/configs/effects-strict-requiring-type-checking.js.map +0 -1
  190. package/src/configs/effects-strict.js +0 -18
  191. package/src/configs/effects-strict.js.map +0 -1
  192. package/src/configs/index.js +0 -33
  193. package/src/configs/index.js.map +0 -1
  194. package/src/configs/recommended-requiring-type-checking.js +0 -46
  195. package/src/configs/recommended-requiring-type-checking.js.map +0 -1
  196. package/src/configs/recommended.js +0 -39
  197. package/src/configs/recommended.js.map +0 -1
  198. package/src/configs/store-strict.js +0 -30
  199. package/src/configs/store-strict.js.map +0 -1
  200. package/src/configs/strict-requiring-type-checking.js +0 -46
  201. package/src/configs/strict-requiring-type-checking.js.map +0 -1
  202. package/src/configs/strict.js +0 -39
  203. package/src/configs/strict.js.map +0 -1
  204. package/src/rules/effects/prefer-concat-latest-from.js +0 -153
  205. package/src/rules/effects/prefer-concat-latest-from.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"no-typed-global-store.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-typed-global-store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAMqB;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;YACpD,WAAW,EAAE,MAAM;YACnB,UAAU,EAAE,IAAI;SACjB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,oBAAY,IACX,qEAAqE;YACvE,GAAC,2BAAmB,IAAG,8BAA8B;eACtD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;QACd,OAAO;YACL,OAAO;;gBACG,IAAA,KAAqB,IAAA,qBAAa,EAAC,OAAO,CAAC,YAA3B,EAAhB,WAAW,mBAAG,EAAE,KAAA,CAA4B;;oBAEpD,KAAyB,IAAA,gBAAA,SAAA,WAAW,CAAA,wCAAA,iEAAE,CAAC;wBAAlC,IAAM,UAAU,wBAAA;wBACnB,iBAAiB;wBACjB,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;4BACvB,IAAA,QAAM,GAAK,UAAU,OAAf,CAAgB;4BAC9B,IACE,IAAA,4BAAoB,EAAC,QAAM,CAAC;gCAC5B,QAAM,CAAC,KAAK;gCACZ,IAAA,wBAAgB,EAAC,QAAM,CAAC,KAAK,CAAC;gCAC9B,QAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAC7B,CAAC;gCACK,IAAA,KAAA,OAAkB,QAAM,CAAC,KAAK,CAAC,SAAS,IAAA,EAAvC,aAAa,QAA0B,CAAC;gCAC/C,IAAI,IAAA,mCAA2B,EAAC,aAAa,CAAC,EAAE,CAAC;oCAC/C,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;gCACvC,CAAC;4BACH,CAAC;4BAED,SAAS;wBACX,CAAC;wBAED,IACE,CAAC,IAAA,yBAAiB,EAAC,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC;4BAC5D,CAAC,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC,cAAc,EACxD,CAAC;4BACD,SAAS;wBACX,CAAC;wBAED,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;oBAClE,CAAC;;;;;;;;;YACH,CAAC;SACF,CAAC;QAEF,SAAS,MAAM,CAAC,cAAqD;YACnE,OAAO,CAAC,MAAM,CAAC;gBACb,IAAI,EAAE,cAAc;gBACpB,SAAS,EAAE,oBAAY;gBACvB,OAAO,EAAE;oBACP;wBACE,SAAS,EAAE,2BAAmB;wBAC9B,GAAG,EAAE,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,EAA5B,CAA4B;qBAC7C;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/experimental-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 recommended: 'warn',\n suggestion: true,\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.typeParameters);\n }\n }\n\n continue;\n }\n\n if (\n !isTSTypeReference(identifier.typeAnnotation.typeAnnotation) ||\n !identifier.typeAnnotation.typeAnnotation.typeParameters\n ) {\n continue;\n }\n\n report(identifier.typeAnnotation.typeAnnotation.typeParameters);\n }\n },\n };\n\n function report(typeParameters: TSESTree.TSTypeParameterInstantiation) {\n context.report({\n node: typeParameters,\n messageId: noTypedStore,\n suggest: [\n {\n messageId: noTypedStoreSuggest,\n fix: (fixer) => fixer.remove(typeParameters),\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,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"]}
@@ -0,0 +1,6 @@
1
+ import type { TSESLint } from '@typescript-eslint/utils';
2
+ export declare const onFunctionExplicitReturnType = "onFunctionExplicitReturnType";
3
+ export declare const onFunctionExplicitReturnTypeSuggest = "onFunctionExplicitReturnTypeSuggest";
4
+ type MessageIds = typeof onFunctionExplicitReturnType | typeof onFunctionExplicitReturnTypeSuggest;
5
+ declare const _default: TSESLint.RuleModule<MessageIds, readonly [], TSESLint.RuleListener>;
6
+ export default _default;
@@ -22,29 +22,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __read = (this && this.__read) || function (o, n) {
26
- var m = typeof Symbol === "function" && o[Symbol.iterator];
27
- if (!m) return o;
28
- var i = m.call(o), r, ar = [], e;
29
- try {
30
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
31
- }
32
- catch (error) { e = { error: error }; }
33
- finally {
34
- try {
35
- if (r && !r.done && (m = i["return"])) m.call(i);
36
- }
37
- finally { if (e) throw e.error; }
38
- }
39
- return ar;
40
- };
41
- var _a;
42
25
  Object.defineProperty(exports, "__esModule", { value: true });
43
26
  exports.onFunctionExplicitReturnTypeSuggest = exports.onFunctionExplicitReturnType = void 0;
44
- var experimental_utils_1 = require("@typescript-eslint/experimental-utils");
45
- var path = __importStar(require("path"));
46
- var rule_creator_1 = require("../../rule-creator");
47
- var utils_1 = require("../../utils");
27
+ const utils_1 = require("@typescript-eslint/utils");
28
+ const path = __importStar(require("path"));
29
+ const rule_creator_1 = require("../../rule-creator");
30
+ const utils_2 = require("../../utils");
48
31
  exports.onFunctionExplicitReturnType = 'onFunctionExplicitReturnType';
49
32
  exports.onFunctionExplicitReturnTypeSuggest = 'onFunctionExplicitReturnTypeSuggest';
50
33
  exports.default = (0, rule_creator_1.createRule)({
@@ -55,48 +38,45 @@ exports.default = (0, rule_creator_1.createRule)({
55
38
  ngrxModule: 'store',
56
39
  docs: {
57
40
  description: '`On` function should have an explicit return type.',
58
- recommended: 'warn',
59
- suggestion: true,
60
41
  },
61
42
  schema: [],
62
- messages: (_a = {},
63
- _a[exports.onFunctionExplicitReturnType] = '`On` functions should have an explicit return type when using arrow functions: `on(action, (state): State => {}`.',
64
- _a[exports.onFunctionExplicitReturnTypeSuggest] = 'Add the explicit return type `State` (if the interface/type is named differently you need to manually correct the return type).',
65
- _a),
43
+ messages: {
44
+ [exports.onFunctionExplicitReturnType]: '`On` functions should have an explicit return type when using arrow functions: `on(action, (state): State => {}`.',
45
+ [exports.onFunctionExplicitReturnTypeSuggest]: 'Add the explicit return type `State` (if the interface/type is named differently you need to manually correct the return type).',
46
+ },
66
47
  },
67
48
  defaultOptions: [],
68
- create: function (context) {
69
- var _a;
70
- var sourceCode = context.getSourceCode();
71
- return _a = {},
72
- _a[utils_1.onFunctionWithoutType] = function (node) {
49
+ create: (context) => {
50
+ const sourceCode = context.getSourceCode();
51
+ return {
52
+ [utils_2.onFunctionWithoutType](node) {
73
53
  context.report({
74
- node: node,
54
+ node,
75
55
  messageId: exports.onFunctionExplicitReturnType,
76
56
  suggest: [
77
57
  {
78
58
  messageId: exports.onFunctionExplicitReturnTypeSuggest,
79
- fix: function (fixer) { return getFixes(node, sourceCode, fixer); },
59
+ fix: (fixer) => getFixes(node, sourceCode, fixer),
80
60
  },
81
61
  ],
82
62
  });
83
63
  },
84
- _a;
64
+ };
85
65
  },
86
66
  });
87
67
  function getFixes(node, sourceCode, fixer) {
88
- var params = node.params;
68
+ const { params } = node;
89
69
  if (params.length === 0) {
90
- var _a = __read(sourceCode.getTokens(node), 2), closingParen = _a[1];
70
+ const [, closingParen] = sourceCode.getTokens(node);
91
71
  return fixer.insertTextAfter(closingParen, ': State');
92
72
  }
93
- var _b = __read(params, 1), firstParam = _b[0];
94
- var lastParam = (0, utils_1.getLast)(params);
95
- var previousToken = sourceCode.getTokenBefore(firstParam);
96
- var isParenthesized = previousToken && experimental_utils_1.ASTUtils.isOpeningParenToken(previousToken);
73
+ const [firstParam] = params;
74
+ const lastParam = (0, utils_2.getLast)(params);
75
+ const previousToken = sourceCode.getTokenBefore(firstParam);
76
+ const isParenthesized = previousToken && utils_1.ASTUtils.isOpeningParenToken(previousToken);
97
77
  if (isParenthesized) {
98
- var nextToken = sourceCode.getTokenAfter(lastParam);
99
- return fixer.insertTextAfter(nextToken !== null && nextToken !== void 0 ? nextToken : lastParam, ': State');
78
+ const nextToken = sourceCode.getTokenAfter(lastParam);
79
+ return fixer.insertTextAfter(nextToken ?? lastParam, ': State');
100
80
  }
101
81
  return [
102
82
  fixer.insertTextBefore(firstParam, '('),
@@ -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,4EAAiE;AACjE,yCAA6B;AAC7B,mDAAgD;AAChD,qCAA6D;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,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,oDAAoD;YACjE,WAAW,EAAE,MAAM;YACnB,UAAU,EAAE,IAAI;SACjB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,oCAA4B,IAC3B,mHAAmH;YACrH,GAAC,2CAAmC,IAClC,iIAAiI;eACpI;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACd,IAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAE3C;YACE,GAAC,6BAAqB,IAAtB,UAAwB,IAAsC;gBAC5D,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,MAAA;oBACJ,SAAS,EAAE,oCAA4B;oBACvC,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,2CAAmC;4BAC9C,GAAG,EAAE,UAAC,KAAK,IAAK,OAAA,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,EAAjC,CAAiC;yBAClD;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,QAAQ,CACf,IAAsC,EACtC,UAAyC,EACzC,KAAyB;IAEjB,IAAA,MAAM,GAAK,IAAI,OAAT,CAAU;IAExB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClB,IAAA,KAAA,OAAmB,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,IAAA,EAA1C,YAAY,QAA8B,CAAC;QACpD,OAAO,KAAK,CAAC,eAAe,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC;IAEK,IAAA,KAAA,OAAe,MAAM,IAAA,EAApB,UAAU,QAAU,CAAC;IAC5B,IAAM,SAAS,GAAG,IAAA,eAAO,EAAC,MAAM,CAAC,CAAC;IAClC,IAAM,aAAa,GAAG,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC5D,IAAM,eAAe,GACnB,aAAa,IAAI,6BAAQ,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAE/D,IAAI,eAAe,EAAE,CAAC;QACpB,IAAM,SAAS,GAAG,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,eAAe,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,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/experimental-utils';\nimport { ASTUtils } from '@typescript-eslint/experimental-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 recommended: 'warn',\n suggestion: true,\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 const sourceCode = context.getSourceCode();\n\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, 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,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,oDAAoD;SAClE;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,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAE3C,OAAO;YACL,CAAC,6BAAqB,CAAC,CAAC,IAAsC;gBAC5D,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,oCAA4B;oBACvC,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,2CAAmC;4BAC9C,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC;yBAClD;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,QAAQ,CACf,IAAsC,EACtC,UAAyC,EACzC,KAAyB;IAEzB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,CAAC,EAAE,YAAY,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpD,OAAO,KAAK,CAAC,eAAe,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;IAC5B,MAAM,SAAS,GAAG,IAAA,eAAO,EAAC,MAAM,CAAC,CAAC;IAClC,MAAM,aAAa,GAAG,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,eAAe,GACnB,aAAa,IAAI,gBAAQ,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAE/D,IAAI,eAAe,EAAE,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 const sourceCode = context.getSourceCode();\n\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, 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"]}
@@ -0,0 +1,3 @@
1
+ export declare const messageId = "preferActionCreatorInDispatch";
2
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreatorInDispatch", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
3
+ export default _default;
@@ -22,12 +22,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var _a;
26
25
  Object.defineProperty(exports, "__esModule", { value: true });
27
26
  exports.messageId = void 0;
28
- var path = __importStar(require("path"));
29
- var rule_creator_1 = require("../../rule-creator");
30
- var utils_1 = require("../../utils");
27
+ const path = __importStar(require("path"));
28
+ const rule_creator_1 = require("../../rule-creator");
29
+ const utils_1 = require("../../utils");
31
30
  exports.messageId = 'preferActionCreatorInDispatch';
32
31
  exports.default = (0, rule_creator_1.createRule)({
33
32
  name: path.parse(__filename).name,
@@ -36,35 +35,33 @@ exports.default = (0, rule_creator_1.createRule)({
36
35
  ngrxModule: 'store',
37
36
  docs: {
38
37
  description: 'Using `action creator` in `dispatch` is preferred over `object` or old `Action`.',
39
- recommended: 'warn',
40
38
  },
41
39
  schema: [],
42
- messages: (_a = {},
43
- _a[exports.messageId] = 'Using `object` or old `Action` is forbidden. Use `action creator` instead.',
44
- _a),
40
+ messages: {
41
+ [exports.messageId]: 'Using `object` or old `Action` is forbidden. Use `action creator` instead.',
42
+ },
45
43
  },
46
44
  defaultOptions: [],
47
- create: function (context) {
48
- var _a;
49
- var _b = (0, utils_1.getNgRxStores)(context).identifiers, identifiers = _b === void 0 ? [] : _b;
50
- var storeNames = identifiers.length > 0 ? (0, utils_1.asPattern)(identifiers) : null;
45
+ create: (context) => {
46
+ const { identifiers = [] } = (0, utils_1.getNgRxStores)(context);
47
+ const storeNames = identifiers.length > 0 ? (0, utils_1.asPattern)(identifiers) : null;
51
48
  if (!storeNames) {
52
49
  return {};
53
50
  }
54
- return _a = {},
55
- _a["".concat((0, utils_1.dispatchExpression)(storeNames), " :matches(NewExpression, :not(NewExpression) > ObjectExpression)")] = function (node) {
56
- var nearestUpperCallExpression = (0, utils_1.getNearestUpperNodeFrom)(node, utils_1.isCallExpression);
57
- var isStoreDispatchImmediateParent = nearestUpperCallExpression !== undefined &&
51
+ return {
52
+ [`${(0, utils_1.dispatchExpression)(storeNames)} :matches(NewExpression, :not(NewExpression) > ObjectExpression)`](node) {
53
+ const nearestUpperCallExpression = (0, utils_1.getNearestUpperNodeFrom)(node, utils_1.isCallExpression);
54
+ const isStoreDispatchImmediateParent = nearestUpperCallExpression !== undefined &&
58
55
  (0, utils_1.isCallExpressionWith)(nearestUpperCallExpression, storeNames, 'dispatch');
59
56
  if (!isStoreDispatchImmediateParent) {
60
57
  return;
61
58
  }
62
59
  context.report({
63
- node: node,
60
+ node,
64
61
  messageId: exports.messageId,
65
62
  });
66
63
  },
67
- _a;
64
+ };
68
65
  },
69
66
  });
70
67
  //# sourceMappingURL=prefer-action-creator-in-dispatch.js.map
@@ -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,yCAA6B;AAC7B,mDAAgD;AAChD,qCAOqB;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;YACpF,WAAW,EAAE,MAAM;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IACR,4EAA4E;eAC/E;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACN,IAAA,KAAqB,IAAA,qBAAa,EAAC,OAAO,CAAC,YAA3B,EAAhB,WAAW,mBAAG,EAAE,KAAA,CAA4B;QACpD,IAAM,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;YACE,GAAC,UAAG,IAAA,0BAAkB,EACpB,UAAU,CACX,qEAAkE,IAFnE,UAGE,IAAwD;gBAExD,IAAM,0BAA0B,GAAG,IAAA,+BAAuB,EACxD,IAAI,EACJ,wBAAgB,CACjB,CAAC;gBACF,IAAM,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,MAAA;oBACJ,SAAS,mBAAA;iBACV,CAAC,CAAC;YACL,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n 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 recommended: 'warn',\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,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"]}
@@ -0,0 +1,3 @@
1
+ export declare const messageId = "preferActionCreator";
2
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreator", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
3
+ export default _default;
@@ -22,11 +22,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var _a;
26
25
  Object.defineProperty(exports, "__esModule", { value: true });
27
26
  exports.messageId = void 0;
28
- var path = __importStar(require("path"));
29
- var rule_creator_1 = require("../../rule-creator");
27
+ const path = __importStar(require("path"));
28
+ const rule_creator_1 = require("../../rule-creator");
30
29
  exports.messageId = 'preferActionCreator';
31
30
  exports.default = (0, rule_creator_1.createRule)({
32
31
  name: path.parse(__filename).name,
@@ -35,24 +34,22 @@ exports.default = (0, rule_creator_1.createRule)({
35
34
  ngrxModule: 'store',
36
35
  docs: {
37
36
  description: 'Using `action creator` is preferred over `Action class`.',
38
- recommended: 'warn',
39
37
  },
40
38
  schema: [],
41
- messages: (_a = {},
42
- _a[exports.messageId] = 'Using `Action class` is forbidden. Use `action creator` instead.',
43
- _a),
39
+ messages: {
40
+ [exports.messageId]: 'Using `Action class` is forbidden. Use `action creator` instead.',
41
+ },
44
42
  },
45
43
  defaultOptions: [],
46
- create: function (context) {
47
- var _a;
48
- return _a = {},
49
- _a["ClassDeclaration:has(TSClassImplements:matches([expression.name='Action'], [expression.property.name='Action'])):has(PropertyDefinition[key.name='type'])"] = function (node) {
44
+ create: (context) => {
45
+ return {
46
+ [`ClassDeclaration:has(TSClassImplements:matches([expression.name='Action'], [expression.property.name='Action'])):has(PropertyDefinition[key.name='type'])`](node) {
50
47
  context.report({
51
- node: node,
48
+ node,
52
49
  messageId: exports.messageId,
53
50
  });
54
51
  },
55
- _a;
52
+ };
56
53
  },
57
54
  });
58
55
  //# sourceMappingURL=prefer-action-creator.js.map
@@ -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,yCAA6B;AAC7B,mDAAgD;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;YACvE,WAAW,EAAE,MAAM;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IACR,kEAAkE;eACrE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACd;YACE,GAAC,2JAA2J,IAA5J,UACE,IAA+B;gBAE/B,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,MAAA;oBACJ,SAAS,mBAAA;iBACV,CAAC,CAAC;YACL,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\n\nexport const messageId = '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 recommended: 'warn',\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,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"]}
@@ -0,0 +1,5 @@
1
+ export declare const preferInlineActionProps = "preferInlineActionProps";
2
+ export declare const preferInlineActionPropsSuggest = "preferInlineActionPropsSuggest";
3
+ type MessageIds = typeof preferInlineActionProps | typeof preferInlineActionPropsSuggest;
4
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
5
+ export default _default;
@@ -22,12 +22,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var _a;
26
25
  Object.defineProperty(exports, "__esModule", { value: true });
27
26
  exports.preferInlineActionPropsSuggest = exports.preferInlineActionProps = void 0;
28
- var path = __importStar(require("path"));
29
- var rule_creator_1 = require("../../rule-creator");
30
- var utils_1 = require("../../utils");
27
+ const path = __importStar(require("path"));
28
+ const rule_creator_1 = require("../../rule-creator");
29
+ const utils_1 = require("../../utils");
31
30
  exports.preferInlineActionProps = 'preferInlineActionProps';
32
31
  exports.preferInlineActionPropsSuggest = 'preferInlineActionPropsSuggest';
33
32
  exports.default = (0, rule_creator_1.createRule)({
@@ -38,35 +37,32 @@ exports.default = (0, rule_creator_1.createRule)({
38
37
  ngrxModule: 'store',
39
38
  docs: {
40
39
  description: 'Prefer using inline types instead of interfaces, types or classes.',
41
- recommended: 'warn',
42
- suggestion: true,
43
40
  },
44
41
  schema: [],
45
- messages: (_a = {},
46
- _a[exports.preferInlineActionProps] = 'Use inline types instead of interfaces, types or classes.',
47
- _a[exports.preferInlineActionPropsSuggest] = 'Change to inline types.',
48
- _a),
42
+ messages: {
43
+ [exports.preferInlineActionProps]: 'Use inline types instead of interfaces, types or classes.',
44
+ [exports.preferInlineActionPropsSuggest]: 'Change to inline types.',
45
+ },
49
46
  },
50
47
  defaultOptions: [],
51
- create: function (context) {
52
- var _a;
53
- return _a = {},
54
- _a[utils_1.actionCreatorPropsComputed] = function (node) {
48
+ create: (context) => {
49
+ return {
50
+ [utils_1.actionCreatorPropsComputed](node) {
55
51
  context.report({
56
- node: node,
52
+ node,
57
53
  messageId: exports.preferInlineActionProps,
58
54
  suggest: [
59
55
  {
60
56
  messageId: exports.preferInlineActionPropsSuggest,
61
- fix: function (fixer) { return [
57
+ fix: (fixer) => [
62
58
  fixer.insertTextBefore(node, '{name: '),
63
59
  fixer.insertTextAfter(node, '}'),
64
- ]; },
60
+ ],
65
61
  },
66
62
  ],
67
63
  });
68
64
  },
69
- _a;
65
+ };
70
66
  },
71
67
  });
72
68
  //# sourceMappingURL=prefer-inline-action-props.js.map
@@ -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,yCAA6B;AAC7B,mDAAgD;AAChD,qCAAyD;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;YACtE,WAAW,EAAE,MAAM;YACnB,UAAU,EAAE,IAAI;SACjB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,+BAAuB,IACtB,2DAA2D;YAC7D,GAAC,sCAA8B,IAAG,yBAAyB;eAC5D;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACd;YACE,GAAC,kCAA0B,IAA3B,UAA6B,IAA8B;gBACzD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,MAAA;oBACJ,SAAS,EAAE,+BAAuB;oBAClC,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,sCAA8B;4BACzC,GAAG,EAAE,UAAC,KAAK,IAAK,OAAA;gCACd,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC;gCACvC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC;6BACjC,EAHe,CAGf;yBACF;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { 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 recommended: 'warn',\n suggestion: true,\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,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"]}
@@ -0,0 +1,5 @@
1
+ export declare const preferOneGenericInCreateForFeatureSelector = "preferOneGenericInCreateForFeatureSelector";
2
+ export declare const preferOneGenericInCreateForFeatureSelectorSuggest = "preferOneGenericInCreateForFeatureSelectorSuggest";
3
+ type MessageIds = typeof preferOneGenericInCreateForFeatureSelector | typeof preferOneGenericInCreateForFeatureSelectorSuggest;
4
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
5
+ export default _default;
@@ -22,27 +22,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __read = (this && this.__read) || function (o, n) {
26
- var m = typeof Symbol === "function" && o[Symbol.iterator];
27
- if (!m) return o;
28
- var i = m.call(o), r, ar = [], e;
29
- try {
30
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
31
- }
32
- catch (error) { e = { error: error }; }
33
- finally {
34
- try {
35
- if (r && !r.done && (m = i["return"])) m.call(i);
36
- }
37
- finally { if (e) throw e.error; }
38
- }
39
- return ar;
40
- };
41
- var _a;
42
25
  Object.defineProperty(exports, "__esModule", { value: true });
43
26
  exports.preferOneGenericInCreateForFeatureSelectorSuggest = exports.preferOneGenericInCreateForFeatureSelector = void 0;
44
- var path = __importStar(require("path"));
45
- var rule_creator_1 = require("../../rule-creator");
27
+ const path = __importStar(require("path"));
28
+ const rule_creator_1 = require("../../rule-creator");
46
29
  exports.preferOneGenericInCreateForFeatureSelector = 'preferOneGenericInCreateForFeatureSelector';
47
30
  exports.preferOneGenericInCreateForFeatureSelectorSuggest = 'preferOneGenericInCreateForFeatureSelectorSuggest';
48
31
  exports.default = (0, rule_creator_1.createRule)({
@@ -53,41 +36,37 @@ exports.default = (0, rule_creator_1.createRule)({
53
36
  ngrxModule: 'store',
54
37
  docs: {
55
38
  description: 'Prefer using a single generic to define the feature state.',
56
- recommended: 'warn',
57
- suggestion: true,
58
39
  },
59
40
  schema: [],
60
- messages: (_a = {},
61
- _a[exports.preferOneGenericInCreateForFeatureSelector] = 'Use a single generic to define the feature state.',
62
- _a[exports.preferOneGenericInCreateForFeatureSelectorSuggest] = 'Remove the global state generic.',
63
- _a),
41
+ messages: {
42
+ [exports.preferOneGenericInCreateForFeatureSelector]: 'Use a single generic to define the feature state.',
43
+ [exports.preferOneGenericInCreateForFeatureSelectorSuggest]: 'Remove the global state generic.',
44
+ },
64
45
  },
65
46
  defaultOptions: [],
66
- create: function (context) {
67
- var _a;
68
- var sourceCode = context.getSourceCode();
69
- return _a = {},
70
- _a["CallExpression[callee.name='createFeatureSelector'] > TSTypeParameterInstantiation[params.length>1]"] = function (node) {
47
+ create: (context) => {
48
+ const sourceCode = context.getSourceCode();
49
+ return {
50
+ [`CallExpression[callee.name='createFeatureSelector'] > TSTypeParameterInstantiation[params.length>1]`](node) {
71
51
  context.report({
72
- node: node,
52
+ node,
73
53
  messageId: exports.preferOneGenericInCreateForFeatureSelector,
74
54
  suggest: [
75
55
  {
76
56
  messageId: exports.preferOneGenericInCreateForFeatureSelectorSuggest,
77
- fix: function (fixer) {
78
- var _a;
79
- var _b = __read(node.params, 1), globalState = _b[0];
80
- var nextToken = sourceCode.getTokenAfter(globalState);
57
+ fix: (fixer) => {
58
+ const [globalState] = node.params;
59
+ const nextToken = sourceCode.getTokenAfter(globalState);
81
60
  return fixer.removeRange([
82
61
  globalState.range[0],
83
- (_a = nextToken === null || nextToken === void 0 ? void 0 : nextToken.range[1]) !== null && _a !== void 0 ? _a : globalState.range[1] + 1,
62
+ nextToken?.range[1] ?? globalState.range[1] + 1,
84
63
  ]);
85
64
  },
86
65
  },
87
66
  ],
88
67
  });
89
68
  },
90
- _a;
69
+ };
91
70
  },
92
71
  });
93
72
  //# sourceMappingURL=prefer-one-generic-in-create-for-feature-selector.js.map
@@ -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,yCAA6B;AAC7B,mDAAgD;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;YACzE,WAAW,EAAE,MAAM;YACnB,UAAU,EAAE,IAAI;SACjB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,kDAA0C,IACzC,mDAAmD;YACrD,GAAC,yDAAiD,IAChD,kCAAkC;eACrC;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACd,IAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAE3C;YACE,GAAC,qGAAqG,IAAtG,UACE,IAA2C;gBAE3C,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,MAAA;oBACJ,SAAS,EAAE,kDAA0C;oBACrD,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,yDAAiD;4BAC5D,GAAG,EAAE,UAAC,KAAK;;gCACH,IAAA,KAAA,OAAgB,IAAI,CAAC,MAAM,IAAA,EAA1B,WAAW,QAAe,CAAC;gCAClC,IAAM,SAAS,GAAG,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;gCACxD,OAAO,KAAK,CAAC,WAAW,CAAC;oCACvB,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;oCACpB,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,CAAC,CAAC,CAAC,mCAAI,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;iCAChD,CAAC,CAAC;4BACL,CAAC;yBACF;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\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 recommended: 'warn',\n suggestion: true,\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 const sourceCode = context.getSourceCode();\n\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 = 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,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,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAE3C,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,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;gCACxD,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 const sourceCode = context.getSourceCode();\n\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 = 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"]}
@@ -0,0 +1,3 @@
1
+ export declare const messageId = "preferSelectorInSelect";
2
+ declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferSelectorInSelect", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
3
+ export default _default;