@ngrx/eslint-plugin 18.0.1 → 18.0.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngrx/eslint-plugin",
3
- "version": "18.0.1",
3
+ "version": "18.0.2",
4
4
  "description": "NgRx ESLint Plugin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,6 +31,7 @@
31
31
  "@ngrx/component-store",
32
32
  "@ngrx/component",
33
33
  "@ngrx/eslint-plugin",
34
+ "@ngrx/operators",
34
35
  "@ngrx/signals"
35
36
  ],
36
37
  "migrations": "./migrations/migration.json"
@@ -38,6 +38,7 @@ exports.default = (plugin, parser) => [
38
38
  '@ngrx/use-effects-lifecycle-interface': 'error',
39
39
  '@ngrx/prefer-concat-latest-from': 'error',
40
40
  '@ngrx/signal-state-no-arrays-at-root-level': 'error',
41
+ '@ngrx/signal-store-feature-should-use-generic-type': 'error',
41
42
  '@ngrx/with-state-no-arrays-at-root-level': 'error',
42
43
  '@ngrx/avoid-combining-selectors': 'error',
43
44
  '@ngrx/avoid-dispatching-multiple-actions-sequentially': 'error',
@@ -1 +1 @@
1
- {"version":3,"file":"all.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/configs/all.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAIH,kBAAe,CACb,MAAkC,EAClC,MAAkC,EACD,EAAE,CAAC;IACpC;QACE,IAAI,EAAE,WAAW;QACjB,eAAe,EAAE;YACf,MAAM;YACN,UAAU,EAAE,QAAQ;SACrB;QACD,OAAO,EAAE;YACP,OAAO,EAAE,MAAM;SAChB;KACF;IACD;QACE,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE;YACf,MAAM;YACN,aAAa,EAAE;gBACb,WAAW,EAAE,IAAI;gBACjB,UAAU,EAAE,QAAQ;gBACpB,OAAO,EAAE,iBAAiB;aAC3B;SACF;QACD,KAAK,EAAE;YACL,iDAAiD,EAAE,OAAO;YAC1D,+CAA+C,EAAE,OAAO;YACxD,oCAAoC,EAAE,OAAO;YAC7C,4BAA4B,EAAE,OAAO;YACrC,8BAA8B,EAAE,OAAO;YACvC,+BAA+B,EAAE,OAAO;YACxC,sCAAsC,EAAE,OAAO;YAC/C,wCAAwC,EAAE,OAAO;YACjD,iDAAiD,EAAE,OAAO;YAC1D,uCAAuC,EAAE,OAAO;YAChD,iCAAiC,EAAE,OAAO;YAC1C,4CAA4C,EAAE,OAAO;YACrD,0CAA0C,EAAE,OAAO;YACnD,iCAAiC,EAAE,OAAO;YAC1C,uDAAuD,EAAE,OAAO;YAChE,0CAA0C,EAAE,OAAO;YACnD,+BAA+B,EAAE,OAAO;YACxC,2BAA2B,EAAE,OAAO;YACpC,iCAAiC,EAAE,OAAO;YAC1C,+BAA+B,EAAE,OAAO;YACxC,6BAA6B,EAAE,OAAO;YACtC,6BAA6B,EAAE,OAAO;YACtC,wCAAwC,EAAE,OAAO;YACjD,yCAAyC,EAAE,OAAO;YAClD,6BAA6B,EAAE,OAAO;YACtC,kCAAkC,EAAE,OAAO;YAC3C,yDAAyD,EAAE,OAAO;YAClE,iCAAiC,EAAE,OAAO;YAC1C,oCAAoC,EAAE,OAAO;YAC7C,oBAAoB,EAAE,OAAO;YAC7B,wCAAwC,EAAE,OAAO;SAClD;KACF;CACF,CAAC","sourcesContent":["/**\n * DO NOT EDIT\n * This file is generated\n */\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nexport default (\n plugin: TSESLint.FlatConfig.Plugin,\n parser: TSESLint.FlatConfig.Parser\n): TSESLint.FlatConfig.ConfigArray => [\n {\n name: 'ngrx/base',\n languageOptions: {\n parser,\n sourceType: 'module',\n },\n plugins: {\n '@ngrx': plugin,\n },\n },\n {\n name: 'ngrx/all',\n languageOptions: {\n parser,\n parserOptions: {\n ecmaVersion: 2020,\n sourceType: 'module',\n project: './tsconfig.json',\n },\n },\n rules: {\n '@ngrx/avoid-combining-component-store-selectors': 'error',\n '@ngrx/avoid-mapping-component-store-selectors': 'error',\n '@ngrx/updater-explicit-return-type': 'error',\n '@ngrx/avoid-cyclic-effects': 'error',\n '@ngrx/no-dispatch-in-effects': 'error',\n '@ngrx/no-effects-in-providers': 'error',\n '@ngrx/no-multiple-actions-in-effects': 'error',\n '@ngrx/prefer-action-creator-in-of-type': 'error',\n '@ngrx/prefer-effect-callback-in-block-statement': 'error',\n '@ngrx/use-effects-lifecycle-interface': 'error',\n '@ngrx/prefer-concat-latest-from': 'error',\n '@ngrx/signal-state-no-arrays-at-root-level': 'error',\n '@ngrx/with-state-no-arrays-at-root-level': 'error',\n '@ngrx/avoid-combining-selectors': 'error',\n '@ngrx/avoid-dispatching-multiple-actions-sequentially': 'error',\n '@ngrx/avoid-duplicate-actions-in-reducer': 'error',\n '@ngrx/avoid-mapping-selectors': 'error',\n '@ngrx/good-action-hygiene': 'error',\n '@ngrx/no-multiple-global-stores': 'error',\n '@ngrx/no-reducer-in-key-names': 'error',\n '@ngrx/no-store-subscription': 'error',\n '@ngrx/no-typed-global-store': 'error',\n '@ngrx/on-function-explicit-return-type': 'error',\n '@ngrx/prefer-action-creator-in-dispatch': 'error',\n '@ngrx/prefer-action-creator': 'error',\n '@ngrx/prefer-inline-action-props': 'error',\n '@ngrx/prefer-one-generic-in-create-for-feature-selector': 'error',\n '@ngrx/prefer-selector-in-select': 'error',\n '@ngrx/prefix-selectors-with-select': 'error',\n '@ngrx/select-style': 'error',\n '@ngrx/use-consistent-global-store-name': 'error',\n },\n },\n];\n"]}
1
+ {"version":3,"file":"all.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/configs/all.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAIH,kBAAe,CACb,MAAkC,EAClC,MAAkC,EACD,EAAE,CAAC;IACpC;QACE,IAAI,EAAE,WAAW;QACjB,eAAe,EAAE;YACf,MAAM;YACN,UAAU,EAAE,QAAQ;SACrB;QACD,OAAO,EAAE;YACP,OAAO,EAAE,MAAM;SAChB;KACF;IACD;QACE,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE;YACf,MAAM;YACN,aAAa,EAAE;gBACb,WAAW,EAAE,IAAI;gBACjB,UAAU,EAAE,QAAQ;gBACpB,OAAO,EAAE,iBAAiB;aAC3B;SACF;QACD,KAAK,EAAE;YACL,iDAAiD,EAAE,OAAO;YAC1D,+CAA+C,EAAE,OAAO;YACxD,oCAAoC,EAAE,OAAO;YAC7C,4BAA4B,EAAE,OAAO;YACrC,8BAA8B,EAAE,OAAO;YACvC,+BAA+B,EAAE,OAAO;YACxC,sCAAsC,EAAE,OAAO;YAC/C,wCAAwC,EAAE,OAAO;YACjD,iDAAiD,EAAE,OAAO;YAC1D,uCAAuC,EAAE,OAAO;YAChD,iCAAiC,EAAE,OAAO;YAC1C,4CAA4C,EAAE,OAAO;YACrD,oDAAoD,EAAE,OAAO;YAC7D,0CAA0C,EAAE,OAAO;YACnD,iCAAiC,EAAE,OAAO;YAC1C,uDAAuD,EAAE,OAAO;YAChE,0CAA0C,EAAE,OAAO;YACnD,+BAA+B,EAAE,OAAO;YACxC,2BAA2B,EAAE,OAAO;YACpC,iCAAiC,EAAE,OAAO;YAC1C,+BAA+B,EAAE,OAAO;YACxC,6BAA6B,EAAE,OAAO;YACtC,6BAA6B,EAAE,OAAO;YACtC,wCAAwC,EAAE,OAAO;YACjD,yCAAyC,EAAE,OAAO;YAClD,6BAA6B,EAAE,OAAO;YACtC,kCAAkC,EAAE,OAAO;YAC3C,yDAAyD,EAAE,OAAO;YAClE,iCAAiC,EAAE,OAAO;YAC1C,oCAAoC,EAAE,OAAO;YAC7C,oBAAoB,EAAE,OAAO;YAC7B,wCAAwC,EAAE,OAAO;SAClD;KACF;CACF,CAAC","sourcesContent":["/**\n * DO NOT EDIT\n * This file is generated\n */\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nexport default (\n plugin: TSESLint.FlatConfig.Plugin,\n parser: TSESLint.FlatConfig.Parser\n): TSESLint.FlatConfig.ConfigArray => [\n {\n name: 'ngrx/base',\n languageOptions: {\n parser,\n sourceType: 'module',\n },\n plugins: {\n '@ngrx': plugin,\n },\n },\n {\n name: 'ngrx/all',\n languageOptions: {\n parser,\n parserOptions: {\n ecmaVersion: 2020,\n sourceType: 'module',\n project: './tsconfig.json',\n },\n },\n rules: {\n '@ngrx/avoid-combining-component-store-selectors': 'error',\n '@ngrx/avoid-mapping-component-store-selectors': 'error',\n '@ngrx/updater-explicit-return-type': 'error',\n '@ngrx/avoid-cyclic-effects': 'error',\n '@ngrx/no-dispatch-in-effects': 'error',\n '@ngrx/no-effects-in-providers': 'error',\n '@ngrx/no-multiple-actions-in-effects': 'error',\n '@ngrx/prefer-action-creator-in-of-type': 'error',\n '@ngrx/prefer-effect-callback-in-block-statement': 'error',\n '@ngrx/use-effects-lifecycle-interface': 'error',\n '@ngrx/prefer-concat-latest-from': 'error',\n '@ngrx/signal-state-no-arrays-at-root-level': 'error',\n '@ngrx/signal-store-feature-should-use-generic-type': 'error',\n '@ngrx/with-state-no-arrays-at-root-level': 'error',\n '@ngrx/avoid-combining-selectors': 'error',\n '@ngrx/avoid-dispatching-multiple-actions-sequentially': 'error',\n '@ngrx/avoid-duplicate-actions-in-reducer': 'error',\n '@ngrx/avoid-mapping-selectors': 'error',\n '@ngrx/good-action-hygiene': 'error',\n '@ngrx/no-multiple-global-stores': 'error',\n '@ngrx/no-reducer-in-key-names': 'error',\n '@ngrx/no-store-subscription': 'error',\n '@ngrx/no-typed-global-store': 'error',\n '@ngrx/on-function-explicit-return-type': 'error',\n '@ngrx/prefer-action-creator-in-dispatch': 'error',\n '@ngrx/prefer-action-creator': 'error',\n '@ngrx/prefer-inline-action-props': 'error',\n '@ngrx/prefer-one-generic-in-create-for-feature-selector': 'error',\n '@ngrx/prefer-selector-in-select': 'error',\n '@ngrx/prefix-selectors-with-select': 'error',\n '@ngrx/select-style': 'error',\n '@ngrx/use-consistent-global-store-name': 'error',\n },\n },\n];\n"]}
@@ -14,6 +14,7 @@
14
14
  "@ngrx/use-effects-lifecycle-interface": "error",
15
15
  "@ngrx/prefer-concat-latest-from": "error",
16
16
  "@ngrx/signal-state-no-arrays-at-root-level": "error",
17
+ "@ngrx/signal-store-feature-should-use-generic-type": "error",
17
18
  "@ngrx/with-state-no-arrays-at-root-level": "error",
18
19
  "@ngrx/avoid-combining-selectors": "error",
19
20
  "@ngrx/avoid-dispatching-multiple-actions-sequentially": "error",
@@ -27,6 +27,7 @@ exports.default = (plugin, parser) => [
27
27
  },
28
28
  rules: {
29
29
  '@ngrx/signal-state-no-arrays-at-root-level': 'error',
30
+ '@ngrx/signal-store-feature-should-use-generic-type': 'error',
30
31
  '@ngrx/with-state-no-arrays-at-root-level': 'error',
31
32
  },
32
33
  },
