@ngrx/eslint-plugin 20.0.1 → 21.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -2
- package/schematics/ng-add/schema.json +15 -0
- package/scripts/generate-config.js +61 -72
- package/scripts/generate-config.js.map +1 -1
- package/scripts/generate-docs.js +21 -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 +7 -9
- package/spec/utils/rule-tester.js.map +1 -1
- package/src/configs/all.js +0 -9
- package/src/configs/all.js.map +1 -1
- package/src/configs/all.json +0 -8
- package/src/configs/allTypeChecked.d.ts +7 -0
- package/src/configs/allTypeChecked.js +61 -0
- package/src/configs/allTypeChecked.js.map +1 -0
- package/src/configs/allTypeChecked.json +41 -0
- package/src/configs/component-store.js +0 -1
- package/src/configs/component-store.js.map +1 -1
- package/src/configs/effects.js +0 -8
- package/src/configs/effects.js.map +1 -1
- package/src/configs/effects.json +0 -7
- package/src/configs/effectsTypeChecked.d.ts +7 -0
- package/src/configs/effectsTypeChecked.js +33 -0
- package/src/configs/effectsTypeChecked.js.map +1 -0
- package/src/configs/effectsTypeChecked.json +13 -0
- package/src/configs/operators.js +0 -1
- package/src/configs/operators.js.map +1 -1
- package/src/configs/signals.js +0 -7
- package/src/configs/signals.js.map +1 -1
- package/src/configs/signals.json +1 -7
- package/src/configs/signalsTypeChecked.d.ts +7 -0
- package/src/configs/signalsTypeChecked.js +31 -0
- package/src/configs/signalsTypeChecked.js.map +1 -0
- package/src/configs/signalsTypeChecked.json +11 -0
- package/src/configs/store.js +0 -1
- package/src/configs/store.js.map +1 -1
- package/src/index.d.ts +35 -56
- 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 +121 -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/v9/index.d.ts +6 -0
- package/v9/index.js +6 -0
- package/v9/index.js.map +1 -1
- package/jest.config.d.ts +0 -15
- package/jest.config.js +0 -25
- package/jest.config.js.map +0 -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
|
@@ -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,oBAAoB,EAAE,IAAI;SAC3B;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EAAE,yCAAyC;SACvD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,GAAG,8BAAsB,IAAI,sCAA8B,EAAE,CAAC,CAC7D,IAAmC;gBAEnC,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;gBAC3C,IAAI,CAAC,YAAY,EAAE,CAAC;oBAClB,OAAO;gBACT,CAAC;gBAED,MAAM,QAAQ,GAAG,mBAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;gBACxD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;gBACtD,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;gBAEtD,IAAI,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;oBAClC,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,YAAY;wBAClB,SAAS,EAAT,iBAAS;qBACV,CAAC,CAAC;gBACL,CAAC;qBAAM,IACL,IAAI,CAAC,OAAO,EAAE;oBACd,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,EACpD,CAAC;oBACD,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,YAAY;wBAClB,SAAS,EAAT,iBAAS;qBACV,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,eAAe,CAAC,IAAmC;IAC1D,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,sBAAc,CAAC,uBAAuB,CAAC;QAC5C,KAAK,sBAAc,CAAC,kBAAkB;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"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
2
|
export declare const messageId = "preferEffectCallbackInBlockStatement";
|
|
3
|
-
declare const _default: TSESLint.RuleModule<"preferEffectCallbackInBlockStatement", readonly [],
|
|
3
|
+
declare const _default: TSESLint.RuleModule<"preferEffectCallbackInBlockStatement", readonly [], import("../../rule-creator").NgRxRuleDocs, TSESLint.RuleListener>;
|
|
4
4
|
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: 'suggestion',
|
|
46
|
-
ngrxModule: 'effects',
|
|
47
46
|
docs: {
|
|
48
47
|
description: 'A block statement is easier to troubleshoot.',
|
|
48
|
+
ngrxModule: 'effects',
|
|
49
49
|
},
|
|
50
50
|
schema: [],
|
|
51
51
|
messages: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-effect-callback-in-block-statement.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/prefer-effect-callback-in-block-statement.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAAoD;AACpD,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAqD;AAExC,QAAA,SAAS,GAAG,sCAAsC,CAAC;AAKhE,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-effect-callback-in-block-statement.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/prefer-effect-callback-in-block-statement.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAAoD;AACpD,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAqD;AAExC,QAAA,SAAS,GAAG,sCAAsC,CAAC;AAKhE,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,8CAA8C;YAC3D,UAAU,EAAE,SAAS;SACtB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,kEAAkE;SACrE;QACD,OAAO,EAAE,MAAM;KAChB;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,qBAAqB,GACzB,GAAG,8BAAsB,wFAAiG,CAAC;QAC7H,MAAM,kBAAkB,GACtB,GAAG,8BAAsB,sFAA+F,CAAC;QAC3H,MAAM,sCAAsC,GAC1C,GAAG,8BAAsB,yHAAkI,CAAC;QAE9J,OAAO;YACL,CAAC,GAAG,qBAAqB,KAAK,kBAAkB,KAAK,sCAAsC,EAAE,CAAC,CAC5F,IAA8C;gBAE9C,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAT,iBAAS;oBACT,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;wBACb,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG,sBAAsB,CACrD,OAAO,CAAC,UAAU,EAClB,IAAI,CACL,CAAC;wBACF,OAAO;4BACL,KAAK,CAAC,gBAAgB,CAAC,YAAY,EAAE,WAAW,CAAC;4BACjD,KAAK,CAAC,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC;yBACtC,CAAC;oBACJ,CAAC;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,sBAAsB,CAC7B,UAAyC,EACzC,IAAmB;IAEnB,MAAM,aAAa,GAAG,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAEjD,IACE,aAAa;QACb,gBAAQ,CAAC,mBAAmB,CAAC,aAAa,CAAC;QAC3C,SAAS;QACT,gBAAQ,CAAC,mBAAmB,CAAC,SAAS,CAAC,EACvC,CAAC;QACD,OAAO,CAAC,aAAa,EAAE,SAAS,CAAU,CAAC;IAC7C,CAAC;IAED,OAAO,CAAC,IAAI,EAAE,IAAI,CAAU,CAAC;AAC/B,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 { createEffectExpression } from '../../utils';\n\nexport const messageId = 'preferEffectCallbackInBlockStatement';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n docs: {\n description: 'A block statement is easier to troubleshoot.',\n ngrxModule: 'effects',\n },\n schema: [],\n messages: {\n [messageId]:\n 'The callback of `Effect` should be wrapped in a block statement.',\n },\n fixable: 'code',\n },\n defaultOptions: [],\n create: (context) => {\n const nonParametrizedEffect =\n `${createEffectExpression} > ArrowFunctionExpression > .body[type!=/^(ArrowFunctionExpression|BlockStatement)$/]` as const;\n const parametrizedEffect =\n `${createEffectExpression} > ArrowFunctionExpression > ArrowFunctionExpression > .body[type!='BlockStatement']` as const;\n const parametrizedEffectWithinBlockStatement =\n `${createEffectExpression} > ArrowFunctionExpression > BlockStatement > ReturnStatement > ArrowFunctionExpression > .body[type!='BlockStatement']` as const;\n\n return {\n [`${nonParametrizedEffect}, ${parametrizedEffect}, ${parametrizedEffectWithinBlockStatement}`](\n node: TSESTree.ArrowFunctionExpression['body']\n ) {\n context.report({\n node,\n messageId,\n fix: (fixer) => {\n const [previousNode, nextNode] = getSafeNodesToApplyFix(\n context.sourceCode,\n node\n );\n return [\n fixer.insertTextBefore(previousNode, `{ return `),\n fixer.insertTextAfter(nextNode, ` }`),\n ];\n },\n });\n },\n };\n },\n});\n\nfunction getSafeNodesToApplyFix(\n sourceCode: Readonly<TSESLint.SourceCode>,\n node: TSESTree.Node\n) {\n const previousToken = sourceCode.getTokenBefore(node);\n const nextToken = sourceCode.getTokenAfter(node);\n\n if (\n previousToken &&\n ASTUtils.isOpeningParenToken(previousToken) &&\n nextToken &&\n ASTUtils.isClosingParenToken(nextToken)\n ) {\n return [previousToken, nextToken] as const;\n }\n\n return [node, node] as const;\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const messageId = "useEffectsLifecycleInterface";
|
|
2
|
-
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"useEffectsLifecycleInterface", readonly [],
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"useEffectsLifecycleInterface", 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: 'effects',
|
|
46
45
|
docs: {
|
|
47
46
|
description: 'Ensures classes implement lifecycle interfaces corresponding to the declared lifecycle methods.',
|
|
47
|
+
ngrxModule: 'effects',
|
|
48
48
|
},
|
|
49
49
|
fixable: 'code',
|
|
50
50
|
schema: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-effects-lifecycle-interface.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/use-effects-lifecycle-interface.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,SAAS,GAAG,8BAA8B,CAAC;AAKxD,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":"use-effects-lifecycle-interface.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/use-effects-lifecycle-interface.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,SAAS,GAAG,8BAA8B,CAAC;AAKxD,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,iGAAiG;YACnG,UAAU,EAAE,SAAS;SACtB;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,gGAAgG;SACnG;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,eAAe,GAAG;YACtB,qBAAqB,EAAE,mBAAmB;YAC1C,iBAAiB,EAAE,eAAe;YAClC,gBAAgB,EAAE,cAAc;SACxB,CAAC;QACX,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEjE,OAAO;YACL,CAAC,sEAAsE,iBAAiB,IAAI,CAAC,CAC3F,IAKC;gBAED,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;gBACnD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC;gBAC7B,MAAM,aAAa,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;gBAElD,IAAI,IAAA,oBAAY,EAAC,gBAAgB,EAAE,aAAa,CAAC,EAAE,CAAC;oBAClD,OAAO;gBACT,CAAC;gBAED,OAAO,CAAC,MAAM,CAAC;oBACb,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;wBACb,MAAM,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,GACpD,IAAA,gCAAwB,EAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;wBAC5D,OAAO;4BACL,KAAK,CAAC,eAAe,CACnB,qBAAqB,EACrB,qBAAqB,CACtB;yBACF,CAAC,MAAM,CACN,IAAA,uBAAe,EAAC;4BACd,4BAA4B,EAAE,IAAI;4BAClC,KAAK;4BACL,UAAU,EAAE,aAAa;4BACzB,UAAU,EAAE,yBAAiB,CAAC,OAAO;4BACrC,IAAI,EAAE,gBAAgB;yBACvB,CAAC,CACH,CAAC;oBACJ,CAAC;oBACD,IAAI;oBACJ,SAAS,EAAT,iBAAS;oBACT,IAAI,EAAE;wBACJ,aAAa;wBACb,UAAU;qBACX;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n getImplementsSchemaFixer,\n getImportAddFix,\n getInterface,\n NGRX_MODULE_PATHS,\n} from '../../utils';\n\nexport const messageId = 'useEffectsLifecycleInterface';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n docs: {\n description:\n 'Ensures classes implement lifecycle interfaces corresponding to the declared lifecycle methods.',\n ngrxModule: 'effects',\n },\n fixable: 'code',\n schema: [],\n messages: {\n [messageId]:\n 'Lifecycle interface `{{ interfaceName }}` should be implemented for method `{{ methodName }}`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const lifecycleMapper = {\n ngrxOnIdentifyEffects: 'OnIdentifyEffects',\n ngrxOnInitEffects: 'OnInitEffects',\n ngrxOnRunEffects: 'OnRunEffects',\n } as const;\n const lifecyclesPattern = Object.keys(lifecycleMapper).join('|');\n\n return {\n [`ClassDeclaration > ClassBody > MethodDefinition > Identifier[name=/${lifecyclesPattern}/]`](\n node: TSESTree.Identifier & {\n name: keyof typeof lifecycleMapper;\n parent: TSESTree.MethodDefinition & {\n parent: TSESTree.ClassBody & { parent: TSESTree.ClassDeclaration };\n };\n }\n ) {\n const classDeclaration = node.parent.parent.parent;\n const methodName = node.name;\n const interfaceName = lifecycleMapper[methodName];\n\n if (getInterface(classDeclaration, interfaceName)) {\n return;\n }\n\n context.report({\n fix: (fixer) => {\n const { implementsNodeReplace, implementsTextReplace } =\n getImplementsSchemaFixer(classDeclaration, interfaceName);\n return [\n fixer.insertTextAfter(\n implementsNodeReplace,\n implementsTextReplace\n ),\n ].concat(\n getImportAddFix({\n compatibleWithTypeOnlyImport: true,\n fixer,\n importName: interfaceName,\n moduleName: NGRX_MODULE_PATHS.effects,\n node: classDeclaration,\n })\n );\n },\n node,\n messageId,\n data: {\n interfaceName,\n methodName,\n },\n });\n },\n };\n },\n});\n"]}
|
package/src/rules/index.d.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
export declare const rules: {
|
|
2
|
-
'avoid-combining-component-store-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCombiningComponentStoreSelectors", readonly [],
|
|
3
|
-
'avoid-mapping-component-store-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidMappingComponentStoreSelectors", readonly [],
|
|
4
|
-
'updater-explicit-return-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"updaterExplicitReturnType", readonly [],
|
|
5
|
-
'require-super-ondestroy': import("@typescript-eslint/utils/ts-eslint").RuleModule<"requireSuperOnDestroy", readonly [],
|
|
6
|
-
'avoid-cyclic-effects': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCyclicEffects", readonly [],
|
|
7
|
-
'no-dispatch-in-effects': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noDispatchInEffects" | "noDispatchInEffectsSuggest", readonly [],
|
|
8
|
-
'no-effects-in-providers': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noEffectsInProviders", readonly [],
|
|
9
|
-
'no-multiple-actions-in-effects': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMultipleActionsInEffects", readonly unknown[],
|
|
10
|
-
'prefer-action-creator-in-of-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreatorInOfType", readonly [],
|
|
11
|
-
'prefer-effect-callback-in-block-statement': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferEffectCallbackInBlockStatement", readonly [],
|
|
12
|
-
'use-effects-lifecycle-interface': import("@typescript-eslint/utils/ts-eslint").RuleModule<"useEffectsLifecycleInterface", readonly [],
|
|
13
|
-
'avoid-combining-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCombiningSelectors", readonly [],
|
|
14
|
-
'avoid-dispatching-multiple-actions-sequentially': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidDispatchingMultipleActionsSequentially", readonly [],
|
|
15
|
-
'avoid-duplicate-actions-in-reducer': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidDuplicateActionsInReducer" | "avoidDuplicateActionsInReducerSuggest", readonly [],
|
|
16
|
-
'avoid-mapping-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidMapppingSelectors", readonly [],
|
|
17
|
-
'good-action-hygiene': import("@typescript-eslint/utils/ts-eslint").RuleModule<"goodActionHygiene", readonly [],
|
|
18
|
-
'no-multiple-global-stores': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMultipleGlobalStores" | "noMultipleGlobalStoresSuggest", readonly [],
|
|
19
|
-
'no-reducer-in-key-names': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noReducerInKeyNames" | "noReducerInKeyNamesSuggest", readonly [],
|
|
20
|
-
'no-store-subscription': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noStoreSubscription", readonly [],
|
|
21
|
-
'no-typed-global-store': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noTypedStore" | "noTypedStoreSuggest", readonly [],
|
|
22
|
-
'on-function-explicit-return-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"onFunctionExplicitReturnType" | "onFunctionExplicitReturnTypeSuggest", readonly [],
|
|
23
|
-
'prefer-action-creator': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreator", readonly [],
|
|
24
|
-
'prefer-action-creator-in-dispatch': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreatorInDispatch", readonly [],
|
|
25
|
-
'prefer-inline-action-props': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferInlineActionProps" | "preferInlineActionPropsSuggest", readonly [],
|
|
26
|
-
'prefer-one-generic-in-create-for-feature-selector': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferOneGenericInCreateForFeatureSelector" | "preferOneGenericInCreateForFeatureSelectorSuggest", readonly [],
|
|
27
|
-
'prefer-selector-in-select': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferSelectorInSelect", readonly [],
|
|
28
|
-
'prefix-selectors-with-select': import("@typescript-eslint/utils/ts-eslint").RuleModule<"prefixSelectorsWithSelect" | "prefixSelectorsWithSelectSuggest", readonly [],
|
|
29
|
-
'select-style': import("@typescript-eslint/utils/ts-eslint").RuleModule<"operator" | "method", readonly ["operator" | "method"],
|
|
30
|
-
'use-consistent-global-store-name': import("@typescript-eslint/utils/ts-eslint").RuleModule<"useConsistentGlobalStoreName" | "useConsistentGlobalStoreNameSuggest", readonly [string],
|
|
2
|
+
'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>;
|
|
3
|
+
'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>;
|
|
4
|
+
'updater-explicit-return-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"updaterExplicitReturnType", readonly [], import("../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
5
|
+
'require-super-ondestroy': import("@typescript-eslint/utils/ts-eslint").RuleModule<"requireSuperOnDestroy", readonly [], import("../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
6
|
+
'avoid-cyclic-effects': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCyclicEffects", readonly [], import("../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
7
|
+
'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>;
|
|
8
|
+
'no-effects-in-providers': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noEffectsInProviders", readonly [], import("../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
9
|
+
'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>;
|
|
10
|
+
'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>;
|
|
11
|
+
'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>;
|
|
12
|
+
'use-effects-lifecycle-interface': import("@typescript-eslint/utils/ts-eslint").RuleModule<"useEffectsLifecycleInterface", readonly [], import("../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
13
|
+
'avoid-combining-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCombiningSelectors", readonly [], import("../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
14
|
+
'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>;
|
|
15
|
+
'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>;
|
|
16
|
+
'avoid-mapping-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidMapppingSelectors", readonly [], import("../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
17
|
+
'good-action-hygiene': import("@typescript-eslint/utils/ts-eslint").RuleModule<"goodActionHygiene", readonly [], import("../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
18
|
+
'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>;
|
|
19
|
+
'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>;
|
|
20
|
+
'no-store-subscription': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noStoreSubscription", readonly [], import("../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
21
|
+
'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>;
|
|
22
|
+
'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>;
|
|
23
|
+
'prefer-action-creator': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreator", readonly [], import("../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
24
|
+
'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>;
|
|
25
|
+
'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>;
|
|
26
|
+
'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>;
|
|
27
|
+
'prefer-selector-in-select': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferSelectorInSelect", readonly [], import("../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
28
|
+
'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>;
|
|
29
|
+
'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>;
|
|
30
|
+
'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>;
|
|
31
31
|
'prefer-concat-latest-from': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferConcatLatestFrom", readonly [{
|
|
32
32
|
readonly strict: boolean;
|
|
33
|
-
}],
|
|
34
|
-
'signal-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStateNoArraysAtRootLevel", readonly [],
|
|
35
|
-
'signal-store-feature-should-use-generic-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStoreFeatureShouldUseGenericType", readonly [],
|
|
36
|
-
'prefer-protected-state': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferProtectedState" | "preferProtectedStateSuggest", readonly [],
|
|
37
|
-
'with-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"withStateNoArraysAtRootLevel", readonly [],
|
|
38
|
-
'enforce-type-call': import("@typescript-eslint/utils/ts-eslint").RuleModule<"enforceTypeCall", readonly [],
|
|
33
|
+
}], import("../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
34
|
+
'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>;
|
|
35
|
+
'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>;
|
|
36
|
+
'prefer-protected-state': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferProtectedState" | "preferProtectedStateSuggest", readonly [], import("../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
37
|
+
'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>;
|
|
38
|
+
'enforce-type-call': import("@typescript-eslint/utils/ts-eslint").RuleModule<"enforceTypeCall", readonly [], import("../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
39
39
|
};
|
|
@@ -3,5 +3,5 @@ export declare const messageId = "preferConcatLatestFrom";
|
|
|
3
3
|
type Options = readonly [{
|
|
4
4
|
readonly strict: boolean;
|
|
5
5
|
}];
|
|
6
|
-
declare const _default: TSESLint.RuleModule<"preferConcatLatestFrom", Options,
|
|
6
|
+
declare const _default: TSESLint.RuleModule<"preferConcatLatestFrom", Options, import("../../rule-creator").NgRxRuleDocs, TSESLint.RuleListener>;
|
|
7
7
|
export default _default;
|
|
@@ -46,9 +46,9 @@ exports.default = (0, rule_creator_1.createRule)({
|
|
|
46
46
|
name: path.parse(__filename).name,
|
|
47
47
|
meta: {
|
|
48
48
|
type: 'problem',
|
|
49
|
-
ngrxModule: 'operators',
|
|
50
49
|
docs: {
|
|
51
50
|
description: `Use \`${concatLatestFromKeyword}\` instead of \`${withLatestFromKeyword}\` to prevent the selector from firing until the correct \`Action\` is dispatched.`,
|
|
51
|
+
ngrxModule: 'operators',
|
|
52
52
|
},
|
|
53
53
|
fixable: 'code',
|
|
54
54
|
schema: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-concat-latest-from.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/operators/prefer-concat-latest-from.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAIkC;AAClC,2CAA6B;AAC7B,qDAAgD;AAChD,uCAOqB;AAER,QAAA,SAAS,GAAG,wBAAwB,CAAC;AAQlD,MAAM,cAAc,GAAoB,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC1D,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AACnD,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAE/C,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,
|
|
1
|
+
{"version":3,"file":"prefer-concat-latest-from.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/operators/prefer-concat-latest-from.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n AST_NODE_TYPES,\n type TSESLint,\n type TSESTree,\n} from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n createEffectExpression,\n getImportAddFix,\n getNgRxEffectActions,\n namedExpression,\n NGRX_MODULE_PATHS,\n} from '../../utils';\n\nexport const messageId = 'preferConcatLatestFrom';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [{ readonly strict: boolean }];\ntype WithLatestFromIdentifier = TSESTree.Identifier & {\n parent: TSESTree.CallExpression;\n};\n\nconst defaultOptions: Options[number] = { strict: false };\nconst concatLatestFromKeyword = 'concatLatestFrom';\nconst withLatestFromKeyword = 'withLatestFrom';\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n docs: {\n description: `Use \\`${concatLatestFromKeyword}\\` instead of \\`${withLatestFromKeyword}\\` to prevent the selector from firing until the correct \\`Action\\` is dispatched.`,\n ngrxModule: 'operators',\n },\n fixable: 'code',\n schema: [\n {\n type: 'object',\n properties: {\n strict: {\n type: 'boolean',\n default: defaultOptions.strict,\n },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n [messageId]: `Use \\`${concatLatestFromKeyword}\\` instead of \\`${withLatestFromKeyword}\\`.`,\n },\n },\n defaultOptions: [defaultOptions],\n create: (context, [options]) => {\n if (options.strict) {\n return {\n [`${createEffectExpression} CallExpression > Identifier[name='withLatestFrom']`](\n node: WithLatestFromIdentifier\n ) {\n context.report({\n node,\n messageId,\n fix: (fixer) => getFixes(context.sourceCode, fixer, node),\n });\n },\n };\n }\n\n const { identifiers = [], sourceCode } = getNgRxEffectActions(context);\n const actionsNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!actionsNames) {\n return {};\n }\n\n return {\n [`${createEffectExpression} ${namedExpression(\n actionsNames\n )} > CallExpression[arguments.length=1] > Identifier[name='${withLatestFromKeyword}']`](\n node: WithLatestFromIdentifier\n ) {\n context.report({\n node,\n messageId,\n fix: (fixer) => getFixes(sourceCode, fixer, node),\n });\n },\n [`${createEffectExpression} ${namedExpression(\n actionsNames\n )} > CallExpression[arguments.length>1] > Identifier[name='${withLatestFromKeyword}']`](\n node: WithLatestFromIdentifier\n ) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n\nfunction getFixes(\n sourceCode: Readonly<TSESLint.SourceCode>,\n fixer: TSESLint.RuleFixer,\n node: WithLatestFromIdentifier\n) {\n const { parent } = node;\n const isUsingDeprecatedProjectorArgument = parent.arguments.length > 1;\n const [firstArgument] = parent.arguments;\n const nextToken =\n isUsingDeprecatedProjectorArgument &&\n sourceCode.getTokenAfter(firstArgument);\n return [\n fixer.replaceText(node, concatLatestFromKeyword),\n ...(firstArgument.type == AST_NODE_TYPES.ArrowFunctionExpression\n ? []\n : [fixer.insertTextBefore(firstArgument, '() => ')]),\n ].concat(\n getImportAddFix({\n fixer,\n importName: concatLatestFromKeyword,\n moduleName: NGRX_MODULE_PATHS.operators,\n node,\n }),\n ...(isUsingDeprecatedProjectorArgument && nextToken\n ? [\n getImportAddFix({\n fixer,\n importName: 'map',\n moduleName: 'rxjs/operators',\n node,\n }),\n fixer.insertTextAfterRange(nextToken.range, '), map('),\n ]\n : [])\n );\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const enforceTypeCall = "enforceTypeCall";
|
|
2
|
-
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"enforceTypeCall", readonly [],
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"enforceTypeCall", 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: 'signals',
|
|
46
45
|
docs: {
|
|
47
46
|
description: 'The `type` function must be called.',
|
|
47
|
+
ngrxModule: 'signals',
|
|
48
48
|
},
|
|
49
49
|
fixable: 'code',
|
|
50
50
|
schema: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enforce-type-call.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/signals/enforce-type-call.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAA6D;AAEhD,QAAA,eAAe,GAAG,iBAAiB,CAAC;AAKjD,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":"enforce-type-call.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/signals/enforce-type-call.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAA6D;AAEhD,QAAA,eAAe,GAAG,iBAAiB,CAAC;AAKjD,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,qCAAqC;YAClD,UAAU,EAAE,SAAS;SACtB;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,uBAAe,CAAC,EAAE,yCAAyC;SAC7D;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,yFAAyF;QACzF,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;QAEpC,OAAO;YACL,CAAC,uFAAuF,CAAC,CACvF,IAA8B;gBAE9B,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC;YAED,yBAAyB,CAAC,IAAwC;gBAChE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;gBACnC,IACE,IAAA,oBAAY,EAAC,UAAU,CAAC;oBACxB,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;oBAC9B,CAAC,IAAA,wBAAgB,EAAC,IAAI,CAAC,MAAM,CAAC,EAC9B,CAAC;oBACD,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,UAAU;wBAChB,SAAS,EAAE,uBAAe;wBAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE;wBAC/B,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;qBAClD,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { type TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { isCallExpression, isIdentifier } from '../../utils';\n\nexport const enforceTypeCall = 'enforceTypeCall';\n\ntype MessageIds = typeof enforceTypeCall;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n docs: {\n description: 'The `type` function must be called.',\n ngrxModule: 'signals',\n },\n fixable: 'code',\n schema: [],\n messages: {\n [enforceTypeCall]: 'The `{{name}}` function must be called.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n // It's possible that we have multiple type import aliases, so we need to track them all.\n const typeNames = new Set<string>();\n\n return {\n [`ImportDeclaration[source.value='@ngrx/signals'] ImportSpecifier[imported.name='type']`](\n node: TSESTree.ImportSpecifier\n ) {\n typeNames.add(node.local.name);\n },\n\n TSInstantiationExpression(node: TSESTree.TSInstantiationExpression) {\n const expression = node.expression;\n if (\n isIdentifier(expression) &&\n typeNames.has(expression.name) &&\n !isCallExpression(node.parent)\n ) {\n context.report({\n node: expression,\n messageId: enforceTypeCall,\n data: { name: expression.name },\n fix: (fixer) => fixer.insertTextAfter(node, '()'),\n });\n }\n },\n };\n },\n});\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const preferProtectedState = "preferProtectedState";
|
|
2
2
|
export declare const preferProtectedStateSuggest = "preferProtectedStateSuggest";
|
|
3
3
|
type MessageIds = typeof preferProtectedState | typeof preferProtectedStateSuggest;
|
|
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,9 +43,9 @@ exports.default = (0, rule_creator_1.createRule)({
|
|
|
43
43
|
meta: {
|
|
44
44
|
type: 'suggestion',
|
|
45
45
|
hasSuggestions: true,
|
|
46
|
-
ngrxModule: 'signals',
|
|
47
46
|
docs: {
|
|
48
47
|
description: `A Signal Store prefers protected state`,
|
|
48
|
+
ngrxModule: 'signals',
|
|
49
49
|
},
|
|
50
50
|
schema: [],
|
|
51
51
|
messages: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-protected-state.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/signals/prefer-protected-state.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAEnC,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAC9C,QAAA,2BAA2B,GAAG,6BAA6B,CAAC;AAOzE,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,
|
|
1
|
+
{"version":3,"file":"prefer-protected-state.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/signals/prefer-protected-state.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAEnC,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAC9C,QAAA,2BAA2B,GAAG,6BAA6B,CAAC;AAOzE,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,IAAI,EAAE;YACJ,WAAW,EAAE,wCAAwC;YACrD,UAAU,EAAE,SAAS;SACtB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,4BAAoB,CAAC,EACpB,kFAAkF;YACpF,CAAC,mCAA2B,CAAC,EAAE,mCAAmC;SACnE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,4JAA4J,CAAC,CAC5J,IAAuB;gBAEvB,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,4BAAoB;oBAC/B,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,mCAA2B;4BACtC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;gCACb,MAAM,mBAAmB,GAAG,GAEvB,EAAE;oCACL,MAAM,YAAY,GAAG,IAAI,CAAC,MAAmC,CAAC;oCAC9D,MAAM,8BAA8B,GAClC,YAAY,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC;oCAEvC,IAAI,8BAA8B,EAAE,CAAC;wCACnC;;2CAEG;wCACH,OAAO,YAAY,CAAC,KAAK,CAAC;oCAC5B,CAAC;oCAED,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;oCAC1D,MAAM,iBAAiB,GAAG,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,CAAC;oCAC5D;;uCAEG;oCACH,OAAO;wCACL,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;wCACb;;2CAEG;wCACH,iBAAiB,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;qCACxD,CAAC;gCACJ,CAAC,CAAC;gCAEF,OAAO,KAAK,CAAC,WAAW,CAAC,mBAAmB,EAAE,CAAC,CAAC;4BAClD,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 preferProtectedState = 'preferProtectedState';\nexport const preferProtectedStateSuggest = 'preferProtectedStateSuggest';\n\ntype MessageIds =\n | typeof preferProtectedState\n | typeof preferProtectedStateSuggest;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n docs: {\n description: `A Signal Store prefers protected state`,\n ngrxModule: 'signals',\n },\n schema: [],\n messages: {\n [preferProtectedState]:\n '{ protectedState: false } should be removed to prevent external state mutations.',\n [preferProtectedStateSuggest]: 'Remove `{protectedState: false}`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`CallExpression[callee.name=signalStore][arguments.length>0] > ObjectExpression[properties.length>0] > Property[key.name=protectedState][value.value=false]`](\n node: TSESTree.Property\n ) {\n context.report({\n node,\n messageId: preferProtectedState,\n suggest: [\n {\n messageId: preferProtectedStateSuggest,\n fix: (fixer) => {\n const getRangeToBeRemoved = (): Parameters<\n typeof fixer.removeRange\n >[0] => {\n const parentObject = node.parent as TSESTree.ObjectExpression;\n const parentObjectHasOnlyOneProperty =\n parentObject.properties.length === 1;\n\n if (parentObjectHasOnlyOneProperty) {\n /**\n * Remove the entire object if it contains only one property - the relevant one\n */\n return parentObject.range;\n }\n\n const tokenAfter = context.sourceCode.getTokenAfter(node);\n const tokenAfterIsComma = tokenAfter?.value?.trim() === ',';\n /**\n * Remove the specific property if there is more than one property in the parent\n */\n return [\n node.range[0],\n /**\n * remove trailing comma as well\n */\n tokenAfterIsComma ? tokenAfter.range[1] : node.range[1],\n ];\n };\n\n return fixer.removeRange(getRangeToBeRemoved());\n },\n },\n ],\n });\n },\n };\n },\n});\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const messageId = "signalStateNoArraysAtRootLevel";
|
|
2
|
-
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStateNoArraysAtRootLevel", readonly [],
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStateNoArraysAtRootLevel", 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: 'signals',
|
|
46
45
|
docs: {
|
|
47
46
|
description: `signalState should accept a record or dictionary as an input argument.`,
|
|
47
|
+
ngrxModule: 'signals',
|
|
48
48
|
},
|
|
49
49
|
schema: [],
|
|
50
50
|
messages: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal-state-no-arrays-at-root-level.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/signals/signal-state-no-arrays-at-root-level.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAgD;AAEnC,QAAA,SAAS,GAAG,gCAAgC,CAAC;AAK1D,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":"signal-state-no-arrays-at-root-level.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/signals/signal-state-no-arrays-at-root-level.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAgD;AAEnC,QAAA,SAAS,GAAG,gCAAgC,CAAC;AAK1D,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,wEAAwE;YACrF,UAAU,EAAE,SAAS;SACtB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EAAE,4CAA4C;SAC1D;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,yCAAyC,CAAC,CACzC,IAA6B;gBAE7B,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;gBAClC,IAAI,IAAA,yBAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;oBAChC,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,QAAQ;wBACd,SAAS,EAAT,iBAAS;qBACV,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { type TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { isArrayExpression } from '../../utils';\n\nexport const messageId = 'signalStateNoArraysAtRootLevel';\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: `signalState should accept a record or dictionary as an input argument.`,\n ngrxModule: 'signals',\n },\n schema: [],\n messages: {\n [messageId]: `Wrap the array in an record or dictionary.`,\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`CallExpression[callee.name=signalState]`](\n node: TSESTree.CallExpression\n ) {\n const [argument] = node.arguments;\n if (isArrayExpression(argument)) {\n context.report({\n node: argument,\n messageId,\n });\n }\n },\n };\n },\n});\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
2
|
export declare const messageId = "signalStoreFeatureShouldUseGenericType";
|
|
3
|
-
declare const _default: ESLintUtils.RuleModule<"signalStoreFeatureShouldUseGenericType", readonly [],
|
|
3
|
+
declare const _default: ESLintUtils.RuleModule<"signalStoreFeatureShouldUseGenericType", readonly [], import("../../rule-creator").NgRxRuleDocs, ESLintUtils.RuleListener>;
|
|
4
4
|
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: 'signals',
|
|
46
45
|
docs: {
|
|
47
46
|
description: `A custom Signal Store feature that accepts an input should define a generic type.`,
|
|
47
|
+
ngrxModule: 'signals',
|
|
48
48
|
},
|
|
49
49
|
fixable: 'code',
|
|
50
50
|
schema: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal-store-feature-should-use-generic-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/signals/signal-store-feature-should-use-generic-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,SAAS,GAAG,wCAAwC,CAAC;AAKlE,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":"signal-store-feature-should-use-generic-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/signals/signal-store-feature-should-use-generic-type.ts"],"names":[],"mappings":"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","sourcesContent":["import { ESLintUtils, type TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n isArrowFunctionExpression,\n isCallExpression,\n isFunctionDeclaration,\n isIdentifier,\n} from '../../utils';\n\nexport const messageId = 'signalStoreFeatureShouldUseGenericType';\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: `A custom Signal Store feature that accepts an input should define a generic type.`,\n ngrxModule: 'signals',\n },\n fixable: 'code',\n schema: [],\n messages: {\n [messageId]: `Add an unused generic type to the function creating the signal store feature.`,\n },\n },\n defaultOptions: [],\n create: (context) => {\n function report(\n signalStoreFeature: TSESTree.CallExpression,\n func?: TSESTree.Node\n ) {\n if (\n !func ||\n (!isFunctionDeclaration(func) && !isArrowFunctionExpression(func))\n ) {\n return;\n }\n const parentHasGenerics =\n func.typeParameters && func.typeParameters.params.length > 0;\n if (!parentHasGenerics) {\n context.report({\n node: signalStoreFeature.callee,\n messageId,\n fix(fixer) {\n if (isFunctionDeclaration(func)) {\n if (func.id) {\n return fixer.insertTextAfter(func.id, '<_>');\n }\n }\n\n return fixer.insertTextBefore(func, '<_>');\n },\n });\n }\n }\n\n function hasInputAsArgument(node: TSESTree.CallExpression) {\n const [inputArg] = node.arguments;\n return (\n !isCallExpression(inputArg) ||\n (isIdentifier(inputArg.callee) && inputArg.callee.name === 'type')\n );\n }\n\n return {\n [`ArrowFunctionExpression > CallExpression[callee.name=signalStoreFeature]`](\n node: TSESTree.CallExpression\n ) {\n if (hasInputAsArgument(node)) {\n report(node, node.parent);\n }\n },\n [`ArrowFunctionExpression > BlockStatement CallExpression[callee.name=signalStoreFeature]`](\n node: TSESTree.CallExpression\n ) {\n if (hasInputAsArgument(node)) {\n let parent: TSESTree.Node | undefined = node.parent;\n while (parent && !isArrowFunctionExpression(parent)) {\n parent = parent.parent;\n }\n report(node, parent);\n }\n },\n [`FunctionDeclaration > BlockStatement CallExpression[callee.name=signalStoreFeature]`](\n node: TSESTree.CallExpression\n ) {\n if (hasInputAsArgument(node)) {\n let parent: TSESTree.Node | undefined = node.parent;\n while (parent && !isFunctionDeclaration(parent)) {\n parent = parent.parent;\n }\n report(node, parent);\n }\n },\n };\n },\n});\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
2
|
export declare const messageId = "withStateNoArraysAtRootLevel";
|
|
3
|
-
declare const _default: ESLintUtils.RuleModule<"withStateNoArraysAtRootLevel", readonly [],
|
|
3
|
+
declare const _default: ESLintUtils.RuleModule<"withStateNoArraysAtRootLevel", readonly [], import("../../rule-creator").NgRxRuleDocs, ESLintUtils.RuleListener>;
|
|
4
4
|
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: 'signals',
|
|
47
46
|
docs: {
|
|
48
47
|
description: `withState should accept a record or dictionary as an input argument.`,
|
|
48
|
+
ngrxModule: 'signals',
|
|
49
49
|
requiresTypeChecking: true,
|
|
50
50
|
},
|
|
51
51
|
schema: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-state-no-arrays-at-root-level.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/signals/with-state-no-arrays-at-root-level.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsE;AACtE,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAgD;AAEnC,QAAA,SAAS,GAAG,8BAA8B,CAAC;AAKxD,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":"with-state-no-arrays-at-root-level.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/signals/with-state-no-arrays-at-root-level.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsE;AACtE,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAgD;AAEnC,QAAA,SAAS,GAAG,8BAA8B,CAAC;AAKxD,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,sEAAsE;YACnF,UAAU,EAAE,SAAS;YACrB,oBAAoB,EAAE,IAAI;SAC3B;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EAAE,4CAA4C;SAC1D;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,uCAAuC,CAAC,CAAC,IAA6B;gBACrE,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;gBAClC,IAAI,IAAA,yBAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;oBAChC,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,QAAQ;wBACd,SAAS,EAAT,iBAAS;qBACV,CAAC,CAAC;gBACL,CAAC;qBAAM,IAAI,QAAQ,EAAE,CAAC;oBACpB,MAAM,QAAQ,GAAG,mBAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;oBACxD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;oBACtD,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;oBAElD,IAAI,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;wBAClC,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI,EAAE,QAAQ;4BACd,SAAS,EAAT,iBAAS;yBACV,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { ESLintUtils, type TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { isArrayExpression } from '../../utils';\n\nexport const messageId = 'withStateNoArraysAtRootLevel';\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: `withState should accept a record or dictionary as an input argument.`,\n ngrxModule: 'signals',\n requiresTypeChecking: true,\n },\n schema: [],\n messages: {\n [messageId]: `Wrap the array in an record or dictionary.`,\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`CallExpression[callee.name=withState]`](node: TSESTree.CallExpression) {\n const [argument] = node.arguments;\n if (isArrayExpression(argument)) {\n context.report({\n node: argument,\n messageId,\n });\n } else if (argument) {\n const services = ESLintUtils.getParserServices(context);\n const typeChecker = services.program.getTypeChecker();\n const type = services.getTypeAtLocation(argument);\n\n if (typeChecker.isArrayType(type)) {\n context.report({\n node: argument,\n messageId,\n });\n }\n }\n },\n };\n },\n});\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const messageId = "avoidCombiningSelectors";
|
|
2
|
-
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCombiningSelectors", readonly [],
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCombiningSelectors", readonly [], import("../../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
3
3
|
export default _default;
|
|
@@ -42,9 +42,9 @@ exports.default = (0, rule_creator_1.createRule)({
|
|
|
42
42
|
name: path.parse(__filename).name,
|
|
43
43
|
meta: {
|
|
44
44
|
type: 'suggestion',
|
|
45
|
-
ngrxModule: 'store',
|
|
46
45
|
docs: {
|
|
47
46
|
description: 'Prefer combining selectors at the selector level.',
|
|
47
|
+
ngrxModule: 'store',
|
|
48
48
|
},
|
|
49
49
|
schema: [],
|
|
50
50
|
messages: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avoid-combining-selectors.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/avoid-combining-selectors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,SAAS,GAAG,yBAAyB,CAAC;AAKnD,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-selectors.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/avoid-combining-selectors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,SAAS,GAAG,yBAAyB,CAAC;AAKnD,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,OAAO;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EAAE,0CAA0C;SACxD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,qBAAa,EAAC,OAAO,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,qBAAqB,GAAG,YAAY,IAAA,uBAAe,EACvD,UAAU,CACX,4EAA4E,IAAA,wBAAgB,EAC3F,UAAU,CACX,GAAY,CAAC;QAEd,MAAM,cAAc,GAA8B,EAAE,CAAC;QACrD,OAAO;YACL,CAAC,+CAA+C,qBAAqB,MAAM,qBAAqB,EAAE,CAAC,CACjG,IAA6B;gBAE7B,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC;YACD,CAAC,kDAAkD,CAAC;gBAClD,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;oBAClC,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI;wBACJ,SAAS,EAAT,iBAAS;qBACV,CAAC,CAAC;gBACL,CAAC;gBACD,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;YAC5B,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n getNgRxStores,\n namedExpression,\n selectExpression,\n} from '../../utils';\n\nexport const messageId = 'avoidCombiningSelectors';\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: 'Prefer combining selectors at the selector level.',\n ngrxModule: 'store',\n },\n schema: [],\n messages: {\n [messageId]: 'Combine selectors at the selector level.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!storeNames) {\n return {};\n }\n\n const pipeableOrStoreSelect = `:matches(${namedExpression(\n storeNames\n )}[callee.property.name='pipe']:has(CallExpression[callee.name='select']), ${selectExpression(\n storeNames\n )})` as const;\n\n const selectsInArray: TSESTree.CallExpression[] = [];\n return {\n [`CallExpression[callee.name='combineLatest'] ${pipeableOrStoreSelect} ~ ${pipeableOrStoreSelect}`](\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 = "avoidDispatchingMultipleActionsSequentially";
|
|
2
|
-
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidDispatchingMultipleActionsSequentially", readonly [],
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidDispatchingMultipleActionsSequentially", readonly [], import("../../rule-creator").NgRxRuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
3
3
|
export default _default;
|
|
@@ -42,9 +42,9 @@ exports.default = (0, rule_creator_1.createRule)({
|
|
|
42
42
|
name: path.parse(__filename).name,
|
|
43
43
|
meta: {
|
|
44
44
|
type: 'suggestion',
|
|
45
|
-
ngrxModule: 'store',
|
|
46
45
|
docs: {
|
|
47
46
|
description: 'It is recommended to only dispatch one `Action` at a time.',
|
|
47
|
+
ngrxModule: 'store',
|
|
48
48
|
},
|
|
49
49
|
schema: [],
|
|
50
50
|
messages: {
|