@ngrx/eslint-plugin 20.0.0 → 20.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -2
- package/scripts/generate-config.js +74 -72
- package/scripts/generate-config.js.map +1 -1
- package/scripts/generate-docs.js +22 -22
- package/scripts/generate-docs.js.map +1 -1
- package/scripts/generate-overview.js +63 -56
- package/scripts/generate-overview.js.map +1 -1
- package/spec/utils/from-fixture.js.map +1 -1
- package/spec/utils/rule-tester.d.ts +1 -4
- package/spec/utils/rule-tester.js +1 -6
- package/spec/utils/rule-tester.js.map +1 -1
- package/src/index.d.ts +35 -35
- package/src/rule-creator.d.ts +7 -23
- package/src/rule-creator.js +22 -18
- package/src/rule-creator.js.map +1 -1
- package/src/rules/component-store/avoid-combining-component-store-selectors.d.ts +1 -1
- package/src/rules/component-store/avoid-combining-component-store-selectors.js +1 -1
- package/src/rules/component-store/avoid-combining-component-store-selectors.js.map +1 -1
- package/src/rules/component-store/avoid-mapping-component-store-selectors.d.ts +1 -1
- package/src/rules/component-store/avoid-mapping-component-store-selectors.js +1 -1
- package/src/rules/component-store/avoid-mapping-component-store-selectors.js.map +1 -1
- package/src/rules/component-store/require-super-ondestroy.d.ts +1 -1
- package/src/rules/component-store/require-super-ondestroy.js +1 -1
- package/src/rules/component-store/require-super-ondestroy.js.map +1 -1
- package/src/rules/component-store/updater-explicit-return-type.d.ts +1 -1
- package/src/rules/component-store/updater-explicit-return-type.js +1 -1
- package/src/rules/component-store/updater-explicit-return-type.js.map +1 -1
- package/src/rules/effects/avoid-cyclic-effects.d.ts +1 -1
- package/src/rules/effects/avoid-cyclic-effects.js +1 -1
- package/src/rules/effects/avoid-cyclic-effects.js.map +1 -1
- package/src/rules/effects/no-dispatch-in-effects.d.ts +1 -1
- package/src/rules/effects/no-dispatch-in-effects.js +1 -1
- package/src/rules/effects/no-dispatch-in-effects.js.map +1 -1
- package/src/rules/effects/no-effects-in-providers.d.ts +1 -1
- package/src/rules/effects/no-effects-in-providers.js +1 -1
- package/src/rules/effects/no-effects-in-providers.js.map +1 -1
- package/src/rules/effects/no-multiple-actions-in-effects.d.ts +1 -1
- package/src/rules/effects/no-multiple-actions-in-effects.js +1 -1
- package/src/rules/effects/no-multiple-actions-in-effects.js.map +1 -1
- package/src/rules/effects/prefer-action-creator-in-of-type.d.ts +1 -1
- package/src/rules/effects/prefer-action-creator-in-of-type.js +1 -1
- package/src/rules/effects/prefer-action-creator-in-of-type.js.map +1 -1
- package/src/rules/effects/prefer-effect-callback-in-block-statement.d.ts +1 -1
- package/src/rules/effects/prefer-effect-callback-in-block-statement.js +1 -1
- package/src/rules/effects/prefer-effect-callback-in-block-statement.js.map +1 -1
- package/src/rules/effects/use-effects-lifecycle-interface.d.ts +1 -1
- package/src/rules/effects/use-effects-lifecycle-interface.js +1 -1
- package/src/rules/effects/use-effects-lifecycle-interface.js.map +1 -1
- package/src/rules/index.d.ts +35 -35
- package/src/rules/operators/prefer-concat-latest-from.d.ts +1 -1
- package/src/rules/operators/prefer-concat-latest-from.js +1 -1
- package/src/rules/operators/prefer-concat-latest-from.js.map +1 -1
- package/src/rules/signals/enforce-type-call.d.ts +1 -1
- package/src/rules/signals/enforce-type-call.js +1 -1
- package/src/rules/signals/enforce-type-call.js.map +1 -1
- package/src/rules/signals/prefer-protected-state.d.ts +1 -1
- package/src/rules/signals/prefer-protected-state.js +1 -1
- package/src/rules/signals/prefer-protected-state.js.map +1 -1
- package/src/rules/signals/signal-state-no-arrays-at-root-level.d.ts +1 -1
- package/src/rules/signals/signal-state-no-arrays-at-root-level.js +1 -1
- package/src/rules/signals/signal-state-no-arrays-at-root-level.js.map +1 -1
- package/src/rules/signals/signal-store-feature-should-use-generic-type.d.ts +1 -1
- package/src/rules/signals/signal-store-feature-should-use-generic-type.js +1 -1
- package/src/rules/signals/signal-store-feature-should-use-generic-type.js.map +1 -1
- package/src/rules/signals/with-state-no-arrays-at-root-level.d.ts +1 -1
- package/src/rules/signals/with-state-no-arrays-at-root-level.js +1 -1
- package/src/rules/signals/with-state-no-arrays-at-root-level.js.map +1 -1
- package/src/rules/store/avoid-combining-selectors.d.ts +1 -1
- package/src/rules/store/avoid-combining-selectors.js +1 -1
- package/src/rules/store/avoid-combining-selectors.js.map +1 -1
- package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.d.ts +1 -1
- package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js +1 -1
- package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js.map +1 -1
- package/src/rules/store/avoid-duplicate-actions-in-reducer.d.ts +1 -1
- package/src/rules/store/avoid-duplicate-actions-in-reducer.js +1 -1
- package/src/rules/store/avoid-duplicate-actions-in-reducer.js.map +1 -1
- package/src/rules/store/avoid-mapping-selectors.d.ts +1 -1
- package/src/rules/store/avoid-mapping-selectors.js +1 -1
- package/src/rules/store/avoid-mapping-selectors.js.map +1 -1
- package/src/rules/store/good-action-hygiene.d.ts +1 -1
- package/src/rules/store/good-action-hygiene.js +1 -1
- package/src/rules/store/good-action-hygiene.js.map +1 -1
- package/src/rules/store/no-multiple-global-stores.d.ts +1 -1
- package/src/rules/store/no-multiple-global-stores.js +1 -1
- package/src/rules/store/no-multiple-global-stores.js.map +1 -1
- package/src/rules/store/no-reducer-in-key-names.d.ts +1 -1
- package/src/rules/store/no-reducer-in-key-names.js +1 -1
- package/src/rules/store/no-reducer-in-key-names.js.map +1 -1
- package/src/rules/store/no-store-subscription.d.ts +1 -1
- package/src/rules/store/no-store-subscription.js +1 -1
- package/src/rules/store/no-store-subscription.js.map +1 -1
- package/src/rules/store/no-typed-global-store.d.ts +1 -1
- package/src/rules/store/no-typed-global-store.js +1 -1
- package/src/rules/store/no-typed-global-store.js.map +1 -1
- package/src/rules/store/on-function-explicit-return-type.d.ts +1 -1
- package/src/rules/store/on-function-explicit-return-type.js +1 -1
- package/src/rules/store/on-function-explicit-return-type.js.map +1 -1
- package/src/rules/store/prefer-action-creator-in-dispatch.d.ts +1 -1
- package/src/rules/store/prefer-action-creator-in-dispatch.js +1 -1
- package/src/rules/store/prefer-action-creator-in-dispatch.js.map +1 -1
- package/src/rules/store/prefer-action-creator.d.ts +1 -1
- package/src/rules/store/prefer-action-creator.js +1 -1
- package/src/rules/store/prefer-action-creator.js.map +1 -1
- package/src/rules/store/prefer-inline-action-props.d.ts +1 -1
- package/src/rules/store/prefer-inline-action-props.js +1 -1
- package/src/rules/store/prefer-inline-action-props.js.map +1 -1
- package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.d.ts +1 -1
- package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js +1 -1
- package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js.map +1 -1
- package/src/rules/store/prefer-selector-in-select.d.ts +1 -1
- package/src/rules/store/prefer-selector-in-select.js +1 -1
- package/src/rules/store/prefer-selector-in-select.js.map +1 -1
- package/src/rules/store/prefix-selectors-with-select.d.ts +1 -1
- package/src/rules/store/prefix-selectors-with-select.js +115 -25
- package/src/rules/store/prefix-selectors-with-select.js.map +1 -1
- package/src/rules/store/select-style.d.ts +1 -1
- package/src/rules/store/select-style.js +1 -1
- package/src/rules/store/select-style.js.map +1 -1
- package/src/rules/store/use-consistent-global-store-name.d.ts +1 -1
- package/src/rules/store/use-consistent-global-store-name.js +1 -1
- package/src/rules/store/use-consistent-global-store-name.js.map +1 -1
- package/src/utils/helper-functions/index.d.ts +0 -2
- package/src/utils/helper-functions/index.js +0 -2
- package/src/utils/helper-functions/index.js.map +1 -1
- package/src/utils/helper-functions/rules.d.ts +1 -2
- package/src/utils/helper-functions/rules.js +5 -4
- package/src/utils/helper-functions/rules.js.map +1 -1
- package/src/utils/helper-functions/utils.js.map +1 -1
- package/src/utils/selectors/index.d.ts +1 -1
- package/src/utils/selectors/index.js +1 -1
- package/src/utils/selectors/index.js.map +1 -1
- package/src/utils/helper-functions/docs.d.ts +0 -1
- package/src/utils/helper-functions/docs.js +0 -6
- package/src/utils/helper-functions/docs.js.map +0 -1
- package/src/utils/helper-functions/versions.d.ts +0 -1
- package/src/utils/helper-functions/versions.js +0 -78
- package/src/utils/helper-functions/versions.js.map +0 -1
package/src/index.d.ts
CHANGED
|
@@ -123,43 +123,43 @@ declare const _default: {
|
|
|
123
123
|
};
|
|
124
124
|
};
|
|
125
125
|
rules: {
|
|
126
|
-
'avoid-combining-component-store-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCombiningComponentStoreSelectors", readonly [],
|
|
127
|
-
'avoid-mapping-component-store-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidMappingComponentStoreSelectors", readonly [],
|
|
128
|
-
'updater-explicit-return-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"updaterExplicitReturnType", readonly [],
|
|
129
|
-
'require-super-ondestroy': import("@typescript-eslint/utils/ts-eslint").RuleModule<"requireSuperOnDestroy", readonly [],
|
|
130
|
-
'avoid-cyclic-effects': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCyclicEffects", readonly [],
|
|
131
|
-
'no-dispatch-in-effects': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noDispatchInEffects" | "noDispatchInEffectsSuggest", readonly [],
|
|
132
|
-
'no-effects-in-providers': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noEffectsInProviders", readonly [],
|
|
133
|
-
'no-multiple-actions-in-effects': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMultipleActionsInEffects", readonly unknown[],
|
|
134
|
-
'prefer-action-creator-in-of-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreatorInOfType", readonly [],
|
|
135
|
-
'prefer-effect-callback-in-block-statement': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferEffectCallbackInBlockStatement", readonly [],
|
|
136
|
-
'use-effects-lifecycle-interface': import("@typescript-eslint/utils/ts-eslint").RuleModule<"useEffectsLifecycleInterface", readonly [],
|
|
137
|
-
'avoid-combining-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCombiningSelectors", readonly [],
|
|
138
|
-
'avoid-dispatching-multiple-actions-sequentially': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidDispatchingMultipleActionsSequentially", readonly [],
|
|
139
|
-
'avoid-duplicate-actions-in-reducer': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidDuplicateActionsInReducer" | "avoidDuplicateActionsInReducerSuggest", readonly [],
|
|
140
|
-
'avoid-mapping-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidMapppingSelectors", readonly [],
|
|
141
|
-
'good-action-hygiene': import("@typescript-eslint/utils/ts-eslint").RuleModule<"goodActionHygiene", readonly [],
|
|
142
|
-
'no-multiple-global-stores': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMultipleGlobalStores" | "noMultipleGlobalStoresSuggest", readonly [],
|
|
143
|
-
'no-reducer-in-key-names': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noReducerInKeyNames" | "noReducerInKeyNamesSuggest", readonly [],
|
|
144
|
-
'no-store-subscription': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noStoreSubscription", readonly [],
|
|
145
|
-
'no-typed-global-store': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noTypedStore" | "noTypedStoreSuggest", readonly [],
|
|
146
|
-
'on-function-explicit-return-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"onFunctionExplicitReturnType" | "onFunctionExplicitReturnTypeSuggest", readonly [],
|
|
147
|
-
'prefer-action-creator': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreator", readonly [],
|
|
148
|
-
'prefer-action-creator-in-dispatch': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreatorInDispatch", readonly [],
|
|
149
|
-
'prefer-inline-action-props': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferInlineActionProps" | "preferInlineActionPropsSuggest", readonly [],
|
|
150
|
-
'prefer-one-generic-in-create-for-feature-selector': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferOneGenericInCreateForFeatureSelector" | "preferOneGenericInCreateForFeatureSelectorSuggest", readonly [],
|
|
151
|
-
'prefer-selector-in-select': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferSelectorInSelect", readonly [],
|
|
152
|
-
'prefix-selectors-with-select': import("@typescript-eslint/utils/ts-eslint").RuleModule<"prefixSelectorsWithSelect" | "prefixSelectorsWithSelectSuggest", readonly [],
|
|
153
|
-
'select-style': import("@typescript-eslint/utils/ts-eslint").RuleModule<"operator" | "method", readonly ["operator" | "method"],
|
|
154
|
-
'use-consistent-global-store-name': import("@typescript-eslint/utils/ts-eslint").RuleModule<"useConsistentGlobalStoreName" | "useConsistentGlobalStoreNameSuggest", readonly [string],
|
|
126
|
+
'avoid-combining-component-store-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCombiningComponentStoreSelectors", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
127
|
+
'avoid-mapping-component-store-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidMappingComponentStoreSelectors", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
128
|
+
'updater-explicit-return-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"updaterExplicitReturnType", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
129
|
+
'require-super-ondestroy': import("@typescript-eslint/utils/ts-eslint").RuleModule<"requireSuperOnDestroy", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
130
|
+
'avoid-cyclic-effects': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCyclicEffects", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
131
|
+
'no-dispatch-in-effects': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noDispatchInEffects" | "noDispatchInEffectsSuggest", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
132
|
+
'no-effects-in-providers': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noEffectsInProviders", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
133
|
+
'no-multiple-actions-in-effects': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMultipleActionsInEffects", readonly unknown[], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
134
|
+
'prefer-action-creator-in-of-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreatorInOfType", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
135
|
+
'prefer-effect-callback-in-block-statement': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferEffectCallbackInBlockStatement", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
136
|
+
'use-effects-lifecycle-interface': import("@typescript-eslint/utils/ts-eslint").RuleModule<"useEffectsLifecycleInterface", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
137
|
+
'avoid-combining-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCombiningSelectors", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
138
|
+
'avoid-dispatching-multiple-actions-sequentially': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidDispatchingMultipleActionsSequentially", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
139
|
+
'avoid-duplicate-actions-in-reducer': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidDuplicateActionsInReducer" | "avoidDuplicateActionsInReducerSuggest", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
140
|
+
'avoid-mapping-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidMapppingSelectors", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
141
|
+
'good-action-hygiene': import("@typescript-eslint/utils/ts-eslint").RuleModule<"goodActionHygiene", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
142
|
+
'no-multiple-global-stores': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMultipleGlobalStores" | "noMultipleGlobalStoresSuggest", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
143
|
+
'no-reducer-in-key-names': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noReducerInKeyNames" | "noReducerInKeyNamesSuggest", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
144
|
+
'no-store-subscription': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noStoreSubscription", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
145
|
+
'no-typed-global-store': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noTypedStore" | "noTypedStoreSuggest", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
146
|
+
'on-function-explicit-return-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"onFunctionExplicitReturnType" | "onFunctionExplicitReturnTypeSuggest", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
147
|
+
'prefer-action-creator': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreator", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
148
|
+
'prefer-action-creator-in-dispatch': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreatorInDispatch", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
149
|
+
'prefer-inline-action-props': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferInlineActionProps" | "preferInlineActionPropsSuggest", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
150
|
+
'prefer-one-generic-in-create-for-feature-selector': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferOneGenericInCreateForFeatureSelector" | "preferOneGenericInCreateForFeatureSelectorSuggest", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
151
|
+
'prefer-selector-in-select': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferSelectorInSelect", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
152
|
+
'prefix-selectors-with-select': import("@typescript-eslint/utils/ts-eslint").RuleModule<"prefixSelectorsWithSelect" | "prefixSelectorsWithSelectSuggest", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
153
|
+
'select-style': import("@typescript-eslint/utils/ts-eslint").RuleModule<"operator" | "method", readonly ["operator" | "method"], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
154
|
+
'use-consistent-global-store-name': import("@typescript-eslint/utils/ts-eslint").RuleModule<"useConsistentGlobalStoreName" | "useConsistentGlobalStoreNameSuggest", readonly [string], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
155
155
|
'prefer-concat-latest-from': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferConcatLatestFrom", readonly [{
|
|
156
156
|
readonly strict: boolean;
|
|
157
|
-
}],
|
|
158
|
-
'signal-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStateNoArraysAtRootLevel", readonly [],
|
|
159
|
-
'signal-store-feature-should-use-generic-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStoreFeatureShouldUseGenericType", readonly [],
|
|
160
|
-
'prefer-protected-state': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferProtectedState" | "preferProtectedStateSuggest", readonly [],
|
|
161
|
-
'with-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"withStateNoArraysAtRootLevel", readonly [],
|
|
162
|
-
'enforce-type-call': import("@typescript-eslint/utils/ts-eslint").RuleModule<"enforceTypeCall", readonly [],
|
|
157
|
+
}], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
158
|
+
'signal-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStateNoArraysAtRootLevel", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
159
|
+
'signal-store-feature-should-use-generic-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStoreFeatureShouldUseGenericType", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
160
|
+
'prefer-protected-state': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferProtectedState" | "preferProtectedStateSuggest", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
161
|
+
'with-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"withStateNoArraysAtRootLevel", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
162
|
+
'enforce-type-call': import("@typescript-eslint/utils/ts-eslint").RuleModule<"enforceTypeCall", readonly [], import("./rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
163
163
|
};
|
|
164
164
|
};
|
|
165
165
|
export = _default;
|
package/src/rule-creator.d.ts
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
import { NGRX_MODULE } from './utils';
|
|
3
|
+
export interface NgRxRuleDocs {
|
|
4
4
|
ngrxModule: NGRX_MODULE;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
type CreateRuleMeta<TMessageIds extends string, TOptions extends readonly unknown[]> = {
|
|
11
|
-
docs: Omit<TSESLint.RuleMetaDataDocs, 'url'> & {
|
|
12
|
-
requiresTypeChecking?: boolean;
|
|
13
|
-
};
|
|
14
|
-
} & Omit<Meta<TMessageIds, TOptions>, 'docs'>;
|
|
15
|
-
export type NgRxRuleModule<TOptions extends readonly unknown[], TMessageIds extends string> = Omit<TSESLint.RuleModule<TMessageIds, TOptions>, 'meta'> & {
|
|
16
|
-
meta: Meta<TMessageIds, TOptions>;
|
|
17
|
-
};
|
|
18
|
-
export declare function createRule<TOptions extends readonly unknown[], TMessageIds extends string>(config: Readonly<{
|
|
19
|
-
name: string;
|
|
20
|
-
meta: CreateRuleMeta<TMessageIds, TOptions>;
|
|
21
|
-
defaultOptions: Readonly<TOptions>;
|
|
22
|
-
create: (context: Readonly<TSESLint.RuleContext<TMessageIds, TOptions>>, optionsWithDefault: Readonly<TOptions>) => TSESLint.RuleListener;
|
|
23
|
-
}>): TSESLint.RuleModule<TMessageIds, TOptions>;
|
|
24
|
-
export {};
|
|
5
|
+
requiresTypeChecking?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export type NgRxRule = ReturnType<ReturnType<typeof ESLintUtils.RuleCreator<NgRxRuleDocs>>>;
|
|
8
|
+
export declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, NgRxRuleDocs>>) => ESLintUtils.RuleModule<MessageIds, Options, NgRxRuleDocs, ESLintUtils.RuleListener>;
|
package/src/rule-creator.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createRule =
|
|
3
|
+
exports.createRule = void 0;
|
|
4
4
|
const utils_1 = require("@typescript-eslint/utils");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
/**
|
|
6
|
+
* We need to patch the RuleCreator in order to preserve the defaultOptions
|
|
7
|
+
* to use as part of documentation generation.
|
|
8
|
+
*/
|
|
9
|
+
const patchedRuleCreator = (urlCreator) => {
|
|
10
|
+
return function createRule({ name, meta, defaultOptions, create }) {
|
|
11
|
+
return {
|
|
12
|
+
meta: Object.assign(Object.assign({}, meta), {
|
|
13
|
+
docs: Object.assign(Object.assign({}, meta.docs), {
|
|
14
|
+
url: urlCreator(name),
|
|
15
|
+
}),
|
|
16
|
+
}),
|
|
17
|
+
defaultOptions,
|
|
18
|
+
create(context) {
|
|
19
|
+
const optionsWithDefault = utils_1.ESLintUtils.applyDefault(defaultOptions, context.options);
|
|
20
|
+
return create(context, optionsWithDefault);
|
|
21
|
+
},
|
|
22
|
+
};
|
|
17
23
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return utils_1.ESLintUtils.RuleCreator(utils_2.docsUrl)(configOverwrite);
|
|
22
|
-
}
|
|
24
|
+
};
|
|
25
|
+
patchedRuleCreator.withoutDocs = utils_1.ESLintUtils.RuleCreator.withoutDocs;
|
|
26
|
+
exports.createRule = patchedRuleCreator((ruleName) => `https://ngrx.io/guide/eslint-plugin/rules/${ruleName}`);
|
|
23
27
|
//# sourceMappingURL=rule-creator.js.map
|
package/src/rule-creator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-creator.js","sourceRoot":"","sources":["../../../../modules/eslint-plugin/src/rule-creator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rule-creator.js","sourceRoot":"","sources":["../../../../modules/eslint-plugin/src/rule-creator.ts"],"names":[],"mappings":";;;AAAA,oDAAuD;AAYvD;;;GAGG;AACH,MAAM,kBAAkB,GAAmC,CAAC,UAAU,EAAE,EAAE;IACxE,OAAO,SAAS,UAAU,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE;QAC/D,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE;gBAC3C,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;oBAChD,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC;iBACtB,CAAC;aACH,CAAC;YACF,cAAc;YACd,MAAM,CAAC,OAAO;gBACZ,MAAM,kBAAkB,GAAG,mBAAW,CAAC,YAAY,CACjD,cAAc,EACd,OAAO,CAAC,OAAO,CAChB,CAAC;gBACF,OAAO,MAAM,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;YAC7C,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AACF,kBAAkB,CAAC,WAAW,GAAG,mBAAW,CAAC,WAAW,CAAC,WAAW,CAAC;AAExD,QAAA,UAAU,GAAG,kBAAkB,CAC1C,CAAC,QAAQ,EAAE,EAAE,CAAC,6CAA6C,QAAQ,EAAE,CACtE,CAAC","sourcesContent":["import { ESLintUtils } from '@typescript-eslint/utils';\nimport { NGRX_MODULE } from './utils';\n\nexport interface NgRxRuleDocs {\n ngrxModule: NGRX_MODULE;\n requiresTypeChecking?: boolean;\n}\n\nexport type NgRxRule = ReturnType<\n ReturnType<typeof ESLintUtils.RuleCreator<NgRxRuleDocs>>\n>;\n\n/**\n * We need to patch the RuleCreator in order to preserve the defaultOptions\n * to use as part of documentation generation.\n */\nconst patchedRuleCreator: typeof ESLintUtils.RuleCreator = (urlCreator) => {\n return function createRule({ name, meta, defaultOptions, create }) {\n return {\n meta: Object.assign(Object.assign({}, meta), {\n docs: Object.assign(Object.assign({}, meta.docs), {\n url: urlCreator(name),\n }),\n }),\n defaultOptions,\n create(context) {\n const optionsWithDefault = ESLintUtils.applyDefault(\n defaultOptions,\n context.options\n );\n return create(context, optionsWithDefault);\n },\n };\n };\n};\npatchedRuleCreator.withoutDocs = ESLintUtils.RuleCreator.withoutDocs;\n\nexport const createRule = patchedRuleCreator<NgRxRuleDocs>(\n (ruleName) => `https://ngrx.io/guide/eslint-plugin/rules/${ruleName}`\n);\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const messageId = "avoidCombiningComponentStoreSelectors";
|
|
2
|
-
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCombiningComponentStoreSelectors", readonly [],
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCombiningComponentStoreSelectors", 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: 'component-store',
|
|
46
45
|
docs: {
|
|
47
46
|
description: 'Prefer combining selectors at the selector level.',
|
|
47
|
+
ngrxModule: 'component-store',
|
|
48
48
|
},
|
|
49
49
|
schema: [],
|
|
50
50
|
messages: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avoid-combining-component-store-selectors.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/avoid-combining-component-store-selectors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAA0E;AAC7D,QAAA,SAAS,GAAG,uCAAuC,CAAC;AAIjE,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,
|
|
1
|
+
{"version":3,"file":"avoid-combining-component-store-selectors.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/avoid-combining-component-store-selectors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAA0E;AAC7D,QAAA,SAAS,GAAG,uCAAuC,CAAC;AAIjE,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,mDAAmD;YAChE,UAAU,EAAE,iBAAiB;SAC9B;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EAAE,0CAA0C;SACxD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,UAAU,GAAG,IAAA,kCAA0B,EAAC,OAAO,CAAC,CAAC;QAEvD,MAAM,WAAW,GAAG,oFAAoF,CAAC;QACzG,MAAM,YAAY,GAAG,UAAU,CAAC,CAAC,CAAC,IAAA,uBAAe,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAErE,MAAM,cAAc,GAA8B,EAAE,CAAC;QACrD,OAAO;YACL,CAAC,yFAAyF,WAAW,MAAM,WAAW,EAAE,CAAC,CACvH,IAA6B;gBAE7B,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC;YACD,CAAC,+CAA+C,YAAY,MAAM,YAAY,EAAE,CAAC,CAC/E,IAA6B;gBAE7B,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC;YACD,CAAC,kDAAkD,CAAC;gBAClD,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;oBAClC,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI;wBACJ,SAAS,EAAT,iBAAS;qBACV,CAAC,CAAC;gBACL,CAAC;gBACD,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;YAC5B,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { getNgrxComponentStoreNames, namedExpression } from '../../utils';\nexport const messageId = 'avoidCombiningComponentStoreSelectors';\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n docs: {\n description: 'Prefer combining selectors at the selector level.',\n ngrxModule: 'component-store',\n },\n schema: [],\n messages: {\n [messageId]: 'Combine selectors at the selector level.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const storeNames = getNgrxComponentStoreNames(context);\n\n const thisSelects = `CallExpression[callee.object.type='ThisExpression'][callee.property.name='select']`;\n const storeSelects = storeNames ? namedExpression(storeNames) : null;\n\n const selectsInArray: TSESTree.CallExpression[] = [];\n return {\n [`ClassDeclaration[superClass.name=/Store/] CallExpression[callee.name='combineLatest'] ${thisSelects} ~ ${thisSelects}`](\n node: TSESTree.CallExpression\n ) {\n selectsInArray.push(node);\n },\n [`CallExpression[callee.name='combineLatest'] ${storeSelects} ~ ${storeSelects}`](\n node: TSESTree.CallExpression\n ) {\n selectsInArray.push(node);\n },\n [`CallExpression[callee.name='combineLatest']:exit`]() {\n for (const node of selectsInArray) {\n context.report({\n node,\n messageId,\n });\n }\n selectsInArray.length = 0;\n },\n };\n },\n});\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const messageId = "avoidMappingComponentStoreSelectors";
|
|
2
|
-
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidMappingComponentStoreSelectors", readonly [],
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidMappingComponentStoreSelectors", 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: 'problem',
|
|
45
|
-
ngrxModule: 'component-store',
|
|
46
45
|
docs: {
|
|
47
46
|
description: 'Avoid mapping logic outside the selector level.',
|
|
47
|
+
ngrxModule: 'component-store',
|
|
48
48
|
},
|
|
49
49
|
schema: [],
|
|
50
50
|
messages: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avoid-mapping-component-store-selectors.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/avoid-mapping-component-store-selectors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAGqB;AAER,QAAA,SAAS,GAAG,qCAAqC,CAAC;AAK/D,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,
|
|
1
|
+
{"version":3,"file":"avoid-mapping-component-store-selectors.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/avoid-mapping-component-store-selectors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAGqB;AAER,QAAA,SAAS,GAAG,qCAAqC,CAAC;AAK/D,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,iDAAiD;YAC9D,UAAU,EAAE,iBAAiB;SAC9B;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EAAE,0CAA0C;SACxD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,UAAU,GAAG,IAAA,kCAA0B,EAAC,OAAO,CAAC,CAAC;QAEvD,MAAM,mBAAmB,GAAG,+DAA+D,CAAC;QAC5F,MAAM,SAAS,GAAG;YAChB,mJAAmJ,mBAAmB,EAAE;YACxK,UAAU;gBACR,GAAG,IAAA,+BAAuB,EAAC,UAAU,CAAC,GAAG,mBAAmB,EAAE;SACjE;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,OAAO;YACL,CAAC,SAAS,CAAC,CAAC,IAAsC;gBAChD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAT,iBAAS;iBACV,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n getNgrxComponentStoreNames,\n namedCallableExpression,\n} from '../../utils';\n\nexport const messageId = 'avoidMappingComponentStoreSelectors';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n docs: {\n description: 'Avoid mapping logic outside the selector level.',\n ngrxModule: 'component-store',\n },\n schema: [],\n messages: {\n [messageId]: 'Map logic at the selector level instead.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const storeNames = getNgrxComponentStoreNames(context);\n\n const mapOperatorSelector = `[callee.property.name=pipe] > CallExpression[callee.name=map]`;\n const selectors = [\n `ClassDeclaration[superClass.name=/Store/] CallExpression:has(CallExpression[callee.object.type='ThisExpression'][callee.property.name='select'])${mapOperatorSelector}`,\n storeNames &&\n `${namedCallableExpression(storeNames)}${mapOperatorSelector}`,\n ]\n .filter(Boolean)\n .join(',');\n\n return {\n [selectors](node: TSESTree.ArrowFunctionExpression) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const messageId = "requireSuperOnDestroy";
|
|
2
|
-
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"requireSuperOnDestroy", readonly [],
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"requireSuperOnDestroy", 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: 'problem',
|
|
44
|
-
ngrxModule: 'component-store',
|
|
45
44
|
docs: {
|
|
46
45
|
description: 'Overriden ngOnDestroy method in component stores require a call to super.ngOnDestroy().',
|
|
46
|
+
ngrxModule: 'component-store',
|
|
47
47
|
},
|
|
48
48
|
schema: [],
|
|
49
49
|
messages: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-super-ondestroy.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/require-super-ondestroy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,qDAAgD;AAGnC,QAAA,SAAS,GAAG,uBAAuB,CAAC;AAIjD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,
|
|
1
|
+
{"version":3,"file":"require-super-ondestroy.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/require-super-ondestroy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,qDAAgD;AAGnC,QAAA,SAAS,GAAG,uBAAuB,CAAC;AAIjD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,yFAAyF;YAC3F,UAAU,EAAE,iBAAiB;SAC9B;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,yEAAyE;SAC5E;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,yBAAyB,GAAG,0CAA0C,CAAC;QAC7E,MAAM,uBAAuB,GAAG,gBAAgB,CAAC;QAEjD,IAAI,2BAA2B,GAAG,KAAK,CAAC;QAExC,OAAO;YACL,CAAC,0FAA0F,uBAAuB,IAAI,CAAC,CACrH,CAA2B;gBAE3B,2BAA2B,GAAG,IAAI,CAAC;YACrC,CAAC;YACD,CAAC,oCAAoC,uBAAuB,KAAK,yBAAyB,mGAAmG,CAAC,CAC5L,IAAyB;gBAEzB,IAAI,CAAC,2BAA2B,EAAE,CAAC;oBACjC,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 * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { TSESTree } from '@typescript-eslint/types';\n\nexport const messageId = 'requireSuperOnDestroy';\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n docs: {\n description:\n 'Overriden ngOnDestroy method in component stores require a call to super.ngOnDestroy().',\n ngrxModule: 'component-store',\n },\n schema: [],\n messages: {\n [messageId]:\n \"Call super.ngOnDestroy() inside a component store's ngOnDestroy method.\",\n },\n },\n defaultOptions: [],\n create: (context) => {\n const ngOnDestroyMethodSelector = `MethodDefinition[key.name='ngOnDestroy']`;\n const componentStoreClassName = 'ComponentStore';\n\n let hasNgrxComponentStoreImport = false;\n\n return {\n [`ImportDeclaration[source.value='@ngrx/component-store'] ImportSpecifier[imported.name='${componentStoreClassName}']`](\n _: TSESTree.ImportSpecifier\n ) {\n hasNgrxComponentStoreImport = true;\n },\n [`ClassDeclaration[superClass.name=${componentStoreClassName}] ${ngOnDestroyMethodSelector}:not(:has(CallExpression[callee.object.type='Super'][callee.property.name='ngOnDestroy'])) > .key`](\n node: TSESTree.Identifier\n ) {\n if (!hasNgrxComponentStoreImport) {\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 = "updaterExplicitReturnType";
|
|
2
|
-
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"updaterExplicitReturnType", readonly [],
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"updaterExplicitReturnType", 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: 'problem',
|
|
45
|
-
ngrxModule: 'component-store',
|
|
46
45
|
docs: {
|
|
47
46
|
description: '`Updater` should have an explicit return type.',
|
|
47
|
+
ngrxModule: 'component-store',
|
|
48
48
|
},
|
|
49
49
|
schema: [],
|
|
50
50
|
messages: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updater-explicit-return-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/updater-explicit-return-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAA0E;AAE7D,QAAA,SAAS,GAAG,2BAA2B,CAAC;AAKrD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,
|
|
1
|
+
{"version":3,"file":"updater-explicit-return-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/updater-explicit-return-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAA0E;AAE7D,QAAA,SAAS,GAAG,2BAA2B,CAAC;AAKrD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,gDAAgD;YAC7D,UAAU,EAAE,iBAAiB;SAC9B;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,6HAA6H;SAChI;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,UAAU,GAAG,IAAA,kCAA0B,EAAC,OAAO,CAAC,CAAC;QACvD,MAAM,qBAAqB,GAAG,0DAA0D,CAAC;QACzF,MAAM,SAAS,GAAG;YAChB,mIAAmI,qBAAqB,EAAE;YAC1J,UAAU;gBACR,GAAG,IAAA,uBAAe,EAChB,UAAU,CACX,sCAAsC,qBAAqB,EAAE;SACjE;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,OAAO;YACL,CAAC,SAAS,CAAC,CAAC,IAAsC;gBAChD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAT,iBAAS;iBACV,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { getNgrxComponentStoreNames, namedExpression } from '../../utils';\n\nexport const messageId = 'updaterExplicitReturnType';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n docs: {\n description: '`Updater` should have an explicit return type.',\n ngrxModule: 'component-store',\n },\n schema: [],\n messages: {\n [messageId]:\n '`Updater` should have an explicit return type when using arrow functions: `this.store.updater((state, value): State => {}`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const storeNames = getNgrxComponentStoreNames(context);\n const withoutTypeAnnotation = `ArrowFunctionExpression:not([returnType.typeAnnotation])`;\n const selectors = [\n `ClassDeclaration[superClass.name=/Store/] CallExpression[callee.object.type='ThisExpression'][callee.property.name='updater'] > ${withoutTypeAnnotation}`,\n storeNames &&\n `${namedExpression(\n storeNames\n )}[callee.property.name='updater'] > ${withoutTypeAnnotation}`,\n ]\n .filter(Boolean)\n .join(',');\n\n return {\n [selectors](node: TSESTree.ArrowFunctionExpression) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
2
|
export declare const messageId = "avoidCyclicEffects";
|
|
3
|
-
declare const _default: ESLintUtils.RuleModule<"avoidCyclicEffects", readonly [],
|
|
3
|
+
declare const _default: ESLintUtils.RuleModule<"avoidCyclicEffects", readonly [], import("../../rule-creator").NgRxRuleDocs, ESLintUtils.RuleListener>;
|
|
4
4
|
export default _default;
|
|
@@ -47,9 +47,9 @@ exports.default = (0, rule_creator_1.createRule)({
|
|
|
47
47
|
name: path.parse(__filename).name,
|
|
48
48
|
meta: {
|
|
49
49
|
type: 'problem',
|
|
50
|
-
ngrxModule: 'effects',
|
|
51
50
|
docs: {
|
|
52
51
|
description: 'Avoid `Effect` that re-emit filtered actions.',
|
|
52
|
+
ngrxModule: 'effects',
|
|
53
53
|
requiresTypeChecking: true,
|
|
54
54
|
},
|
|
55
55
|
schema: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avoid-cyclic-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/avoid-cyclic-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsE;AACtE,2CAA6B;AAC7B,+CAAiC;AACjC,qDAAgD;AAChD,uCAOqB;AAER,QAAA,SAAS,GAAG,oBAAoB,CAAC;AAK9C,mGAAmG;AACnG,uIAAuI;AACvI,0CAA0C;AAE1C,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,
|
|
1
|
+
{"version":3,"file":"avoid-cyclic-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/avoid-cyclic-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsE;AACtE,2CAA6B;AAC7B,+CAAiC;AACjC,qDAAgD;AAChD,uCAOqB;AAER,QAAA,SAAS,GAAG,oBAAoB,CAAC;AAK9C,mGAAmG;AACnG,uIAAuI;AACvI,0CAA0C;AAE1C,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,+CAA+C;YAC5D,UAAU,EAAE,SAAS;YACrB,oBAAoB,EAAE,IAAI;SAC3B;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EAAE,uDAAuD;SACrE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,4BAAoB,EAAC,OAAO,CAAC,CAAC;QAC3D,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE5E,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,QAAQ,GAAG,mBAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACxD,MAAM,WAAW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;YAED,MAAM,MAAM,GAAG,WAAW,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAE3D,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;YAEzC,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,gCAAgC;YAChC,iFAAiF;YACjF,IAAI,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACtD,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;QAChD,CAAC;QAED,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,OAAO;YACL,CAAC,GAAG,8BAAsB,qJAAqJ,YAAY,GAAG,CAAC,CAC7L,IAAI;gBAEJ,IAAI,SAAS,EAAE,CAAC;oBACd,SAAS,CAAC,IAAI,CAAC,CAAC;oBAChB,SAAS,GAAG,KAAK,CAAC;oBAClB,OAAO;gBACT,CAAC;YACH,CAAC;YAED,CAAC,GAAG,8BAAsB,4HAA4H,CAAC;gBACrJ,SAAS,GAAG,IAAI,CAAC;YACnB,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { ESLintUtils, type TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport * as ts from 'typescript';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n createEffectExpression,\n getNgRxEffectActions,\n isCallExpression,\n isIdentifier,\n isTypeReference,\n} from '../../utils';\n\nexport const messageId = 'avoidCyclicEffects';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\n// This rule is a modified version (to support dispatch: false) from the eslint-plugin-rxjs plugin.\n// The original implementation can be found at https://github.com/cartant/eslint-plugin-rxjs/blob/main/source/rules/no-cyclic-action.ts\n// Thank you Nicholas Jamieson (@cartant).\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n docs: {\n description: 'Avoid `Effect` that re-emit filtered actions.',\n ngrxModule: 'effects',\n requiresTypeChecking: true,\n },\n schema: [],\n messages: {\n [messageId]: '`Effect` that re-emit filtered actions are forbidden.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxEffectActions(context);\n const actionsNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!actionsNames) {\n return {};\n }\n\n const services = ESLintUtils.getParserServices(context);\n const typeChecker = services.program.getTypeChecker();\n\n function checkNode(pipeCallExpression: TSESTree.CallExpression) {\n const operatorCallExpression = pipeCallExpression.arguments.find(\n (arg) =>\n isCallExpression(arg) &&\n isIdentifier(arg.callee) &&\n arg.callee.name === 'ofType'\n );\n if (!operatorCallExpression) {\n return;\n }\n const operatorType = services.getTypeAtLocation(operatorCallExpression);\n const [signature] = typeChecker.getSignaturesOfType(\n operatorType,\n ts.SignatureKind.Call\n );\n\n if (!signature) {\n return;\n }\n const operatorReturnType =\n typeChecker.getReturnTypeOfSignature(signature);\n if (!isTypeReference(operatorReturnType)) {\n return;\n }\n const [operatorElementType] =\n typeChecker.getTypeArguments(operatorReturnType);\n if (!operatorElementType) {\n return;\n }\n\n const pipeType = services.getTypeAtLocation(pipeCallExpression);\n if (!isTypeReference(pipeType)) {\n return;\n }\n const [pipeElementType] = typeChecker.getTypeArguments(pipeType);\n if (!pipeElementType) {\n return;\n }\n\n const operatorActionTypes = getActionTypes(operatorElementType);\n const pipeActionTypes = getActionTypes(pipeElementType);\n\n for (const actionType of operatorActionTypes) {\n if (pipeActionTypes.includes(actionType)) {\n context.report({\n node: pipeCallExpression.callee,\n messageId,\n });\n return;\n }\n }\n }\n\n function getActionType(symbol: ts.Symbol): ts.Type | null {\n const { valueDeclaration } = symbol;\n\n if (!valueDeclaration) {\n return null;\n }\n\n if (valueDeclaration.kind === ts.SyntaxKind.PropertyDeclaration) {\n const { parent } = symbol as typeof symbol & { parent: ts.Symbol };\n return parent.valueDeclaration\n ? typeChecker.getTypeOfSymbolAtLocation(\n parent,\n parent.valueDeclaration\n )\n : null;\n }\n\n return typeChecker.getTypeOfSymbolAtLocation(symbol, valueDeclaration);\n }\n\n function getActionTypes(type: ts.Type): string[] {\n if (type.isUnion()) {\n const memberActionTypes: string[] = [];\n for (const memberType of type.types) {\n memberActionTypes.push(...getActionTypes(memberType));\n }\n return memberActionTypes;\n }\n\n const symbol = typeChecker.getPropertyOfType(type, 'type');\n\n if (!symbol) {\n return [];\n }\n\n const actionType = getActionType(symbol);\n\n if (!actionType) {\n return [];\n }\n\n // TODO: support \"dynamic\" types\n // e.g. const genericFoo = createAction(`${subject} FOO`); (resolves to 'string')\n if (typeChecker.typeToString(actionType) === 'string') {\n return [];\n }\n return [typeChecker.typeToString(actionType)];\n }\n\n let firstPipe = true;\n return {\n [`${createEffectExpression}:not([arguments.1]:has(Property[key.name='dispatch'][value.value=false])) CallExpression[callee.property.name='pipe'][callee.object.property.name=${actionsNames}]`](\n node\n ) {\n if (firstPipe) {\n checkNode(node);\n firstPipe = false;\n return;\n }\n },\n\n [`${createEffectExpression}:not([arguments.1]:has(Property[key.name='dispatch'][value.value=false])) CallExpression[callee.property.name='pipe']:exit`]() {\n firstPipe = true;\n },\n };\n },\n});\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const noDispatchInEffects = "noDispatchInEffects";
|
|
2
2
|
export declare const noDispatchInEffectsSuggest = "noDispatchInEffectsSuggest";
|
|
3
3
|
type MessageIds = typeof noDispatchInEffects | typeof noDispatchInEffectsSuggest;
|
|
4
|
-
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [],
|
|
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,10 +43,10 @@ exports.default = (0, rule_creator_1.createRule)({
|
|
|
43
43
|
name: path.parse(__filename).name,
|
|
44
44
|
meta: {
|
|
45
45
|
type: 'suggestion',
|
|
46
|
-
ngrxModule: 'effects',
|
|
47
46
|
hasSuggestions: true,
|
|
48
47
|
docs: {
|
|
49
48
|
description: '`Effect` should not call `store.dispatch`.',
|
|
49
|
+
ngrxModule: 'effects',
|
|
50
50
|
},
|
|
51
51
|
schema: [],
|
|
52
52
|
messages: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-dispatch-in-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/no-dispatch-in-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAMqB;AAER,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAC5C,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AAUvE,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,
|
|
1
|
+
{"version":3,"file":"no-dispatch-in-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/no-dispatch-in-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAMqB;AAER,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAC5C,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AAUvE,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAA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AC,IAAI,IAAA,yBAAiB,EAAC,WAAW,CAAC,CAAC;QAC1E,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,MAAM,CAAC;AACb,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n dispatchInEffects,\n getNgRxStores,\n isArrowFunctionExpression,\n isReturnStatement,\n} from '../../utils';\n\nexport const noDispatchInEffects = 'noDispatchInEffects';\nexport const noDispatchInEffectsSuggest = 'noDispatchInEffectsSuggest';\n\ntype MessageIds =\n | typeof noDispatchInEffects\n | typeof noDispatchInEffectsSuggest;\ntype Options = readonly [];\ntype MemberExpressionWithinCallExpression = TSESTree.MemberExpression & {\n parent: TSESTree.CallExpression;\n};\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n docs: {\n description: '`Effect` should not call `store.dispatch`.',\n ngrxModule: 'effects',\n },\n schema: [],\n messages: {\n [noDispatchInEffects]:\n 'Calling `store.dispatch` in `Effect` is forbidden.',\n [noDispatchInEffectsSuggest]: 'Remove `store.dispatch`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!storeNames) {\n return {};\n }\n\n return {\n [dispatchInEffects(storeNames)](\n node: MemberExpressionWithinCallExpression\n ) {\n const nodeToReport = getNodeToReport(node);\n context.report({\n node: nodeToReport,\n messageId: noDispatchInEffects,\n suggest: [\n {\n messageId: noDispatchInEffectsSuggest,\n fix: (fixer) => fixer.remove(nodeToReport),\n },\n ],\n });\n },\n };\n },\n});\n\nfunction getNodeToReport(node: MemberExpressionWithinCallExpression) {\n const { parent } = node;\n const { parent: grandParent } = parent;\n return grandParent &&\n (isArrowFunctionExpression(grandParent) || isReturnStatement(grandParent))\n ? node\n : parent;\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const messageId = "noEffectsInProviders";
|
|
2
|
-
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noEffectsInProviders", readonly [],
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noEffectsInProviders", 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: 'problem',
|
|
45
|
-
ngrxModule: 'effects',
|
|
46
45
|
docs: {
|
|
47
46
|
description: '`Effect` should not be listed as a provider if it is added to the `EffectsModule`.',
|
|
47
|
+
ngrxModule: 'effects',
|
|
48
48
|
},
|
|
49
49
|
fixable: 'code',
|
|
50
50
|
schema: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-effects-in-providers.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/no-effects-in-providers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,SAAS,GAAG,sBAAsB,CAAC;AAKhD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,
|
|
1
|
+
{"version":3,"file":"no-effects-in-providers.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/no-effects-in-providers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,SAAS,GAAG,sBAAsB,CAAC;AAKhD,kBAAe,I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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 effectsInNgModuleImports,\n effectsInNgModuleProviders,\n getNodeToCommaRemoveFix,\n ngModuleDecorator,\n} from '../../utils';\n\nexport const messageId = 'noEffectsInProviders';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n docs: {\n description:\n '`Effect` should not be listed as a provider if it is added to the `EffectsModule`.',\n ngrxModule: 'effects',\n },\n fixable: 'code',\n schema: [],\n messages: {\n [messageId]:\n '`Effect` should not be listed as a provider if it is added to the `EffectsModule`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const effectsInProviders = new Set<TSESTree.Identifier>();\n const effectsInImports = new Set<string>();\n\n return {\n [effectsInNgModuleProviders](node: TSESTree.Identifier) {\n effectsInProviders.add(node);\n },\n [effectsInNgModuleImports]({ name }: TSESTree.Identifier) {\n effectsInImports.add(name);\n },\n [`${ngModuleDecorator}:exit`]() {\n for (const effectInProvider of effectsInProviders) {\n if (!effectsInImports.has(effectInProvider.name)) {\n continue;\n }\n\n context.report({\n node: effectInProvider,\n messageId,\n fix: (fixer) =>\n getNodeToCommaRemoveFix(\n context.sourceCode,\n fixer,\n effectInProvider\n ),\n });\n }\n\n effectsInImports.clear();\n effectsInProviders.clear();\n },\n };\n },\n});\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
2
|
export declare const messageId = "noMultipleActionsInEffects";
|
|
3
3
|
type Options = readonly unknown[];
|
|
4
|
-
declare const _default: ESLintUtils.RuleModule<"noMultipleActionsInEffects", Options,
|
|
4
|
+
declare const _default: ESLintUtils.RuleModule<"noMultipleActionsInEffects", Options, import("../../rule-creator").NgRxRuleDocs, ESLintUtils.RuleListener>;
|
|
5
5
|
export default _default;
|
|
@@ -43,9 +43,9 @@ exports.default = (0, rule_creator_1.createRule)({
|
|
|
43
43
|
name: path.parse(__filename).name,
|
|
44
44
|
meta: {
|
|
45
45
|
type: 'problem',
|
|
46
|
-
ngrxModule: 'effects',
|
|
47
46
|
docs: {
|
|
48
47
|
description: '`Effect` should not return multiple actions.',
|
|
48
|
+
ngrxModule: 'effects',
|
|
49
49
|
requiresTypeChecking: true,
|
|
50
50
|
},
|
|
51
51
|
schema: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-multiple-actions-in-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/no-multiple-actions-in-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAIkC;AAClC,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,SAAS,GAAG,4BAA4B,CAAC;AAUtD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,
|
|
1
|
+
{"version":3,"file":"no-multiple-actions-in-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/no-multiple-actions-in-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAIkC;AAClC,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,SAAS,GAAG,4BAA4B,CAAC;AAUtD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,8CAA8C;YAC3D,UAAU,EAAE,SAAS;YACrB,oB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AAkB;YACpC,OAAO,IAAA,wBAAgB,EAAC,IAAI,CAAC,IAAI,CAAC;gBAChC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBACrC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAChB,KAAK,sBAAc,CAAC,cAAc;YAChC,OAAO,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAClE;YACE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAsB;IACjD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAiC,EAAE,CACjE,IAAA,yBAAiB,EAAC,CAAC,CAAC,CACrB,CAAC;IACF,OAAO,UAAU,EAAE,QAAQ,CAAC;AAC9B,CAAC","sourcesContent":["import {\n AST_NODE_TYPES,\n ESLintUtils,\n type TSESTree,\n} from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n createEffectExpression,\n isBlockStatement,\n isReturnStatement,\n mapLikeOperatorCallExpressions,\n} from '../../utils';\n\nexport const messageId = 'noMultipleActionsInEffects';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly unknown[];\ntype EffectsMapLikeOperatorsReturn =\n | TSESTree.ArrowFunctionExpression\n | TSESTree.CallExpression\n | TSESTree.FunctionExpression\n | TSESTree.ReturnStatement;\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n docs: {\n description: '`Effect` should not return multiple actions.',\n ngrxModule: 'effects',\n requiresTypeChecking: true,\n },\n schema: [],\n messages: {\n [messageId]: '`Effect` should return a single action.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`${createEffectExpression} ${mapLikeOperatorCallExpressions}`](\n node: EffectsMapLikeOperatorsReturn\n ) {\n const nodeToReport = getNodeToReport(node);\n if (!nodeToReport) {\n return;\n }\n\n const services = ESLintUtils.getParserServices(context);\n const typeChecker = services.program.getTypeChecker();\n const type = services.getTypeAtLocation(nodeToReport);\n\n if (typeChecker.isArrayType(type)) {\n context.report({\n node: nodeToReport,\n messageId,\n });\n } else if (\n type.isUnion() &&\n type.types.some((ut) => typeChecker.isArrayType(ut))\n ) {\n context.report({\n node: nodeToReport,\n messageId,\n });\n }\n },\n };\n },\n});\n\nfunction getNodeToReport(node: EffectsMapLikeOperatorsReturn) {\n switch (node.type) {\n case AST_NODE_TYPES.ArrowFunctionExpression:\n case AST_NODE_TYPES.FunctionExpression:\n return isBlockStatement(node.body)\n ? findReturnStatement(node.body.body)\n : node.body;\n case AST_NODE_TYPES.CallExpression:\n return findReturnStatement(node.arguments) ?? node.arguments[0];\n default:\n return node.argument;\n }\n}\n\nfunction findReturnStatement(nodes: TSESTree.Node[]) {\n const returnNode = nodes.find((n): n is TSESTree.ReturnStatement =>\n isReturnStatement(n)\n );\n return returnNode?.argument;\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const messageId = "preferActionCreatorInOfType";
|
|
2
|
-
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreatorInOfType", readonly [],
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreatorInOfType", 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: 'effects',
|
|
45
44
|
docs: {
|
|
46
45
|
description: 'Using `action creator` in `ofType` is preferred over `string`.',
|
|
46
|
+
ngrxModule: 'effects',
|
|
47
47
|
},
|
|
48
48
|
schema: [],
|
|
49
49
|
messages: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-action-creator-in-of-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/prefer-action-creator-in-of-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAEnC,QAAA,SAAS,GAAG,6BAA6B,CAAC;AAKvD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,
|
|
1
|
+
{"version":3,"file":"prefer-action-creator-in-of-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/prefer-action-creator-in-of-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAEnC,QAAA,SAAS,GAAG,6BAA6B,CAAC;AAKvD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EACT,gEAAgE;YAClE,UAAU,EAAE,SAAS;SACtB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EAAE,4DAA4D;SAC1E;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,8CAA8C,CAAC,CAAC,IAAsB;gBACrE,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 = 'preferActionCreatorInOfType';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n docs: {\n description:\n 'Using `action creator` in `ofType` is preferred over `string`.',\n ngrxModule: 'effects',\n },\n schema: [],\n messages: {\n [messageId]: 'Using `string` is forbidden. Use `action creator` instead.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`CallExpression[callee.name='ofType'] Literal`](node: TSESTree.Literal) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
|