@@ -1 +1 @@
1
- {"version":3,"file":"signals.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/configs/signals.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAIH,kBAAe,CACb,MAAkC,EAClC,MAAkC,EACD,EAAE,CAAC;IACpC;QACE,IAAI,EAAE,WAAW;QACjB,eAAe,EAAE;YACf,MAAM;YACN,UAAU,EAAE,QAAQ;SACrB;QACD,OAAO,EAAE;YACP,OAAO,EAAE,MAAM;SAChB;KACF;IACD;QACE,IAAI,EAAE,cAAc;QACpB,eAAe,EAAE;YACf,MAAM;YACN,aAAa,EAAE;gBACb,WAAW,EAAE,IAAI;gBACjB,UAAU,EAAE,QAAQ;gBACpB,OAAO,EAAE,iBAAiB;aAC3B;SACF;QACD,KAAK,EAAE;YACL,4CAA4C,EAAE,OAAO;YACrD,0CAA0C,EAAE,OAAO;SACpD;KACF;CACF,CAAC","sourcesContent":["/**\n * DO NOT EDIT\n * This file is generated\n */\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nexport default (\n plugin: TSESLint.FlatConfig.Plugin,\n parser: TSESLint.FlatConfig.Parser\n): TSESLint.FlatConfig.ConfigArray => [\n {\n name: 'ngrx/base',\n languageOptions: {\n parser,\n sourceType: 'module',\n },\n plugins: {\n '@ngrx': plugin,\n },\n },\n {\n name: 'ngrx/signals',\n languageOptions: {\n parser,\n parserOptions: {\n ecmaVersion: 2020,\n sourceType: 'module',\n project: './tsconfig.json',\n },\n },\n rules: {\n '@ngrx/signal-state-no-arrays-at-root-level': 'error',\n '@ngrx/with-state-no-arrays-at-root-level': 'error',\n },\n },\n];\n"]}
1
+ {"version":3,"file":"signals.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/configs/signals.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAIH,kBAAe,CACb,MAAkC,EAClC,MAAkC,EACD,EAAE,CAAC;IACpC;QACE,IAAI,EAAE,WAAW;QACjB,eAAe,EAAE;YACf,MAAM;YACN,UAAU,EAAE,QAAQ;SACrB;QACD,OAAO,EAAE;YACP,OAAO,EAAE,MAAM;SAChB;KACF;IACD;QACE,IAAI,EAAE,cAAc;QACpB,eAAe,EAAE;YACf,MAAM;YACN,aAAa,EAAE;gBACb,WAAW,EAAE,IAAI;gBACjB,UAAU,EAAE,QAAQ;gBACpB,OAAO,EAAE,iBAAiB;aAC3B;SACF;QACD,KAAK,EAAE;YACL,4CAA4C,EAAE,OAAO;YACrD,oDAAoD,EAAE,OAAO;YAC7D,0CAA0C,EAAE,OAAO;SACpD;KACF;CACF,CAAC","sourcesContent":["/**\n * DO NOT EDIT\n * This file is generated\n */\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nexport default (\n plugin: TSESLint.FlatConfig.Plugin,\n parser: TSESLint.FlatConfig.Parser\n): TSESLint.FlatConfig.ConfigArray => [\n {\n name: 'ngrx/base',\n languageOptions: {\n parser,\n sourceType: 'module',\n },\n plugins: {\n '@ngrx': plugin,\n },\n },\n {\n name: 'ngrx/signals',\n languageOptions: {\n parser,\n parserOptions: {\n ecmaVersion: 2020,\n sourceType: 'module',\n project: './tsconfig.json',\n },\n },\n rules: {\n '@ngrx/signal-state-no-arrays-at-root-level': 'error',\n '@ngrx/signal-store-feature-should-use-generic-type': 'error',\n '@ngrx/with-state-no-arrays-at-root-level': 'error',\n },\n },\n];\n"]}
@@ -3,6 +3,7 @@
3
3
  "plugins": ["@ngrx"],
