@ngrx/eslint-plugin 15.3.0 → 16.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/jest.config.js +17 -14
  2. package/jest.config.js.map +1 -1
  3. package/package.json +1 -1
  4. package/schematics/ng-add/index.js +6 -6
  5. package/schematics/ng-add/index.js.map +1 -1
  6. package/schematics/ng-add/schema.js +1 -1
  7. package/scripts/generate-config.js +2 -2
  8. package/scripts/generate-docs.js +2 -2
  9. package/scripts/generate-overview.js +1 -1
  10. package/spec/utils/index.js +3 -3
  11. package/src/configs/all-requiring-type-checking.js +3 -3
  12. package/src/configs/all.js +2 -2
  13. package/src/configs/component-store-strict.js +1 -1
  14. package/src/configs/component-store.js +1 -1
  15. package/src/configs/effects-requiring-type-checking.js +3 -3
  16. package/src/configs/effects-strict-requiring-type-checking.js +3 -3
  17. package/src/configs/effects-strict.js +2 -2
  18. package/src/configs/effects.js +2 -2
  19. package/src/configs/index.js +3 -3
  20. package/src/configs/index.js.map +1 -1
  21. package/src/configs/recommended-requiring-type-checking.js +3 -3
  22. package/src/configs/recommended.js +2 -2
  23. package/src/configs/store-strict.js +2 -2
  24. package/src/configs/store.js +2 -2
  25. package/src/configs/strict-requiring-type-checking.js +3 -3
  26. package/src/configs/strict.js +2 -2
  27. package/src/index.js +1 -1
  28. package/src/rule-creator.js +1 -1
  29. package/src/rules/component-store/updater-explicit-return-type.js +6 -6
  30. package/src/rules/component-store/updater-explicit-return-type.js.map +1 -1
  31. package/src/rules/effects/avoid-cyclic-effects.js +8 -8
  32. package/src/rules/effects/avoid-cyclic-effects.js.map +1 -1
  33. package/src/rules/effects/no-dispatch-in-effects.js +7 -7
  34. package/src/rules/effects/no-dispatch-in-effects.js.map +1 -1
  35. package/src/rules/effects/no-effects-in-providers.js +7 -7
  36. package/src/rules/effects/no-effects-in-providers.js.map +1 -1
  37. package/src/rules/effects/no-multiple-actions-in-effects.js +6 -6
  38. package/src/rules/effects/no-multiple-actions-in-effects.js.map +1 -1
  39. package/src/rules/effects/prefer-action-creator-in-of-type.js +6 -6
  40. package/src/rules/effects/prefer-action-creator-in-of-type.js.map +1 -1
  41. package/src/rules/effects/prefer-concat-latest-from.js +13 -13
  42. package/src/rules/effects/prefer-concat-latest-from.js.map +1 -1
  43. package/src/rules/effects/prefer-effect-callback-in-block-statement.js +6 -6
  44. package/src/rules/effects/prefer-effect-callback-in-block-statement.js.map +1 -1
  45. package/src/rules/effects/use-effects-lifecycle-interface.js +9 -9
  46. package/src/rules/effects/use-effects-lifecycle-interface.js.map +1 -1
  47. package/src/rules/index.js +3 -3
  48. package/src/rules/index.js.map +1 -1
  49. package/src/rules/store/avoid-combining-selectors.js +7 -7
  50. package/src/rules/store/avoid-combining-selectors.js.map +1 -1
  51. package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js +7 -7
  52. package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js.map +1 -1
  53. package/src/rules/store/avoid-duplicate-actions-in-reducer.js +10 -10
  54. package/src/rules/store/avoid-duplicate-actions-in-reducer.js.map +1 -1
  55. package/src/rules/store/avoid-mapping-selectors.js +6 -6
  56. package/src/rules/store/avoid-mapping-selectors.js.map +1 -1
  57. package/src/rules/store/good-action-hygiene.js +7 -7
  58. package/src/rules/store/good-action-hygiene.js.map +1 -1
  59. package/src/rules/store/no-multiple-global-stores.js +10 -10
  60. package/src/rules/store/no-multiple-global-stores.js.map +1 -1
  61. package/src/rules/store/no-reducer-in-key-names.js +7 -7
  62. package/src/rules/store/no-reducer-in-key-names.js.map +1 -1
  63. package/src/rules/store/no-store-subscription.js +6 -6
  64. package/src/rules/store/no-store-subscription.js.map +1 -1
  65. package/src/rules/store/no-typed-global-store.js +9 -9
  66. package/src/rules/store/no-typed-global-store.js.map +1 -1
  67. package/src/rules/store/on-function-explicit-return-type.js +7 -7
  68. package/src/rules/store/on-function-explicit-return-type.js.map +1 -1
  69. package/src/rules/store/prefer-action-creator-in-dispatch.js +6 -6
  70. package/src/rules/store/prefer-action-creator-in-dispatch.js.map +1 -1
  71. package/src/rules/store/prefer-action-creator.js +6 -6
  72. package/src/rules/store/prefer-action-creator.js.map +1 -1
  73. package/src/rules/store/prefer-inline-action-props.js +7 -7
  74. package/src/rules/store/prefer-inline-action-props.js.map +1 -1
  75. package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js +7 -7
  76. package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js.map +1 -1
  77. package/src/rules/store/prefer-selector-in-select.js +7 -7
  78. package/src/rules/store/prefer-selector-in-select.js.map +1 -1
  79. package/src/rules/store/prefix-selectors-with-select.js +10 -10
  80. package/src/rules/store/prefix-selectors-with-select.js.map +1 -1
  81. package/src/rules/store/select-style.js +12 -12
  82. package/src/rules/store/select-style.js.map +1 -1
  83. package/src/rules/store/use-consistent-global-store-name.js +10 -10
  84. package/src/rules/store/use-consistent-global-store-name.js.map +1 -1
  85. package/src/utils/helper-functions/docs.js +1 -1
  86. package/src/utils/helper-functions/folder.js +4 -4
  87. package/src/utils/helper-functions/guards.js +1 -1
  88. package/src/utils/helper-functions/index.js +1 -1
  89. package/src/utils/helper-functions/ngrx-modules.js +1 -1
  90. package/src/utils/helper-functions/utils.js +3 -3
  91. package/src/utils/helper-functions/versions.js +1 -1
  92. package/src/utils/index.js +1 -1
  93. package/src/utils/selectors/index.js +1 -1
