@ngrx/eslint-plugin 18.0.1 → 18.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/package.json +4 -2
  2. package/schematics/ng-add/index.js +1 -1
  3. package/schematics/ng-add/index.js.map +1 -1
  4. package/spec/utils/from-fixture.js +1 -2
  5. package/spec/utils/from-fixture.js.map +1 -1
  6. package/spec/utils/rule-tester.js +1 -2
  7. package/spec/utils/rule-tester.js.map +1 -1
  8. package/src/configs/all.js +2 -0
  9. package/src/configs/all.js.map +1 -1
  10. package/src/configs/all.json +2 -0
  11. package/src/configs/signals.js +2 -0
  12. package/src/configs/signals.js.map +1 -1
  13. package/src/configs/signals.json +2 -0
  14. package/src/index.d.ts +6 -0
  15. package/src/rule-creator.js +1 -2
  16. package/src/rule-creator.js.map +1 -1
  17. package/src/rules/effects/no-multiple-actions-in-effects.js +1 -1
  18. package/src/rules/effects/no-multiple-actions-in-effects.js.map +1 -1
  19. package/src/rules/index.d.ts +2 -0
  20. package/src/rules/index.js +5 -0
  21. package/src/rules/index.js.map +1 -1
  22. package/src/rules/signals/prefer-protected-state.d.ts +5 -0
  23. package/src/rules/signals/prefer-protected-state.js +88 -0
  24. package/src/rules/signals/prefer-protected-state.js.map +1 -0
  25. package/src/rules/signals/signal-store-feature-should-use-generic-type.d.ts +4 -0
  26. package/src/rules/signals/signal-store-feature-should-use-generic-type.js +100 -0
  27. package/src/rules/signals/signal-store-feature-should-use-generic-type.js.map +1 -0
  28. package/src/utils/helper-functions/folder.js +1 -2
  29. package/src/utils/helper-functions/folder.js.map +1 -1
  30. package/src/utils/helper-functions/guards.d.ts +34 -51
  31. package/src/utils/helper-functions/guards.js +5 -4
  32. package/src/utils/helper-functions/guards.js.map +1 -1
  33. package/src/utils/helper-functions/utils.js +19 -20
  34. package/src/utils/helper-functions/utils.js.map +1 -1
  35. package/src/utils/helper-functions/versions.js +3 -4
  36. package/src/utils/helper-functions/versions.js.map +1 -1
  37. package/src/utils/selectors/index.js +2 -2
  38. package/src/utils/selectors/index.js.map +1 -1
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.traverseFolder = void 0;
26
+ exports.traverseFolder = traverseFolder;
27
27
  const fs = __importStar(require("fs"));
28
28
  const path = __importStar(require("path"));
29
29
  function* traverseFolder(folder, extensions) {
@@ -42,5 +42,4 @@ function* traverseFolder(folder, extensions) {
42
42
  }
43
43
  }
44
44
  }
45
- exports.traverseFolder = traverseFolder;
46
45
  //# sourceMappingURL=folder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"folder.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/folder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,QAAe,CAAC,CAAC,cAAc,CAC7B,MAAc,EACd,UAAoB;IAEpB,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,KAAK,MAAM,WAAW,IAAI,OAAO,EAAE,CAAC;QAClC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QACzD,IAAI,WAAW,CAAC,WAAW,EAAE,EAAE,CAAC;YAC9B,KAAK,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC/C,CAAC;aAAM,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;YACxD,MAAM;gBACJ,MAAM;gBACN,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI;gBACvC,IAAI,EAAE,SAAS;aAChB,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAjBD,wCAiBC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n\nexport function* traverseFolder(\n folder: string,\n extensions: string[]\n): Generator<{ folder: string; file: string; path: string }> {\n const folders = fs.readdirSync(folder, { withFileTypes: true });\n for (const folderEntry of folders) {\n const entryPath = path.resolve(folder, folderEntry.name);\n if (folderEntry.isDirectory()) {\n yield* traverseFolder(entryPath, extensions);\n } else if (extensions.includes(path.extname(entryPath))) {\n yield {\n folder,\n file: path.parse(folderEntry.name).name,\n path: entryPath,\n };\n }\n }\n}\n"]}
1
+ {"version":3,"file":"folder.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/folder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wCAiBC;AApBD,uCAAyB;AACzB,2CAA6B;AAE7B,QAAe,CAAC,CAAC,cAAc,CAC7B,MAAc,EACd,UAAoB;IAEpB,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,KAAK,MAAM,WAAW,IAAI,OAAO,EAAE,CAAC;QAClC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QACzD,IAAI,WAAW,CAAC,WAAW,EAAE,EAAE,CAAC;YAC9B,KAAK,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC/C,CAAC;aAAM,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;YACxD,MAAM;gBACJ,MAAM;gBACN,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI;gBACvC,IAAI,EAAE,SAAS;aAChB,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n\nexport function* traverseFolder(\n folder: string,\n extensions: string[]\n): Generator<{ folder: string; file: string; path: string }> {\n const folders = fs.readdirSync(folder, { withFileTypes: true });\n for (const folderEntry of folders) {\n const entryPath = path.resolve(folder, folderEntry.name);\n if (folderEntry.isDirectory()) {\n yield* traverseFolder(entryPath, extensions);\n } else if (extensions.includes(path.extname(entryPath))) {\n yield {\n folder,\n file: path.parse(folderEntry.name).name,\n path: entryPath,\n };\n }\n }\n}\n"]}
@@ -1,98 +1,81 @@
1
1
  import type { TSESTree } from '@typescript-eslint/utils';
2
2
  import type * as ts from 'typescript';