4
4
  "rules": {
5
5
  "@ngrx/signal-state-no-arrays-at-root-level": "error",
6
+ "@ngrx/signal-store-feature-should-use-generic-type": "error",
6
7
  "@ngrx/with-state-no-arrays-at-root-level": "error"
7
8
  },
8
9
  "parserOptions": {
package/src/index.d.ts CHANGED
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  "@ngrx/use-effects-lifecycle-interface": string;
17
17
  "@ngrx/prefer-concat-latest-from": string;
18
18
  "@ngrx/signal-state-no-arrays-at-root-level": string;
19
+ "@ngrx/signal-store-feature-should-use-generic-type": string;
19
20
  "@ngrx/with-state-no-arrays-at-root-level": string;
20
21
  "@ngrx/avoid-combining-selectors": string;
21
22
  "@ngrx/avoid-dispatching-multiple-actions-sequentially": string;
@@ -105,6 +106,7 @@ declare const _default: {
105
106
  plugins: string[];
106
107
  rules: {
107
108
  "@ngrx/signal-state-no-arrays-at-root-level": string;
109
+ "@ngrx/signal-store-feature-should-use-generic-type": string;
108
110
  "@ngrx/with-state-no-arrays-at-root-level": string;
109
111
  };
110
112
  parserOptions: {
@@ -147,6 +149,7 @@ declare const _default: {
147
149
  readonly strict: boolean;
148
150
  }], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
149
151
  'signal-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStateNoArraysAtRootLevel", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
152
+ 'signal-store-feature-should-use-generic-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStoreFeatureShouldUseGenericType", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
150
153
  'with-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"withStateNoArraysAtRootLevel", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
151
154
  };
152
155
  };
@@ -61,7 +61,7 @@ exports.default = (0, rule_creator_1.createRule)({
61
61
  });
62
62
  }
