@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.
- package/package.json +4 -2
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.js.map +1 -1
- package/spec/utils/from-fixture.js +1 -2
- package/spec/utils/from-fixture.js.map +1 -1
- package/spec/utils/rule-tester.js +1 -2
- package/spec/utils/rule-tester.js.map +1 -1
- package/src/configs/all.js +2 -0
- package/src/configs/all.js.map +1 -1
- package/src/configs/all.json +2 -0
- package/src/configs/signals.js +2 -0
- package/src/configs/signals.js.map +1 -1
- package/src/configs/signals.json +2 -0
- package/src/index.d.ts +6 -0
- package/src/rule-creator.js +1 -2
- package/src/rule-creator.js.map +1 -1
- package/src/rules/effects/no-multiple-actions-in-effects.js +1 -1
- package/src/rules/effects/no-multiple-actions-in-effects.js.map +1 -1
- package/src/rules/index.d.ts +2 -0
- package/src/rules/index.js +5 -0
- package/src/rules/index.js.map +1 -1
- package/src/rules/signals/prefer-protected-state.d.ts +5 -0
- package/src/rules/signals/prefer-protected-state.js +88 -0
- package/src/rules/signals/prefer-protected-state.js.map +1 -0
- package/src/rules/signals/signal-store-feature-should-use-generic-type.d.ts +4 -0
- package/src/rules/signals/signal-store-feature-should-use-generic-type.js +100 -0
- package/src/rules/signals/signal-store-feature-should-use-generic-type.js.map +1 -0
- package/src/utils/helper-functions/folder.js +1 -2
- package/src/utils/helper-functions/folder.js.map +1 -1
- package/src/utils/helper-functions/guards.d.ts +34 -51
- package/src/utils/helper-functions/guards.js +5 -4
- package/src/utils/helper-functions/guards.js.map +1 -1
- package/src/utils/helper-functions/utils.js +19 -20
- package/src/utils/helper-functions/utils.js.map +1 -1
- package/src/utils/helper-functions/versions.js +3 -4
- package/src/utils/helper-functions/versions.js.map +1 -1
- package/src/utils/selectors/index.js +2 -2
- package/src/utils/selectors/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngrx/eslint-plugin",
|
|
3
|
-
"version": "18.0
|
|
3
|
+
"version": "18.1.0",
|
|
4
4
|
"description": "NgRx ESLint Plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@ngrx/component-store",
|
|
32
32
|
"@ngrx/component",
|
|
33
33
|
"@ngrx/eslint-plugin",
|
|
34
|
+
"@ngrx/operators",
|
|
34
35
|
"@ngrx/signals"
|
|
35
36
|
],
|
|
36
37
|
"migrations": "./migrations/migration.json"
|
|
@@ -49,5 +50,6 @@
|
|
|
49
50
|
"typescript": "*"
|
|
50
51
|
},
|
|
51
52
|
"main": "./src/index.js",
|
|
52
|
-
"type": "commonjs"
|
|
53
|
+
"type": "commonjs",
|
|
54
|
+
"types": "./src/index.d.ts"
|
|
53
55
|
}
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = addNgRxESLintPlugin;
|
|
6
7
|
const strip_json_comments_1 = __importDefault(require("strip-json-comments"));
|
|
7
8
|
function addNgRxESLintPlugin(schema) {
|
|
8
9
|
return (host, context) => {
|
|
@@ -59,5 +60,4 @@ ${detailsContent}
|
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
|
-
exports.default = addNgRxESLintPlugin;
|
|
63
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/schematics/ng-add/index.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/schematics/ng-add/index.ts"],"names":[],"mappings":";;;;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,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAEhE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;iEACuC,MAAM,CAAC,MAAM;;+BAE/C,IAAI;GAChC,CAAC,CAAC;YACC,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,cAAc,GAClB,GAAG,YAAY,KAAK;gBAClB,CAAC,CAAC;;EAEV,GAAG,CAAC,OAAO;CACZ;gBACS,CAAC,CAAC,EAAE,CAAC;YACT,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;;;;aAIb,IAAI;EACf,cAAc;CACf,CAAC,CAAC;QACC,CAAC;IACH,CAAC,CAAC;IACF,SAAS,eAAe,CAAC,MAAwB;QAC/C,OAAO;YACL,KAAK,EAAE,CAAC,MAAM,CAAC;YACf,OAAO,EAAE,CAAC,gBAAgB,MAAM,EAAE,CAAC;SACpC,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport stripJsonComments from 'strip-json-comments';\nimport type { Schema } from './schema';\n\nexport default function addNgRxESLintPlugin(schema: Schema): Rule {\n return (host: Tree, context: SchematicContext) => {\n const eslintConfigPath = '.eslintrc.json';\n const docs = 'https://ngrx.io/guide/eslint-plugin';\n\n const eslint = host.read(eslintConfigPath)?.toString('utf-8');\n if (!eslint) {\n context.logger.warn(`\nCould not find the ESLint config at \\`${eslintConfigPath}\\`.\nThe NgRx ESLint Plugin is installed but not configured.\n\nPlease see ${docs} to configure the NgRx ESLint Plugin.\n`);\n return host;\n }\n\n try {\n const json = JSON.parse(stripJsonComments(eslint));\n if (json.overrides) {\n if (\n !json.overrides.some((override: any) =>\n override.extends?.some((extend: any) =>\n extend.startsWith('plugin:@ngrx')\n )\n )\n ) {\n json.overrides.push(configurePlugin(schema.config));\n }\n } else if (\n !json.extends?.some((extend: any) => extend.startsWith('plugin:@ngrx'))\n ) {\n json.overrides = [configurePlugin(schema.config)];\n }\n\n host.overwrite(eslintConfigPath, JSON.stringify(json, null, 2));\n\n context.logger.info(`\n The NgRx ESLint Plugin is installed and configured with the '${schema.config}' config.\n\n Take a look at the docs at ${docs} if you want to change the default configuration.\n `);\n return host;\n } catch (err) {\n const detailsContent =\n err instanceof Error\n ? `\nDetails:\n${err.message}\n`\n : '';\n context.logger.warn(`\nSomething went wrong while adding the NgRx ESLint Plugin.\nThe NgRx ESLint Plugin is installed but not configured.\n\nPlease see ${docs} to configure the NgRx ESLint Plugin.\n${detailsContent}\n`);\n }\n };\n function configurePlugin(config: Schema['config']): Record<string, unknown> {\n return {\n files: ['*.ts'],\n extends: [`plugin:@ngrx/${config}`],\n };\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fromFixture =
|
|
3
|
+
exports.fromFixture = fromFixture;
|
|
4
4
|
function fromFixture(fixture, invalidTestCase = {}) {
|
|
5
5
|
const { suggestions, ...rest } = invalidTestCase;
|
|
6
6
|
return {
|
|
@@ -8,7 +8,6 @@ function fromFixture(fixture, invalidTestCase = {}) {
|
|
|
8
8
|
...parseFixture(fixture, suggestions),
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
exports.fromFixture = fromFixture;
|
|
12
11
|
function getSuggestions(suggestions, suggest, indices) {
|
|
13
12
|
if (!suggestions || !suggest) {
|
|
14
13
|
return {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"from-fixture.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/spec/utils/from-fixture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"from-fixture.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/spec/utils/from-fixture.ts"],"names":[],"mappings":";;AAuBA,kCAiBC;AAjBD,SAAgB,WAAW,CAIzB,OAAe,EACf,kBAKI,EAAE;IAEN,M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MAAM;gBACN,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC;gBAC3C,SAAS;gBACT,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,MAAM;gBACZ,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,EAAiB;gBACzC,kHAAkH;gBAClH,GAAI,cAAc,CAChB,WAAW,EACX,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAC7B,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,CACwB;aACvD,CAAC,CAAC;YACH,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACzB,YAAY,GAAG,IAAI,CAAC;YACtB,CAAC;QACH,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,IAAI,WAAW,IAAI,CAAC,YAAY,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QACtB,MAAM;KACP,CAAC;AACJ,CAAC","sourcesContent":["import { TSESLint as eslint } from '@typescript-eslint/utils';\n\nexport function fromFixture<TMessageIds extends string>(\n fixture: string,\n invalidTestCase?: {\n output?: string;\n suggestions?: readonly eslint.SuggestionOutput<TMessageIds>[] | null;\n }\n): eslint.InvalidTestCase<TMessageIds, never>;\n\nexport function fromFixture<\n TMessageIds extends string,\n TOptions extends readonly unknown[]\n>(\n fixture: string,\n invalidTestCase: Omit<\n eslint.InvalidTestCase<TMessageIds, TOptions>,\n 'code' | 'errors'\n > & {\n suggestions?: readonly eslint.SuggestionOutput<TMessageIds>[] | null;\n }\n): eslint.InvalidTestCase<TMessageIds, TOptions>;\n\nexport function fromFixture<\n TMessageIds extends string,\n TOptions extends readonly unknown[]\n>(\n fixture: string,\n invalidTestCase: Omit<\n eslint.InvalidTestCase<TMessageIds, TOptions>,\n 'code' | 'errors'\n > & {\n suggestions?: readonly eslint.SuggestionOutput<TMessageIds>[] | null;\n } = {}\n): eslint.InvalidTestCase<TMessageIds, TOptions> {\n const { suggestions, ...rest } = invalidTestCase;\n return {\n ...rest,\n ...parseFixture(fixture, suggestions),\n };\n}\n\nfunction getSuggestions<TMessageIds extends string>(\n suggestions:\n | readonly eslint.SuggestionOutput<TMessageIds>[]\n | null\n | undefined,\n suggest: boolean,\n indices: string | undefined\n) {\n if (!suggestions || !suggest) {\n return {};\n }\n if (!indices) {\n return { suggestions } as const;\n }\n return {\n suggestions: indices\n .split(/\\s+/)\n .map((index) => suggestions[Number.parseInt(index, 10)]),\n } as const;\n}\n\nfunction parseFixture<TMessageIds extends string>(\n fixture: string,\n suggestions?: readonly eslint.SuggestionOutput<TMessageIds>[] | null\n) {\n const errorRegExp =\n /^(?<indent>\\s*)(?<error>~+)\\s*\\[(?<id>\\w+)\\s*(?<data>.*?)(?:\\s*(?<suggest>suggest)\\s*(?<indices>[\\d\\s]*))?\\]\\s*$/;\n const lines: string[] = [];\n const errors: eslint.TestCaseError<TMessageIds>[] = [];\n let suggestFound = false;\n fixture.split('\\n').forEach((line) => {\n const match = line.match(errorRegExp);\n if (match?.groups) {\n const column = match.groups.indent.length + 1;\n const endColumn = column + match.groups.error.length;\n const { length } = lines;\n errors.push({\n column,\n data: JSON.parse(match.groups.data || '{}'),\n endColumn,\n endLine: length,\n line: length,\n messageId: match.groups.id as TMessageIds,\n // TODO: Remove type assertion once https://github.com/typescript-eslint/typescript-eslint/pull/3844 is available.\n ...(getSuggestions(\n suggestions,\n Boolean(match.groups.suggest),\n match.groups.indices?.trim()\n ) as eslint.TestCaseError<TMessageIds>['suggestions']),\n });\n if (match.groups.suggest) {\n suggestFound = true;\n }\n } else {\n lines.push(line);\n }\n });\n if (suggestions && !suggestFound) {\n throw new Error(\"Suggestions specified but no 'suggest' annotation found.\");\n }\n return {\n code: lines.join('\\n'),\n errors,\n };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ruleTester =
|
|
3
|
+
exports.ruleTester = ruleTester;
|
|
4
4
|
const utils_1 = require("../../src/utils");
|
|
5
5
|
const test_utils_1 = require("@angular-eslint/test-utils");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -19,5 +19,4 @@ function ruleTester(environment) {
|
|
|
19
19
|
},
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
exports.ruleTester = ruleTester;
|
|
23
22
|
//# sourceMappingURL=rule-tester.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-tester.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/spec/utils/rule-tester.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rule-tester.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/spec/utils/rule-tester.ts"],"names":[],"mappings":";;AAIA,gCAmBC;AAvBD,2CAA6D;AAC7D,2DAAwD;AACxD,+BAA+B;AAE/B,SAAgB,UAAU,CAAC,WAG1B;IACC,IAAA,kBAAU,GAAE,CAAC;IAEb,IAAI,WAAW,EAAE,CAAC;QAChB,IAAA,sBAAc,EAAC,WAAW,CAAC,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,IAAI,uBAAU,CAAC;QACpB,MAAM,EAAE,2BAA2B;QACnC,aAAa,EAAE;YACb,WAAW,EAAE,IAAI;YACjB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,IAAA,cAAO,EAAC,uCAAuC,CAAC;YACjE,OAAO,EAAE,iBAAiB;SAC3B;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { clearCache, setNgrxVersion } from '../../src/utils';\nimport { RuleTester } from '@angular-eslint/test-utils';\nimport { resolve } from 'path';\n\nexport function ruleTester(environment?: {\n ngrxModule: string;\n version: string;\n}) {\n clearCache();\n\n if (environment) {\n setNgrxVersion(environment.ngrxModule, environment.version);\n }\n\n return new RuleTester({\n parser: '@typescript-eslint/parser',\n parserOptions: {\n ecmaVersion: 2020,\n sourceType: 'module',\n tsconfigRootDir: resolve('./modules/eslint-plugin/spec/fixtures'),\n project: './tsconfig.json',\n },\n });\n}\n"]}
|
package/src/configs/all.js
CHANGED
|
@@ -38,6 +38,8 @@ exports.default = (plugin, parser) => [
|
|
|
38
38
|
'@ngrx/use-effects-lifecycle-interface': 'error',
|
|
39
39
|
'@ngrx/prefer-concat-latest-from': 'error',
|
|
40
40
|
'@ngrx/signal-state-no-arrays-at-root-level': 'error',
|
|
41
|
+
'@ngrx/signal-store-feature-should-use-generic-type': 'error',
|
|
42
|
+
'@ngrx/prefer-protected-state': 'error',
|
|
41
43
|
'@ngrx/with-state-no-arrays-at-root-level': 'error',
|
|
42
44
|
'@ngrx/avoid-combining-selectors': 'error',
|
|
43
45
|
'@ngrx/avoid-dispatching-multiple-actions-sequentially': 'error',
|
package/src/configs/all.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/configs/all.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAIH,kBAAe,CACb,MAAkC,EAClC,MAAkC,EACD,EAAE,CAAC;IACpC;QACE,IAAI,EAAE,WAAW;QACjB,eAAe,EAAE;YACf,MAAM;YACN,UAAU,EAAE,QAAQ;SACrB;QACD,OAAO,EAAE;YACP,OAAO,EAAE,MAAM;SAChB;KACF;IACD;QACE,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE;YACf,MAAM;YACN,aAAa,EAAE;gBACb,WAAW,EAAE,IAAI;gBACjB,UAAU,EAAE,QAAQ;gBACpB,OAAO,EAAE,iBAAiB;aAC3B;SACF;QACD,KAAK,EAAE;YACL,iDAAiD,EAAE,OAAO;YAC1D,+CAA+C,EAAE,OAAO;YACxD,oCAAoC,EAAE,OAAO;YAC7C,4BAA4B,EAAE,OAAO;YACrC,8BAA8B,EAAE,OAAO;YACvC,+BAA+B,EAAE,OAAO;YACxC,sCAAsC,EAAE,OAAO;YAC/C,wCAAwC,EAAE,OAAO;YACjD,iDAAiD,EAAE,OAAO;YAC1D,uCAAuC,EAAE,OAAO;YAChD,iCAAiC,EAAE,OAAO;YAC1C,4CAA4C,EAAE,OAAO;YACrD,0CAA0C,EAAE,OAAO;YACnD,iCAAiC,EAAE,OAAO;YAC1C,uDAAuD,EAAE,OAAO;YAChE,0CAA0C,EAAE,OAAO;YACnD,+BAA+B,EAAE,OAAO;YACxC,2BAA2B,EAAE,OAAO;YACpC,iCAAiC,EAAE,OAAO;YAC1C,+BAA+B,EAAE,OAAO;YACxC,6BAA6B,EAAE,OAAO;YACtC,6BAA6B,EAAE,OAAO;YACtC,wCAAwC,EAAE,OAAO;YACjD,yCAAyC,EAAE,OAAO;YAClD,6BAA6B,EAAE,OAAO;YACtC,kCAAkC,EAAE,OAAO;YAC3C,yDAAyD,EAAE,OAAO;YAClE,iCAAiC,EAAE,OAAO;YAC1C,oCAAoC,EAAE,OAAO;YAC7C,oBAAoB,EAAE,OAAO;YAC7B,wCAAwC,EAAE,OAAO;SAClD;KACF;CACF,CAAC","sourcesContent":["/**\n * DO NOT EDIT\n * This file is generated\n */\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nexport default (\n plugin: TSESLint.FlatConfig.Plugin,\n parser: TSESLint.FlatConfig.Parser\n): TSESLint.FlatConfig.ConfigArray => [\n {\n name: 'ngrx/base',\n languageOptions: {\n parser,\n sourceType: 'module',\n },\n plugins: {\n '@ngrx': plugin,\n },\n },\n {\n name: 'ngrx/all',\n languageOptions: {\n parser,\n parserOptions: {\n ecmaVersion: 2020,\n sourceType: 'module',\n project: './tsconfig.json',\n },\n },\n rules: {\n '@ngrx/avoid-combining-component-store-selectors': 'error',\n '@ngrx/avoid-mapping-component-store-selectors': 'error',\n '@ngrx/updater-explicit-return-type': 'error',\n '@ngrx/avoid-cyclic-effects': 'error',\n '@ngrx/no-dispatch-in-effects': 'error',\n '@ngrx/no-effects-in-providers': 'error',\n '@ngrx/no-multiple-actions-in-effects': 'error',\n '@ngrx/prefer-action-creator-in-of-type': 'error',\n '@ngrx/prefer-effect-callback-in-block-statement': 'error',\n '@ngrx/use-effects-lifecycle-interface': 'error',\n '@ngrx/prefer-concat-latest-from': 'error',\n '@ngrx/signal-state-no-arrays-at-root-level': 'error',\n '@ngrx/with-state-no-arrays-at-root-level': 'error',\n '@ngrx/avoid-combining-selectors': 'error',\n '@ngrx/avoid-dispatching-multiple-actions-sequentially': 'error',\n '@ngrx/avoid-duplicate-actions-in-reducer': 'error',\n '@ngrx/avoid-mapping-selectors': 'error',\n '@ngrx/good-action-hygiene': 'error',\n '@ngrx/no-multiple-global-stores': 'error',\n '@ngrx/no-reducer-in-key-names': 'error',\n '@ngrx/no-store-subscription': 'error',\n '@ngrx/no-typed-global-store': 'error',\n '@ngrx/on-function-explicit-return-type': 'error',\n '@ngrx/prefer-action-creator-in-dispatch': 'error',\n '@ngrx/prefer-action-creator': 'error',\n '@ngrx/prefer-inline-action-props': 'error',\n '@ngrx/prefer-one-generic-in-create-for-feature-selector': 'error',\n '@ngrx/prefer-selector-in-select': 'error',\n '@ngrx/prefix-selectors-with-select': 'error',\n '@ngrx/select-style': 'error',\n '@ngrx/use-consistent-global-store-name': 'error',\n },\n },\n];\n"]}
|
|
1
|
+
{"version":3,"file":"all.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/configs/all.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAIH,kBAAe,CACb,MAAkC,EAClC,MAAkC,EACD,EAAE,CAAC;IACpC;QACE,IAAI,EAAE,WAAW;QACjB,eAAe,EAAE;YACf,MAAM;YACN,UAAU,EAAE,QAAQ;SACrB;QACD,OAAO,EAAE;YACP,OAAO,EAAE,MAAM;SAChB;KACF;IACD;QACE,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE;YACf,MAAM;YACN,aAAa,EAAE;gBACb,WAAW,EAAE,IAAI;gBACjB,UAAU,EAAE,QAAQ;gBACpB,OAAO,EAAE,iBAAiB;aAC3B;SACF;QACD,KAAK,EAAE;YACL,iDAAiD,EAAE,OAAO;YAC1D,+CAA+C,EAAE,OAAO;YACxD,oCAAoC,EAAE,OAAO;YAC7C,4BAA4B,EAAE,OAAO;YACrC,8BAA8B,EAAE,OAAO;YACvC,+BAA+B,EAAE,OAAO;YACxC,sCAAsC,EAAE,OAAO;YAC/C,wCAAwC,EAAE,OAAO;YACjD,iDAAiD,EAAE,OAAO;YAC1D,uCAAuC,EAAE,OAAO;YAChD,iCAAiC,EAAE,OAAO;YAC1C,4CAA4C,EAAE,OAAO;YACrD,oDAAoD,EAAE,OAAO;YAC7D,8BAA8B,EAAE,OAAO;YACvC,0CAA0C,EAAE,OAAO;YACnD,iCAAiC,EAAE,OAAO;YAC1C,uDAAuD,EAAE,OAAO;YAChE,0CAA0C,EAAE,OAAO;YACnD,+BAA+B,EAAE,OAAO;YACxC,2BAA2B,EAAE,OAAO;YACpC,iCAAiC,EAAE,OAAO;YAC1C,+BAA+B,EAAE,OAAO;YACxC,6BAA6B,EAAE,OAAO;YACtC,6BAA6B,EAAE,OAAO;YACtC,wCAAwC,EAAE,OAAO;YACjD,yCAAyC,EAAE,OAAO;YAClD,6BAA6B,EAAE,OAAO;YACtC,kCAAkC,EAAE,OAAO;YAC3C,yDAAyD,EAAE,OAAO;YAClE,iCAAiC,EAAE,OAAO;YAC1C,oCAAoC,EAAE,OAAO;YAC7C,oBAAoB,EAAE,OAAO;YAC7B,wCAAwC,EAAE,OAAO;SAClD;KACF;CACF,CAAC","sourcesContent":["/**\n * DO NOT EDIT\n * This file is generated\n */\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nexport default (\n plugin: TSESLint.FlatConfig.Plugin,\n parser: TSESLint.FlatConfig.Parser\n): TSESLint.FlatConfig.ConfigArray => [\n {\n name: 'ngrx/base',\n languageOptions: {\n parser,\n sourceType: 'module',\n },\n plugins: {\n '@ngrx': plugin,\n },\n },\n {\n name: 'ngrx/all',\n languageOptions: {\n parser,\n parserOptions: {\n ecmaVersion: 2020,\n sourceType: 'module',\n project: './tsconfig.json',\n },\n },\n rules: {\n '@ngrx/avoid-combining-component-store-selectors': 'error',\n '@ngrx/avoid-mapping-component-store-selectors': 'error',\n '@ngrx/updater-explicit-return-type': 'error',\n '@ngrx/avoid-cyclic-effects': 'error',\n '@ngrx/no-dispatch-in-effects': 'error',\n '@ngrx/no-effects-in-providers': 'error',\n '@ngrx/no-multiple-actions-in-effects': 'error',\n '@ngrx/prefer-action-creator-in-of-type': 'error',\n '@ngrx/prefer-effect-callback-in-block-statement': 'error',\n '@ngrx/use-effects-lifecycle-interface': 'error',\n '@ngrx/prefer-concat-latest-from': 'error',\n '@ngrx/signal-state-no-arrays-at-root-level': 'error',\n '@ngrx/signal-store-feature-should-use-generic-type': 'error',\n '@ngrx/prefer-protected-state': 'error',\n '@ngrx/with-state-no-arrays-at-root-level': 'error',\n '@ngrx/avoid-combining-selectors': 'error',\n '@ngrx/avoid-dispatching-multiple-actions-sequentially': 'error',\n '@ngrx/avoid-duplicate-actions-in-reducer': 'error',\n '@ngrx/avoid-mapping-selectors': 'error',\n '@ngrx/good-action-hygiene': 'error',\n '@ngrx/no-multiple-global-stores': 'error',\n '@ngrx/no-reducer-in-key-names': 'error',\n '@ngrx/no-store-subscription': 'error',\n '@ngrx/no-typed-global-store': 'error',\n '@ngrx/on-function-explicit-return-type': 'error',\n '@ngrx/prefer-action-creator-in-dispatch': 'error',\n '@ngrx/prefer-action-creator': 'error',\n '@ngrx/prefer-inline-action-props': 'error',\n '@ngrx/prefer-one-generic-in-create-for-feature-selector': 'error',\n '@ngrx/prefer-selector-in-select': 'error',\n '@ngrx/prefix-selectors-with-select': 'error',\n '@ngrx/select-style': 'error',\n '@ngrx/use-consistent-global-store-name': 'error',\n },\n },\n];\n"]}
|
package/src/configs/all.json
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
"@ngrx/use-effects-lifecycle-interface": "error",
|
|
15
15
|
"@ngrx/prefer-concat-latest-from": "error",
|
|
16
16
|
"@ngrx/signal-state-no-arrays-at-root-level": "error",
|
|
17
|
+
"@ngrx/signal-store-feature-should-use-generic-type": "error",
|
|
18
|
+
"@ngrx/prefer-protected-state": "error",
|
|
17
19
|
"@ngrx/with-state-no-arrays-at-root-level": "error",
|
|
18
20
|
"@ngrx/avoid-combining-selectors": "error",
|
|
19
21
|
"@ngrx/avoid-dispatching-multiple-actions-sequentially": "error",
|
package/src/configs/signals.js
CHANGED
|
@@ -27,6 +27,8 @@ exports.default = (plugin, parser) => [
|
|
|
27
27
|
},
|
|
28
28
|
rules: {
|
|
29
29
|
'@ngrx/signal-state-no-arrays-at-root-level': 'error',
|
|
30
|
+
'@ngrx/signal-store-feature-should-use-generic-type': 'error',
|
|
31
|
+
'@ngrx/prefer-protected-state': 'error',
|
|
30
32
|
'@ngrx/with-state-no-arrays-at-root-level': 'error',
|
|
31
33
|
},
|
|
32
34
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signals.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/configs/signals.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAIH,kBAAe,CACb,MAAkC,EAClC,MAAkC,EACD,EAAE,CAAC;IACpC;QACE,IAAI,EAAE,WAAW;QACjB,eAAe,EAAE;YACf,MAAM;YACN,UAAU,EAAE,QAAQ;SACrB;QACD,OAAO,EAAE;YACP,OAAO,EAAE,MAAM;SAChB;KACF;IACD;QACE,IAAI,EAAE,cAAc;QACpB,eAAe,EAAE;YACf,MAAM;YACN,aAAa,EAAE;gBACb,WAAW,EAAE,IAAI;gBACjB,UAAU,EAAE,QAAQ;gBACpB,OAAO,EAAE,iBAAiB;aAC3B;SACF;QACD,KAAK,EAAE;YACL,4CAA4C,EAAE,OAAO;YACrD,0CAA0C,EAAE,OAAO;SACpD;KACF;CACF,CAAC","sourcesContent":["/**\n * DO NOT EDIT\n * This file is generated\n */\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nexport default (\n plugin: TSESLint.FlatConfig.Plugin,\n parser: TSESLint.FlatConfig.Parser\n): TSESLint.FlatConfig.ConfigArray => [\n {\n name: 'ngrx/base',\n languageOptions: {\n parser,\n sourceType: 'module',\n },\n plugins: {\n '@ngrx': plugin,\n },\n },\n {\n name: 'ngrx/signals',\n languageOptions: {\n parser,\n parserOptions: {\n ecmaVersion: 2020,\n sourceType: 'module',\n project: './tsconfig.json',\n },\n },\n rules: {\n '@ngrx/signal-state-no-arrays-at-root-level': 'error',\n '@ngrx/with-state-no-arrays-at-root-level': 'error',\n },\n },\n];\n"]}
|
|
1
|
+
{"version":3,"file":"signals.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/configs/signals.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAIH,kBAAe,CACb,MAAkC,EAClC,MAAkC,EACD,EAAE,CAAC;IACpC;QACE,IAAI,EAAE,WAAW;QACjB,eAAe,EAAE;YACf,MAAM;YACN,UAAU,EAAE,QAAQ;SACrB;QACD,OAAO,EAAE;YACP,OAAO,EAAE,MAAM;SAChB;KACF;IACD;QACE,IAAI,EAAE,cAAc;QACpB,eAAe,EAAE;YACf,MAAM;YACN,aAAa,EAAE;gBACb,WAAW,EAAE,IAAI;gBACjB,UAAU,EAAE,QAAQ;gBACpB,OAAO,EAAE,iBAAiB;aAC3B;SACF;QACD,KAAK,EAAE;YACL,4CAA4C,EAAE,OAAO;YACrD,oDAAoD,EAAE,OAAO;YAC7D,8BAA8B,EAAE,OAAO;YACvC,0CAA0C,EAAE,OAAO;SACpD;KACF;CACF,CAAC","sourcesContent":["/**\n * DO NOT EDIT\n * This file is generated\n */\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nexport default (\n plugin: TSESLint.FlatConfig.Plugin,\n parser: TSESLint.FlatConfig.Parser\n): TSESLint.FlatConfig.ConfigArray => [\n {\n name: 'ngrx/base',\n languageOptions: {\n parser,\n sourceType: 'module',\n },\n plugins: {\n '@ngrx': plugin,\n },\n },\n {\n name: 'ngrx/signals',\n languageOptions: {\n parser,\n parserOptions: {\n ecmaVersion: 2020,\n sourceType: 'module',\n project: './tsconfig.json',\n },\n },\n rules: {\n '@ngrx/signal-state-no-arrays-at-root-level': 'error',\n '@ngrx/signal-store-feature-should-use-generic-type': 'error',\n '@ngrx/prefer-protected-state': 'error',\n '@ngrx/with-state-no-arrays-at-root-level': 'error',\n },\n },\n];\n"]}
|
package/src/configs/signals.json
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
"plugins": ["@ngrx"],
|
|
4
4
|
"rules": {
|
|
5
5
|
"@ngrx/signal-state-no-arrays-at-root-level": "error",
|
|
6
|
+
"@ngrx/signal-store-feature-should-use-generic-type": "error",
|
|
7
|
+
"@ngrx/prefer-protected-state": "error",
|
|
6
8
|
"@ngrx/with-state-no-arrays-at-root-level": "error"
|
|
7
9
|
},
|
|
8
10
|
"parserOptions": {
|
package/src/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ declare const _default: {
|
|
|
16
16
|
"@ngrx/use-effects-lifecycle-interface": string;
|
|
17
17
|
"@ngrx/prefer-concat-latest-from": string;
|
|
18
18
|
"@ngrx/signal-state-no-arrays-at-root-level": string;
|
|
19
|
+
"@ngrx/signal-store-feature-should-use-generic-type": string;
|
|
20
|
+
"@ngrx/prefer-protected-state": string;
|
|
19
21
|
"@ngrx/with-state-no-arrays-at-root-level": string;
|
|
20
22
|
"@ngrx/avoid-combining-selectors": string;
|
|
21
23
|
"@ngrx/avoid-dispatching-multiple-actions-sequentially": string;
|
|
@@ -105,6 +107,8 @@ declare const _default: {
|
|
|
105
107
|
plugins: string[];
|
|
106
108
|
rules: {
|
|
107
109
|
"@ngrx/signal-state-no-arrays-at-root-level": string;
|
|
110
|
+
"@ngrx/signal-store-feature-should-use-generic-type": string;
|
|
111
|
+
"@ngrx/prefer-protected-state": string;
|
|
108
112
|
"@ngrx/with-state-no-arrays-at-root-level": string;
|
|
109
113
|
};
|
|
110
114
|
parserOptions: {
|
|
@@ -147,6 +151,8 @@ declare const _default: {
|
|
|
147
151
|
readonly strict: boolean;
|
|
148
152
|
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
149
153
|
'signal-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStateNoArraysAtRootLevel", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
154
|
+
'signal-store-feature-should-use-generic-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStoreFeatureShouldUseGenericType", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
155
|
+
'prefer-protected-state': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferProtectedState" | "preferProtectedStateSuggest", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
150
156
|
'with-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"withStateNoArraysAtRootLevel", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
151
157
|
};
|
|
152
158
|
};
|
package/src/rule-creator.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createRule =
|
|
3
|
+
exports.createRule = createRule;
|
|
4
4
|
const utils_1 = require("@typescript-eslint/utils");
|
|
5
5
|
const utils_2 = require("./utils");
|
|
6
6
|
function createRule(config) {
|
|
@@ -20,5 +20,4 @@ function createRule(config) {
|
|
|
20
20
|
}
|
|
21
21
|
return utils_1.ESLintUtils.RuleCreator(utils_2.docsUrl)(configOverwrite);
|
|
22
22
|
}
|
|
23
|
-
exports.createRule = createRule;
|
|
24
23
|
//# sourceMappingURL=rule-creator.js.map
|
package/src/rule-creator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-creator.js","sourceRoot":"","sources":["../../../../modules/eslint-plugin/src/rule-creator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rule-creator.js","sourceRoot":"","sources":["../../../../modules/eslint-plugin/src/rule-creator.ts"],"names":[],"mappings":";;AA2BA,gCAyCC;AAnED,oDAAuD;AAEvD,mCAA2E;AAwB3E,SAAgB,UAAU,CAIxB,MAQE;IAEF,MAAM,eAAe,GAAG;QACtB,GAAG,MAAM;QACT,MAAM,EAAE,CACN,OAA8D,EAC9D,kBAAsC,EACtC,EAAE;YACF,MAAM,EACJ,IAAI,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,GAC9B,GAAG,MAAM,CAAC;YACX,IACE,OAAO,KAAK,SAAS;gBACrB,CAAC,IAAA,4BAAoB,EAAC,yBAAiB,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,EAC7D,CAAC;gBACD,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QACpD,CAAC;KACF,CAAC;IAEF,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1E,eAAe,CAAC,IAAI,CAAC,QAAgB,CAAC,GAAG,CAAC,GAAG,GAAG,OAAO,KAAK,IAAA,eAAO,EAClE,MAAM,CAAC,IAAI,CACZ,GAAG,CAAC;IACP,CAAC;IAED,OAAO,mBAAW,CAAC,WAAW,CAAC,eAAO,CAAC,CAAC,eAAe,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import type { TSESLint } from '@typescript-eslint/utils';\nimport { ESLintUtils } from '@typescript-eslint/utils';\nimport type { NGRX_MODULE } from './utils';\nimport { docsUrl, ngrxVersionSatisfies, NGRX_MODULE_PATHS } from './utils';\n\ntype Meta<TMessageIds extends string, TOptions extends readonly unknown[]> =\n | TSESLint.RuleMetaData<TMessageIds, TOptions> & {\n ngrxModule: NGRX_MODULE;\n version?: string;\n docs: { requiresTypeChecking?: boolean };\n };\n\ntype CreateRuleMeta<\n TMessageIds extends string,\n TOptions extends readonly unknown[]\n> = {\n docs: Omit<TSESLint.RuleMetaDataDocs, 'url'> & {\n requiresTypeChecking?: boolean;\n };\n} & Omit<Meta<TMessageIds, TOptions>, 'docs'>;\nexport type NgRxRuleModule<\n TOptions extends readonly unknown[],\n TMessageIds extends string\n> = Omit<TSESLint.RuleModule<TMessageIds, TOptions>, 'meta'> & {\n meta: Meta<TMessageIds, TOptions>;\n};\n\nexport function createRule<\n TOptions extends readonly unknown[],\n TMessageIds extends string\n>(\n config: Readonly<{\n name: string;\n meta: CreateRuleMeta<TMessageIds, TOptions>;\n defaultOptions: Readonly<TOptions>;\n create: (\n context: Readonly<TSESLint.RuleContext<TMessageIds, TOptions>>,\n optionsWithDefault: Readonly<TOptions>\n ) => TSESLint.RuleListener;\n }>\n): TSESLint.RuleModule<TMessageIds, TOptions> {\n const configOverwrite = {\n ...config,\n create: (\n context: Readonly<TSESLint.RuleContext<TMessageIds, TOptions>>,\n optionsWithDefault: Readonly<TOptions>\n ) => {\n const {\n meta: { ngrxModule, version },\n } = config;\n if (\n version !== undefined &&\n !ngrxVersionSatisfies(NGRX_MODULE_PATHS[ngrxModule], version)\n ) {\n return {};\n }\n\n return config.create(context, optionsWithDefault);\n },\n };\n\n for (const [key, message] of Object.entries(configOverwrite.meta.messages)) {\n (configOverwrite.meta.messages as any)[key] = `${message} (${docsUrl(\n config.name\n )})`;\n }\n\n return ESLintUtils.RuleCreator(docsUrl)(configOverwrite);\n}\n"]}
|
|
@@ -61,7 +61,7 @@ exports.default = (0, rule_creator_1.createRule)({
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
else if (type.isUnion() &&
|
|
64
|
-
type.types.some((ut) =>
|
|
64
|
+
type.types.some((ut) => typeChecker.isArrayType(ut))) {
|
|
65
65
|
context.report({
|
|
66
66
|
node: nodeToReport,
|
|
67
67
|
messageId: exports.messageId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-multiple-actions-in-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/no-multiple-actions-in-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAIkC;AAClC,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,SAAS,GAAG,4BAA4B,CAAC;AAUtD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,UAAU,EAAE,SAAS;QACrB,IAAI,EAAE;YACJ,WAAW,EAAE,8CAA8C;YAC3D,oBAAoB,EAAE,IAAI;SAC3B;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EAAE,yCAAyC;SACvD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,GAAG,8BAAsB,IAAI,sCAA8B,EAAE,CAAC,CAC7D,IAAmC;gBAEnC,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;gBAC3C,IAAI,CAAC,YAAY,EAAE,CAAC;oBAClB,OAAO;gBACT,CAAC;gBAED,MAAM,QAAQ,GAAG,mBAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;gBACxD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;gBACtD,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;gBAEtD,IAAI,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;oBAClC,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,YAAY;wBAClB,SAAS,EAAT,iBAAS;qBACV,CAAC,CAAC;gBACL,CAAC;qBAAM,IACL,IAAI,CAAC,OAAO,EAAE;oBACd,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"no-multiple-actions-in-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/no-multiple-actions-in-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAIkC;AAClC,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,SAAS,GAAG,4BAA4B,CAAC;AAUtD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,UAAU,EAAE,SAAS;QACrB,IAAI,EAAE;YACJ,WAAW,EAAE,8CAA8C;YAC3D,oBAAoB,EAAE,IAAI;SAC3B;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EAAE,yCAAyC;SACvD;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,GAAG,8BAAsB,IAAI,sCAA8B,EAAE,CAAC,CAC7D,IAAmC;gBAEnC,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;gBAC3C,IAAI,CAAC,YAAY,EAAE,CAAC;oBAClB,OAAO;gBACT,CAAC;gBAED,MAAM,QAAQ,GAAG,mBAAW,CAAC,iBAAiB,CAAC,OAAO,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,IAAI,CAAC,CAAC,CAAC,EAAiC,EAAE,CACjE,IAAA,yBAAiB,EAAC,CAAC,CAAC,CACrB,CAAC;IACF,OAAO,UAAU,EAAE,QAAQ,CAAC;AAC9B,CAAC","sourcesContent":["import {\n AST_NODE_TYPES,\n ESLintUtils,\n type TSESTree,\n} from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n createEffectExpression,\n isBlockStatement,\n isReturnStatement,\n mapLikeOperatorCallExpressions,\n} from '../../utils';\n\nexport const messageId = 'noMultipleActionsInEffects';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly unknown[];\ntype EffectsMapLikeOperatorsReturn =\n | TSESTree.ArrowFunctionExpression\n | TSESTree.CallExpression\n | TSESTree.FunctionExpression\n | TSESTree.ReturnStatement;\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n ngrxModule: 'effects',\n docs: {\n description: '`Effect` should not return multiple actions.',\n requiresTypeChecking: true,\n },\n schema: [],\n messages: {\n [messageId]: '`Effect` should return a single action.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`${createEffectExpression} ${mapLikeOperatorCallExpressions}`](\n node: EffectsMapLikeOperatorsReturn\n ) {\n const nodeToReport = getNodeToReport(node);\n if (!nodeToReport) {\n return;\n }\n\n const services = ESLintUtils.getParserServices(context);\n const typeChecker = services.program.getTypeChecker();\n const type = services.getTypeAtLocation(nodeToReport);\n\n if (typeChecker.isArrayType(type)) {\n context.report({\n node: nodeToReport,\n messageId,\n });\n } else if (\n type.isUnion() &&\n type.types.some((ut) => typeChecker.isArrayType(ut))\n ) {\n context.report({\n node: nodeToReport,\n messageId,\n });\n }\n },\n };\n },\n});\n\nfunction getNodeToReport(node: EffectsMapLikeOperatorsReturn) {\n switch (node.type) {\n case AST_NODE_TYPES.ArrowFunctionExpression:\n case AST_NODE_TYPES.FunctionExpression:\n return isBlockStatement(node.body)\n ? findReturnStatement(node.body.body)\n : node.body;\n case AST_NODE_TYPES.CallExpression:\n return findReturnStatement(node.arguments) ?? node.arguments[0];\n default:\n return node.argument;\n }\n}\n\nfunction findReturnStatement(nodes: TSESTree.Node[]) {\n const returnNode = nodes.find((n): n is TSESTree.ReturnStatement =>\n isReturnStatement(n)\n );\n return returnNode?.argument;\n}\n"]}
|
package/src/rules/index.d.ts
CHANGED
|
@@ -31,5 +31,7 @@ export declare const rules: {
|
|
|
31
31
|
readonly strict: boolean;
|
|
32
32
|
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
33
33
|
'signal-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStateNoArraysAtRootLevel", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
34
|
+
'signal-store-feature-should-use-generic-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStoreFeatureShouldUseGenericType", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
35
|
+
'prefer-protected-state': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferProtectedState" | "preferProtectedStateSuggest", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
34
36
|
'with-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"withStateNoArraysAtRootLevel", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
35
37
|
};
|
package/src/rules/index.js
CHANGED
|
@@ -37,8 +37,11 @@ const select_style_1 = __importDefault(require("./store/select-style"));
|
|
|
37
37
|
const use_consistent_global_store_name_1 = __importDefault(require("./store/use-consistent-global-store-name"));
|
|
38
38
|
// operators
|
|
39
39
|
const prefer_concat_latest_from_1 = __importDefault(require("./operators/prefer-concat-latest-from"));
|
|
40
|
+
// signals
|
|
40
41
|
const signal_state_no_arrays_at_root_level_1 = __importDefault(require("./signals/signal-state-no-arrays-at-root-level"));
|
|
42
|
+
const signal_store_feature_should_use_generic_type_1 = __importDefault(require("./signals/signal-store-feature-should-use-generic-type"));
|
|
41
43
|
const with_state_no_arrays_at_root_level_1 = __importDefault(require("./signals/with-state-no-arrays-at-root-level"));
|
|
44
|
+
const prefer_protected_state_1 = __importDefault(require("./signals/prefer-protected-state"));
|
|
42
45
|
exports.rules = {
|
|
43
46
|
// component-store
|
|
44
47
|
'avoid-combining-component-store-selectors': avoid_combining_component_store_selectors_1.default,
|
|
@@ -75,6 +78,8 @@ exports.rules = {
|
|
|
75
78
|
'prefer-concat-latest-from': prefer_concat_latest_from_1.default,
|
|
76
79
|
// signals
|
|
77
80
|
'signal-state-no-arrays-at-root-level': signal_state_no_arrays_at_root_level_1.default,
|
|
81
|
+
'signal-store-feature-should-use-generic-type': signal_store_feature_should_use_generic_type_1.default,
|
|
82
|
+
'prefer-protected-state': prefer_protected_state_1.default,
|
|
78
83
|
'with-state-no-arrays-at-root-level': with_state_no_arrays_at_root_level_1.default,
|
|
79
84
|
};
|
|
80
85
|
//# sourceMappingURL=index.js.map
|
package/src/rules/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/rules/index.ts"],"names":[],"mappings":";;;;;;AAAA,kBAAkB;AAClB,4IAAgH;AAChH,wIAA4G;AAC5G,kHAAuF;AACvF,UAAU;AACV,0FAAgE;AAChE,8FAAmE;AACnE,gGAAqE;AACrE,8GAAkF;AAClF,kHAAqF;AACrF,oIAAuG;AACvG,gHAAqF;AACrF,QAAQ;AACR,kGAAwE;AACxE,8IAAkH;AAClH,oHAAwF;AACxF,8FAAoE;AACpE,sFAA4D;AAC5D,kGAAuE;AACvE,8FAAkE;AAClE,0FAAgE;AAChE,0FAA+D;AAC/D,gHAAoF;AACpF,0FAAgE;AAChE,kHAAsF;AACtF,oGAAyE;AACzE,kJAAmH;AACnH,kGAAuE;AACvE,wGAA6E;AAC7E,wEAA+C;AAC/C,gHAAoF;AACpF,YAAY;AACZ,sGAA2E;AAC3E,0HAA4F;AAC5F,sHAAwF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/rules/index.ts"],"names":[],"mappings":";;;;;;AAAA,kBAAkB;AAClB,4IAAgH;AAChH,wIAA4G;AAC5G,kHAAuF;AACvF,UAAU;AACV,0FAAgE;AAChE,8FAAmE;AACnE,gGAAqE;AACrE,8GAAkF;AAClF,kHAAqF;AACrF,oIAAuG;AACvG,gHAAqF;AACrF,QAAQ;AACR,kGAAwE;AACxE,8IAAkH;AAClH,oHAAwF;AACxF,8FAAoE;AACpE,sFAA4D;AAC5D,kGAAuE;AACvE,8FAAkE;AAClE,0FAAgE;AAChE,0FAA+D;AAC/D,gHAAoF;AACpF,0FAAgE;AAChE,kHAAsF;AACtF,oGAAyE;AACzE,kJAAmH;AACnH,kGAAuE;AACvE,wGAA6E;AAC7E,wEAA+C;AAC/C,gHAAoF;AACpF,YAAY;AACZ,sGAA2E;AAC3E,UAAU;AACV,0HAA4F;AAC5F,0IAA4G;AAC5G,sHAAwF;AACxF,8FAAoE;AAEvD,QAAA,KAAK,GAAG;IACnB,kBAAkB;IAClB,2CAA2C,EACzC,mDAAqC;IACvC,yCAAyC,EACvC,iDAAmC;IACrC,8BAA8B,EAAE,sCAAyB;IACzD,SAAS;IACT,sBAAsB,EAAE,8BAAkB;IAC1C,wBAAwB,EAAE,gCAAmB;IAC7C,yBAAyB,EAAE,iCAAoB;IAC/C,gCAAgC,EAAE,wCAA0B;IAC5D,kCAAkC,EAAE,0CAA2B;IAC/D,2CAA2C,EACzC,mDAAoC;IACtC,iCAAiC,EAAE,yCAA4B;IAC/D,QAAQ;IACR,2BAA2B,EAAE,mCAAuB;IACpD,iDAAiD,EAC/C,yDAA2C;IAC7C,oCAAoC,EAAE,4CAA8B;IACpE,yBAAyB,EAAE,iCAAqB;IAChD,qBAAqB,EAAE,6BAAiB;IACxC,2BAA2B,EAAE,mCAAsB;IACnD,yBAAyB,EAAE,iCAAmB;IAC9C,uBAAuB,EAAE,+BAAmB;IAC5C,uBAAuB,EAAE,+BAAkB;IAC3C,kCAAkC,EAAE,0CAA4B;IAChE,uBAAuB,EAAE,+BAAmB;IAC5C,mCAAmC,EAAE,2CAA6B;IAClE,4BAA4B,EAAE,oCAAuB;IACrD,mDAAmD,EACjD,2DAA0C;IAC5C,2BAA2B,EAAE,mCAAsB;IACnD,8BAA8B,EAAE,sCAAyB;IACzD,cAAc,EAAE,sBAAW;IAC3B,kCAAkC,EAAE,0CAA4B;IAChE,YAAY;IACZ,2BAA2B,EAAE,mCAAsB;IACnD,UAAU;IACV,sCAAsC,EAAE,8CAA8B;IACtE,8CAA8C,EAC5C,sDAAsC;IACxC,wBAAwB,EAAE,gCAAoB;IAC9C,oCAAoC,EAAE,4CAA4B;CACnE,CAAC","sourcesContent":["// component-store\nimport avoidCombiningComponentStoreSelectors from './component-store/avoid-combining-component-store-selectors';\nimport avoidMappingComponentStoreSelectors from './component-store/avoid-mapping-component-store-selectors';\nimport updaterExplicitReturnType from './component-store/updater-explicit-return-type';\n// effects\nimport avoidCyclicEffects from './effects/avoid-cyclic-effects';\nimport noDispatchInEffects from './effects/no-dispatch-in-effects';\nimport noEffectsInProviders from './effects/no-effects-in-providers';\nimport noMultipleActionsInEffects from './effects/no-multiple-actions-in-effects';\nimport preferActionCreatorInOfType from './effects/prefer-action-creator-in-of-type';\nimport preferEffectCallbackInBlockStatement from './effects/prefer-effect-callback-in-block-statement';\nimport useEffectsLifecycleInterface from './effects/use-effects-lifecycle-interface';\n// store\nimport avoidCombiningSelectors from './store/avoid-combining-selectors';\nimport avoidDispatchingMultipleActionsSequentially from './store/avoid-dispatching-multiple-actions-sequentially';\nimport avoidDuplicateActionsInReducer from './store/avoid-duplicate-actions-in-reducer';\nimport avoidMappingSelectors from './store/avoid-mapping-selectors';\nimport goodActionHygiene from './store/good-action-hygiene';\nimport noMultipleGlobalStores from './store/no-multiple-global-stores';\nimport noReducerInKeyNames from './store/no-reducer-in-key-names';\nimport noStoreSubscription from './store/no-store-subscription';\nimport noTypedGlobalStore from './store/no-typed-global-store';\nimport onFunctionExplicitReturnType from './store/on-function-explicit-return-type';\nimport preferActionCreator from './store/prefer-action-creator';\nimport preferActionCreatorInDispatch from './store/prefer-action-creator-in-dispatch';\nimport preferInlineActionProps from './store/prefer-inline-action-props';\nimport preferOneGenericInCreateForFeatureSelector from './store/prefer-one-generic-in-create-for-feature-selector';\nimport preferSelectorInSelect from './store/prefer-selector-in-select';\nimport prefixSelectorsWithSelect from './store/prefix-selectors-with-select';\nimport selectStyle from './store/select-style';\nimport useConsistentGlobalStoreName from './store/use-consistent-global-store-name';\n// operators\nimport preferConcatLatestFrom from './operators/prefer-concat-latest-from';\n// signals\nimport signalStateNoArraysAtRootLevel from './signals/signal-state-no-arrays-at-root-level';\nimport signalStoreFeatureShouldUseGenericType from './signals/signal-store-feature-should-use-generic-type';\nimport withStateNoArraysAtRootLevel from './signals/with-state-no-arrays-at-root-level';\nimport preferProtectedState from './signals/prefer-protected-state';\n\nexport const rules = {\n // component-store\n 'avoid-combining-component-store-selectors':\n avoidCombiningComponentStoreSelectors,\n 'avoid-mapping-component-store-selectors':\n avoidMappingComponentStoreSelectors,\n 'updater-explicit-return-type': updaterExplicitReturnType,\n //effects\n 'avoid-cyclic-effects': avoidCyclicEffects,\n 'no-dispatch-in-effects': noDispatchInEffects,\n 'no-effects-in-providers': noEffectsInProviders,\n 'no-multiple-actions-in-effects': noMultipleActionsInEffects,\n 'prefer-action-creator-in-of-type': preferActionCreatorInOfType,\n 'prefer-effect-callback-in-block-statement':\n preferEffectCallbackInBlockStatement,\n 'use-effects-lifecycle-interface': useEffectsLifecycleInterface,\n // store\n 'avoid-combining-selectors': avoidCombiningSelectors,\n 'avoid-dispatching-multiple-actions-sequentially':\n avoidDispatchingMultipleActionsSequentially,\n 'avoid-duplicate-actions-in-reducer': avoidDuplicateActionsInReducer,\n 'avoid-mapping-selectors': avoidMappingSelectors,\n 'good-action-hygiene': goodActionHygiene,\n 'no-multiple-global-stores': noMultipleGlobalStores,\n 'no-reducer-in-key-names': noReducerInKeyNames,\n 'no-store-subscription': noStoreSubscription,\n 'no-typed-global-store': noTypedGlobalStore,\n 'on-function-explicit-return-type': onFunctionExplicitReturnType,\n 'prefer-action-creator': preferActionCreator,\n 'prefer-action-creator-in-dispatch': preferActionCreatorInDispatch,\n 'prefer-inline-action-props': preferInlineActionProps,\n 'prefer-one-generic-in-create-for-feature-selector':\n preferOneGenericInCreateForFeatureSelector,\n 'prefer-selector-in-select': preferSelectorInSelect,\n 'prefix-selectors-with-select': prefixSelectorsWithSelect,\n 'select-style': selectStyle,\n 'use-consistent-global-store-name': useConsistentGlobalStoreName,\n // operators\n 'prefer-concat-latest-from': preferConcatLatestFrom,\n // signals\n 'signal-state-no-arrays-at-root-level': signalStateNoArraysAtRootLevel,\n 'signal-store-feature-should-use-generic-type':\n signalStoreFeatureShouldUseGenericType,\n 'prefer-protected-state': preferProtectedState,\n 'with-state-no-arrays-at-root-level': withStateNoArraysAtRootLevel,\n};\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const preferProtectedState = "preferProtectedState";
|
|
2
|
+
export declare const preferProtectedStateSuggest = "preferProtectedStateSuggest";
|
|
3
|
+
type MessageIds = typeof preferProtectedState | typeof preferProtectedStateSuggest;
|
|
4
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.preferProtectedStateSuggest = exports.preferProtectedState = void 0;
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const rule_creator_1 = require("../../rule-creator");
|
|
29
|
+
exports.preferProtectedState = 'preferProtectedState';
|
|
30
|
+
exports.preferProtectedStateSuggest = 'preferProtectedStateSuggest';
|
|
31
|
+
exports.default = (0, rule_creator_1.createRule)({
|
|
32
|
+
name: path.parse(__filename).name,
|
|
33
|
+
meta: {
|
|
34
|
+
type: 'suggestion',
|
|
35
|
+
hasSuggestions: true,
|
|
36
|
+
ngrxModule: 'signals',
|
|
37
|
+
docs: {
|
|
38
|
+
description: `A Signal Store prefers protected state`,
|
|
39
|
+
},
|
|
40
|
+
schema: [],
|
|
41
|
+
messages: {
|
|
42
|
+
[exports.preferProtectedState]: '{ protectedState: false } should be removed to prevent external state mutations.',
|
|
43
|
+
[exports.preferProtectedStateSuggest]: 'Remove `{protectedState: false}`.',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
defaultOptions: [],
|
|
47
|
+
create: (context) => {
|
|
48
|
+
return {
|
|
49
|
+
[`CallExpression[callee.name=signalStore][arguments.length>0] > ObjectExpression[properties.length>0] > Property[key.name=protectedState][value.value=false]`](node) {
|
|
50
|
+
context.report({
|
|
51
|
+
node,
|
|
52
|
+
messageId: exports.preferProtectedState,
|
|
53
|
+
suggest: [
|
|
54
|
+
{
|
|
55
|
+
messageId: exports.preferProtectedStateSuggest,
|
|
56
|
+
fix: (fixer) => {
|
|
57
|
+
const getRangeToBeRemoved = () => {
|
|
58
|
+
const parentObject = node.parent;
|
|
59
|
+
const parentObjectHasOnlyOneProperty = parentObject.properties.length === 1;
|
|
60
|
+
if (parentObjectHasOnlyOneProperty) {
|
|
61
|
+
/**
|
|
62
|
+
* Remove the entire object if it contains only one property - the relevant one
|
|
63
|
+
*/
|
|
64
|
+
return parentObject.range;
|
|
65
|
+
}
|
|
66
|
+
const tokenAfter = context.sourceCode.getTokenAfter(node);
|
|
67
|
+
const tokenAfterIsComma = tokenAfter?.value?.trim() === ',';
|
|
68
|
+
/**
|
|
69
|
+
* Remove the specific property if there is more than one property in the parent
|
|
70
|
+
*/
|
|
71
|
+
return [
|
|
72
|
+
node.range[0],
|
|
73
|
+
/**
|
|
74
|
+
* remove trailing comma as well
|
|
75
|
+
*/
|
|
76
|
+
tokenAfterIsComma ? tokenAfter.range[1] : node.range[1],
|
|
77
|
+
];
|
|
78
|
+
};
|
|
79
|
+
return fixer.removeRange(getRangeToBeRemoved());
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=prefer-protected-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-protected-state.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/signals/prefer-protected-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E,KAAK,GAAG,CAAC;oCAC5D;;uCAEG;oCACH,OAAO;wCACL,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;wCACb;;2CAEG;wCACH,iBAAiB,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;qCACxD,CAAC;gCACJ,CAAC,CAAC;gCAEF,OAAO,KAAK,CAAC,WAAW,CAAC,mBAAmB,EAAE,CAAC,CAAC;4BAClD,CAAC;yBACF;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { type TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\n\nexport const preferProtectedState = 'preferProtectedState';\nexport const preferProtectedStateSuggest = 'preferProtectedStateSuggest';\n\ntype MessageIds =\n | typeof preferProtectedState\n | typeof preferProtectedStateSuggest;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n ngrxModule: 'signals',\n docs: {\n description: `A Signal Store prefers protected state`,\n },\n schema: [],\n messages: {\n [preferProtectedState]:\n '{ protectedState: false } should be removed to prevent external state mutations.',\n [preferProtectedStateSuggest]: 'Remove `{protectedState: false}`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`CallExpression[callee.name=signalStore][arguments.length>0] > ObjectExpression[properties.length>0] > Property[key.name=protectedState][value.value=false]`](\n node: TSESTree.Property\n ) {\n context.report({\n node,\n messageId: preferProtectedState,\n suggest: [\n {\n messageId: preferProtectedStateSuggest,\n fix: (fixer) => {\n const getRangeToBeRemoved = (): Parameters<\n typeof fixer.removeRange\n >[0] => {\n const parentObject = node.parent as TSESTree.ObjectExpression;\n const parentObjectHasOnlyOneProperty =\n parentObject.properties.length === 1;\n\n if (parentObjectHasOnlyOneProperty) {\n /**\n * Remove the entire object if it contains only one property - the relevant one\n */\n return parentObject.range;\n }\n\n const tokenAfter = context.sourceCode.getTokenAfter(node);\n const tokenAfterIsComma = tokenAfter?.value?.trim() === ',';\n /**\n * Remove the specific property if there is more than one property in the parent\n */\n return [\n node.range[0],\n /**\n * remove trailing comma as well\n */\n tokenAfterIsComma ? tokenAfter.range[1] : node.range[1],\n ];\n };\n\n return fixer.removeRange(getRangeToBeRemoved());\n },\n },\n ],\n });\n },\n };\n },\n});\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
export declare const messageId = "signalStoreFeatureShouldUseGenericType";
|
|
3
|
+
declare const _default: ESLintUtils.RuleModule<"signalStoreFeatureShouldUseGenericType", readonly [], unknown, ESLintUtils.RuleListener>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.messageId = void 0;
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const rule_creator_1 = require("../../rule-creator");
|
|
29
|
+
const utils_1 = require("../../utils");
|
|
30
|
+
exports.messageId = 'signalStoreFeatureShouldUseGenericType';
|
|
31
|
+
exports.default = (0, rule_creator_1.createRule)({
|
|
32
|
+
name: path.parse(__filename).name,
|
|
33
|
+
meta: {
|
|
34
|
+
type: 'problem',
|
|
35
|
+
ngrxModule: 'signals',
|
|
36
|
+
docs: {
|
|
37
|
+
description: `A custom Signal Store feature that accepts an input should define a generic type.`,
|
|
38
|
+
},
|
|
39
|
+
fixable: 'code',
|
|
40
|
+
schema: [],
|
|
41
|
+
messages: {
|
|
42
|
+
[exports.messageId]: `Add an unused generic type to the function creating the signal store feature.`,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
defaultOptions: [],
|
|
46
|
+
create: (context) => {
|
|
47
|
+
function report(signalStoreFeature, func) {
|
|
48
|
+
if (!func ||
|
|
49
|
+
(!(0, utils_1.isFunctionDeclaration)(func) && !(0, utils_1.isArrowFunctionExpression)(func))) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const parentHasGenerics = func.typeParameters && func.typeParameters.params.length > 0;
|
|
53
|
+
if (!parentHasGenerics) {
|
|
54
|
+
context.report({
|
|
55
|
+
node: signalStoreFeature.callee,
|
|
56
|
+
messageId: exports.messageId,
|
|
57
|
+
fix(fixer) {
|
|
58
|
+
if ((0, utils_1.isFunctionDeclaration)(func)) {
|
|
59
|
+
if (func.id) {
|
|
60
|
+
return fixer.insertTextAfter(func.id, '<_>');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return fixer.insertTextBefore(func, '<_>');
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function hasInputAsArgument(node) {
|
|
69
|
+
const [inputArg] = node.arguments;
|
|
70
|
+
return (!(0, utils_1.isCallExpression)(inputArg) ||
|
|
71
|
+
((0, utils_1.isIdentifier)(inputArg.callee) && inputArg.callee.name === 'type'));
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
[`ArrowFunctionExpression > CallExpression[callee.name=signalStoreFeature]`](node) {
|
|
75
|
+
if (hasInputAsArgument(node)) {
|
|
76
|
+
report(node, node.parent);
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
[`ArrowFunctionExpression > BlockStatement CallExpression[callee.name=signalStoreFeature]`](node) {
|
|
80
|
+
if (hasInputAsArgument(node)) {
|
|
81
|
+
let parent = node.parent;
|
|
82
|
+
while (parent && !(0, utils_1.isArrowFunctionExpression)(parent)) {
|
|
83
|
+
parent = parent.parent;
|
|
84
|
+
}
|
|
85
|
+
report(node, parent);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
[`FunctionDeclaration > BlockStatement CallExpression[callee.name=signalStoreFeature]`](node) {
|
|
89
|
+
if (hasInputAsArgument(node)) {
|
|
90
|
+
let parent = node.parent;
|
|
91
|
+
while (parent && !(0, utils_1.isFunctionDeclaration)(parent)) {
|
|
92
|
+
parent = parent.parent;
|
|
93
|
+
}
|
|
94
|
+
report(node, parent);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
//# sourceMappingURL=signal-store-feature-should-use-generic-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-store-feature-should-use-generic-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/signals/signal-store-feature-should-use-generic-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;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AAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { ESLintUtils, type TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n isArrowFunctionExpression,\n isCallExpression,\n isFunctionDeclaration,\n isIdentifier,\n} from '../../utils';\n\nexport const messageId = 'signalStoreFeatureShouldUseGenericType';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n ngrxModule: 'signals',\n docs: {\n description: `A custom Signal Store feature that accepts an input should define a generic type.`,\n },\n fixable: 'code',\n schema: [],\n messages: {\n [messageId]: `Add an unused generic type to the function creating the signal store feature.`,\n },\n },\n defaultOptions: [],\n create: (context) => {\n function report(\n signalStoreFeature: TSESTree.CallExpression,\n func?: TSESTree.Node\n ) {\n if (\n !func ||\n (!isFunctionDeclaration(func) && !isArrowFunctionExpression(func))\n ) {\n return;\n }\n const parentHasGenerics =\n func.typeParameters && func.typeParameters.params.length > 0;\n if (!parentHasGenerics) {\n context.report({\n node: signalStoreFeature.callee,\n messageId,\n fix(fixer) {\n if (isFunctionDeclaration(func)) {\n if (func.id) {\n return fixer.insertTextAfter(func.id, '<_>');\n }\n }\n\n return fixer.insertTextBefore(func, '<_>');\n },\n });\n }\n }\n\n function hasInputAsArgument(node: TSESTree.CallExpression) {\n const [inputArg] = node.arguments;\n return (\n !isCallExpression(inputArg) ||\n (isIdentifier(inputArg.callee) && inputArg.callee.name === 'type')\n );\n }\n\n return {\n [`ArrowFunctionExpression > CallExpression[callee.name=signalStoreFeature]`](\n node: TSESTree.CallExpression\n ) {\n if (hasInputAsArgument(node)) {\n report(node, node.parent);\n }\n },\n [`ArrowFunctionExpression > BlockStatement CallExpression[callee.name=signalStoreFeature]`](\n node: TSESTree.CallExpression\n ) {\n if (hasInputAsArgument(node)) {\n let parent: TSESTree.Node | undefined = node.parent;\n while (parent && !isArrowFunctionExpression(parent)) {\n parent = parent.parent;\n }\n report(node, parent);\n }\n },\n [`FunctionDeclaration > BlockStatement CallExpression[callee.name=signalStoreFeature]`](\n node: TSESTree.CallExpression\n ) {\n if (hasInputAsArgument(node)) {\n let parent: TSESTree.Node | undefined = node.parent;\n while (parent && !isFunctionDeclaration(parent)) {\n parent = parent.parent;\n }\n report(node, parent);\n }\n },\n };\n },\n});\n"]}
|