@@ -59,34 +59,34 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
59
59
  return to.concat(ar || Array.prototype.slice.call(from));
60
60
  };
61
61
  var _a;
62
- exports.__esModule = true;
62
+ Object.defineProperty(exports, "__esModule", { value: true });
63
63
  exports.selectOperator = exports.selectMethod = void 0;
64
64
  var path = __importStar(require("path"));
65
65
  var rule_creator_1 = require("../../rule-creator");
66
66
  var utils_1 = require("../../utils");
67
67
  exports.selectMethod = 'selectMethod';
68
68
  exports.selectOperator = 'selectOperator';
69
- exports["default"] = (0, rule_creator_1.createRule)({
69
+ exports.default = (0, rule_creator_1.createRule)({
70
70
  name: path.parse(__filename).name,
71
71
  meta: {
72
72
  type: 'suggestion',
73
73
  ngrxModule: 'store',
74
74
  docs: {
75
75
  description: 'Selector can be used either with `select` as a pipeable operator or as a method.',
76
- recommended: 'warn'
76
+ recommended: 'warn',
77
77
  },
78
78
  fixable: 'code',
79
79
  schema: [
80
80
  {
81
81
  type: 'string',
82
- "enum": ["method" /* SelectStyle.Method */, "operator" /* SelectStyle.Operator */],
83
- additionalProperties: false
82
+ enum: ["method" /* SelectStyle.Method */, "operator" /* SelectStyle.Operator */],
83
+ additionalProperties: false,
84
84
  },
85
85
  ],
86
86
  messages: (_a = {},
87
87
  _a["method" /* SelectStyle.Method */] = 'Selector should be used with select method: `this.store.select(selector)`.',
88
88
  _a["operator" /* SelectStyle.Operator */] = 'Selector should be used with the pipeable operator: `this.store.pipe(select(selector))`.',
89
- _a)
89
+ _a),
90
90
  },
91
91
  defaultOptions: ["method" /* SelectStyle.Method */],
92
92
  create: function (context, _a) {
@@ -103,7 +103,7 @@ exports["default"] = (0, rule_creator_1.createRule)({
103
103
  context.report({
104
104
  node: node.callee.property,
105
105
  messageId: "operator" /* SelectStyle.Operator */,
106
- fix: function (fixer) { return getMethodToOperatorFixes(node, fixer); }
106
+ fix: function (fixer) { return getMethodToOperatorFixes(node, fixer); },
107
107
  });
108
108
  },
109
109
  _b;
@@ -116,7 +116,7 @@ exports["default"] = (0, rule_creator_1.createRule)({
116
116
  messageId: "method" /* SelectStyle.Method */,
117
117
  fix: function (fixer) {
118
118
  return (0, utils_1.getImportRemoveFix)(sourceCode, [node.parent], 'select', fixer);
119
- }
119
+ },
120
120
  });
121
121
  var _b = __read(context.getDeclaredVariables(node), 1), references = _b[0].references;
122
122
  var _loop_1 = function (identifier) {
@@ -125,7 +125,7 @@ exports["default"] = (0, rule_creator_1.createRule)({
125
125
  messageId: "method" /* SelectStyle.Method */,
126
126
  fix: function (fixer) {
127
127
  return getOperatorToMethodFixes(identifier, sourceCode, fixer);
128
- }
128
+ },
129
129
  });
130
130
  };
131
131
  try {
@@ -137,13 +137,13 @@ exports["default"] = (0, rule_creator_1.createRule)({
137
137
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
138
138
  finally {
139
139
  try {
140
- if (references_1_1 && !references_1_1.done && (_a = references_1["return"])) _a.call(references_1);
140
+ if (references_1_1 && !references_1_1.done && (_a = references_1.return)) _a.call(references_1);
141
141
  }
142
142
  finally { if (e_1) throw e_1.error; }
143
143
  }
144
144
  },
145
145
  _c;
146
- }
146
+ },
147
147
  });
148
148
  function getMethodToOperatorFixes(node, fixer) {
149
149
  var classDeclaration = (0, utils_1.getNearestUpperNodeFrom)(node, utils_1.isClassDeclaration);
@@ -157,7 +157,7 @@ function getMethodToOperatorFixes(node, fixer) {
157
157
  fixer: fixer,
158
158
  importName: 'select',
159
159
  moduleName: utils_1.NGRX_MODULE_PATHS.store,
160
- node: classDeclaration
160
+ node: classDeclaration,
161
161
  }));
