@ngrx/eslint-plugin 19.0.1 → 19.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/generate-docs.js +17 -7
- package/scripts/generate-docs.js.map +1 -1
- package/src/rules/component-store/avoid-combining-component-store-selectors.js +17 -7
- package/src/rules/component-store/avoid-combining-component-store-selectors.js.map +1 -1
- package/src/rules/component-store/avoid-mapping-component-store-selectors.js +17 -7
- package/src/rules/component-store/avoid-mapping-component-store-selectors.js.map +1 -1
- package/src/rules/component-store/updater-explicit-return-type.js +17 -7
- package/src/rules/component-store/updater-explicit-return-type.js.map +1 -1
- package/src/rules/effects/avoid-cyclic-effects.js +17 -7
- package/src/rules/effects/avoid-cyclic-effects.js.map +1 -1
- package/src/rules/effects/no-dispatch-in-effects.js +17 -7
- package/src/rules/effects/no-dispatch-in-effects.js.map +1 -1
- package/src/rules/effects/no-effects-in-providers.js +17 -7
- package/src/rules/effects/no-effects-in-providers.js.map +1 -1
- package/src/rules/effects/no-multiple-actions-in-effects.js +17 -7
- package/src/rules/effects/no-multiple-actions-in-effects.js.map +1 -1
- package/src/rules/effects/prefer-action-creator-in-of-type.js +17 -7
- package/src/rules/effects/prefer-action-creator-in-of-type.js.map +1 -1
- package/src/rules/effects/prefer-effect-callback-in-block-statement.js +17 -7
- package/src/rules/effects/prefer-effect-callback-in-block-statement.js.map +1 -1
- package/src/rules/effects/use-effects-lifecycle-interface.js +17 -7
- package/src/rules/effects/use-effects-lifecycle-interface.js.map +1 -1
- package/src/rules/operators/prefer-concat-latest-from.js +17 -7
- package/src/rules/operators/prefer-concat-latest-from.js.map +1 -1
- package/src/rules/signals/prefer-protected-state.js +17 -7
- package/src/rules/signals/prefer-protected-state.js.map +1 -1
- package/src/rules/signals/signal-state-no-arrays-at-root-level.js +17 -7
- package/src/rules/signals/signal-state-no-arrays-at-root-level.js.map +1 -1
- package/src/rules/signals/signal-store-feature-should-use-generic-type.js +17 -7
- package/src/rules/signals/signal-store-feature-should-use-generic-type.js.map +1 -1
- package/src/rules/signals/with-state-no-arrays-at-root-level.js +17 -7
- package/src/rules/signals/with-state-no-arrays-at-root-level.js.map +1 -1
- package/src/rules/store/avoid-combining-selectors.js +17 -7
- package/src/rules/store/avoid-combining-selectors.js.map +1 -1
- package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js +17 -7
- package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js.map +1 -1
- package/src/rules/store/avoid-duplicate-actions-in-reducer.js +17 -7
- package/src/rules/store/avoid-duplicate-actions-in-reducer.js.map +1 -1
- package/src/rules/store/avoid-mapping-selectors.js +17 -7
- package/src/rules/store/avoid-mapping-selectors.js.map +1 -1
- package/src/rules/store/good-action-hygiene.js +17 -7
- package/src/rules/store/good-action-hygiene.js.map +1 -1
- package/src/rules/store/no-multiple-global-stores.js +17 -7
- package/src/rules/store/no-multiple-global-stores.js.map +1 -1
- package/src/rules/store/no-reducer-in-key-names.js +17 -7
- package/src/rules/store/no-reducer-in-key-names.js.map +1 -1
- package/src/rules/store/no-store-subscription.js +17 -7
- package/src/rules/store/no-store-subscription.js.map +1 -1
- package/src/rules/store/no-typed-global-store.js +17 -7
- package/src/rules/store/no-typed-global-store.js.map +1 -1
- package/src/rules/store/on-function-explicit-return-type.js +17 -7
- package/src/rules/store/on-function-explicit-return-type.js.map +1 -1
- package/src/rules/store/prefer-action-creator-in-dispatch.js +17 -7
- package/src/rules/store/prefer-action-creator-in-dispatch.js.map +1 -1
- package/src/rules/store/prefer-action-creator.js +17 -7
- package/src/rules/store/prefer-action-creator.js.map +1 -1
- package/src/rules/store/prefer-inline-action-props.js +17 -7
- package/src/rules/store/prefer-inline-action-props.js.map +1 -1
- package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js +17 -7
- package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js.map +1 -1
- package/src/rules/store/prefer-selector-in-select.js +17 -7
- package/src/rules/store/prefer-selector-in-select.js.map +1 -1
- package/src/rules/store/prefix-selectors-with-select.js +17 -7
- package/src/rules/store/prefix-selectors-with-select.js.map +1 -1
- package/src/rules/store/select-style.js +17 -7
- package/src/rules/store/select-style.js.map +1 -1
- package/src/rules/store/use-consistent-global-store-name.js +17 -7
- package/src/rules/store/use-consistent-global-store-name.js.map +1 -1
- package/src/utils/helper-functions/folder.js +17 -7
- package/src/utils/helper-functions/folder.js.map +1 -1
- package/src/utils/helper-functions/rules.js +17 -7
- package/src/utils/helper-functions/rules.js.map +1 -1
- package/src/utils/helper-functions/versions.js +17 -7
- package/src/utils/helper-functions/versions.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-multiple-global-stores.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-multiple-global-stores.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-multiple-global-stores.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-multiple-global-stores.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAIqB;AAER,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AAClD,QAAA,6BAA6B,GAAG,+BAA+B,CAAC;AAO7E,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,iDAAiD;SAC/D;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,8BAAsB,CAAC,EAAE,4CAA4C;YACtE,CAAC,qCAA6B,CAAC,EAAE,wBAAwB;SAC1D;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,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AO,IAAA,+BAAuB,EAAC,UAAU,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;AAClE,CAAC;AAID,SAAS,OAAO,CAAC,WAAwB;IACvC,OAAO,WAAW,CAAC,MAAM,CACvB,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE;QAC1B,MAAM,MAAM,GAAG,IAAA,6BAAqB,EAAC,UAAU,CAAC,MAAM,CAAC;YACrD,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM;YAC1B,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;QACtB,MAAM,oBAAoB,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrD,OAAO,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE;YAC7B,GAAG,CAAC,oBAAoB,IAAI,EAAE,CAAC;YAC/B,UAAU;SACX,CAAC,CAAC;IACL,CAAC,EACD,IAAI,GAAG,EAAE,CACV,CAAC;AACJ,CAAC","sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n getNgRxStores,\n getNodeToCommaRemoveFix,\n isTSParameterProperty,\n} from '../../utils';\n\nexport const noMultipleGlobalStores = 'noMultipleGlobalStores';\nexport const noMultipleGlobalStoresSuggest = 'noMultipleGlobalStoresSuggest';\n\ntype MessageIds =\n | typeof noMultipleGlobalStores\n | typeof noMultipleGlobalStoresSuggest;\ntype Options = readonly [];\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: 'There should only be one global store injected.',\n },\n schema: [],\n messages: {\n [noMultipleGlobalStores]: 'Global store should be injected only once.',\n [noMultipleGlobalStoresSuggest]: 'Remove this reference.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n Program() {\n const { identifiers = [], sourceCode } = getNgRxStores(context);\n const flattenedIdentifiers = groupBy(identifiers).values();\n\n for (const identifiers of flattenedIdentifiers) {\n if (identifiers.length <= 1) {\n continue;\n }\n\n for (const node of identifiers) {\n const nodeToReport = getNodeToReport(node);\n context.report({\n node: nodeToReport,\n messageId: noMultipleGlobalStores,\n suggest: [\n {\n messageId: noMultipleGlobalStoresSuggest,\n fix: (fixer) => getFixes(sourceCode, fixer, nodeToReport),\n },\n ],\n });\n }\n }\n },\n };\n },\n});\n\nfunction getNodeToReport(node: TSESTree.Node) {\n return node.parent && isTSParameterProperty(node.parent) ? node.parent : node;\n}\n\nfunction getFixes(\n sourceCode: Readonly<TSESLint.SourceCode>,\n fixer: TSESLint.RuleFixer,\n node: TSESTree.Node\n) {\n const { parent } = node;\n const nodeToRemove = parent && isTSParameterProperty(parent) ? parent : node;\n return getNodeToCommaRemoveFix(sourceCode, fixer, nodeToRemove);\n}\n\ntype Identifiers = NonNullable<ReturnType<typeof getNgRxStores>['identifiers']>;\n\nfunction groupBy(identifiers: Identifiers): Map<TSESTree.Node, Identifiers> {\n return identifiers.reduce<Map<TSESTree.Node, Identifiers>>(\n (accumulator, identifier) => {\n const parent = isTSParameterProperty(identifier.parent)\n ? identifier.parent.parent\n : identifier.parent;\n const collectedIdentifiers = accumulator.get(parent);\n return accumulator.set(parent, [\n ...(collectedIdentifiers ?? []),\n identifier,\n ]);\n },\n new Map()\n );\n}\n"]}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.noReducerInKeyNamesSuggest = exports.noReducerInKeyNames = void 0;
|
|
27
37
|
const path = __importStar(require("path"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-reducer-in-key-names.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-reducer-in-key-names.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-reducer-in-key-names.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-reducer-in-key-names.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAC5C,QAAA,0BAA0B,GAAG,4BAA4B,CAAC;AAOvE,MAAM,cAAc,GAAG,SAAS,CAAC;AAEjC,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,mBAAmB,cAAc,qBAAqB;SACpE;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,2BAAmB,CAAC,EAAE,mBAAmB,cAAc,mDAAmD;YAC3G,CAAC,kCAA0B,CAAC,EAAE,oBAAoB,cAAc,IAAI;SACrE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,YAAY,6BAAqB,KAAK,wBAAgB,OAAO,IAAA,wBAAgB,EAC5E,UAAU,CACX,SAAS,CAAC,CAAC,IAA8B;gBACxC,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,2BAAmB;oBAC9B,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,kCAA0B;4BACrC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;gCACb,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,IAAI,CAAC,CAAC;gCAEjC,IAAI,CAAC,OAAO,EAAE,CAAC;oCACb,OAAO,IAAI,CAAC;gCACd,CAAC;gCAED,OAAO,KAAK,CAAC,WAAW,CACtB,IAAI,EACJ,OAAO,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,cAAc,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CACrD,CAAC;4BACJ,CAAC;yBACF;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n actionReducerMap,\n getRawText,\n metadataProperty,\n storeActionReducerMap,\n} from '../../utils';\n\nexport const noReducerInKeyNames = 'noReducerInKeyNames';\nexport const noReducerInKeyNamesSuggest = 'noReducerInKeyNamesSuggest';\n\ntype MessageIds =\n | typeof noReducerInKeyNames\n | typeof noReducerInKeyNamesSuggest;\ntype Options = readonly [];\n\nconst reducerKeyword = 'reducer';\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: `Avoid the word \"${reducerKeyword}\" in the key names.`,\n },\n schema: [],\n messages: {\n [noReducerInKeyNames]: `Avoid the word \"${reducerKeyword}\" in the key names to better represent the state.`,\n [noReducerInKeyNamesSuggest]: `Remove the word \"${reducerKeyword}\".`,\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`:matches(${storeActionReducerMap}, ${actionReducerMap}) > ${metadataProperty(\n /reducer/i\n )} > .key`](node: TSESTree.Property['key']) {\n context.report({\n node,\n messageId: noReducerInKeyNames,\n suggest: [\n {\n messageId: noReducerInKeyNamesSuggest,\n fix: (fixer) => {\n const keyName = getRawText(node);\n\n if (!keyName) {\n return null;\n }\n\n return fixer.replaceText(\n node,\n keyName.replace(new RegExp(reducerKeyword, 'i'), '')\n );\n },\n },\n ],\n });\n },\n };\n },\n});\n"]}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.messageId = void 0;
|
|
27
37
|
const path = __importStar(require("path"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-store-subscription.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-store-subscription.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-store-subscription.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-store-subscription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAgF;AAEnE,QAAA,SAAS,GAAG,qBAAqB,CAAC;AAK/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,gEAAgE;SACnE;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,kEAAkE;SACrE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,qBAAa,EAAC,OAAO,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO;YACL,CAAC,GAAG,IAAA,+BAAuB,EACzB,UAAU,CACX,oDAAoD,CAAC,CACpD,IAAyB;gBAEzB,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAT,iBAAS;iBACV,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { asPattern, getNgRxStores, namedCallableExpression } from '../../utils';\n\nexport const messageId = 'noStoreSubscription';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'store',\n docs: {\n description:\n 'Using the `async` pipe is preferred over `store` subscription.',\n },\n schema: [],\n messages: {\n [messageId]:\n '`Store` subscription is forbidden. Use the `async` pipe instead.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!storeNames) {\n return {};\n }\n\n return {\n [`${namedCallableExpression(\n storeNames\n )} > MemberExpression > Identifier[name='subscribe']`](\n node: TSESTree.Identifier\n ) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.noTypedStoreSuggest = exports.noTypedStore = void 0;
|
|
27
37
|
const path = __importStar(require("path"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-typed-global-store.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-typed-global-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-typed-global-store.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/no-typed-global-store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAMqB;AAGR,QAAA,YAAY,GAAG,cAAc,CAAC;AAC9B,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAKzD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,uCAAuC;SACrD;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,oBAAY,CAAC,EACZ,qEAAqE;YACvE,CAAC,2BAAmB,CAAC,EAAE,8BAA8B;SACtD;KACF;IACD,cAAc,EAAE,EAA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AAC,MAAM,CAAC,aAAa,CAAC;qBAC5C;iBACF;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC,CAAC","sourcesContent":["import * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n getNgRxStores,\n isPropertyDefinition,\n isTSTypeReference,\n isCallExpression,\n isTSInstantiationExpression,\n} from '../../utils';\nimport type { TSESTree } from '@typescript-eslint/utils';\n\nexport const noTypedStore = 'noTypedStore';\nexport const noTypedStoreSuggest = 'noTypedStoreSuggest';\n\ntype MessageIds = typeof noTypedStore | typeof noTypedStoreSuggest;\ntype Options = readonly [];\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: 'The global store should not be typed.',\n },\n schema: [],\n messages: {\n [noTypedStore]:\n '`Store` should not be typed, use `Store` (without generic) instead.',\n [noTypedStoreSuggest]: 'Remove generic from `Store`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n Program() {\n const { identifiers = [] } = getNgRxStores(context);\n\n for (const identifier of identifiers) {\n // using inject()\n if (!identifier.typeAnnotation) {\n const { parent } = identifier;\n if (\n isPropertyDefinition(parent) &&\n parent.value &&\n isCallExpression(parent.value) &&\n parent.value.arguments.length\n ) {\n const [storeArgument] = parent.value.arguments;\n if (isTSInstantiationExpression(storeArgument)) {\n report(storeArgument.typeArguments);\n }\n }\n\n continue;\n }\n\n if (\n !isTSTypeReference(identifier.typeAnnotation.typeAnnotation) ||\n !identifier.typeAnnotation.typeAnnotation.typeArguments\n ) {\n continue;\n }\n\n report(identifier.typeAnnotation.typeAnnotation.typeArguments);\n }\n },\n };\n\n function report(typeArguments: TSESTree.TSTypeParameterInstantiation) {\n context.report({\n node: typeArguments,\n messageId: noTypedStore,\n suggest: [\n {\n messageId: noTypedStoreSuggest,\n fix: (fixer) => fixer.remove(typeArguments),\n },\n ],\n });\n }\n },\n});\n"]}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.onFunctionExplicitReturnTypeSuggest = exports.onFunctionExplicitReturnType = void 0;
|
|
27
37
|
const utils_1 = require("@typescript-eslint/utils");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-function-explicit-return-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/on-function-explicit-return-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"on-function-explicit-return-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/on-function-explicit-return-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAAoD;AACpD,2CAA6B;AAC7B,qDAAgD;AAChD,u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MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;IAC5B,MAAM,SAAS,GAAG,IAAA,eAAO,EAAC,MAAM,CAAC,CAAC;IAClC,MAAM,aAAa,GAAG,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,eAAe,GACnB,aAAa,IAAI,gBAAQ,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAE/D,IAAI,eAAe,EAAE,CAAC;QACpB,MAAM,SAAS,GAAG,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,eAAe,CAAC,SAAS,IAAI,SAAS,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC;IAED,OAAO;QACL,KAAK,CAAC,gBAAgB,CAAC,UAAU,EAAE,GAAG,CAAC;QACvC,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,UAAU,CAAC;KACpC,CAAC;AACb,CAAC","sourcesContent":["import type { TSESLint, TSESTree } from '@typescript-eslint/utils';\nimport { ASTUtils } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { getLast, onFunctionWithoutType } from '../../utils';\n\nexport const onFunctionExplicitReturnType = 'onFunctionExplicitReturnType';\nexport const onFunctionExplicitReturnTypeSuggest =\n 'onFunctionExplicitReturnTypeSuggest';\n\ntype MessageIds =\n | typeof onFunctionExplicitReturnType\n | typeof onFunctionExplicitReturnTypeSuggest;\ntype Options = readonly [];\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: '`On` function should have an explicit return type.',\n },\n schema: [],\n messages: {\n [onFunctionExplicitReturnType]:\n '`On` functions should have an explicit return type when using arrow functions: `on(action, (state): State => {}`.',\n [onFunctionExplicitReturnTypeSuggest]:\n 'Add the explicit return type `State` (if the interface/type is named differently you need to manually correct the return type).',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [onFunctionWithoutType](node: TSESTree.ArrowFunctionExpression) {\n context.report({\n node,\n messageId: onFunctionExplicitReturnType,\n suggest: [\n {\n messageId: onFunctionExplicitReturnTypeSuggest,\n fix: (fixer) => getFixes(node, context.sourceCode, fixer),\n },\n ],\n });\n },\n };\n },\n});\n\nfunction getFixes(\n node: TSESTree.ArrowFunctionExpression,\n sourceCode: Readonly<TSESLint.SourceCode>,\n fixer: TSESLint.RuleFixer\n) {\n const { params } = node;\n\n if (params.length === 0) {\n const [, closingParen] = sourceCode.getTokens(node);\n return fixer.insertTextAfter(closingParen, ': State');\n }\n\n const [firstParam] = params;\n const lastParam = getLast(params);\n const previousToken = sourceCode.getTokenBefore(firstParam);\n const isParenthesized =\n previousToken && ASTUtils.isOpeningParenToken(previousToken);\n\n if (isParenthesized) {\n const nextToken = sourceCode.getTokenAfter(lastParam);\n return fixer.insertTextAfter(nextToken ?? lastParam, ': State');\n }\n\n return [\n fixer.insertTextBefore(firstParam, '('),\n fixer.insertTextAfter(lastParam, '): State'),\n ] as const;\n}\n"]}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.messageId = void 0;
|
|
27
37
|
const path = __importStar(require("path"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-action-creator-in-dispatch.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-action-creator-in-dispatch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prefer-action-creator-in-dispatch.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-action-creator-in-dispatch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAOqB;AAER,QAAA,SAAS,GAAG,+BAA+B,CAAC;AAKzD,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;SACrF;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,4EAA4E;SAC/E;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAA,qBAAa,EAAC,OAAO,CAAC,CAAC;QACpD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO;YACL,CAAC,GAAG,IAAA,0BAAkB,EACpB,UAAU,CACX,kEAAkE,CAAC,CAClE,IAAwD;gBAExD,MAAM,0BAA0B,GAAG,IAAA,+BAAuB,EACxD,IAAI,EACJ,wBAAgB,CACjB,CAAC;gBACF,MAAM,8BAA8B,GAClC,0BAA0B,KAAK,SAAS;oBACxC,IAAA,4BAAoB,EAClB,0BAA0B,EAC1B,UAAU,EACV,UAAU,CACX,CAAC;gBAEJ,IAAI,CAAC,8BAA8B,EAAE,CAAC;oBACpC,OAAO;gBACT,CAAC;gBAED,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAT,iBAAS;iBACV,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n dispatchExpression,\n getNearestUpperNodeFrom,\n getNgRxStores,\n isCallExpression,\n isCallExpressionWith,\n} from '../../utils';\n\nexport const messageId = 'preferActionCreatorInDispatch';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'store',\n docs: {\n description:\n 'Using `action creator` in `dispatch` is preferred over `object` or old `Action`.',\n },\n schema: [],\n messages: {\n [messageId]:\n 'Using `object` or old `Action` is forbidden. Use `action creator` instead.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!storeNames) {\n return {};\n }\n\n return {\n [`${dispatchExpression(\n storeNames\n )} :matches(NewExpression, :not(NewExpression) > ObjectExpression)`](\n node: TSESTree.NewExpression | TSESTree.ObjectExpression\n ) {\n const nearestUpperCallExpression = getNearestUpperNodeFrom(\n node,\n isCallExpression\n );\n const isStoreDispatchImmediateParent =\n nearestUpperCallExpression !== undefined &&\n isCallExpressionWith(\n nearestUpperCallExpression,\n storeNames,\n 'dispatch'\n );\n\n if (!isStoreDispatchImmediateParent) {\n return;\n }\n\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.messageId = void 0;
|
|
27
37
|
const path = __importStar(require("path"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-action-creator.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-action-creator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prefer-action-creator.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-action-creator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAEnC,QAAA,SAAS,GAAG,qBAAqB,CAAC;AAK/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,EAAE,0DAA0D;SACxE;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,kEAAkE;SACrE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,2JAA2J,CAAC,CAC3J,IAA+B;gBAE/B,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAT,iBAAS;iBACV,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\n\nexport const messageId = 'preferActionCreator';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'store',\n docs: {\n description: 'Using `action creator` is preferred over `Action class`.',\n },\n schema: [],\n messages: {\n [messageId]:\n 'Using `Action class` is forbidden. Use `action creator` instead.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`ClassDeclaration:has(TSClassImplements:matches([expression.name='Action'], [expression.property.name='Action'])):has(PropertyDefinition[key.name='type'])`](\n node: TSESTree.ClassDeclaration\n ) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.preferInlineActionPropsSuggest = exports.preferInlineActionProps = void 0;
|
|
27
37
|
const path = __importStar(require("path"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-inline-action-props.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-inline-action-props.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prefer-inline-action-props.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-inline-action-props.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAyD;AAE5C,QAAA,uBAAuB,GAAG,yBAAyB,CAAC;AACpD,QAAA,8BAA8B,GAAG,gCAAgC,CAAC;AAO/E,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EACT,oEAAoE;SACvE;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,+BAAuB,CAAC,EACvB,2DAA2D;YAC7D,CAAC,sCAA8B,CAAC,EAAE,yBAAyB;SAC5D;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,kCAA0B,CAAC,CAAC,IAA8B;gBACzD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,+BAAuB;oBAClC,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,sCAA8B;4BACzC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC;gCACd,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC;gCACvC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC;6BACjC;yBACF;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { actionCreatorPropsComputed } from '../../utils';\n\nexport const preferInlineActionProps = 'preferInlineActionProps';\nexport const preferInlineActionPropsSuggest = 'preferInlineActionPropsSuggest';\n\ntype MessageIds =\n | typeof preferInlineActionProps\n | typeof preferInlineActionPropsSuggest;\ntype Options = readonly [];\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:\n 'Prefer using inline types instead of interfaces, types or classes.',\n },\n schema: [],\n messages: {\n [preferInlineActionProps]:\n 'Use inline types instead of interfaces, types or classes.',\n [preferInlineActionPropsSuggest]: 'Change to inline types.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [actionCreatorPropsComputed](node: TSESTree.TSTypeReference) {\n context.report({\n node,\n messageId: preferInlineActionProps,\n suggest: [\n {\n messageId: preferInlineActionPropsSuggest,\n fix: (fixer) => [\n fixer.insertTextBefore(node, '{name: '),\n fixer.insertTextAfter(node, '}'),\n ],\n },\n ],\n });\n },\n };\n },\n});\n"]}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.preferOneGenericInCreateForFeatureSelectorSuggest = exports.preferOneGenericInCreateForFeatureSelector = void 0;
|
|
27
37
|
const path = __importStar(require("path"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-one-generic-in-create-for-feature-selector.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-one-generic-in-create-for-feature-selector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prefer-one-generic-in-create-for-feature-selector.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-one-generic-in-create-for-feature-selector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAEnC,QAAA,0CAA0C,GACrD,4CAA4C,CAAC;AAClC,QAAA,iDAAiD,GAC5D,mDAAmD,CAAC;AAOtD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,EAAE,4DAA4D;SAC1E;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,kDAA0C,CAAC,EAC1C,mDAAmD;YACrD,CAAC,yDAAiD,CAAC,EACjD,kCAAkC;SACrC;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,qGAAqG,CAAC,CACrG,IAA2C;gBAE3C,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,kDAA0C;oBACrD,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,yDAAiD;4BAC5D,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;gCACb,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;gCAClC,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;gCAChE,OAAO,KAAK,CAAC,WAAW,CAAC;oCACvB,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;oCACpB,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;iCAChD,CAAC,CAAC;4BACL,CAAC;yBACF;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\n\nexport const preferOneGenericInCreateForFeatureSelector =\n 'preferOneGenericInCreateForFeatureSelector';\nexport const preferOneGenericInCreateForFeatureSelectorSuggest =\n 'preferOneGenericInCreateForFeatureSelectorSuggest';\n\ntype MessageIds =\n | typeof preferOneGenericInCreateForFeatureSelector\n | typeof preferOneGenericInCreateForFeatureSelectorSuggest;\ntype Options = readonly [];\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: 'Prefer using a single generic to define the feature state.',\n },\n schema: [],\n messages: {\n [preferOneGenericInCreateForFeatureSelector]:\n 'Use a single generic to define the feature state.',\n [preferOneGenericInCreateForFeatureSelectorSuggest]:\n 'Remove the global state generic.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`CallExpression[callee.name='createFeatureSelector'] > TSTypeParameterInstantiation[params.length>1]`](\n node: TSESTree.TSTypeParameterInstantiation\n ) {\n context.report({\n node,\n messageId: preferOneGenericInCreateForFeatureSelector,\n suggest: [\n {\n messageId: preferOneGenericInCreateForFeatureSelectorSuggest,\n fix: (fixer) => {\n const [globalState] = node.params;\n const nextToken = context.sourceCode.getTokenAfter(globalState);\n return fixer.removeRange([\n globalState.range[0],\n nextToken?.range[1] ?? globalState.range[1] + 1,\n ]);\n },\n },\n ],\n });\n },\n };\n },\n});\n"]}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.messageId = void 0;
|
|
27
37
|
const path = __importStar(require("path"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefer-selector-in-select.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefer-selector-in-select.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prefer-selector-in-select.js","sourceRoot":"","s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CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,QAAQ;wBACd,SAAS,EAAT,iBAAS;qBACV,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n getNgRxStores,\n isArrowFunctionExpression,\n isFunctionExpression,\n isLiteral,\n pipeableSelect,\n selectExpression,\n} from '../../utils';\n\nexport const messageId = 'preferSelectorInSelect';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'store',\n docs: {\n description:\n 'Using a selector in the `select` is preferred over `string` or `props drilling`.',\n },\n schema: [],\n messages: {\n [messageId]:\n 'Using `string` or `props drilling` is forbidden. Use a selector instead.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!storeNames) {\n return {};\n }\n\n return {\n [`${pipeableSelect(storeNames)}, ${selectExpression(storeNames)}`](\n node: TSESTree.CallExpression\n ) {\n for (const argument of node.arguments) {\n if (\n !isLiteral(argument) &&\n !isArrowFunctionExpression(argument) &&\n !isFunctionExpression(argument)\n ) {\n break;\n }\n\n context.report({\n node: argument,\n messageId,\n });\n }\n },\n };\n },\n});\n"]}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.prefixSelectorsWithSelectSuggest = exports.prefixSelectorsWithSelect = void 0;
|
|
27
37
|
const path = __importStar(require("path"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefix-selectors-with-select.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefix-selectors-with-select.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prefix-selectors-with-select.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/prefix-selectors-with-select.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAyC;AAE5B,QAAA,yBAAyB,GAAG,2BAA2B,CAAC;AACxD,QAAA,gCAAgC,GAC3C,kCAAkC,CAAC;AAOrC,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,OAAO;QACnB,IAAI,EAAE;YACJ,WAAW,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IACzC,IAAI,oBAAoB,GAAG,IAAI,CAAC,OAAO,CACrC,IAAI,MAAM,CAAC,IAAI,UAAU,MAAM,CAAC,EAChC,CAAC,CAAC,EAAE,IAAY,EAAE,EAAE;QAClB,OAAO,GAAG,UAAU,GAAG,IAAA,kBAAU,EAAC,IAAI,CAAC,EAAE,CAAC;IAC5C,CAAC,CACF,CAAC;IAEF,IAAI,IAAI,KAAK,oBAAoB,EAAE,CAAC;QAClC,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,kCAAkC;IAClC,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,IAAY,EAAE,EAAE;QACxE,OAAO,GAAG,UAAU,GAAG,IAAA,kBAAU,EAAC,IAAI,CAAC,EAAE,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,IAAI,IAAI,KAAK,oBAAoB,EAAE,CAAC;QAClC,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,6BAA6B;IAC7B,OAAO,GAAG,UAAU,GAAG,IAAA,kBAAU,EAAC,IAAI,CAAC,EAAE,CAAC;AAC5C,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { capitalize } from '../../utils';\n\nexport const prefixSelectorsWithSelect = 'prefixSelectorsWithSelect';\nexport const prefixSelectorsWithSelectSuggest =\n 'prefixSelectorsWithSelectSuggest';\n\ntype MessageIds =\n | typeof prefixSelectorsWithSelect\n | typeof prefixSelectorsWithSelectSuggest;\ntype Options = readonly [];\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:\n 'The selector should start with \"select\", for example \"selectEntity\".',\n },\n schema: [],\n messages: {\n [prefixSelectorsWithSelect]: 'The selector should start with \"select\".',\n [prefixSelectorsWithSelectSuggest]:\n 'Prefix the selector with \"select\": `{{ name }}`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n 'VariableDeclarator[id.name!=/^select[^a-z].+$/]:not(:has(Identifier[name=\"createFeature\"])):matches([id.typeAnnotation.typeAnnotation.typeName.name=/^MemoizedSelector(WithProps)?$/], :has(CallExpression[callee.name=/^(create(Feature)?Selector|createSelectorFactory)$/]))'({\n id,\n }: TSESTree.VariableDeclarator & { id: TSESTree.Identifier }) {\n const suggestedName = getSuggestedName(id.name);\n context.report({\n loc: {\n ...id.loc,\n end: {\n ...id.loc.end,\n column: id.typeAnnotation?.range[0]\n ? id.typeAnnotation.range[0] - 1\n : id.loc.end.column,\n },\n },\n messageId: prefixSelectorsWithSelect,\n suggest: [\n {\n messageId: prefixSelectorsWithSelectSuggest,\n data: {\n name: suggestedName,\n },\n fix: (fixer) =>\n fixer.replaceTextRange(\n [id.range[0], id.typeAnnotation?.range[0] ?? id.range[1]],\n suggestedName\n ),\n },\n ],\n });\n },\n };\n },\n});\n\nfunction getSuggestedName(name: string) {\n const selectWord = 'select';\n // Ex: 'selectfeature' => 'selectFeature'\n let possibleReplacedName = name.replace(\n new RegExp(`^${selectWord}(.+)`),\n (_, word: string) => {\n return `${selectWord}${capitalize(word)}`;\n }\n );\n\n if (name !== possibleReplacedName) {\n return possibleReplacedName;\n }\n\n // Ex: 'getCount' => 'selectCount'\n possibleReplacedName = name.replace(/^get([^a-z].+)/, (_, word: string) => {\n return `${selectWord}${capitalize(word)}`;\n });\n\n if (name !== possibleReplacedName) {\n return possibleReplacedName;\n }\n\n // Ex: 'item' => 'selectItem'\n return `${selectWord}${capitalize(name)}`;\n}\n"]}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.SelectStyle = exports.selectOperator = exports.selectMethod = void 0;
|
|
27
37
|
const path = __importStar(require("path"));
|