3
- export declare const isArrowFunctionExpression: (node: TSESTree.Node) => node is TSESTree.ArrowFunctionExpression & {
3
+ export declare const isArrowFunctionExpression: (node: TSESTree.Node) => node is TSESTree.Node & {
4
4
  type: TSESTree.AST_NODE_TYPES.ArrowFunctionExpression;
5
5
  };
6
- export declare const isReturnStatement: (node: TSESTree.Node) => node is TSESTree.ReturnStatement & {
6
+ export declare const isReturnStatement: (node: TSESTree.Node) => node is TSESTree.Node & {
7
7
  type: TSESTree.AST_NODE_TYPES.ReturnStatement;
8
8
  };
9
- export declare const isMethodDefinition: (node: TSESTree.Node) => node is (TSESTree.MethodDefinitionComputedName & {
9
+ export declare const isMethodDefinition: (node: TSESTree.Node) => node is TSESTree.Node & {
10
10
  type: TSESTree.AST_NODE_TYPES.MethodDefinition;
11
- }) | (TSESTree.MethodDefinitionNonComputedName & {
12
- type: TSESTree.AST_NODE_TYPES.MethodDefinition;
13
- });
14
- export declare const isCallExpression: (node: TSESTree.Node) => node is TSESTree.CallExpression & {
11
+ };
12
+ export declare const isCallExpression: (node: TSESTree.Node) => node is TSESTree.Node & {
15
13
  type: TSESTree.AST_NODE_TYPES.CallExpression;
16
14
  };
17
- export declare const isClassDeclaration: (node: TSESTree.Node) => node is (TSESTree.ClassDeclarationWithName & {
18
- type: TSESTree.AST_NODE_TYPES.ClassDeclaration;
19
- }) | (TSESTree.ClassDeclarationWithOptionalName & {
15
+ export declare const isClassDeclaration: (node: TSESTree.Node) => node is TSESTree.Node & {
20
16
  type: TSESTree.AST_NODE_TYPES.ClassDeclaration;
21
- });
22
- export declare const isPropertyDefinition: (node: TSESTree.Node) => node is (TSESTree.PropertyDefinitionComputedName & {
23
- type: TSESTree.AST_NODE_TYPES.PropertyDefinition;
24
- }) | (TSESTree.PropertyDefinitionNonComputedName & {
17
+ };
18
+ export declare const isPropertyDefinition: (node: TSESTree.Node) => node is TSESTree.Node & {
25
19
  type: TSESTree.AST_NODE_TYPES.PropertyDefinition;
26
- });
27
- export declare const isFunctionExpression: (node: TSESTree.Node) => node is TSESTree.FunctionExpression & {
20
+ };
21
+ export declare const isFunctionExpression: (node: TSESTree.Node) => node is TSESTree.Node & {
28
22
  type: TSESTree.AST_NODE_TYPES.FunctionExpression;
29
23
  };
30
- export declare const isIdentifier: (node: TSESTree.Node) => node is TSESTree.Identifier & {
24
+ export declare const isFunctionDeclaration: (node: TSESTree.Node) => node is TSESTree.Node & {
25
+ type: TSESTree.AST_NODE_TYPES.FunctionDeclaration;
26
+ };
27
+ export declare const isIdentifier: (node: TSESTree.Node) => node is TSESTree.Node & {
31
28
  type: TSESTree.AST_NODE_TYPES.Identifier;
32
29
  };
33
- export declare const isImportDeclaration: (node: TSESTree.Node) => node is TSESTree.ImportDeclaration & {
30
+ export declare const isImportDeclaration: (node: TSESTree.Node) => node is TSESTree.Node & {
34
31
  type: TSESTree.AST_NODE_TYPES.ImportDeclaration;
35
32
  };
36
- export declare const isImportDefaultSpecifier: (node: TSESTree.Node) => node is TSESTree.ImportDefaultSpecifier & {
33
+ export declare const isImportDefaultSpecifier: (node: TSESTree.Node) => node is TSESTree.Node & {
37
34
  type: TSESTree.AST_NODE_TYPES.ImportDefaultSpecifier;
38
35
  };
39
- export declare const isImportNamespaceSpecifier: (node: TSESTree.Node) => node is TSESTree.ImportNamespaceSpecifier & {
36
+ export declare const isImportNamespaceSpecifier: (node: TSESTree.Node) => node is TSESTree.Node & {
40
37
  type: TSESTree.AST_NODE_TYPES.ImportNamespaceSpecifier;
41
38
  };
42
- export declare const isImportSpecifier: (node: TSESTree.Node) => node is TSESTree.ImportSpecifier & {
39
+ export declare const isImportSpecifier: (node: TSESTree.Node) => node is TSESTree.Node & {
43
40
  type: TSESTree.AST_NODE_TYPES.ImportSpecifier;
44
41
  };
45
- export declare const isLiteral: (node: TSESTree.Node) => node is (TSESTree.BigIntLiteral & {
46
- type: TSESTree.AST_NODE_TYPES.Literal;
47
- }) | (TSESTree.BooleanLiteral & {
48
- type: TSESTree.AST_NODE_TYPES.Literal;
49
- }) | (TSESTree.NullLiteral & {
42
+ export declare const isLiteral: (node: TSESTree.Node) => node is TSESTree.Node & {
50
43
  type: TSESTree.AST_NODE_TYPES.Literal;
51
- }) | (TSESTree.NumberLiteral & {
52
- type: TSESTree.AST_NODE_TYPES.Literal;
53
- }) | (TSESTree.RegExpLiteral & {
54
- type: TSESTree.AST_NODE_TYPES.Literal;
55
- }) | (TSESTree.StringLiteral & {
56
- type: TSESTree.AST_NODE_TYPES.Literal;
57
- });
58
- export declare const isTemplateElement: (node: TSESTree.Node) => node is TSESTree.TemplateElement & {
44
+ };
45
+ export declare const isTemplateElement: (node: TSESTree.Node) => node is TSESTree.Node & {
59
46
  type: TSESTree.AST_NODE_TYPES.TemplateElement;
60
47
  };
61
- export declare const isTemplateLiteral: (node: TSESTree.Node) => node is TSESTree.TemplateLiteral & {
48
+ export declare const isTemplateLiteral: (node: TSESTree.Node) => node is TSESTree.Node & {
62
49
  type: TSESTree.AST_NODE_TYPES.TemplateLiteral;
63
50
  };
64
- export declare const isMemberExpression: (node: TSESTree.Node) => node is (TSESTree.MemberExpressionComputedName & {
51
+ export declare const isMemberExpression: (node: TSESTree.Node) => node is TSESTree.Node & {
65
52
  type: TSESTree.AST_NODE_TYPES.MemberExpression;
66
- }) | (TSESTree.MemberExpressionNonComputedName & {
67
- type: TSESTree.AST_NODE_TYPES.MemberExpression;
68
- });
69
- export declare const isProgram: (node: TSESTree.Node) => node is TSESTree.Program & {
53
+ };
54
+ export declare const isProgram: (node: TSESTree.Node) => node is TSESTree.Node & {
70
55
  type: TSESTree.AST_NODE_TYPES.Program;
71
56
  };
72
- export declare const isThisExpression: (node: TSESTree.Node) => node is TSESTree.ThisExpression & {
57
+ export declare const isThisExpression: (node: TSESTree.Node) => node is TSESTree.Node & {
73
58
  type: TSESTree.AST_NODE_TYPES.ThisExpression;
74
59
  };
75
- export declare const isTSParameterProperty: (node: TSESTree.Node) => node is TSESTree.TSParameterProperty & {
60
+ export declare const isTSParameterProperty: (node: TSESTree.Node) => node is TSESTree.Node & {
76
61
  type: TSESTree.AST_NODE_TYPES.TSParameterProperty;
77
62
  };
78
- export declare const isTSTypeAnnotation: (node: TSESTree.Node) => node is TSESTree.TSTypeAnnotation & {
63
+ export declare const isTSTypeAnnotation: (node: TSESTree.Node) => node is TSESTree.Node & {
79
64
  type: TSESTree.AST_NODE_TYPES.TSTypeAnnotation;
80
65
  };
81
- export declare const isTSTypeReference: (node: TSESTree.Node) => node is TSESTree.TSTypeReference & {
66
+ export declare const isTSTypeReference: (node: TSESTree.Node) => node is TSESTree.Node & {
82
67
  type: TSESTree.AST_NODE_TYPES.TSTypeReference;
83
68
  };
84
- export declare const isTSInstantiationExpression: (node: TSESTree.Node) => node is TSESTree.TSInstantiationExpression & {
69
+ export declare const isTSInstantiationExpression: (node: TSESTree.Node) => node is TSESTree.Node & {
85
70
  type: TSESTree.AST_NODE_TYPES.TSInstantiationExpression;
86
71
  };
87
- export declare const isProperty: (node: TSESTree.Node) => node is (TSESTree.PropertyComputedName & {
72
+ export declare const isProperty: (node: TSESTree.Node) => node is TSESTree.Node & {
88
73
  type: TSESTree.AST_NODE_TYPES.Property;
89
- }) | (TSESTree.PropertyNonComputedName & {
90
- type: TSESTree.AST_NODE_TYPES.Property;
91
- });
92
- export declare const isArrayExpression: (node: TSESTree.Node) => node is TSESTree.ArrayExpression & {
74
+ };
75
+ export declare const isArrayExpression: (node: TSESTree.Node) => node is TSESTree.Node & {
93
76
  type: TSESTree.AST_NODE_TYPES.ArrayExpression;
94
77
  };
95
- export declare const isBlockStatement: (node: TSESTree.Node) => node is TSESTree.BlockStatement & {
78
+ export declare const isBlockStatement: (node: TSESTree.Node) => node is TSESTree.Node & {
96
79
  type: TSESTree.AST_NODE_TYPES.BlockStatement;
97
80
  };
98
81
  export declare function isIdentifierOrMemberExpression(node: TSESTree.Node): node is TSESTree.Identifier | TSESTree.MemberExpression;
@@ -1,6 +1,9 @@
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.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
+ exports.isIdentifierOrMemberExpression = isIdentifierOrMemberExpression;
5
+ exports.isTypeReference = isTypeReference;
6
+ exports.isCallExpressionWith = isCallExpressionWith;
4
7
  const utils_1 = require("@typescript-eslint/utils");
5
8
  const isNodeOfType = (nodeType) => (node) => node.type === nodeType;
6
9
  exports.isArrowFunctionExpression = isNodeOfType(utils_1.AST_NODE_TYPES.ArrowFunctionExpression);
@@ -10,6 +13,7 @@ exports.isCallExpression = isNodeOfType(utils_1.AST_NODE_TYPES.CallExpression);
10
13
  exports.isClassDeclaration = isNodeOfType(utils_1.AST_NODE_TYPES.ClassDeclaration);
11
14
  exports.isPropertyDefinition = isNodeOfType(utils_1.AST_NODE_TYPES.PropertyDefinition);
12
15
  exports.isFunctionExpression = isNodeOfType(utils_1.AST_NODE_TYPES.FunctionExpression);
16
+ exports.isFunctionDeclaration = isNodeOfType(utils_1.AST_NODE_TYPES.FunctionDeclaration);
13
17
  exports.isIdentifier = isNodeOfType(utils_1.AST_NODE_TYPES.Identifier);
14
18
  exports.isImportDeclaration = isNodeOfType(utils_1.AST_NODE_TYPES.ImportDeclaration);
15
19
  exports.isImportDefaultSpecifier = isNodeOfType(utils_1.AST_NODE_TYPES.ImportDefaultSpecifier);
@@ -31,11 +35,9 @@ exports.isBlockStatement = isNodeOfType(utils_1.AST_NODE_TYPES.BlockStatement);
31
35
  function isIdentifierOrMemberExpression(node) {
32
36
  return (0, exports.isIdentifier)(node) || (0, exports.isMemberExpression)(node);
33
37
  }
34
- exports.isIdentifierOrMemberExpression = isIdentifierOrMemberExpression;
35
38
  function isTypeReference(type) {
36
39
  return type.hasOwnProperty('target');
37
40
  }
38
- exports.isTypeReference = isTypeReference;
39
41
  function equalTo(one, other) {
40
42
  return typeof one === 'string' ? one === other : one.test(other);
41
43
  }
@@ -50,5 +52,4 @@ function isCallExpressionWith(node, objectName, propertyName) {
50
52
  (0, exports.isIdentifier)(node.callee.object.property) &&
51
53
  equalTo(objectName, node.callee.object.property.name))));
52
54
  }
53
- exports.isCallExpressionWith = isCallExpressionWith;
54
55
  //# sourceMappingURL=guards.js.map
@@ -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,eAAe,CAAC,CAAC;AACjE,QAAA,kBAAkB,GAAG,YAAY,CAAC,sBAAc,CAAC,gBAAgB,CAAC,CAAC;AACnE,QAAA,gBAAgB,GAAG,YAAY,CAAC,sBAAc,CAAC,cAAc,CAAC,CAAC;AAC/D,QAAA,kBAAkB,GAAG,YAAY,CAAC,sBAAc,CAAC,gBAAgB,CAAC,CAAC;AACnE,QAAA,oBAAoB,GAAG,YAAY,CAC9C,sBAAc,CAAC,kBAAkB,CAClC,CAAC;AACW,QAAA,oBAAoB,GAAG,YAAY,CAC9C,sBAAc,CAAC,kBAAkB,CAClC,CAAC;AACW,QAAA,YAAY,GAAG,YAAY,CAAC,sBAAc,CAAC,UAAU,CAAC,CAAC;AACvD,QAAA,mBAAmB,GAAG,YAAY,CAC7C,sBAAc,CAAC,iBAAiB,CACjC,CAAC;AACW,QAAA,wBAAwB,GAAG,YAAY,CAClD,sBAAc,CAAC,sBAAsB,CACtC,CAAC;AACW,QAAA,0BAA0B,GAAG,YAAY,CACpD,sBAAc,CAAC,wBAAwB,CACxC,CAAC;AACW,QAAA,iBAAiB,GAAG,YAAY,CAAC,sBAAc,CAAC,eAAe,CAAC,CAAC;AACjE,QAAA,SAAS,GAAG,YAAY,CAAC,sBAAc,CAAC,OAAO,CAAC,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C,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,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 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":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/guards.ts"],"names":[],"mappings":";;;AAqDA,wEAIC;AAED,0CAEC;AAMD,oDAgBC;AAlFD,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,eAAe,CAAC,CAAC;AACjE,QAAA,kBAAkB,GAAG,YAAY,CAAC,sBAAc,CAAC,gBAAgB,CAAC,CAAC;AACnE,QAAA,gBAAgB,GAAG,YAAY,CAAC,sBAAc,CAAC,cAAc,CAAC,CAAC;AAC/D,QAAA,kBAAkB,GAAG,YAAY,CAAC,sBAAc,CAAC,gBAAgB,CAAC,CAAC;AACnE,QAAA,oBAAoB,GAAG,YAAY,CAC9C,sBAAc,CAAC,kBAAkB,CAClC,CAAC;AACW,QAAA,oBAAoB,GAAG,YAAY,CAC9C,sBAAc,CAAC,kBAAkB,CAClC,CAAC;AACW,QAAA,qBAAqB,GAAG,YAAY,CAC/C,sBAAc,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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"]}
@@ -1,6 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.asPattern = exports.escapeText = exports.getNgRxStores = exports.getNgRxComponentStores = exports.getNgRxEffectActions = exports.capitalize = exports.getRawText = exports.getDecoratorName = exports.getLast = exports.getImplementsSchemaFixer = exports.getInterface = exports.getInterfaces = exports.getInterfaceName = exports.getNodeToCommaRemoveFix = exports.getImportRemoveFix = exports.getImportAddFix = exports.getImportDeclarations = exports.getImportDeclarationSpecifier = exports.getNearestUpperNodeFrom = void 0;
3
+ exports.getNearestUpperNodeFrom = getNearestUpperNodeFrom;
4
+ exports.getImportDeclarationSpecifier = getImportDeclarationSpecifier;
5
+ exports.getImportDeclarations = getImportDeclarations;
6
+ exports.getImportAddFix = getImportAddFix;
7
+ exports.getImportRemoveFix = getImportRemoveFix;
8
+ exports.getNodeToCommaRemoveFix = getNodeToCommaRemoveFix;
9
+ exports.getInterfaceName = getInterfaceName;
10
+ exports.getInterfaces = getInterfaces;
11
+ exports.getInterface = getInterface;
12
+ exports.getImplementsSchemaFixer = getImplementsSchemaFixer;
13
+ exports.getLast = getLast;
14
+ exports.getDecoratorName = getDecoratorName;
15
+ exports.getRawText = getRawText;
16
+ exports.capitalize = capitalize;
17
+ exports.getNgRxEffectActions = getNgRxEffectActions;
18
+ exports.getNgRxComponentStores = getNgRxComponentStores;
19
+ exports.getNgRxStores = getNgRxStores;
20
+ exports.escapeText = escapeText;
21
+ exports.asPattern = asPattern;
4
22
  const utils_1 = require("@typescript-eslint/utils");
5
23
  const guards_1 = require("./guards");
6
24
  const ngrx_modules_1 = require("./ngrx-modules");
@@ -13,7 +31,6 @@ function getNearestUpperNodeFrom({ parent }, predicate) {
13
31
  }
14
32
  return undefined;
15
33
  }
16
- exports.getNearestUpperNodeFrom = getNearestUpperNodeFrom;
17
34
  function getImportDeclarationSpecifier(importDeclarations, importName) {
18
35
  for (const importDeclaration of importDeclarations) {
19
36
  const importSpecifier = importDeclaration.specifiers.find((importClause) => {
@@ -26,7 +43,6 @@ function getImportDeclarationSpecifier(importDeclarations, importName) {
26
43
  }
27
44
  return undefined;
28
45
  }
29
- exports.getImportDeclarationSpecifier = getImportDeclarationSpecifier;
30
46
  function getImportDeclarations(node, moduleName) {
31
47
  let parentNode = node;
32
48
  while (parentNode && !(0, guards_1.isProgram)(parentNode)) {
@@ -36,7 +52,6 @@ function getImportDeclarations(node, moduleName) {
36
52
  return (0, guards_1.isImportDeclaration)(node) && node.source.value === moduleName;
37
53
  });
38
54
  }
39
- exports.getImportDeclarations = getImportDeclarations;
40
55
  function getCorrespondentImportClause(importDeclarations, compatibleWithTypeOnlyImport = false) {
41
56
  let importClause;
42
57
  for (const { importKind, specifiers } of importDeclarations) {
@@ -68,7 +83,6 @@ function getImportAddFix({ compatibleWithTypeOnlyImport = false, fixer, importNa
68
83
  : `, ${importName}`;
69
84
  return fixer.insertTextAfter(importClause, replacementText);
70
85
  }
71
- exports.getImportAddFix = getImportAddFix;
72
86
  function getImportRemoveFix(sourceCode, importDeclarations, importedName, fixer) {
73
87
  const { importDeclaration, importSpecifier } = getImportDeclarationSpecifier(importDeclarations, importedName) ?? {};
74
88
  if (!importDeclaration || !importSpecifier) {
@@ -96,7 +110,6 @@ function getImportRemoveFix(sourceCode, importDeclarations, importedName, fixer)
96
110
  importSpecifier.range[1],
97
111
  ]);
98
112
  }
99
- exports.getImportRemoveFix = getImportRemoveFix;
100
113
  function getNodeToCommaRemoveFix(sourceCode, fixer, node) {
101
114
  const nextToken = sourceCode.getTokenAfter(node);
102
115
  const isNextTokenComma = nextToken && utils_1.ASTUtils.isCommaToken(nextToken);
@@ -105,7 +118,6 @@ function getNodeToCommaRemoveFix(sourceCode, fixer, node) {
105
118
  ...(isNextTokenComma ? [fixer.remove(nextToken)] : []),
106
119
  ];
107
120
  }
108
- exports.getNodeToCommaRemoveFix = getNodeToCommaRemoveFix;
109
121
  function getInterfaceName(interfaceMember) {
110
122
  if ((0, guards_1.isIdentifier)(interfaceMember)) {
111
123
  return interfaceMember.name;
@@ -114,28 +126,23 @@ function getInterfaceName(interfaceMember) {
114
126
  ? interfaceMember.property.name
115
127
  : undefined;
116
128
  }
117
- exports.getInterfaceName = getInterfaceName;
118
129
  function getInterfaces({ implements: classImplements, }) {
119
130
  return (classImplements ?? [])
120
131
  .map(({ expression }) => expression)
121
132
  .filter(guards_1.isIdentifierOrMemberExpression);
122
133
  }
123
- exports.getInterfaces = getInterfaces;
124
134
  function getInterface(node, interfaceName) {
125
135
  return getInterfaces(node).find((interfaceMember) => getInterfaceName(interfaceMember) === interfaceName);
126
136
  }
127
- exports.getInterface = getInterface;
128
137
  function getImplementsSchemaFixer({ id, implements: classImplements }, interfaceName) {
129
138
  const [implementsNodeReplace, implementsTextReplace] = classImplements && classImplements.length
130
139
  ? [getLast(classImplements), `, ${interfaceName}`]
131
140
  : [id, ` implements ${interfaceName}`];
132
141
  return { implementsNodeReplace, implementsTextReplace };
133
142
  }
134
- exports.getImplementsSchemaFixer = getImplementsSchemaFixer;
135
143
  function getLast(items) {
136
144
  return items.slice(-1)[0];
137
145
  }
138
- exports.getLast = getLast;
139
146
  function getDecoratorName({ expression, }) {
140
147
  if ((0, guards_1.isIdentifier)(expression)) {
141
148
  return expression.name;
@@ -144,7 +151,6 @@ function getDecoratorName({ expression, }) {
144
151
  ? expression.callee.name
145
152
  : undefined;
146
153
  }
147
- exports.getDecoratorName = getDecoratorName;
148
154
  function getRawText(node) {
149
155
  if ((0, guards_1.isIdentifier)(node)) {
150
156
  return node.name;
@@ -165,11 +171,9 @@ function getRawText(node) {
165
171
  }
166
172
  return null;
167
173
  }
168
- exports.getRawText = getRawText;
169
174
  function capitalize(text) {
170
175
  return `${text[0].toUpperCase()}${text.slice(1)}`;
171
176
  }
172
- exports.capitalize = capitalize;
173
177
  function getInjectedParametersWithSourceCode(context, moduleName, importName) {
174
178
  const sourceCode = context.getSourceCode();
175
179
  const importDeclarations = getImportDeclarations(sourceCode.ast, moduleName) ?? [];
@@ -212,23 +216,18 @@ function getInjectedParametersWithSourceCode(context, moduleName, importName) {
212
216
  function getNgRxEffectActions(context) {
213
217
  return getInjectedParametersWithSourceCode(context, ngrx_modules_1.NGRX_MODULE_PATHS.effects, 'Actions');
214
218
  }
215
- exports.getNgRxEffectActions = getNgRxEffectActions;
216
219
  function getNgRxComponentStores(context) {
217
220
  return getInjectedParametersWithSourceCode(context, ngrx_modules_1.NGRX_MODULE_PATHS['component-store'], 'ComponentStore');
218
221
  }
219
- exports.getNgRxComponentStores = getNgRxComponentStores;
220
222
  function getNgRxStores(context) {
221
223
  return getInjectedParametersWithSourceCode(context, ngrx_modules_1.NGRX_MODULE_PATHS.store, 'Store');
222
224
  }
223
- exports.getNgRxStores = getNgRxStores;
224
225
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
225
226
  function escapeText(text) {
226
227
  return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
227
228
  }
228
- exports.escapeText = escapeText;
229
229
  function asPattern(identifiers) {
230
230
  const escapedNames = identifiers.map(({ name }) => escapeText(name));
231
231
  return new RegExp(`^(${escapedNames.join('|')})$`);
232
232
  }
233
- exports.asPattern = asPattern;
234
233
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/utils.ts"],"names":[],"mappings":";;;AACA,oDAAoD;AACpD,qCAkBkB;AAClB,iDAAmD;AAoBnD,SAAgB,uBAAuB,CACrC,EAAE,MAAM,EAAiB,EACzB,SAAiD;IAEjD,OAAO,MAAM,IAAI,CAAC,IAAA,kBAAS,EAAC,MAAM,CAAC,EAAE,CAAC;QACpC,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACtB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAbD,0DAaC;AAED,SAAgB,6BAA6B,CAC3C,kBAAyD,EACzD,UAAkB;IAElB,KAAK,MAAM,iBAAiB,IAAI,kBAAkB,EAAE,CAAC;QACnD,MAAM,eAAe,GAAG,iBAAiB,CAAC,UAAU,CAAC,IAAI,CACvD,CAAC,YAAY,EAA4C,EAAE;YACzD,OAAO,CACL,IAAA,0BAAiB,EAAC,YAAY,CAAC;gBAC/B,YAAY,CAAC,QAAQ,CAAC,IAAI,KAAK,UAAU,CAC1C,CAAC;QACJ,CAAC,CACF,CAAC;QAEF,IAAI,eAAe,EAAE,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B,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC;AAFD,gCAEC;AAED,SAAgB,SAAS,CAAC,WAAyC;IACjE,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IACrE,OAAO,IAAI,MAAM,CAAC,KAAK,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC;AAHD,8BAGC","sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/utils';\nimport { ASTUtils } from '@typescript-eslint/utils';\nimport {\n isCallExpression,\n isIdentifier,\n isIdentifierOrMemberExpression,\n isImportDeclaration,\n isImportDefaultSpecifier,\n isImportNamespaceSpecifier,\n isImportSpecifier,\n isLiteral,\n isMethodDefinition,\n isProgram,\n isProperty,\n isPropertyDefinition,\n isTSTypeAnnotation,\n isTSTypeReference,\n isTemplateElement,\n isTemplateLiteral,\n isTSInstantiationExpression,\n} from './guards';\nimport { NGRX_MODULE_PATHS } from './ngrx-modules';\n\ntype ConstructorFunctionExpression = TSESTree.FunctionExpression & {\n parent: TSESTree.MethodDefinition & { kind: 'constructor' };\n};\ntype InjectedParameter =\n | TSESTree.Identifier & {\n typeAnnotation: TSESTree.TSTypeAnnotation;\n parent:\n | ConstructorFunctionExpression\n | (TSESTree.TSParameterProperty & {\n parent: ConstructorFunctionExpression;\n })\n | TSESTree.PropertyDefinition;\n };\ntype InjectedParameterWithSourceCode = Readonly<{\n identifiers?: readonly InjectedParameter[];\n sourceCode: Readonly<TSESLint.SourceCode>;\n}>;\n\nexport function getNearestUpperNodeFrom<T extends TSESTree.Node>(\n { parent }: TSESTree.Node,\n predicate: (parent: TSESTree.Node) => parent is T\n): T | undefined {\n while (parent && !isProgram(parent)) {\n if (predicate(parent)) {\n return parent;\n }\n\n parent = parent.parent;\n }\n\n return undefined;\n}\n\nexport function getImportDeclarationSpecifier(\n importDeclarations: readonly TSESTree.ImportDeclaration[],\n importName: string\n) {\n for (const importDeclaration of importDeclarations) {\n const importSpecifier = importDeclaration.specifiers.find(\n (importClause): importClause is TSESTree.ImportSpecifier => {\n return (\n isImportSpecifier(importClause) &&\n importClause.imported.name === importName\n );\n }\n );\n\n if (importSpecifier) {\n return { importDeclaration, importSpecifier } as const;\n }\n }\n\n return undefined;\n}\n\nexport function getImportDeclarations(\n node: TSESTree.Node,\n moduleName: string\n): readonly TSESTree.ImportDeclaration[] | undefined {\n let parentNode: TSESTree.Node | undefined = node;\n\n while (parentNode && !isProgram(parentNode)) {\n parentNode = parentNode.parent;\n }\n\n return parentNode?.body.filter((node): node is TSESTree.ImportDeclaration => {\n return isImportDeclaration(node) && node.source.value === moduleName;\n });\n}\n\nfunction getCorrespondentImportClause(\n importDeclarations: readonly TSESTree.ImportDeclaration[],\n compatibleWithTypeOnlyImport = false\n) {\n let importClause: TSESTree.ImportClause | undefined;\n\n for (const { importKind, specifiers } of importDeclarations) {\n const lastImportSpecifier = getLast(specifiers);\n\n if (\n (!compatibleWithTypeOnlyImport && importKind === 'type') ||\n isImportNamespaceSpecifier(lastImportSpecifier)\n ) {\n continue;\n }\n\n importClause = lastImportSpecifier;\n }\n\n return importClause;\n}\n\nexport function getImportAddFix({\n compatibleWithTypeOnlyImport = false,\n fixer,\n importName,\n moduleName,\n node,\n}: {\n compatibleWithTypeOnlyImport?: boolean;\n fixer: TSESLint.RuleFixer;\n importName: string;\n moduleName: string;\n node: TSESTree.Node;\n}): TSESLint.RuleFix | TSESLint.RuleFix[] {\n const fullImport = `import { ${importName} } from '${moduleName}';`;\n const importDeclarations = getImportDeclarations(node, moduleName);\n\n if (!importDeclarations?.length) {\n return fixer.insertTextAfterRange([0, 0], fullImport);\n }\n\n const importDeclarationSpecifier = getImportDeclarationSpecifier(\n importDeclarations,\n importName\n );\n\n if (importDeclarationSpecifier) {\n return [];\n }\n\n const importClause = getCorrespondentImportClause(\n importDeclarations,\n compatibleWithTypeOnlyImport\n );\n\n if (!importClause) {\n return fixer.insertTextAfterRange([0, 0], fullImport);\n }\n\n const replacementText = isImportDefaultSpecifier(importClause)\n ? `, { ${importName} }`\n : `, ${importName}`;\n return fixer.insertTextAfter(importClause, replacementText);\n}\n\nexport function getImportRemoveFix(\n sourceCode: Readonly<TSESLint.SourceCode>,\n importDeclarations: readonly TSESTree.ImportDeclaration[],\n importedName: string,\n fixer: TSESLint.RuleFixer\n): TSESLint.RuleFix | TSESLint.RuleFix[] {\n const { importDeclaration, importSpecifier } =\n getImportDeclarationSpecifier(importDeclarations, importedName) ?? {};\n\n if (!importDeclaration || !importSpecifier) {\n return [];\n }\n\n const isFirstImportSpecifier =\n importDeclaration.specifiers[0] === importSpecifier;\n const isLastImportSpecifier =\n getLast(importDeclaration.specifiers) === importSpecifier;\n const isSingleImportSpecifier =\n isFirstImportSpecifier && isLastImportSpecifier;\n\n if (isSingleImportSpecifier) {\n return fixer.remove(importDeclaration);\n }\n\n const tokenAfterImportSpecifier = sourceCode.getTokenAfter(importSpecifier);\n\n if (isFirstImportSpecifier && tokenAfterImportSpecifier) {\n return fixer.removeRange([\n importSpecifier.range[0],\n tokenAfterImportSpecifier.range[1],\n ]);\n }\n\n const tokenBeforeImportSpecifier = sourceCode.getTokenBefore(importSpecifier);\n\n if (!tokenBeforeImportSpecifier) {\n return [];\n }\n\n return fixer.removeRange([\n tokenBeforeImportSpecifier.range[0],\n importSpecifier.range[1],\n ]);\n}\n\nexport function getNodeToCommaRemoveFix(\n sourceCode: Readonly<TSESLint.SourceCode>,\n fixer: TSESLint.RuleFixer,\n node: TSESTree.Node\n) {\n const nextToken = sourceCode.getTokenAfter(node);\n const isNextTokenComma = nextToken && ASTUtils.isCommaToken(nextToken);\n return [\n fixer.remove(node),\n ...(isNextTokenComma ? [fixer.remove(nextToken)] : []),\n ] as const;\n}\n\nexport function getInterfaceName(\n interfaceMember: TSESTree.Identifier | TSESTree.MemberExpression\n): string | undefined {\n if (isIdentifier(interfaceMember)) {\n return interfaceMember.name;\n }\n\n return isIdentifier(interfaceMember.property)\n ? interfaceMember.property.name\n : undefined;\n}\n\nexport function getInterfaces({\n implements: classImplements,\n}: TSESTree.ClassDeclaration): readonly (\n | TSESTree.Identifier\n | TSESTree.MemberExpression\n)[] {\n return (classImplements ?? [])\n .map(({ expression }) => expression)\n .filter(isIdentifierOrMemberExpression);\n}\n\nexport function getInterface(\n node: TSESTree.ClassDeclaration,\n interfaceName: string\n): TSESTree.Identifier | TSESTree.MemberExpression | undefined {\n return getInterfaces(node).find(\n (interfaceMember) => getInterfaceName(interfaceMember) === interfaceName\n );\n}\n\nexport function getImplementsSchemaFixer(\n { id, implements: classImplements }: TSESTree.ClassDeclaration,\n interfaceName: string\n) {\n const [implementsNodeReplace, implementsTextReplace] =\n classImplements && classImplements.length\n ? [getLast(classImplements), `, ${interfaceName}`]\n : [id as TSESTree.Identifier, ` implements ${interfaceName}`];\n\n return { implementsNodeReplace, implementsTextReplace } as const;\n}\n\nexport function getLast<T extends readonly unknown[]>(items: T): T[number] {\n return items.slice(-1)[0];\n}\n\nexport function getDecoratorName({\n expression,\n}: TSESTree.Decorator): string | undefined {\n if (isIdentifier(expression)) {\n return expression.name;\n }\n\n return isCallExpression(expression) && isIdentifier(expression.callee)\n ? expression.callee.name\n : undefined;\n}\n\nexport function getRawText(node: TSESTree.Node): string | null {\n if (isIdentifier(node)) {\n return node.name;\n }\n\n if (\n isPropertyDefinition(node) ||\n isMethodDefinition(node) ||\n isProperty(node)\n ) {\n return getRawText(node.key);\n }\n\n if (isLiteral(node)) {\n return node.raw;\n }\n\n if (isTemplateElement(node)) {\n return `\\`${node.value.raw}\\``;\n }\n\n if (isTemplateLiteral(node)) {\n return `\\`${node.quasis[0].value.raw}\\``;\n }\n\n return null;\n}\n\nexport function capitalize<T extends string>(text: T): Capitalize<T> {\n return `${text[0].toUpperCase()}${text.slice(1)}` as Capitalize<T>;\n}\n\nfunction getInjectedParametersWithSourceCode(\n context: TSESLint.RuleContext<string, readonly unknown[]>,\n moduleName: string,\n importName: string\n): InjectedParameterWithSourceCode {\n const sourceCode = context.getSourceCode();\n const importDeclarations =\n getImportDeclarations(sourceCode.ast, moduleName) ?? [];\n const { importSpecifier } =\n getImportDeclarationSpecifier(importDeclarations, importName) ?? {};\n\n const injectImportDeclarations =\n getImportDeclarations(sourceCode.ast, '@angular/core') ?? [];\n\n const { importSpecifier: injectImportSpecifier } =\n getImportDeclarationSpecifier(injectImportDeclarations, 'inject') ?? {};\n\n if (!importSpecifier) {\n return { sourceCode };\n }\n\n const variables = sourceCode.getDeclaredVariables(importSpecifier);\n const typedVariable = variables.find(({ name }) => name === importName);\n const identifiers = typedVariable?.references?.reduce<\n readonly InjectedParameter[]\n >((identifiers, { identifier: { parent } }) => {\n if (!parent) {\n return identifiers;\n }\n\n if (\n isTSTypeReference(parent) &&\n parent.parent &&\n isTSTypeAnnotation(parent.parent) &&\n parent.parent.parent &&\n isIdentifier(parent.parent.parent)\n ) {\n return identifiers.concat(parent.parent.parent as InjectedParameter);\n }\n\n const parentToCheck = isTSInstantiationExpression(parent)\n ? parent.parent\n : parent;\n\n if (\n parentToCheck &&\n isCallExpression(parentToCheck) &&\n isIdentifier(parentToCheck.callee) &&\n parentToCheck.callee.name == 'inject' &&\n parentToCheck.parent &&\n isPropertyDefinition(parentToCheck.parent) &&\n isIdentifier(parentToCheck.parent.key) &&\n injectImportSpecifier\n ) {\n return identifiers.concat(parentToCheck.parent.key as InjectedParameter);\n }\n\n return identifiers;\n }, []);\n return { identifiers, sourceCode };\n}\n\nexport function getNgRxEffectActions(\n context: TSESLint.RuleContext<string, readonly unknown[]>\n): InjectedParameterWithSourceCode {\n return getInjectedParametersWithSourceCode(\n context,\n NGRX_MODULE_PATHS.effects,\n 'Actions'\n );\n}\n\nexport function getNgRxComponentStores(\n context: TSESLint.RuleContext<string, readonly unknown[]>\n): InjectedParameterWithSourceCode {\n return getInjectedParametersWithSourceCode(\n context,\n NGRX_MODULE_PATHS['component-store'],\n 'ComponentStore'\n );\n}\n\nexport function getNgRxStores(\n context: TSESLint.RuleContext<string, readonly unknown[]>\n): InjectedParameterWithSourceCode {\n return getInjectedParametersWithSourceCode(\n context,\n NGRX_MODULE_PATHS.store,\n 'Store'\n );\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping\nexport function escapeText(text: string): string {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function asPattern(identifiers: readonly InjectedParameter[]): RegExp {\n const escapedNames = identifiers.map(({ name }) => escapeText(name));\n return new RegExp(`^(${escapedNames.join('|')})$`);\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/utils.ts"],"names":[],"mappings":";;AAyCA,0DAaC;AAED,sEAoBC;AAED,sDAaC;AAwBD,0CA0CC;AAED,gDA2CC;AAED,0DAWC;AAED,4CAUC;AAED,sCASC;AAED,oCAOC;AAED,4DAUC;AAED,0BAEC;AAED,4CAUC;AAED,gCA0BC;AAED,gCAEC;AAgED,oDAQC;AAED,wDAQC;AAED,sCAQC;AAGD,gCAEC;AAED,8BAGC;AAxZD,oDAAoD;AACpD,qCAkBkB;AAClB,iDAAmD;AAoBnD,SAAgB,uBAAuB,CACrC,EAAE,MAAM,EAAiB,EACzB,SAAiD;IAEjD,OAAO,MAAM,IAAI,CAAC,IAAA,kBAAS,EAAC,MAAM,CAAC,EAAE,CAAC;QACpC,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACtB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,6BAA6B,CAC3C,kBAAyD,EACzD,UAAkB;IAElB,KAAK,MAAM,iBAAiB,IAAI,kBAAkB,EAAE,CAAC;QACnD,MAAM,eAAe,GAA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,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC;AAED,SAAgB,SAAS,CAAC,WAAyC;IACjE,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IACrE,OAAO,IAAI,MAAM,CAAC,KAAK,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/utils';\nimport { ASTUtils } from '@typescript-eslint/utils';\nimport {\n isCallExpression,\n isIdentifier,\n isIdentifierOrMemberExpression,\n isImportDeclaration,\n isImportDefaultSpecifier,\n isImportNamespaceSpecifier,\n isImportSpecifier,\n isLiteral,\n isMethodDefinition,\n isProgram,\n isProperty,\n isPropertyDefinition,\n isTSTypeAnnotation,\n isTSTypeReference,\n isTemplateElement,\n isTemplateLiteral,\n isTSInstantiationExpression,\n} from './guards';\nimport { NGRX_MODULE_PATHS } from './ngrx-modules';\n\ntype ConstructorFunctionExpression = TSESTree.FunctionExpression & {\n parent: TSESTree.MethodDefinition & { kind: 'constructor' };\n};\ntype InjectedParameter =\n | TSESTree.Identifier & {\n typeAnnotation: TSESTree.TSTypeAnnotation;\n parent:\n | ConstructorFunctionExpression\n | (TSESTree.TSParameterProperty & {\n parent: ConstructorFunctionExpression;\n })\n | TSESTree.PropertyDefinition;\n };\ntype InjectedParameterWithSourceCode = Readonly<{\n identifiers?: readonly InjectedParameter[];\n sourceCode: Readonly<TSESLint.SourceCode>;\n}>;\n\nexport function getNearestUpperNodeFrom<T extends TSESTree.Node>(\n { parent }: TSESTree.Node,\n predicate: (parent: TSESTree.Node) => parent is T\n): T | undefined {\n while (parent && !isProgram(parent)) {\n if (predicate(parent)) {\n return parent;\n }\n\n parent = parent.parent;\n }\n\n return undefined;\n}\n\nexport function getImportDeclarationSpecifier(\n importDeclarations: readonly TSESTree.ImportDeclaration[],\n importName: string\n) {\n for (const importDeclaration of importDeclarations) {\n const importSpecifier = importDeclaration.specifiers.find(\n (importClause): importClause is TSESTree.ImportSpecifier => {\n return (\n isImportSpecifier(importClause) &&\n importClause.imported.name === importName\n );\n }\n );\n\n if (importSpecifier) {\n return { importDeclaration, importSpecifier } as const;\n }\n }\n\n return undefined;\n}\n\nexport function getImportDeclarations(\n node: TSESTree.Node,\n moduleName: string\n): readonly TSESTree.ImportDeclaration[] | undefined {\n let parentNode: TSESTree.Node | undefined = node;\n\n while (parentNode && !isProgram(parentNode)) {\n parentNode = parentNode.parent;\n }\n\n return parentNode?.body.filter((node): node is TSESTree.ImportDeclaration => {\n return isImportDeclaration(node) && node.source.value === moduleName;\n });\n}\n\nfunction getCorrespondentImportClause(\n importDeclarations: readonly TSESTree.ImportDeclaration[],\n compatibleWithTypeOnlyImport = false\n) {\n let importClause: TSESTree.ImportClause | undefined;\n\n for (const { importKind, specifiers } of importDeclarations) {\n const lastImportSpecifier = getLast(specifiers);\n\n if (\n (!compatibleWithTypeOnlyImport && importKind === 'type') ||\n isImportNamespaceSpecifier(lastImportSpecifier)\n ) {\n continue;\n }\n\n importClause = lastImportSpecifier;\n }\n\n return importClause;\n}\n\nexport function getImportAddFix({\n compatibleWithTypeOnlyImport = false,\n fixer,\n importName,\n moduleName,\n node,\n}: {\n compatibleWithTypeOnlyImport?: boolean;\n fixer: TSESLint.RuleFixer;\n importName: string;\n moduleName: string;\n node: TSESTree.Node;\n}): TSESLint.RuleFix | TSESLint.RuleFix[] {\n const fullImport = `import { ${importName} } from '${moduleName}';`;\n const importDeclarations = getImportDeclarations(node, moduleName);\n\n if (!importDeclarations?.length) {\n return fixer.insertTextAfterRange([0, 0], fullImport);\n }\n\n const importDeclarationSpecifier = getImportDeclarationSpecifier(\n importDeclarations,\n importName\n );\n\n if (importDeclarationSpecifier) {\n return [];\n }\n\n const importClause = getCorrespondentImportClause(\n importDeclarations,\n compatibleWithTypeOnlyImport\n );\n\n if (!importClause) {\n return fixer.insertTextAfterRange([0, 0], fullImport);\n }\n\n const replacementText = isImportDefaultSpecifier(importClause)\n ? `, { ${importName} }`\n : `, ${importName}`;\n return fixer.insertTextAfter(importClause, replacementText);\n}\n\nexport function getImportRemoveFix(\n sourceCode: Readonly<TSESLint.SourceCode>,\n importDeclarations: readonly TSESTree.ImportDeclaration[],\n importedName: string,\n fixer: TSESLint.RuleFixer\n): TSESLint.RuleFix | TSESLint.RuleFix[] {\n const { importDeclaration, importSpecifier } =\n getImportDeclarationSpecifier(importDeclarations, importedName) ?? {};\n\n if (!importDeclaration || !importSpecifier) {\n return [];\n }\n\n const isFirstImportSpecifier =\n importDeclaration.specifiers[0] === importSpecifier;\n const isLastImportSpecifier =\n getLast(importDeclaration.specifiers) === importSpecifier;\n const isSingleImportSpecifier =\n isFirstImportSpecifier && isLastImportSpecifier;\n\n if (isSingleImportSpecifier) {\n return fixer.remove(importDeclaration);\n }\n\n const tokenAfterImportSpecifier = sourceCode.getTokenAfter(importSpecifier);\n\n if (isFirstImportSpecifier && tokenAfterImportSpecifier) {\n return fixer.removeRange([\n importSpecifier.range[0],\n tokenAfterImportSpecifier.range[1],\n ]);\n }\n\n const tokenBeforeImportSpecifier = sourceCode.getTokenBefore(importSpecifier);\n\n if (!tokenBeforeImportSpecifier) {\n return [];\n }\n\n return fixer.removeRange([\n tokenBeforeImportSpecifier.range[0],\n importSpecifier.range[1],\n ]);\n}\n\nexport function getNodeToCommaRemoveFix(\n sourceCode: Readonly<TSESLint.SourceCode>,\n fixer: TSESLint.RuleFixer,\n node: TSESTree.Node\n) {\n const nextToken = sourceCode.getTokenAfter(node);\n const isNextTokenComma = nextToken && ASTUtils.isCommaToken(nextToken);\n return [\n fixer.remove(node),\n ...(isNextTokenComma ? [fixer.remove(nextToken)] : []),\n ] as const;\n}\n\nexport function getInterfaceName(\n interfaceMember: TSESTree.Identifier | TSESTree.MemberExpression\n): string | undefined {\n if (isIdentifier(interfaceMember)) {\n return interfaceMember.name;\n }\n\n return isIdentifier(interfaceMember.property)\n ? interfaceMember.property.name\n : undefined;\n}\n\nexport function getInterfaces({\n implements: classImplements,\n}: TSESTree.ClassDeclaration): readonly (\n | TSESTree.Identifier\n | TSESTree.MemberExpression\n)[] {\n return (classImplements ?? [])\n .map(({ expression }) => expression)\n .filter(isIdentifierOrMemberExpression);\n}\n\nexport function getInterface(\n node: TSESTree.ClassDeclaration,\n interfaceName: string\n): TSESTree.Identifier | TSESTree.MemberExpression | undefined {\n return getInterfaces(node).find(\n (interfaceMember) => getInterfaceName(interfaceMember) === interfaceName\n );\n}\n\nexport function getImplementsSchemaFixer(\n { id, implements: classImplements }: TSESTree.ClassDeclaration,\n interfaceName: string\n) {\n const [implementsNodeReplace, implementsTextReplace] =\n classImplements && classImplements.length\n ? [getLast(classImplements), `, ${interfaceName}`]\n : [id as TSESTree.Identifier, ` implements ${interfaceName}`];\n\n return { implementsNodeReplace, implementsTextReplace } as const;\n}\n\nexport function getLast<T extends readonly unknown[]>(items: T): T[number] {\n return items.slice(-1)[0];\n}\n\nexport function getDecoratorName({\n expression,\n}: TSESTree.Decorator): string | undefined {\n if (isIdentifier(expression)) {\n return expression.name;\n }\n\n return isCallExpression(expression) && isIdentifier(expression.callee)\n ? expression.callee.name\n : undefined;\n}\n\nexport function getRawText(node: TSESTree.Node): string | null {\n if (isIdentifier(node)) {\n return node.name;\n }\n\n if (\n isPropertyDefinition(node) ||\n isMethodDefinition(node) ||\n isProperty(node)\n ) {\n return getRawText(node.key);\n }\n\n if (isLiteral(node)) {\n return node.raw;\n }\n\n if (isTemplateElement(node)) {\n return `\\`${node.value.raw}\\``;\n }\n\n if (isTemplateLiteral(node)) {\n return `\\`${node.quasis[0].value.raw}\\``;\n }\n\n return null;\n}\n\nexport function capitalize<T extends string>(text: T): Capitalize<T> {\n return `${text[0].toUpperCase()}${text.slice(1)}` as Capitalize<T>;\n}\n\nfunction getInjectedParametersWithSourceCode(\n context: TSESLint.RuleContext<string, readonly unknown[]>,\n moduleName: string,\n importName: string\n): InjectedParameterWithSourceCode {\n const sourceCode = context.getSourceCode();\n const importDeclarations =\n getImportDeclarations(sourceCode.ast, moduleName) ?? [];\n const { importSpecifier } =\n getImportDeclarationSpecifier(importDeclarations, importName) ?? {};\n\n const injectImportDeclarations =\n getImportDeclarations(sourceCode.ast, '@angular/core') ?? [];\n\n const { importSpecifier: injectImportSpecifier } =\n getImportDeclarationSpecifier(injectImportDeclarations, 'inject') ?? {};\n\n if (!importSpecifier) {\n return { sourceCode };\n }\n\n const variables = sourceCode.getDeclaredVariables(importSpecifier);\n const typedVariable = variables.find(({ name }) => name === importName);\n const identifiers = typedVariable?.references?.reduce<\n readonly InjectedParameter[]\n >((identifiers, { identifier: { parent } }) => {\n if (!parent) {\n return identifiers;\n }\n\n if (\n isTSTypeReference(parent) &&\n parent.parent &&\n isTSTypeAnnotation(parent.parent) &&\n parent.parent.parent &&\n isIdentifier(parent.parent.parent)\n ) {\n return identifiers.concat(parent.parent.parent as InjectedParameter);\n }\n\n const parentToCheck = isTSInstantiationExpression(parent)\n ? parent.parent\n : parent;\n\n if (\n parentToCheck &&\n isCallExpression(parentToCheck) &&\n isIdentifier(parentToCheck.callee) &&\n parentToCheck.callee.name == 'inject' &&\n parentToCheck.parent &&\n isPropertyDefinition(parentToCheck.parent) &&\n isIdentifier(parentToCheck.parent.key) &&\n injectImportSpecifier\n ) {\n return identifiers.concat(parentToCheck.parent.key as InjectedParameter);\n }\n\n return identifiers;\n }, []);\n return { identifiers, sourceCode };\n}\n\nexport function getNgRxEffectActions(\n context: TSESLint.RuleContext<string, readonly unknown[]>\n): InjectedParameterWithSourceCode {\n return getInjectedParametersWithSourceCode(\n context,\n NGRX_MODULE_PATHS.effects,\n 'Actions'\n );\n}\n\nexport function getNgRxComponentStores(\n context: TSESLint.RuleContext<string, readonly unknown[]>\n): InjectedParameterWithSourceCode {\n return getInjectedParametersWithSourceCode(\n context,\n NGRX_MODULE_PATHS['component-store'],\n 'ComponentStore'\n );\n}\n\nexport function getNgRxStores(\n context: TSESLint.RuleContext<string, readonly unknown[]>\n): InjectedParameterWithSourceCode {\n return getInjectedParametersWithSourceCode(\n context,\n NGRX_MODULE_PATHS.store,\n 'Store'\n );\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping\nexport function escapeText(text: string): string {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function asPattern(identifiers: readonly InjectedParameter[]): RegExp {\n const escapedNames = identifiers.map(({ name }) => escapeText(name));\n return new RegExp(`^(${escapedNames.join('|')})$`);\n}\n"]}
@@ -23,7 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ngrxVersionSatisfies = exports.clearCache = exports.setNgrxVersion = void 0;
26
+ exports.setNgrxVersion = setNgrxVersion;
27
+ exports.clearCache = clearCache;
28
+ exports.ngrxVersionSatisfies = ngrxVersionSatisfies;
27
29
  const semver = __importStar(require("semver"));
28
30
  const noopVersion = '0.0.0';
29
31
  const versionsCache = new Map();
@@ -49,13 +51,11 @@ function readPlatformVersion(pkg) {
49
51
  function setNgrxVersion(pkg, version) {
50
52
  versionsCache.set(pkg, version);
51
53
  }
52
- exports.setNgrxVersion = setNgrxVersion;
53
54
  // @internal for testing purposes
54
55
  function clearCache() {
55
56
  versionsCache.clear();
56
57
  satisfiesCache.clear();
57
58
  }
58
- exports.clearCache = clearCache;
59
59
  function versionSatisfies(pkg, version) {
60
60
  if (!satisfiesCache.has(pkg)) {
61
61
  satisfiesCache.set(pkg, semver.satisfies(getNgrxVersion(pkg), version));
@@ -65,5 +65,4 @@ function versionSatisfies(pkg, version) {
65
65
  function ngrxVersionSatisfies(pkg, version) {
66
66
  return versionSatisfies(pkg, version);
67
67
  }
68
- exports.ngrxVersionSatisfies = ngrxVersionSatisfies;
69
68
  //# sourceMappingURL=versions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/versions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC,MAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;AAChD,MAAM,cAAc,GAAG,IAAI,GAAG,EAAmB,CAAC;AAElD,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;QACzC,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,IAAI,WAAW,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,aAAa,CAAC,GAAG,CAAC,GAAG,CAAW,CAAC;AAC1C,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAW;IACtC,IAAI,CAAC;QACH,oGAAoG;QACpG,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,GAAG,eAAe,CAEhD,CAAC;QACF,OAAO,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACrD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,iCAAiC;AACjC,SAAgB,cAAc,CAAC,GAAW,EAAE,OAAe;IACzD,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAClC,CAAC;AAFD,wCAEC;AAED,iCAAiC;AACjC,SAAgB,UAAU;IACxB,aAAa,CAAC,KAAK,EAAE,CAAC;IACtB,cAAc,CAAC,KAAK,EAAE,CAAC;AACzB,CAAC;AAHD,gCAGC;AAED,SAAS,gBAAgB,CAAC,GAAW,EAAE,OAAe;IACpD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,cAAc,CAAC,GAAG,CAAC,GAAG,CAAY,CAAC;AAC5C,CAAC;AAED,SAAgB,oBAAoB,CAAC,GAAW,EAAE,OAAe;IAC/D,OAAO,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAFD,oDAEC","sourcesContent":["import * as semver from 'semver';\n\nconst noopVersion = '0.0.0';\nconst versionsCache = new Map<string, string>();\nconst satisfiesCache = new Map<string, boolean>();\n\nfunction getNgrxVersion(pkg: string): string {\n if (!versionsCache.has(pkg)) {\n const version = readPlatformVersion(pkg);\n versionsCache.set(pkg, version ?? noopVersion);\n }\n\n return versionsCache.get(pkg) as string;\n}\n\nfunction readPlatformVersion(pkg: string) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-require-imports\n const ngrxVersion = require(`${pkg}/package.json`) as {\n version?: string;\n };\n return ngrxVersion.version?.replace(/[^\\d.]/g, '');\n } catch {\n return null;\n }\n}\n\n// @internal for testing purposes\nexport function setNgrxVersion(pkg: string, version: string): void {\n versionsCache.set(pkg, version);\n}\n\n// @internal for testing purposes\nexport function clearCache() {\n versionsCache.clear();\n satisfiesCache.clear();\n}\n\nfunction versionSatisfies(pkg: string, version: string) {\n if (!satisfiesCache.has(pkg)) {\n satisfiesCache.set(pkg, semver.satisfies(getNgrxVersion(pkg), version));\n }\n\n return satisfiesCache.get(pkg) as boolean;\n}\n\nexport function ngrxVersionSatisfies(pkg: string, version: string): boolean {\n return versionSatisfies(pkg, version);\n}\n"]}
1
+ {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/versions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;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AC,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,cAAc,CAAC,GAAG,CAAC,GAAG,CAAY,CAAC;AAC5C,CAAC;AAED,SAAgB,oBAAoB,CAAC,GAAW,EAAE,OAAe;IAC/D,OAAO,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import * as semver from 'semver';\n\nconst noopVersion = '0.0.0';\nconst versionsCache = new Map<string, string>();\nconst satisfiesCache = new Map<string, boolean>();\n\nfunction getNgrxVersion(pkg: string): string {\n if (!versionsCache.has(pkg)) {\n const version = readPlatformVersion(pkg);\n versionsCache.set(pkg, version ?? noopVersion);\n }\n\n return versionsCache.get(pkg) as string;\n}\n\nfunction readPlatformVersion(pkg: string) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-require-imports\n const ngrxVersion = require(`${pkg}/package.json`) as {\n version?: string;\n };\n return ngrxVersion.version?.replace(/[^\\d.]/g, '');\n } catch {\n return null;\n }\n}\n\n// @internal for testing purposes\nexport function setNgrxVersion(pkg: string, version: string): void {\n versionsCache.set(pkg, version);\n}\n\n// @internal for testing purposes\nexport function clearCache() {\n versionsCache.clear();\n satisfiesCache.clear();\n}\n\nfunction versionSatisfies(pkg: string, version: string) {\n if (!satisfiesCache.has(pkg)) {\n satisfiesCache.set(pkg, semver.satisfies(getNgrxVersion(pkg), version));\n }\n\n return satisfiesCache.get(pkg) as boolean;\n}\n\nexport function ngrxVersionSatisfies(pkg: string, version: string): boolean {\n return versionSatisfies(pkg, version);\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapLikeOperatorCallExpressions = exports.actionReducerMap = exports.storeActionReducerMap = exports.onFunctionWithoutType = exports.createReducer = exports.dispatchInEffects = exports.dispatchExpression = exports.selectExpression = exports.pipeableSelect = exports.pipeExpression = exports.namedCallableExpression = exports.namedExpression = exports.effectsInNgModuleProviders = exports.effectsInNgModuleImports = exports.ngModuleProviders = exports.ngModuleImports = exports.ngModuleDecorator = exports.metadataProperty = exports.constructorDefinition = exports.actionCreatorPropsComputed = exports.actionCreatorProps = exports.actionCreatorWithLiteral = exports.actionCreator = exports.propertyDefinitionWithEffectDecorator = exports.effectDecorator = exports.createEffectExpression = exports.effectCreator = void 0;
3
+ exports.mapLikeOperatorCallExpressions = exports.actionReducerMap = exports.storeActionReducerMap = exports.onFunctionWithoutType = exports.createReducer = exports.dispatchInEffects = exports.dispatchExpression = exports.selectExpression = exports.pipeableSelect = exports.pipeExpression = exports.namedCallableExpression = exports.namedExpression = exports.effectsInNgModuleProviders = exports.effectsInNgModuleImports = exports.ngModuleProviders = exports.ngModuleImports = exports.ngModuleDecorator = exports.constructorDefinition = exports.actionCreatorPropsComputed = exports.actionCreatorProps = exports.actionCreatorWithLiteral = exports.actionCreator = exports.propertyDefinitionWithEffectDecorator = exports.effectDecorator = exports.createEffectExpression = exports.effectCreator = void 0;
4
+ exports.metadataProperty = metadataProperty;
4
5
  exports.effectCreator = `PropertyDefinition[value.callee.name='createEffect']`;
5
6
  exports.createEffectExpression = `CallExpression[callee.name='createEffect']`;
6
7
  exports.effectDecorator = `Decorator[expression.callee.name='Effect']`;
@@ -13,7 +14,6 @@ exports.constructorDefinition = `MethodDefinition[kind='constructor']`;
13
14
  function metadataProperty(key) {
14
15
  return `Property:matches([key.name=${key}][computed=false], [key.value=${key}], [key.quasis.0.value.raw=${key}])`;
15
16
  }
16
- exports.metadataProperty = metadataProperty;
17
17
  exports.ngModuleDecorator = `ClassDeclaration > Decorator > CallExpression[callee.name='NgModule']`;
18
18
  exports.ngModuleImports = `${exports.ngModuleDecorator} ObjectExpression ${metadataProperty('imports')} > ArrayExpression`;
19
19
  exports.ngModuleProviders = `${exports.ngModuleDecorator} ObjectExpression ${metadataProperty('providers')} > ArrayExpression`;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../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QAAA,uBAAuB,2BAG4L;AAEzN,MAAM,cAAc,GAAG,CAAC,IAAqB,EAAE,EAAE,CACtD,GAAG,IAAA,uBAAe,EAAC,IAAI,CAAC,+BAAwC,CAAC;AADtD,QAAA,cAAc,kBACwC;AAE5D,MAAM,cAAc,GAAG,CAAC,IAAqB,EAAE,EAAE,CACtD,GAAG,IAAA,sBAAc,EAAC,IAAI,CAAC,uCAAgD,CAAC;AAD7D,QAAA,cAAc,kBAC+C;AAEnE,MAAM,gBAAgB,GAAG,CAAC,IAAqB,EAAE,EAAE,CACxD,GAAG,IAAA,uBAAe,EAAC,IAAI,CAAC,iCAA0C,CAAC;AADxD,QAAA,gBAAgB,oBACwC;AAE9D,MAAM,kBAAkB,GAAG,CAAC,IAAqB,EAAE,EAAE,CAC1D,GAAG,IAAA,uBAAe,EAAC,IAAI,CAAC,mCAA4C,CAAC;AAD1D,QAAA,kBAAkB,sBACwC;AAEhE,MAAM,iBAAiB,GAAG,CAAC,IAAqB,EAAE,EAAE,CACzD,GAAG,8BAAsB,IAAI,IAAA,0BAAkB,EAC7C,IAAI,CACL,2CAA2C,IAAI,IAAa,CAAC;AAHnD,QAAA,iBAAiB,qBAGkC;AAEnD,QAAA,aAAa,GAAG,6CAA6C,CAAC;AAE9D,QAAA,qBAAqB,GAChC,GAAG,qBAAa,oHAA6H,CAAC;AAEnI,QAAA,qBAAqB,GAChC,GAAG,uBAAe,8HAAuI,CAAC;AAE/I,QAAA,gBAAgB,GAAG,0GAA0G,CAAC;AAE3I,MAAM,gBAAgB,GAAG,2CAA2C,CAAC;AACrE,MAAM,kBAAkB,GAAG,gCAAgC,CAAC;AAC/C,QAAA,8BAA8B,GACzC,uCAAuC,kBAAkB,iCAAiC,gBAAgB,2EAAoF,CAAC","sourcesContent":["export const effectCreator = `PropertyDefinition[value.callee.name='createEffect']`;\nexport const createEffectExpression = `CallExpression[callee.name='createEffect']`;\n\nexport const effectDecorator = `Decorator[expression.callee.name='Effect']`;\nexport const propertyDefinitionWithEffectDecorator =\n `ClassDeclaration > ClassBody > PropertyDefinition > ${effectDecorator}` as const;\n\nexport const actionCreator = `CallExpression[callee.name='createAction']`;\nexport const actionCreatorWithLiteral =\n `${actionCreator}[arguments.0.type='Literal'][arguments.0.raw=/^'/]` as const;\nexport const actionCreatorProps =\n `${actionCreator} > CallExpression[callee.name='props']` as const;\nexport const actionCreatorPropsComputed =\n `${actionCreatorProps} > TSTypeParameterInstantiation > :matches(TSTypeReference[typeName.name!='Readonly'], [type=/^TS(.*)(Keyword|Type)$/])` as const;\n\nexport const constructorDefinition = `MethodDefinition[kind='constructor']`;\n\nexport function metadataProperty(key: RegExp): string;\nexport function metadataProperty<TKey extends string>(\n key: TKey\n): `Property:matches([key.name=${TKey}][computed=false], [key.value=${TKey}], [key.quasis.0.value.raw=${TKey}])`;\nexport function metadataProperty(key: RegExp | string): string {\n return `Property:matches([key.name=${key}][computed=false], [key.value=${key}], [key.quasis.0.value.raw=${key}])`;\n}\n\nexport const ngModuleDecorator = `ClassDeclaration > Decorator > CallExpression[callee.name='NgModule']`;\n\nexport const ngModuleImports =\n `${ngModuleDecorator} ObjectExpression ${metadataProperty(\n 'imports'\n )} > ArrayExpression` as const;\n\nexport const ngModuleProviders =\n `${ngModuleDecorator} ObjectExpression ${metadataProperty(\n 'providers'\n )} > ArrayExpression` as const;\n\nexport const effectsInNgModuleImports =\n `${ngModuleImports} CallExpression[callee.object.name='EffectsModule'][callee.property.name=/^for(Root|Feature)$/] ArrayExpression > Identifier` as const;\n\nexport const effectsInNgModuleProviders =\n `${ngModuleProviders} Identifier` as const;\n\nexport const namedExpression = (name: RegExp | string) =>\n `:matches(${constructorDefinition} CallExpression[callee.object.name=${name}], CallExpression[callee.object.object.type='ThisExpression'][callee.object.property.name=${name}])` as const;\n\nexport const namedCallableExpression = (name: RegExp | string) =>\n `:matches(${namedExpression(\n name\n )}, ${constructorDefinition} CallExpression[callee.object.callee.object.name=${name}], CallExpression[callee.object.callee.object.object.type='ThisExpression'][callee.object.callee.object.property.name=${name}])` as const;\n\nexport const pipeExpression = (name: RegExp | string) =>\n `${namedExpression(name)}[callee.property.name='pipe']` as const;\n\nexport const pipeableSelect = (name: RegExp | string) =>\n `${pipeExpression(name)} CallExpression[callee.name='select']` as const;\n\nexport const selectExpression = (name: RegExp | string) =>\n `${namedExpression(name)}[callee.property.name='select']` as const;\n\nexport const dispatchExpression = (name: RegExp | string) =>\n `${namedExpression(name)}[callee.property.name='dispatch']` as const;\n\nexport const dispatchInEffects = (name: RegExp | string) =>\n `${createEffectExpression} ${dispatchExpression(\n name\n )} > MemberExpression:has(Identifier[name=${name}])` as const;\n\nexport const createReducer = `CallExpression[callee.name='createReducer']`;\n\nexport const onFunctionWithoutType =\n `${createReducer} CallExpression[callee.name='on'] > ArrowFunctionExpression:not([returnType.typeAnnotation], :has(CallExpression))` as const;\n\nexport const storeActionReducerMap =\n `${ngModuleImports} CallExpression[callee.object.name='StoreModule'][callee.property.name=/^for(Root|Feature)$/] > ObjectExpression:first-child` as const;\n\nexport const actionReducerMap = `VariableDeclarator[id.typeAnnotation.typeAnnotation.typeName.name='ActionReducerMap'] > ObjectExpression`;\n\nconst mapLikeOperators = '/^(concat|exhaust|flat|merge|switch)Map$/';\nconst mapLikeToOperators = '/^(concat|merge|switch)MapTo$/';\nexport const mapLikeOperatorCallExpressions =\n `:matches(CallExpression[callee.name=${mapLikeToOperators}], CallExpression[callee.name=${mapLikeOperators}] > :matches(ReturnStatement,ArrowFunctionExpression,FunctionExpression))` as const;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/selectors/index.ts"],"names":[],"mappings":";;;AAqBA,4CAEC;AAvBY,QAAA,aAAa,GAAG,sDAAsD,CAAC;AACvE,QAAA,sBAAsB,GAAG,4CAA4C,CAAC;AAEtE,QAAA,eAAe,GAAG,4CAA4C,CAAC;AAC/D,QAAA,qCAAqC,GAChD,uDAAuD,uBAAe,EAAW,CAAC;AAE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,CAAC,uCAAgD,CAAC;AAD7D,QAAA,cAAc,kBAC+C;AAEnE,MAAM,gBAAgB,GAAG,CAAC,IAAqB,EAAE,EAAE,CACxD,GAAG,IAAA,uBAAe,EAAC,IAAI,CAAC,iCAA0C,CAAC;AADxD,QAAA,gBAAgB,oBACwC;AAE9D,MAAM,kBAAkB,GAAG,CAAC,IAAqB,EAAE,EAAE,CAC1D,GAAG,IAAA,uBAAe,EAAC,IAAI,CAAC,mCAA4C,CAAC;AAD1D,QAAA,kBAAkB,sBACwC;AAEhE,MAAM,iBAAiB,GAAG,CAAC,IAAqB,EAAE,EAAE,CACzD,GAAG,8BAAsB,IAAI,IAAA,0BAAkB,EAC7C,IAAI,CACL,2CAA2C,IAAI,IAAa,CAAC;AAHnD,QAAA,iBAAiB,qBAGkC;AAEnD,QAAA,aAAa,GAAG,6CAA6C,CAAC;AAE9D,QAAA,qBAAqB,GAChC,GAAG,qBAAa,oHAA6H,CAAC;AAEnI,QAAA,qBAAqB,GAChC,GAAG,uBAAe,8HAAuI,CAAC;AAE/I,QAAA,gBAAgB,GAAG,0GAA0G,CAAC;AAE3I,MAAM,gBAAgB,GAAG,2CAA2C,CAAC;AACrE,MAAM,kBAAkB,GAAG,gCAAgC,CAAC;AAC/C,QAAA,8BAA8B,GACzC,uCAAuC,kBAAkB,iCAAiC,gBAAgB,2EAAoF,CAAC","sourcesContent":["export const effectCreator = `PropertyDefinition[value.callee.name='createEffect']`;\nexport const createEffectExpression = `CallExpression[callee.name='createEffect']`;\n\nexport const effectDecorator = `Decorator[expression.callee.name='Effect']`;\nexport const propertyDefinitionWithEffectDecorator =\n `ClassDeclaration > ClassBody > PropertyDefinition > ${effectDecorator}` as const;\n\nexport const actionCreator = `CallExpression[callee.name='createAction']`;\nexport const actionCreatorWithLiteral =\n `${actionCreator}[arguments.0.type='Literal'][arguments.0.raw=/^'/]` as const;\nexport const actionCreatorProps =\n `${actionCreator} > CallExpression[callee.name='props']` as const;\nexport const actionCreatorPropsComputed =\n `${actionCreatorProps} > TSTypeParameterInstantiation > :matches(TSTypeReference[typeName.name!='Readonly'], [type=/^TS(.*)(Keyword|Type)$/])` as const;\n\nexport const constructorDefinition = `MethodDefinition[kind='constructor']`;\n\nexport function metadataProperty(key: RegExp): string;\nexport function metadataProperty<TKey extends string>(\n key: TKey\n): `Property:matches([key.name=${TKey}][computed=false], [key.value=${TKey}], [key.quasis.0.value.raw=${TKey}])`;\nexport function metadataProperty(key: RegExp | string): string {\n return `Property:matches([key.name=${key}][computed=false], [key.value=${key}], [key.quasis.0.value.raw=${key}])`;\n}\n\nexport const ngModuleDecorator = `ClassDeclaration > Decorator > CallExpression[callee.name='NgModule']`;\n\nexport const ngModuleImports =\n `${ngModuleDecorator} ObjectExpression ${metadataProperty(\n 'imports'\n )} > ArrayExpression` as const;\n\nexport const ngModuleProviders =\n `${ngModuleDecorator} ObjectExpression ${metadataProperty(\n 'providers'\n )} > ArrayExpression` as const;\n\nexport const effectsInNgModuleImports =\n `${ngModuleImports} CallExpression[callee.object.name='EffectsModule'][callee.property.name=/^for(Root|Feature)$/] ArrayExpression > Identifier` as const;\n\nexport const effectsInNgModuleProviders =\n `${ngModuleProviders} Identifier` as const;\n\nexport const namedExpression = (name: RegExp | string) =>\n `:matches(${constructorDefinition} CallExpression[callee.object.name=${name}], CallExpression[callee.object.object.type='ThisExpression'][callee.object.property.name=${name}])` as const;\n\nexport const namedCallableExpression = (name: RegExp | string) =>\n `:matches(${namedExpression(\n name\n )}, ${constructorDefinition} CallExpression[callee.object.callee.object.name=${name}], CallExpression[callee.object.callee.object.object.type='ThisExpression'][callee.object.callee.object.property.name=${name}])` as const;\n\nexport const pipeExpression = (name: RegExp | string) =>\n `${namedExpression(name)}[callee.property.name='pipe']` as const;\n\nexport const pipeableSelect = (name: RegExp | string) =>\n `${pipeExpression(name)} CallExpression[callee.name='select']` as const;\n\nexport const selectExpression = (name: RegExp | string) =>\n `${namedExpression(name)}[callee.property.name='select']` as const;\n\nexport const dispatchExpression = (name: RegExp | string) =>\n `${namedExpression(name)}[callee.property.name='dispatch']` as const;\n\nexport const dispatchInEffects = (name: RegExp | string) =>\n `${createEffectExpression} ${dispatchExpression(\n name\n )} > MemberExpression:has(Identifier[name=${name}])` as const;\n\nexport const createReducer = `CallExpression[callee.name='createReducer']`;\n\nexport const onFunctionWithoutType =\n `${createReducer} CallExpression[callee.name='on'] > ArrowFunctionExpression:not([returnType.typeAnnotation], :has(CallExpression))` as const;\n\nexport const storeActionReducerMap =\n `${ngModuleImports} CallExpression[callee.object.name='StoreModule'][callee.property.name=/^for(Root|Feature)$/] > ObjectExpression:first-child` as const;\n\nexport const actionReducerMap = `VariableDeclarator[id.typeAnnotation.typeAnnotation.typeName.name='ActionReducerMap'] > ObjectExpression`;\n\nconst mapLikeOperators = '/^(concat|exhaust|flat|merge|switch)Map$/';\nconst mapLikeToOperators = '/^(concat|merge|switch)MapTo$/';\nexport const mapLikeOperatorCallExpressions =\n `:matches(CallExpression[callee.name=${mapLikeToOperators}], CallExpression[callee.name=${mapLikeOperators}] > :matches(ReturnStatement,ArrowFunctionExpression,FunctionExpression))` as const;\n"]}