162
162
  }
163
163
  function getOperatorToMethodFixes(identifier, sourceCode, fixer) {
@@ -1 +1 @@
1
- {"version":3,"file":"select-style.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/select-style.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAYqB;AAER,QAAA,YAAY,GAAG,cAAc,CAAC;AAC9B,QAAA,cAAc,GAAG,gBAAgB,CAAC;AAwB/C,qBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EACT,kFAAkF;YACpF,WAAW,EAAE,MAAM;SACpB;QACD,OAAO,EAAE,MAAM;QACf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K,CAAC,oBAAoB,CAAC,CAAC,cAAc,EAAE,cAAc,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC;KACtE,CAAC;AACJ,CAAC","sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n getImportAddFix,\n getImportRemoveFix,\n getNearestUpperNodeFrom,\n getNgRxStores,\n isCallExpression,\n isClassDeclaration,\n isMemberExpression,\n NGRX_MODULE_PATHS,\n pipeableSelect,\n selectExpression,\n} from '../../utils';\n\nexport const selectMethod = 'selectMethod';\nexport const selectOperator = 'selectOperator';\n\nexport const enum SelectStyle {\n Method = 'method',\n Operator = 'operator',\n}\n\ntype MessageIds = `${SelectStyle}`;\ntype Options = readonly [MessageIds];\ntype MemberExpressionWithProperty = Omit<\n TSESTree.MemberExpression,\n 'property'\n> & {\n property: TSESTree.Identifier;\n};\ntype CallExpression = Omit<TSESTree.CallExpression, 'parent'> & {\n callee: MemberExpressionWithProperty;\n parent: TSESTree.CallExpression & {\n callee: Omit<TSESTree.MemberExpression, 'object'> & {\n object: MemberExpressionWithProperty;\n };\n };\n};\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'store',\n docs: {\n description:\n 'Selector can be used either with `select` as a pipeable operator or as a method.',\n recommended: 'warn',\n },\n fixable: 'code',\n schema: [\n {\n type: 'string',\n enum: [SelectStyle.Method, SelectStyle.Operator],\n additionalProperties: false,\n },\n ],\n messages: {\n [SelectStyle.Method]:\n 'Selector should be used with select method: `this.store.select(selector)`.',\n [SelectStyle.Operator]:\n 'Selector should be used with the pipeable operator: `this.store.pipe(select(selector))`.',\n },\n },\n defaultOptions: [SelectStyle.Method],\n create: (context, [mode]) => {\n const { identifiers = [], sourceCode } = getNgRxStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!storeNames) {\n return {};\n }\n\n if (mode === SelectStyle.Operator) {\n return {\n [selectExpression(storeNames)](node: CallExpression) {\n context.report({\n node: node.callee.property,\n messageId: SelectStyle.Operator,\n fix: (fixer) => getMethodToOperatorFixes(node, fixer),\n });\n },\n };\n }\n\n return {\n [`Program:has(${pipeableSelect(\n storeNames\n )}) ImportDeclaration[source.value='${\n NGRX_MODULE_PATHS.store\n }'] > ImportSpecifier[imported.name='select']`](\n node: TSESTree.ImportSpecifier & {\n parent: TSESTree.ImportDeclaration;\n }\n ) {\n context.report({\n node,\n messageId: SelectStyle.Method,\n fix: (fixer) =>\n getImportRemoveFix(sourceCode, [node.parent], 'select', fixer),\n });\n\n const [{ references }] = context.getDeclaredVariables(node);\n\n for (const { identifier } of references) {\n context.report({\n node: identifier,\n messageId: SelectStyle.Method,\n fix: (fixer) =>\n getOperatorToMethodFixes(identifier, sourceCode, fixer),\n });\n }\n },\n };\n },\n});\n\nfunction getMethodToOperatorFixes(\n node: CallExpression,\n fixer: TSESLint.RuleFixer\n): readonly TSESLint.RuleFix[] {\n const classDeclaration = getNearestUpperNodeFrom(node, isClassDeclaration);\n\n if (!classDeclaration) {\n return [];\n }\n\n return [\n fixer.insertTextBefore(node.callee.property, 'pipe('),\n fixer.insertTextAfter(node, ')'),\n ].concat(\n getImportAddFix({\n fixer,\n importName: 'select',\n moduleName: NGRX_MODULE_PATHS.store,\n node: classDeclaration,\n })\n );\n}\n\nfunction getOperatorToMethodFixes(\n identifier: TSESTree.Node,\n sourceCode: Readonly<TSESLint.SourceCode>,\n fixer: TSESLint.RuleFixer\n): readonly TSESLint.RuleFix[] {\n const select = identifier.parent;\n const storePipe = select?.parent;\n\n if (\n !storePipe ||\n !isCallExpression(storePipe) ||\n !isMemberExpression(storePipe.callee)\n ) {\n return [];\n }\n\n const pipeContainsOnlySelect = storePipe.arguments.length === 1;\n\n if (!pipeContainsOnlySelect) {\n const selectContent = sourceCode.getText(select);\n const nextTokenAfterSelect = sourceCode.getTokenAfter(select);\n const store = storePipe.callee.object;\n return [\n fixer.remove(select),\n ...(nextTokenAfterSelect ? [fixer.remove(nextTokenAfterSelect)] : []),\n fixer.insertTextAfter(store, `.${selectContent}`),\n ];\n }\n\n const { property } = storePipe.callee;\n const nextTokenAfterPipe = sourceCode.getTokenAfter(property);\n const [pipeInitialRange, pipeEndRange] = property.range;\n const pipeRange: TSESTree.Range = [\n pipeInitialRange,\n nextTokenAfterPipe?.range[1] ?? pipeEndRange,\n ];\n const [, selectEndRange] = identifier.range;\n return [\n fixer.removeRange(pipeRange),\n fixer.insertTextAfterRange([selectEndRange, selectEndRange + 1], '('),\n ];\n}\n"]}
1
+ {"version":3,"file":"select-style.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/select-style.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAYqB;AAER,QAAA,YAAY,GAAG,cAAc,CAAC;AAC9B,QAAA,cAAc,GAAG,gBAAgB,CAAC;AAwB/C,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EACT,kFAAkF;YACpF,WAAW,EAAE,MAAM;SACpB;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,0EAA0C;gBAChD,oBAAoB,EAAE,KAAK;aAC5B;SACF;QACD,QAAQ;YACN,wCACE,4EAA4E;YAC9E,4CACE,0FAA0F;eAC7F;KACF;IACD,cAAc,EAAE,mCAAoB;IACpC,MAAM,EAAE,UAAC,OAAO,EAAE,EAAM;;YAAN,KAAA,aAAM,EAAL,IAAI,QAAA;QACf,IAAA,KAAmC,I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AG,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACjD,IAAM,oBAAoB,GAAG,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC9D,IAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC;QACtC;YACE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;kBACjB,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACrE,KAAK,CAAC,eAAe,CAAC,KAAK,EAAE,WAAI,aAAa,CAAE,CAAC;kBACjD;KACH;IAEO,IAAA,QAAQ,GAAK,SAAS,CAAC,MAAM,SAArB,CAAsB;IACtC,IAAM,kBAAkB,GAAG,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACxD,IAAA,KAAA,OAAmC,QAAQ,CAAC,KAAK,IAAA,EAAhD,gBAAgB,QAAA,EAAE,YAAY,QAAkB,CAAC;IACxD,IAAM,SAAS,GAAmB;QAChC,gBAAgB;QAChB,MAAA,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,KAAK,CAAC,CAAC,CAAC,mCAAI,YAAY;KAC7C,CAAC;IACI,IAAA,KAAA,OAAqB,UAAU,CAAC,KAAK,IAAA,EAAlC,cAAc,QAAoB,CAAC;IAC5C,OAAO;QACL,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC;QAC5B,KAAK,CAAC,oBAAoB,CAAC,CAAC,cAAc,EAAE,cAAc,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC;KACtE,CAAC;AACJ,CAAC","sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n getImportAddFix,\n getImportRemoveFix,\n getNearestUpperNodeFrom,\n getNgRxStores,\n isCallExpression,\n isClassDeclaration,\n isMemberExpression,\n NGRX_MODULE_PATHS,\n pipeableSelect,\n selectExpression,\n} from '../../utils';\n\nexport const selectMethod = 'selectMethod';\nexport const selectOperator = 'selectOperator';\n\nexport const enum SelectStyle {\n Method = 'method',\n Operator = 'operator',\n}\n\ntype MessageIds = `${SelectStyle}`;\ntype Options = readonly [MessageIds];\ntype MemberExpressionWithProperty = Omit<\n TSESTree.MemberExpression,\n 'property'\n> & {\n property: TSESTree.Identifier;\n};\ntype CallExpression = Omit<TSESTree.CallExpression, 'parent'> & {\n callee: MemberExpressionWithProperty;\n parent: TSESTree.CallExpression & {\n callee: Omit<TSESTree.MemberExpression, 'object'> & {\n object: MemberExpressionWithProperty;\n };\n };\n};\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'store',\n docs: {\n description:\n 'Selector can be used either with `select` as a pipeable operator or as a method.',\n recommended: 'warn',\n },\n fixable: 'code',\n schema: [\n {\n type: 'string',\n enum: [SelectStyle.Method, SelectStyle.Operator],\n additionalProperties: false,\n },\n ],\n messages: {\n [SelectStyle.Method]:\n 'Selector should be used with select method: `this.store.select(selector)`.',\n [SelectStyle.Operator]:\n 'Selector should be used with the pipeable operator: `this.store.pipe(select(selector))`.',\n },\n },\n defaultOptions: [SelectStyle.Method],\n create: (context, [mode]) => {\n const { identifiers = [], sourceCode } = getNgRxStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!storeNames) {\n return {};\n }\n\n if (mode === SelectStyle.Operator) {\n return {\n [selectExpression(storeNames)](node: CallExpression) {\n context.report({\n node: node.callee.property,\n messageId: SelectStyle.Operator,\n fix: (fixer) => getMethodToOperatorFixes(node, fixer),\n });\n },\n };\n }\n\n return {\n [`Program:has(${pipeableSelect(\n storeNames\n )}) ImportDeclaration[source.value='${\n NGRX_MODULE_PATHS.store\n }'] > ImportSpecifier[imported.name='select']`](\n node: TSESTree.ImportSpecifier & {\n parent: TSESTree.ImportDeclaration;\n }\n ) {\n context.report({\n node,\n messageId: SelectStyle.Method,\n fix: (fixer) =>\n getImportRemoveFix(sourceCode, [node.parent], 'select', fixer),\n });\n\n const [{ references }] = context.getDeclaredVariables(node);\n\n for (const { identifier } of references) {\n context.report({\n node: identifier,\n messageId: SelectStyle.Method,\n fix: (fixer) =>\n getOperatorToMethodFixes(identifier, sourceCode, fixer),\n });\n }\n },\n };\n },\n});\n\nfunction getMethodToOperatorFixes(\n node: CallExpression,\n fixer: TSESLint.RuleFixer\n): readonly TSESLint.RuleFix[] {\n const classDeclaration = getNearestUpperNodeFrom(node, isClassDeclaration);\n\n if (!classDeclaration) {\n return [];\n }\n\n return [\n fixer.insertTextBefore(node.callee.property, 'pipe('),\n fixer.insertTextAfter(node, ')'),\n ].concat(\n getImportAddFix({\n fixer,\n importName: 'select',\n moduleName: NGRX_MODULE_PATHS.store,\n node: classDeclaration,\n })\n );\n}\n\nfunction getOperatorToMethodFixes(\n identifier: TSESTree.Node,\n sourceCode: Readonly<TSESLint.SourceCode>,\n fixer: TSESLint.RuleFixer\n): readonly TSESLint.RuleFix[] {\n const select = identifier.parent;\n const storePipe = select?.parent;\n\n if (\n !storePipe ||\n !isCallExpression(storePipe) ||\n !isMemberExpression(storePipe.callee)\n ) {\n return [];\n }\n\n const pipeContainsOnlySelect = storePipe.arguments.length === 1;\n\n if (!pipeContainsOnlySelect) {\n const selectContent = sourceCode.getText(select);\n const nextTokenAfterSelect = sourceCode.getTokenAfter(select);\n const store = storePipe.callee.object;\n return [\n fixer.remove(select),\n ...(nextTokenAfterSelect ? [fixer.remove(nextTokenAfterSelect)] : []),\n fixer.insertTextAfter(store, `.${selectContent}`),\n ];\n }\n\n const { property } = storePipe.callee;\n const nextTokenAfterPipe = sourceCode.getTokenAfter(property);\n const [pipeInitialRange, pipeEndRange] = property.range;\n const pipeRange: TSESTree.Range = [\n pipeInitialRange,\n nextTokenAfterPipe?.range[1] ?? pipeEndRange,\n ];\n const [, selectEndRange] = identifier.range;\n return [\n fixer.removeRange(pipeRange),\n fixer.insertTextAfterRange([selectEndRange, selectEndRange + 1], '('),\n ];\n}\n"]}
@@ -61,14 +61,14 @@ var __values = (this && this.__values) || function(o) {
61
61
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
62
62
  };