63
63
  else if (type.isUnion() &&
64
- type.types.some((ut) => !typeChecker.isArrayType(ut))) {
64
+ type.types.some((ut) => typeChecker.isArrayType(ut))) {
65
65
  context.report({
66
66
  node: nodeToReport,
67
67
  messageId: exports.messageId,
@@ -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,UAAU,EAAE,SAAS;QACrB,IAAI,EAAE;YACJ,WAAW,EAAE,8CAA8C;YAC3D,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,c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,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 ngrxModule: 'effects',\n docs: {\n description: '`Effect` should not return multiple actions.',\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
+ {"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,UAAU,EAAE,SAAS;QACrB,IAAI,EAAE;YACJ,WAAW,EAAE,8CAA8C;YAC3D,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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ils,\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 ngrxModule: 'effects',\n docs: {\n description: '`Effect` should not return multiple actions.',\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"]}
@@ -31,5 +31,6 @@ export declare const rules: {
31
31
  readonly strict: boolean;
32
32
  }], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
33
33
  'signal-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStateNoArraysAtRootLevel", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
34
+ 'signal-store-feature-should-use-generic-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStoreFeatureShouldUseGenericType", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
34
35
  'with-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"withStateNoArraysAtRootLevel", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
35
36
  };
@@ -37,7 +37,9 @@ const select_style_1 = __importDefault(require("./store/select-style"));
37
37
  const use_consistent_global_store_name_1 = __importDefault(require("./store/use-consistent-global-store-name"));
38
38
  // operators
39
39
  const prefer_concat_latest_from_1 = __importDefault(require("./operators/prefer-concat-latest-from"));
40
+ // signals
40
41
  const signal_state_no_arrays_at_root_level_1 = __importDefault(require("./signals/signal-state-no-arrays-at-root-level"));
42
+ const signal_store_feature_should_use_generic_type_1 = __importDefault(require("./signals/signal-store-feature-should-use-generic-type"));
41
43
  const with_state_no_arrays_at_root_level_1 = __importDefault(require("./signals/with-state-no-arrays-at-root-level"));
42
44
  exports.rules = {
43
45
  // component-store
@@ -75,6 +77,7 @@ exports.rules = {
75
77
  'prefer-concat-latest-from': prefer_concat_latest_from_1.default,
76
78
  // signals
77
79
  'signal-state-no-arrays-at-root-level': signal_state_no_arrays_at_root_level_1.default,
80
+ 'signal-store-feature-should-use-generic-type': signal_store_feature_should_use_generic_type_1.default,
78
81
  'with-state-no-arrays-at-root-level': with_state_no_arrays_at_root_level_1.default,
79
82
  };
80
83
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/rules/index.ts"],"names":[],"mappings":";;;;;;AAAA,kBAAkB;AAClB,4IAAgH;AAChH,wIAA4G;AAC5G,kHAAuF;AACvF,UAAU;AACV,0FAAgE;AAChE,8FAAmE;AACnE,gGAAqE;AACrE,8GAAkF;AAClF,kHAAqF;AACrF,oIAAuG;AACvG,gHAAqF;AACrF,QAAQ;AACR,kGAAwE;AACxE,8IAAkH;AAClH,oHAAwF;AACxF,8FAAoE;AACpE,sFAA4D;AAC5D,kGAAuE;AACvE,8FAAkE;AAClE,0FAAgE;AAChE,0FAA+D;AAC/D,gHAAoF;AACpF,0FAAgE;AAChE,kHAAsF;AACtF,oGAAyE;AACzE,kJAAmH;AACnH,kGAAuE;AACvE,wGAA6E;AAC7E,wEAA+C;AAC/C,gHAAoF;AACpF,YAAY;AACZ,sGAA2E;AAC3E,0HAA4F;AAC5F,sHAAwF;AAE3E,QAAA,KAAK,GAAG;IACnB,kBAAkB;IAClB,2CAA2C,EACzC,mDAAqC;IACvC,yCAAyC,EACvC,iDAAmC;IACrC,8BAA8B,EAAE,sCAAyB;IACzD,SAAS;IACT,sBAAsB,EAAE,8BAAkB;IAC1C,wBAAwB,EAAE,gCAAmB;IAC7C,yBAAyB,EAAE,iCAAoB;IAC/C,gCAAgC,EAAE,wCAA0B;IAC5D,kCAAkC,EAAE,0CAA2B;IAC/D,2CAA2C,EACzC,mDAAoC;IACtC,iCAAiC,EAAE,yCAA4B;IAC/D,QAAQ;IACR,2BAA2B,EAAE,mCAAuB;IACpD,iDAAiD,EAC/C,yDAA2C;IAC7C,oCAAoC,EAAE,4CAA8B;IACpE,yBAAyB,EAAE,iCAAqB;IAChD,qBAAqB,EAAE,6BAAiB;IACxC,2BAA2B,EAAE,mCAAsB;IACnD,yBAAyB,EAAE,iCAAmB;IAC9C,uBAAuB,EAAE,+BAAmB;IAC5C,uBAAuB,EAAE,+BAAkB;IAC3C,kCAAkC,EAAE,0CAA4B;IAChE,uBAAuB,EAAE,+BAAmB;IAC5C,mCAAmC,EAAE,2CAA6B;IAClE,4BAA4B,EAAE,oCAAuB;IACrD,mDAAmD,EACjD,2DAA0C;IAC5C,2BAA2B,EAAE,mCAAsB;IACnD,8BAA8B,EAAE,sCAAyB;IACzD,cAAc,EAAE,sBAAW;IAC3B,kCAAkC,EAAE,0CAA4B;IAChE,YAAY;IACZ,2BAA2B,EAAE,mCAAsB;IACnD,UAAU;IACV,sCAAsC,EAAE,8CAA8B;IACtE,oCAAoC,EAAE,4CAA4B;CACnE,CAAC","sourcesContent":["// component-store\nimport avoidCombiningComponentStoreSelectors from './component-store/avoid-combining-component-store-selectors';\nimport avoidMappingComponentStoreSelectors from './component-store/avoid-mapping-component-store-selectors';\nimport updaterExplicitReturnType from './component-store/updater-explicit-return-type';\n// effects\nimport avoidCyclicEffects from './effects/avoid-cyclic-effects';\nimport noDispatchInEffects from './effects/no-dispatch-in-effects';\nimport noEffectsInProviders from './effects/no-effects-in-providers';\nimport noMultipleActionsInEffects from './effects/no-multiple-actions-in-effects';\nimport preferActionCreatorInOfType from './effects/prefer-action-creator-in-of-type';\nimport preferEffectCallbackInBlockStatement from './effects/prefer-effect-callback-in-block-statement';\nimport useEffectsLifecycleInterface from './effects/use-effects-lifecycle-interface';\n// store\nimport avoidCombiningSelectors from './store/avoid-combining-selectors';\nimport avoidDispatchingMultipleActionsSequentially from './store/avoid-dispatching-multiple-actions-sequentially';\nimport avoidDuplicateActionsInReducer from './store/avoid-duplicate-actions-in-reducer';\nimport avoidMappingSelectors from './store/avoid-mapping-selectors';\nimport goodActionHygiene from './store/good-action-hygiene';\nimport noMultipleGlobalStores from './store/no-multiple-global-stores';\nimport noReducerInKeyNames from './store/no-reducer-in-key-names';\nimport noStoreSubscription from './store/no-store-subscription';\nimport noTypedGlobalStore from './store/no-typed-global-store';\nimport onFunctionExplicitReturnType from './store/on-function-explicit-return-type';\nimport preferActionCreator from './store/prefer-action-creator';\nimport preferActionCreatorInDispatch from './store/prefer-action-creator-in-dispatch';\nimport preferInlineActionProps from './store/prefer-inline-action-props';\nimport preferOneGenericInCreateForFeatureSelector from './store/prefer-one-generic-in-create-for-feature-selector';\nimport preferSelectorInSelect from './store/prefer-selector-in-select';\nimport prefixSelectorsWithSelect from './store/prefix-selectors-with-select';\nimport selectStyle from './store/select-style';\nimport useConsistentGlobalStoreName from './store/use-consistent-global-store-name';\n// operators\nimport preferConcatLatestFrom from './operators/prefer-concat-latest-from';\nimport signalStateNoArraysAtRootLevel from './signals/signal-state-no-arrays-at-root-level';\nimport withStateNoArraysAtRootLevel from './signals/with-state-no-arrays-at-root-level';\n\nexport const rules = {\n // component-store\n 'avoid-combining-component-store-selectors':\n avoidCombiningComponentStoreSelectors,\n 'avoid-mapping-component-store-selectors':\n avoidMappingComponentStoreSelectors,\n 'updater-explicit-return-type': updaterExplicitReturnType,\n //effects\n 'avoid-cyclic-effects': avoidCyclicEffects,\n 'no-dispatch-in-effects': noDispatchInEffects,\n 'no-effects-in-providers': noEffectsInProviders,\n 'no-multiple-actions-in-effects': noMultipleActionsInEffects,\n 'prefer-action-creator-in-of-type': preferActionCreatorInOfType,\n 'prefer-effect-callback-in-block-statement':\n preferEffectCallbackInBlockStatement,\n 'use-effects-lifecycle-interface': useEffectsLifecycleInterface,\n // store\n 'avoid-combining-selectors': avoidCombiningSelectors,\n 'avoid-dispatching-multiple-actions-sequentially':\n avoidDispatchingMultipleActionsSequentially,\n 'avoid-duplicate-actions-in-reducer': avoidDuplicateActionsInReducer,\n 'avoid-mapping-selectors': avoidMappingSelectors,\n 'good-action-hygiene': goodActionHygiene,\n 'no-multiple-global-stores': noMultipleGlobalStores,\n 'no-reducer-in-key-names': noReducerInKeyNames,\n 'no-store-subscription': noStoreSubscription,\n 'no-typed-global-store': noTypedGlobalStore,\n 'on-function-explicit-return-type': onFunctionExplicitReturnType,\n 'prefer-action-creator': preferActionCreator,\n 'prefer-action-creator-in-dispatch': preferActionCreatorInDispatch,\n 'prefer-inline-action-props': preferInlineActionProps,\n 'prefer-one-generic-in-create-for-feature-selector':\n preferOneGenericInCreateForFeatureSelector,\n 'prefer-selector-in-select': preferSelectorInSelect,\n 'prefix-selectors-with-select': prefixSelectorsWithSelect,\n 'select-style': selectStyle,\n 'use-consistent-global-store-name': useConsistentGlobalStoreName,\n // operators\n 'prefer-concat-latest-from': preferConcatLatestFrom,\n // signals\n 'signal-state-no-arrays-at-root-level': signalStateNoArraysAtRootLevel,\n 'with-state-no-arrays-at-root-level': withStateNoArraysAtRootLevel,\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/rules/index.ts"],"names":[],"mappings":";;;;;;AAAA,kBAAkB;AAClB,4IAAgH;AAChH,wIAA4G;AAC5G,kHAAuF;AACvF,UAAU;AACV,0FAAgE;AAChE,8FAAmE;AACnE,gGAAqE;AACrE,8GAAkF;AAClF,kHAAqF;AACrF,oIAAuG;AACvG,gHAAqF;AACrF,QAAQ;AACR,kGAAwE;AACxE,8IAAkH;AAClH,oHAAwF;AACxF,8FAAoE;AACpE,sFAA4D;AAC5D,kGAAuE;AACvE,8FAAkE;AAClE,0FAAgE;AAChE,0FAA+D;AAC/D,gHAAoF;AACpF,0FAAgE;AAChE,kHAAsF;AACtF,oGAAyE;AACzE,kJAAmH;AACnH,kGAAuE;AACvE,wGAA6E;AAC7E,wEAA+C;AAC/C,gHAAoF;AACpF,YAAY;AACZ,sGAA2E;AAC3E,UAAU;AACV,0HAA4F;AAC5F,0IAA4G;AAC5G,sHAAwF;AAE3E,QAAA,KAAK,GAAG;IACnB,kBAAkB;IAClB,2CAA2C,EACzC,mDAAqC;IACvC,yCAAyC,EACvC,iDAAmC;IACrC,8BAA8B,EAAE,sCAAyB;IACzD,SAAS;IACT,sBAAsB,EAAE,8BAAkB;IAC1C,wBAAwB,EAAE,gCAAmB;IAC7C,yBAAyB,EAAE,iCAAoB;IAC/C,gCAAgC,EAAE,wCAA0B;IAC5D,kCAAkC,EAAE,0CAA2B;IAC/D,2CAA2C,EACzC,mDAAoC;IACtC,iCAAiC,EAAE,yCAA4B;IAC/D,QAAQ;IACR,2BAA2B,EAAE,mCAAuB;IACpD,iDAAiD,EAC/C,yDAA2C;IAC7C,oCAAoC,EAAE,4CAA8B;IACpE,yBAAyB,EAAE,iCAAqB;IAChD,qBAAqB,EAAE,6BAAiB;IACxC,2BAA2B,EAAE,mCAAsB;IACnD,yBAAyB,EAAE,iCAAmB;IAC9C,uBAAuB,EAAE,+BAAmB;IAC5C,uBAAuB,EAAE,+BAAkB;IAC3C,kCAAkC,EAAE,0CAA4B;IAChE,uBAAuB,EAAE,+BAAmB;IAC5C,mCAAmC,EAAE,2CAA6B;IAClE,4BAA4B,EAAE,oCAAuB;IACrD,mDAAmD,EACjD,2DAA0C;IAC5C,2BAA2B,EAAE,mCAAsB;IACnD,8BAA8B,EAAE,sCAAyB;IACzD,cAAc,EAAE,sBAAW;IAC3B,kCAAkC,EAAE,0CAA4B;IAChE,YAAY;IACZ,2BAA2B,EAAE,mCAAsB;IACnD,UAAU;IACV,sCAAsC,EAAE,8CAA8B;IACtE,8CAA8C,EAC5C,sDAAsC;IACxC,oCAAoC,EAAE,4CAA4B;CACnE,CAAC","sourcesContent":["// component-store\nimport avoidCombiningComponentStoreSelectors from './component-store/avoid-combining-component-store-selectors';\nimport avoidMappingComponentStoreSelectors from './component-store/avoid-mapping-component-store-selectors';\nimport updaterExplicitReturnType from './component-store/updater-explicit-return-type';\n// effects\nimport avoidCyclicEffects from './effects/avoid-cyclic-effects';\nimport noDispatchInEffects from './effects/no-dispatch-in-effects';\nimport noEffectsInProviders from './effects/no-effects-in-providers';\nimport noMultipleActionsInEffects from './effects/no-multiple-actions-in-effects';\nimport preferActionCreatorInOfType from './effects/prefer-action-creator-in-of-type';\nimport preferEffectCallbackInBlockStatement from './effects/prefer-effect-callback-in-block-statement';\nimport useEffectsLifecycleInterface from './effects/use-effects-lifecycle-interface';\n// store\nimport avoidCombiningSelectors from './store/avoid-combining-selectors';\nimport avoidDispatchingMultipleActionsSequentially from './store/avoid-dispatching-multiple-actions-sequentially';\nimport avoidDuplicateActionsInReducer from './store/avoid-duplicate-actions-in-reducer';\nimport avoidMappingSelectors from './store/avoid-mapping-selectors';\nimport goodActionHygiene from './store/good-action-hygiene';\nimport noMultipleGlobalStores from './store/no-multiple-global-stores';\nimport noReducerInKeyNames from './store/no-reducer-in-key-names';\nimport noStoreSubscription from './store/no-store-subscription';\nimport noTypedGlobalStore from './store/no-typed-global-store';\nimport onFunctionExplicitReturnType from './store/on-function-explicit-return-type';\nimport preferActionCreator from './store/prefer-action-creator';\nimport preferActionCreatorInDispatch from './store/prefer-action-creator-in-dispatch';\nimport preferInlineActionProps from './store/prefer-inline-action-props';\nimport preferOneGenericInCreateForFeatureSelector from './store/prefer-one-generic-in-create-for-feature-selector';\nimport preferSelectorInSelect from './store/prefer-selector-in-select';\nimport prefixSelectorsWithSelect from './store/prefix-selectors-with-select';\nimport selectStyle from './store/select-style';\nimport useConsistentGlobalStoreName from './store/use-consistent-global-store-name';\n// operators\nimport preferConcatLatestFrom from './operators/prefer-concat-latest-from';\n// signals\nimport signalStateNoArraysAtRootLevel from './signals/signal-state-no-arrays-at-root-level';\nimport signalStoreFeatureShouldUseGenericType from './signals/signal-store-feature-should-use-generic-type';\nimport withStateNoArraysAtRootLevel from './signals/with-state-no-arrays-at-root-level';\n\nexport const rules = {\n // component-store\n 'avoid-combining-component-store-selectors':\n avoidCombiningComponentStoreSelectors,\n 'avoid-mapping-component-store-selectors':\n avoidMappingComponentStoreSelectors,\n 'updater-explicit-return-type': updaterExplicitReturnType,\n //effects\n 'avoid-cyclic-effects': avoidCyclicEffects,\n 'no-dispatch-in-effects': noDispatchInEffects,\n 'no-effects-in-providers': noEffectsInProviders,\n 'no-multiple-actions-in-effects': noMultipleActionsInEffects,\n 'prefer-action-creator-in-of-type': preferActionCreatorInOfType,\n 'prefer-effect-callback-in-block-statement':\n preferEffectCallbackInBlockStatement,\n 'use-effects-lifecycle-interface': useEffectsLifecycleInterface,\n // store\n 'avoid-combining-selectors': avoidCombiningSelectors,\n 'avoid-dispatching-multiple-actions-sequentially':\n avoidDispatchingMultipleActionsSequentially,\n 'avoid-duplicate-actions-in-reducer': avoidDuplicateActionsInReducer,\n 'avoid-mapping-selectors': avoidMappingSelectors,\n 'good-action-hygiene': goodActionHygiene,\n 'no-multiple-global-stores': noMultipleGlobalStores,\n 'no-reducer-in-key-names': noReducerInKeyNames,\n 'no-store-subscription': noStoreSubscription,\n 'no-typed-global-store': noTypedGlobalStore,\n 'on-function-explicit-return-type': onFunctionExplicitReturnType,\n 'prefer-action-creator': preferActionCreator,\n 'prefer-action-creator-in-dispatch': preferActionCreatorInDispatch,\n 'prefer-inline-action-props': preferInlineActionProps,\n 'prefer-one-generic-in-create-for-feature-selector':\n preferOneGenericInCreateForFeatureSelector,\n 'prefer-selector-in-select': preferSelectorInSelect,\n 'prefix-selectors-with-select': prefixSelectorsWithSelect,\n 'select-style': selectStyle,\n 'use-consistent-global-store-name': useConsistentGlobalStoreName,\n // operators\n 'prefer-concat-latest-from': preferConcatLatestFrom,\n // signals\n 'signal-state-no-arrays-at-root-level': signalStateNoArraysAtRootLevel,\n 'signal-store-feature-should-use-generic-type':\n signalStoreFeatureShouldUseGenericType,\n 'with-state-no-arrays-at-root-level': withStateNoArraysAtRootLevel,\n};\n"]}
@@ -0,0 +1,4 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+ export declare const messageId = "signalStoreFeatureShouldUseGenericType";
3
+ declare const _default: ESLintUtils.RuleModule<"signalStoreFeatureShouldUseGenericType", readonly [], unknown, ESLintUtils.RuleListener>;
4
+ export default _default;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.messageId = void 0;
27
+ const path = __importStar(require("path"));
28
+ const rule_creator_1 = require("../../rule-creator");
29
+ const utils_1 = require("../../utils");
30
+ exports.messageId = 'signalStoreFeatureShouldUseGenericType';
31
+ exports.default = (0, rule_creator_1.createRule)({
32
+ name: path.parse(__filename).name,
33
+ meta: {
34
+ type: 'problem',
35
+ ngrxModule: 'signals',
36
+ docs: {
37
+ description: `A custom Signal Store feature that accepts an input should define a generic type.`,
38
+ },
39
+ fixable: 'code',
40
+ schema: [],
41
+ messages: {
42
+ [exports.messageId]: `Add an unused generic type to the function creating the signal store feature.`,
43
+ },
44
+ },
45
+ defaultOptions: [],
46
+ create: (context) => {
47
+ function report(signalStoreFeature, func) {
48
+ if (!func ||
49
+ (!(0, utils_1.isFunctionDeclaration)(func) && !(0, utils_1.isArrowFunctionExpression)(func))) {
50
+ return;
51
+ }
52
+ const parentHasGenerics = func.typeParameters && func.typeParameters.params.length > 0;
53
+ if (!parentHasGenerics) {
54
+ context.report({
55
+ node: signalStoreFeature.callee,
56
+ messageId: exports.messageId,
57
+ fix(fixer) {
58
+ if ((0, utils_1.isFunctionDeclaration)(func)) {
59
+ if (func.id) {
60
+ return fixer.insertTextAfter(func.id, '<_>');
61
+ }
62
+ }
63
+ return fixer.insertTextBefore(func, '<_>');
64
+ },
65
+ });
66
+ }
67
+ }
68
+ function hasInputAsArgument(node) {
69
+ const [inputArg] = node.arguments;
70
+ return (!(0, utils_1.isCallExpression)(inputArg) ||
71
+ ((0, utils_1.isIdentifier)(inputArg.callee) && inputArg.callee.name === 'type'));
72
+ }
73
+ return {
74
+ [`ArrowFunctionExpression > CallExpression[callee.name=signalStoreFeature]`](node) {
75
+ if (hasInputAsArgument(node)) {
76
+ report(node, node.parent);
77
+ }
78
+ },
79
+ [`ArrowFunctionExpression > BlockStatement CallExpression[callee.name=signalStoreFeature]`](node) {
80
+ if (hasInputAsArgument(node)) {
81
+ let parent = node.parent;
82
+ while (parent && !(0, utils_1.isArrowFunctionExpression)(parent)) {
83
+ parent = parent.parent;
84
+ }
85
+ report(node, parent);
86
+ }
87
+ },
88
+ [`FunctionDeclaration > BlockStatement CallExpression[callee.name=signalStoreFeature]`](node) {
89
+ if (hasInputAsArgument(node)) {
90
+ let parent = node.parent;
91
+ while (parent && !(0, utils_1.isFunctionDeclaration)(parent)) {
92
+ parent = parent.parent;
93
+ }
94
+ report(node, parent);
95
+ }
96
+ },
97
+ };
98
+ },
99
+ });
100
+ //# sourceMappingURL=signal-store-feature-should-use-generic-type.js.map
@@ -0,0 +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;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gBAC3B,CAAC,IAAA,oBAAY,EAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CACnE,CAAC;QACJ,CAAC;QAED,OAAO;YACL,CAAC,0EAA0E,CAAC,CAC1E,IAA6B;gBAE7B,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC7B,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;YACD,CAAC,yFAAyF,CAAC,CACzF,IAA6B;gBAE7B,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC7B,IAAI,MAAM,GAA8B,IAAI,CAAC,MAAM,CAAC;oBACpD,OAAO,MAAM,IAAI,CAAC,IAAA,iCAAyB,EAAC,MAAM,CAAC,EAAE,CAAC;wBACpD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;oBACzB,CAAC;oBACD,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;gBACvB,CAAC;YACH,CAAC;YACD,CAAC,qFAAqF,CAAC,CACrF,IAA6B;gBAE7B,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC7B,IAAI,MAAM,GAA8B,IAAI,CAAC,MAAM,CAAC;oBACpD,OAAO,MAAM,IAAI,CAAC,IAAA,6BAAqB,EAAC,MAAM,CAAC,EAAE,CAAC;wBAChD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;oBACzB,CAAC;oBACD,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;gBACvB,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 {\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 ngrxModule: 'signals',\n docs: {\n description: `A custom Signal Store feature that accepts an input should define a generic type.`,\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"]}
@@ -27,6 +27,11 @@ export declare const isPropertyDefinition: (node: TSESTree.Node) => node is (TSE
27
27
  export declare const isFunctionExpression: (node: TSESTree.Node) => node is TSESTree.FunctionExpression & {
28
28
  type: TSESTree.AST_NODE_TYPES.FunctionExpression;
29
29
  };
30
+ export declare const isFunctionDeclaration: (node: TSESTree.Node) => node is (TSESTree.FunctionDeclarationWithName & {
31
+ type: TSESTree.AST_NODE_TYPES.FunctionDeclaration;
32
+ }) | (TSESTree.FunctionDeclarationWithOptionalName & {
33
+ type: TSESTree.AST_NODE_TYPES.FunctionDeclaration;
34
+ });
30
35
  export declare const isIdentifier: (node: TSESTree.Node) => node is TSESTree.Identifier & {
31
36
  type: TSESTree.AST_NODE_TYPES.Identifier;
32
37
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isCallExpressionWith = exports.isTypeReference = exports.isIdentifierOrMemberExpression = exports.isBlockStatement = exports.isArrayExpression = exports.isProperty = exports.isTSInstantiationExpression = exports.isTSTypeReference = exports.isTSTypeAnnotation = exports.isTSParameterProperty = exports.isThisExpression = exports.isProgram = exports.isMemberExpression = exports.isTemplateLiteral = exports.isTemplateElement = exports.isLiteral = exports.isImportSpecifier = exports.isImportNamespaceSpecifier = exports.isImportDefaultSpecifier = exports.isImportDeclaration = exports.isIdentifier = exports.isFunctionExpression = exports.isPropertyDefinition = exports.isClassDeclaration = exports.isCallExpression = exports.isMethodDefinition = exports.isReturnStatement = exports.isArrowFunctionExpression = void 0;
3
+ exports.isCallExpressionWith = exports.isTypeReference = exports.isIdentifierOrMemberExpression = exports.isBlockStatement = exports.isArrayExpression = exports.isProperty = exports.isTSInstantiationExpression = exports.isTSTypeReference = exports.isTSTypeAnnotation = exports.isTSParameterProperty = exports.isThisExpression = exports.isProgram = exports.isMemberExpression = exports.isTemplateLiteral = exports.isTemplateElement = exports.isLiteral = exports.isImportSpecifier = exports.isImportNamespaceSpecifier = exports.isImportDefaultSpecifier = exports.isImportDeclaration = exports.isIdentifier = exports.isFunctionDeclaration = exports.isFunctionExpression = exports.isPropertyDefinition = exports.isClassDeclaration = exports.isCallExpression = exports.isMethodDefinition = exports.isReturnStatement = exports.isArrowFunctionExpression = void 0;
4
4
  const utils_1 = require("@typescript-eslint/utils");
5
5
  const isNodeOfType = (nodeType) => (node) => node.type === nodeType;
6
6
  exports.isArrowFunctionExpression = isNodeOfType(utils_1.AST_NODE_TYPES.ArrowFunctionExpression);
@@ -10,6 +10,7 @@ exports.isCallExpression = isNodeOfType(utils_1.AST_NODE_TYPES.CallExpression);
10
10
  exports.isClassDeclaration = isNodeOfType(utils_1.AST_NODE_TYPES.ClassDeclaration);
11
11
  exports.isPropertyDefinition = isNodeOfType(utils_1.AST_NODE_TYPES.PropertyDefinition);
12
12
  exports.isFunctionExpression = isNodeOfType(utils_1.AST_NODE_TYPES.FunctionExpression);
13
+ exports.isFunctionDeclaration = isNodeOfType(utils_1.AST_NODE_TYPES.FunctionDeclaration);
13
14
  exports.isIdentifier = isNodeOfType(utils_1.AST_NODE_TYPES.Identifier);
14
15
  exports.isImportDeclaration = isNodeOfType(utils_1.AST_NODE_TYPES.ImportDeclaration);
15
16
  exports.isImportDefaultSpecifier = isNodeOfType(utils_1.AST_NODE_TYPES.ImportDefaultSpecifier);
@@ -1 +1 @@
1
- {"version":3,"file":"guards.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/guards.ts"],"names":[],"mappings":";;;AACA,oDAA0D;AAG1D,MAAM,YAAY,GAChB,CAAkC,QAAkB,EAAE,EAAE,CACxD,CAAC,IAAmB,EAA8C,EAAE,CAClE,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;AAEd,QAAA,yBAAyB,GAAG,YAAY,CACnD,sBAAc,CAAC,uBAAuB,CACvC,CAAC;AACW,QAAA,iBAAiB,GAAG,YAAY,CAAC,sBAAc,CAAC,eA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I,CAAC,CAAC;YAC7C,CAAC,IAAA,0BAAkB,EAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;gBACrC,IAAA,wBAAgB,EAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;gBAC3C,IAAA,oBAAY,EAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;gBACzC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAC5D,CAAC;AACJ,CAAC;AAhBD,oDAgBC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport { AST_NODE_TYPES } from '@typescript-eslint/utils';\nimport type * as ts from 'typescript';\n\nconst isNodeOfType =\n <NodeType extends AST_NODE_TYPES>(nodeType: NodeType) =>\n (node: TSESTree.Node): node is TSESTree.Node & { type: NodeType } =>\n node.type === nodeType;\n\nexport const isArrowFunctionExpression = isNodeOfType(\n AST_NODE_TYPES.ArrowFunctionExpression\n);\nexport const isReturnStatement = isNodeOfType(AST_NODE_TYPES.ReturnStatement);\nexport const isMethodDefinition = isNodeOfType(AST_NODE_TYPES.MethodDefinition);\nexport const isCallExpression = isNodeOfType(AST_NODE_TYPES.CallExpression);\nexport const isClassDeclaration = isNodeOfType(AST_NODE_TYPES.ClassDeclaration);\nexport const isPropertyDefinition = isNodeOfType(\n AST_NODE_TYPES.PropertyDefinition\n);\nexport const isFunctionExpression = isNodeOfType(\n AST_NODE_TYPES.FunctionExpression\n);\nexport const isIdentifier = isNodeOfType(AST_NODE_TYPES.Identifier);\nexport const isImportDeclaration = isNodeOfType(\n AST_NODE_TYPES.ImportDeclaration\n);\nexport const isImportDefaultSpecifier = isNodeOfType(\n AST_NODE_TYPES.ImportDefaultSpecifier\n);\nexport const isImportNamespaceSpecifier = isNodeOfType(\n AST_NODE_TYPES.ImportNamespaceSpecifier\n);\nexport const isImportSpecifier = isNodeOfType(AST_NODE_TYPES.ImportSpecifier);\nexport const isLiteral = isNodeOfType(AST_NODE_TYPES.Literal);\nexport const isTemplateElement = isNodeOfType(AST_NODE_TYPES.TemplateElement);\nexport const isTemplateLiteral = isNodeOfType(AST_NODE_TYPES.TemplateLiteral);\nexport const isMemberExpression = isNodeOfType(AST_NODE_TYPES.MemberExpression);\nexport const isProgram = isNodeOfType(AST_NODE_TYPES.Program);\nexport const isThisExpression = isNodeOfType(AST_NODE_TYPES.ThisExpression);\nexport const isTSParameterProperty = isNodeOfType(\n AST_NODE_TYPES.TSParameterProperty\n);\nexport const isTSTypeAnnotation = isNodeOfType(AST_NODE_TYPES.TSTypeAnnotation);\nexport const isTSTypeReference = isNodeOfType(AST_NODE_TYPES.TSTypeReference);\nexport const isTSInstantiationExpression = isNodeOfType(\n AST_NODE_TYPES.TSInstantiationExpression\n);\nexport const isProperty = isNodeOfType(AST_NODE_TYPES.Property);\nexport const isArrayExpression = isNodeOfType(AST_NODE_TYPES.ArrayExpression);\nexport const isBlockStatement = isNodeOfType(AST_NODE_TYPES.BlockStatement);\nexport function isIdentifierOrMemberExpression(\n node: TSESTree.Node\n): node is TSESTree.Identifier | TSESTree.MemberExpression {\n return isIdentifier(node) || isMemberExpression(node);\n}\n\nexport function isTypeReference(type: ts.Type): type is ts.TypeReference {\n return type.hasOwnProperty('target');\n}\n\nfunction equalTo(one: RegExp | string, other: string) {\n return typeof one === 'string' ? one === other : one.test(other);\n}\n\nexport function isCallExpressionWith(\n node: TSESTree.CallExpression,\n objectName: RegExp | string,\n propertyName: string\n) {\n return (\n isMemberExpression(node.callee) &&\n !node.callee.computed &&\n node.callee.property.name === propertyName &&\n ((isIdentifier(node.callee.object) &&\n equalTo(objectName, node.callee.object.name)) ||\n (isMemberExpression(node.callee.object) &&\n isThisExpression(node.callee.object.object) &&\n isIdentifier(node.callee.object.property) &&\n equalTo(objectName, node.callee.object.property.name)))\n );\n}\n"]}
1
+ {"version":3,"file":"guards.js","sourceRoot":"","sources":["../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,CAAC;AACnE,CAAC;AAED,SAAgB,oBAAoB,CAClC,IAA6B,EAC7B,UAA2B,EAC3B,YAAoB;IAEpB,OAAO,CACL,IAAA,0BAAkB,EAAC,IAAI,CAAC,MAAM,CAAC;QAC/B,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ;QACrB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY;QAC1C,CAAC,CAAC,IAAA,oBAAY,EAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;YAChC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC7C,CAAC,IAAA,0BAAkB,EAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;gBACrC,IAAA,wBAAgB,EAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;gBAC3C,IAAA,oBAAY,EAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;gBACzC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAC5D,CAAC;AACJ,CAAC;AAhBD,oDAgBC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport { AST_NODE_TYPES } from '@typescript-eslint/utils';\nimport type * as ts from 'typescript';\n\nconst isNodeOfType =\n <NodeType extends AST_NODE_TYPES>(nodeType: NodeType) =>\n (node: TSESTree.Node): node is TSESTree.Node & { type: NodeType } =>\n node.type === nodeType;\n\nexport const isArrowFunctionExpression = isNodeOfType(\n AST_NODE_TYPES.ArrowFunctionExpression\n);\nexport const isReturnStatement = isNodeOfType(AST_NODE_TYPES.ReturnStatement);\nexport const isMethodDefinition = isNodeOfType(AST_NODE_TYPES.MethodDefinition);\nexport const isCallExpression = isNodeOfType(AST_NODE_TYPES.CallExpression);\nexport const isClassDeclaration = isNodeOfType(AST_NODE_TYPES.ClassDeclaration);\nexport const isPropertyDefinition = isNodeOfType(\n AST_NODE_TYPES.PropertyDefinition\n);\nexport const isFunctionExpression = isNodeOfType(\n AST_NODE_TYPES.FunctionExpression\n);\nexport const isFunctionDeclaration = isNodeOfType(\n AST_NODE_TYPES.FunctionDeclaration\n);\nexport const isIdentifier = isNodeOfType(AST_NODE_TYPES.Identifier);\nexport const isImportDeclaration = isNodeOfType(\n AST_NODE_TYPES.ImportDeclaration\n);\nexport const isImportDefaultSpecifier = isNodeOfType(\n AST_NODE_TYPES.ImportDefaultSpecifier\n);\nexport const isImportNamespaceSpecifier = isNodeOfType(\n AST_NODE_TYPES.ImportNamespaceSpecifier\n);\nexport const isImportSpecifier = isNodeOfType(AST_NODE_TYPES.ImportSpecifier);\nexport const isLiteral = isNodeOfType(AST_NODE_TYPES.Literal);\nexport const isTemplateElement = isNodeOfType(AST_NODE_TYPES.TemplateElement);\nexport const isTemplateLiteral = isNodeOfType(AST_NODE_TYPES.TemplateLiteral);\nexport const isMemberExpression = isNodeOfType(AST_NODE_TYPES.MemberExpression);\nexport const isProgram = isNodeOfType(AST_NODE_TYPES.Program);\nexport const isThisExpression = isNodeOfType(AST_NODE_TYPES.ThisExpression);\nexport const isTSParameterProperty = isNodeOfType(\n AST_NODE_TYPES.TSParameterProperty\n);\nexport const isTSTypeAnnotation = isNodeOfType(AST_NODE_TYPES.TSTypeAnnotation);\nexport const isTSTypeReference = isNodeOfType(AST_NODE_TYPES.TSTypeReference);\nexport const isTSInstantiationExpression = isNodeOfType(\n AST_NODE_TYPES.TSInstantiationExpression\n);\nexport const isProperty = isNodeOfType(AST_NODE_TYPES.Property);\nexport const isArrayExpression = isNodeOfType(AST_NODE_TYPES.ArrayExpression);\nexport const isBlockStatement = isNodeOfType(AST_NODE_TYPES.BlockStatement);\nexport function isIdentifierOrMemberExpression(\n node: TSESTree.Node\n): node is TSESTree.Identifier | TSESTree.MemberExpression {\n return isIdentifier(node) || isMemberExpression(node);\n}\n\nexport function isTypeReference(type: ts.Type): type is ts.TypeReference {\n return type.hasOwnProperty('target');\n}\n\nfunction equalTo(one: RegExp | string, other: string) {\n return typeof one === 'string' ? one === other : one.test(other);\n}\n\nexport function isCallExpressionWith(\n node: TSESTree.CallExpression,\n objectName: RegExp | string,\n propertyName: string\n) {\n return (\n isMemberExpression(node.callee) &&\n !node.callee.computed &&\n node.callee.property.name === propertyName &&\n ((isIdentifier(node.callee.object) &&\n equalTo(objectName, node.callee.object.name)) ||\n (isMemberExpression(node.callee.object) &&\n isThisExpression(node.callee.object.object) &&\n isIdentifier(node.callee.object.property) &&\n equalTo(objectName, node.callee.object.property.name)))\n );\n}\n"]}