63
63
  var _a;
64
- exports.__esModule = true;
64
+ Object.defineProperty(exports, "__esModule", { value: true });
65
65
  exports.useConsistentGlobalStoreNameSuggest = exports.useConsistentGlobalStoreName = void 0;
66
66
  var path = __importStar(require("path"));
67
67
  var rule_creator_1 = require("../../rule-creator");
68
68
  var utils_1 = require("../../utils");
69
69
  exports.useConsistentGlobalStoreName = 'useConsistentGlobalStoreName';
70
70
  exports.useConsistentGlobalStoreNameSuggest = 'useConsistentGlobalStoreNameSuggest';
71
- exports["default"] = (0, rule_creator_1.createRule)({
71
+ exports.default = (0, rule_creator_1.createRule)({
72
72
  name: path.parse(__filename).name,
73
73
  meta: {
74
74
  type: 'suggestion',
@@ -77,18 +77,18 @@ exports["default"] = (0, rule_creator_1.createRule)({
77
77
  docs: {
78
78
  description: 'Use a consistent name for the global store.',
79
79
  recommended: 'warn',
80
- suggestion: true
80
+ suggestion: true,
81
81
  },
82
82
  schema: [
83
83
  {
84
84
  type: 'string',
85
- additionalProperties: false
85
+ additionalProperties: false,
86
86
  },
87
87
  ],
88
88
  messages: (_a = {},
89
89
  _a[exports.useConsistentGlobalStoreName] = 'Global store should be named as `{{ storeName }}`.',
90
90
  _a[exports.useConsistentGlobalStoreNameSuggest] = 'Rename it to `{{ storeName }}`.',
91
- _a)
91
+ _a),
92
92
  },
93
93
  defaultOptions: ['store'],
94
94
  create: function (context, _a) {
@@ -112,9 +112,9 @@ exports["default"] = (0, rule_creator_1.createRule)({
112
112
  data: data,
113
113
  fix: function (fixer) {
114
114
  return fixer.replaceTextRange([range[0], typeAnnotation.range[0]], storeName);
115
- }
115
+ },
116
116
  },
117
- ]
117
+ ],
118
118
  });
119
119
  };
120
120
  try {
@@ -128,12 +128,12 @@ exports["default"] = (0, rule_creator_1.createRule)({
128
128
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
129
129
  finally {
130
130
  try {
131
- if (identifiers_1_1 && !identifiers_1_1.done && (_a = identifiers_1["return"])) _a.call(identifiers_1);
131
+ if (identifiers_1_1 && !identifiers_1_1.done && (_a = identifiers_1.return)) _a.call(identifiers_1);
132
132
  }
133
133
  finally { if (e_1) throw e_1.error; }
134
134
  }
135
- }
135
+ },
136
136
  };
137
- }
137
+ },
138
138
  });
139
139
  //# sourceMappingURL=use-consistent-global-store-name.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-consistent-global-store-name.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/use-consistent-global-store-name.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAA4C;AAE/B,QAAA,4BAA4B,GAAG,8BAA8B,CAAC;AAC9D,QAAA,mCAAmC,GAC9C,qCAAqC,CAAC;AAOxC,qBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,6CAA6C;YAC1D,WAAW,EAAE,MAAM;YACnB,UAAU,EAAE,IAAI;SACjB;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,oBAAoB,EAAE,KAAK;aAC5B;SACF;QACD,QAAQ;YACN,GAAC,oCAA4B,IAC3B,oDAAoD;YACtD,GAAC,2CAAmC,IAAG,iCAAiC;eACzE;KACF;IACD,cAAc,EAAE,CAAC,OAAO,CAAC;IACzB,MAAM,EAAE,UAAC,OAAO,EAAE,EAAW;YAAX,KAAA,aAAW,EAAV,SAAS,QAAA;QAC1B,OAAO;YACL,OAAO;;gBACG,IAAA,KAAqB,IAAA,qBAAa,EAAC,OAAO,CAAC,YAA3B,EAAhB,WAAW,mBAAG,EAAE,KAAA,CAA4B;wCAEvC,GAAG,EAAE,MAAI,EAAE,KAAK,EAAE,cAAc;oBAC3C,IAAI,MAAI,KAAK,SAAS,EAAE;;qBAEvB;oBAED,IAAM,IAAI,GAAG,EAAE,SAAS,WAAA,EAAE,CAAC;oBAC3B,OAAO,CAAC,MAAM,CAAC;wBACb,GAAG,wBACE,GAAG,KACN,GAAG,wBACE,GAAG,CAAC,KAAK,KACZ,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,MAAI,CAAC,MAAM,MAEzC;wBACD,SAAS,EAAE,oCAA4B;wBACvC,IAAI,MAAA;wBACJ,OAAO,EAAE;4BACP;gCACE,SAAS,EAAE,2CAAmC;gCAC9C,IAAI,MAAA;gCACJ,GAAG,EAAE,UAAC,KAAK;oCACT,OAAA,KAAK,CAAC,gBAAgB,CACpB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACnC,SAAS,CACV;gCAHD,CAGC;6BACJ;yBACF;qBACF,CAAC,CAAC;;;oBA3BL,KAAmD,IAAA,gBAAA,SAAA,WAAW,CAAA,wCAAA;wBAAnD,IAAA,0BAAoC,EAAlC,GAAG,SAAA,EAAE,MAAI,UAAA,EAAE,KAAK,WAAA,EAAE,cAAc,oBAAA;8CAAhC,GAAG,EAAE,MAAI,EAAE,KAAK,EAAE,cAAc;;;qBA4B5C;;;;;;;;;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { getNgRxStores } from '../../utils';\n\nexport const useConsistentGlobalStoreName = 'useConsistentGlobalStoreName';\nexport const useConsistentGlobalStoreNameSuggest =\n 'useConsistentGlobalStoreNameSuggest';\n\ntype MessageIds =\n | typeof useConsistentGlobalStoreName\n | typeof useConsistentGlobalStoreNameSuggest;\ntype Options = readonly [string];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n ngrxModule: 'store',\n docs: {\n description: 'Use a consistent name for the global store.',\n recommended: 'warn',\n suggestion: true,\n },\n schema: [\n {\n type: 'string',\n additionalProperties: false,\n },\n ],\n messages: {\n [useConsistentGlobalStoreName]:\n 'Global store should be named as `{{ storeName }}`.',\n [useConsistentGlobalStoreNameSuggest]: 'Rename it to `{{ storeName }}`.',\n },\n },\n defaultOptions: ['store'],\n create: (context, [storeName]) => {\n return {\n Program() {\n const { identifiers = [] } = getNgRxStores(context);\n\n for (const { loc, name, range, typeAnnotation } of identifiers) {\n if (name === storeName) {\n return;\n }\n\n const data = { storeName };\n context.report({\n loc: {\n ...loc,\n end: {\n ...loc.start,\n column: loc.start.column + name.length,\n },\n },\n messageId: useConsistentGlobalStoreName,\n data,\n suggest: [\n {\n messageId: useConsistentGlobalStoreNameSuggest,\n data,\n fix: (fixer) =>\n fixer.replaceTextRange(\n [range[0], typeAnnotation.range[0]],\n storeName\n ),\n },\n ],\n });\n }\n },\n };\n },\n});\n"]}
1
+ {"version":3,"file":"use-consistent-global-store-name.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/use-consistent-global-store-name.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAA4C;AAE/B,QAAA,4BAA4B,GAAG,8BAA8B,CAAC;AAC9D,QAAA,mCAAmC,GAC9C,qCAAqC,CAAC;AAOxC,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI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yBACF;qBACF,CAAC,CAAC;;;oBA3BL,KAAmD,IAAA,gBAAA,SAAA,WAAW,CAAA,wCAAA;wBAAnD,IAAA,0BAAoC,EAAlC,GAAG,SAAA,EAAE,MAAI,UAAA,EAAE,KAAK,WAAA,EAAE,cAAc,oBAAA;8CAAhC,GAAG,EAAE,MAAI,EAAE,KAAK,EAAE,cAAc;;;qBA4B5C;;;;;;;;;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { getNgRxStores } from '../../utils';\n\nexport const useConsistentGlobalStoreName = 'useConsistentGlobalStoreName';\nexport const useConsistentGlobalStoreNameSuggest =\n 'useConsistentGlobalStoreNameSuggest';\n\ntype MessageIds =\n | typeof useConsistentGlobalStoreName\n | typeof useConsistentGlobalStoreNameSuggest;\ntype Options = readonly [string];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n ngrxModule: 'store',\n docs: {\n description: 'Use a consistent name for the global store.',\n recommended: 'warn',\n suggestion: true,\n },\n schema: [\n {\n type: 'string',\n additionalProperties: false,\n },\n ],\n messages: {\n [useConsistentGlobalStoreName]:\n 'Global store should be named as `{{ storeName }}`.',\n [useConsistentGlobalStoreNameSuggest]: 'Rename it to `{{ storeName }}`.',\n },\n },\n defaultOptions: ['store'],\n create: (context, [storeName]) => {\n return {\n Program() {\n const { identifiers = [] } = getNgRxStores(context);\n\n for (const { loc, name, range, typeAnnotation } of identifiers) {\n if (name === storeName) {\n return;\n }\n\n const data = { storeName };\n context.report({\n loc: {\n ...loc,\n end: {\n ...loc.start,\n column: loc.start.column + name.length,\n },\n },\n messageId: useConsistentGlobalStoreName,\n data,\n suggest: [\n {\n messageId: useConsistentGlobalStoreNameSuggest,\n data,\n fix: (fixer) =>\n fixer.replaceTextRange(\n [range[0], typeAnnotation.range[0]],\n storeName\n ),\n },\n ],\n });\n }\n },\n };\n },\n});\n"]}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.docsUrl = void 0;
4
4
  var docsUrl = function (ruleName) {
5
5
  return "https://ngrx.io/guide/eslint-plugin/rules/".concat(ruleName);
@@ -28,7 +28,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
28
28
  function verb(n) { return function (v) { return step([n, v]); }; }
29
29
  function step(op) {
30
30
  if (f) throw new TypeError("Generator is already executing.");
31
- while (_) try {
31
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
32
32
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
33
  if (y = 0, t) op = [op[0] & 2, t.value];
34
34
  switch (op[0]) {
@@ -60,7 +60,7 @@ var __values = (this && this.__values) || function(o) {
60
60
  };
61
61
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
62
62
  };
63
- exports.__esModule = true;
63
+ Object.defineProperty(exports, "__esModule", { value: true });
64
64
  exports.traverseFolder = void 0;
65
65
  var fs = __importStar(require("fs"));
66
66
  var path = __importStar(require("path"));
@@ -91,7 +91,7 @@ function traverseFolder(folder, extensions) {
91
91
  return [4 /*yield*/, {
92
92
  folder: folder,
93
93
  file: path.parse(folderEntry.name).name,
94
- path: entryPath
94
+ path: entryPath,
95
95
  }];
96
96
  case 5:
97
97
  _b.sent();
@@ -106,7 +106,7 @@ function traverseFolder(folder, extensions) {
106
106
  return [3 /*break*/, 10];
107
107
  case 9:
108
108
  try {
109
- if (folders_1_1 && !folders_1_1.done && (_a = folders_1["return"])) _a.call(folders_1);
109
+ if (folders_1_1 && !folders_1_1.done && (_a = folders_1.return)) _a.call(folders_1);
110
110
  }
111
111
  finally { if (e_1) throw e_1.error; }
112
112
  return [7 /*endfinally*/];
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isCallExpressionWith = exports.isTypeReference = exports.isIdentifierOrMemberExpression = exports.isProperty = exports.isObjectExpression = 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;
4
4
  var experimental_utils_1 = require("@typescript-eslint/experimental-utils");
5
5
  var isNodeOfType = function (nodeType) {
@@ -13,7 +13,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
- exports.__esModule = true;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./docs"), exports);
18
18
  __exportStar(require("./folder"), exports);
19
19
  __exportStar(require("./guards"), exports);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  var _a;
3
- exports.__esModule = true;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.NGRX_MODULE_PATHS = void 0;
5
5
  exports.NGRX_MODULE_PATHS = (_a = {},
6
6
  _a['component-store'] = '@ngrx/component-store',
@@ -35,7 +35,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
35
35
  }
36
36
  return to.concat(ar || Array.prototype.slice.call(from));
37
37
  };
38
- exports.__esModule = true;
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.asPattern = exports.escapeText = exports.getNgRxStores = exports.getNgRxComponentStores = exports.getNgRxEffectActions = exports.capitalize = exports.getRawText = exports.getDecorator = exports.getDecoratorName = exports.getDecoratorArguments = exports.getLast = exports.getImplementsSchemaFixer = exports.getInterface = exports.getInterfaces = exports.getInterfaceName = exports.getNodeToCommaRemoveFix = exports.getImportRemoveFix = exports.getImportAddFix = exports.getImportDeclarations = exports.getImportDeclarationSpecifier = exports.getNearestUpperNodeFrom = void 0;
40
40
  var experimental_utils_1 = require("@typescript-eslint/experimental-utils");
41
41
  var guards_1 = require("./guards");
@@ -68,7 +68,7 @@ function getImportDeclarationSpecifier(importDeclarations, importName) {
68
68
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
69
69
  finally {
70
70
  try {
71
- if (importDeclarations_1_1 && !importDeclarations_1_1.done && (_a = importDeclarations_1["return"])) _a.call(importDeclarations_1);
71
+ if (importDeclarations_1_1 && !importDeclarations_1_1.done && (_a = importDeclarations_1.return)) _a.call(importDeclarations_1);
72
72
  }
73
73
  finally { if (e_1) throw e_1.error; }
74
74
  }
@@ -103,7 +103,7 @@ function getCorrespondentImportClause(importDeclarations, compatibleWithTypeOnly
103
103
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
104
104
  finally {
105
105
  try {
106
- if (importDeclarations_2_1 && !importDeclarations_2_1.done && (_a = importDeclarations_2["return"])) _a.call(importDeclarations_2);
106
+ if (importDeclarations_2_1 && !importDeclarations_2_1.done && (_a = importDeclarations_2.return)) _a.call(importDeclarations_2);
107
107
  }
108
108
  finally { if (e_2) throw e_2.error; }
109
109
  }
@@ -22,7 +22,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- exports.__esModule = true;
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ngrxVersionSatisfies = exports.clearCache = exports.setNgrxVersion = void 0;
27
27
  var semver = __importStar(require("semver"));
28
28
  var noopVersion = '0.0.0';
@@ -13,7 +13,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
- exports.__esModule = true;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./helper-functions"), exports);
18
18
  __exportStar(require("./selectors"), exports);
19
19
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mapLikeOperatorsImplicitReturn = exports.mapLikeOperatorsExplicitReturn = 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;
4
4
  exports.effectCreator = "PropertyDefinition[value.callee.name='createEffect']";
5
5
  exports.createEffectExpression = "CallExpression[callee.name='createEffect']";