@ngrx/eslint-plugin 19.2.1 → 20.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/generate-docs.js +19 -14
- package/scripts/generate-docs.js.map +1 -1
- package/src/configs/all.js +1 -0
- package/src/configs/all.js.map +1 -1
- package/src/configs/all.json +1 -0
- package/src/configs/signals.js +1 -0
- package/src/configs/signals.js.map +1 -1
- package/src/configs/signals.json +1 -0
- package/src/index.d.ts +3 -0
- package/src/rules/index.d.ts +1 -0
- package/src/rules/index.js +2 -0
- package/src/rules/index.js.map +1 -1
- package/src/rules/signals/enforce-type-call.d.ts +3 -0
- package/src/rules/signals/enforce-type-call.js +79 -0
- package/src/rules/signals/enforce-type-call.js.map +1 -0
package/package.json
CHANGED
package/scripts/generate-docs.js
CHANGED
|
@@ -39,17 +39,21 @@ const prettier_1 = require("prettier");
|
|
|
39
39
|
const rules_1 = require("../src/utils/helper-functions/rules");
|
|
40
40
|
const prettierConfig = prettier_1.resolveConfig.sync(__dirname);
|
|
41
41
|
const PLACEHOLDER = '<!-- MANUAL-DOC:START -->';
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
const RULES_PATHS = [
|
|
43
|
+
'./projects/ngrx.io/content/guide/eslint-plugin/rules',
|
|
44
|
+
'./projects/www/src/app/pages/guide/eslint-plugin/rules',
|
|
45
|
+
];
|
|
46
|
+
for (const rules of RULES_PATHS) {
|
|
47
|
+
for (const [ruleName, { meta }] of Object.entries(rules_1.rulesForGenerate)) {
|
|
48
|
+
const docPath = path.join(rules, `${ruleName}.md`);
|
|
49
|
+
if (!(0, fs_1.existsSync)(docPath)) {
|
|
50
|
+
(0, fs_1.writeFileSync)(docPath, ``);
|
|
51
|
+
}
|
|
52
|
+
const doc = (0, fs_1.readFileSync)(docPath, 'utf-8');
|
|
53
|
+
const docContent = doc.substring(doc.indexOf(PLACEHOLDER) + PLACEHOLDER.length);
|
|
54
|
+
const newDoc = (0, prettier_1.format)(`# ${ruleName}
|
|
51
55
|
|
|
52
|
-
${meta.version ? '> Required NgRx Version Range: ${meta.version}' : ''}
|
|
56
|
+
${meta.version ? '> Required NgRx Version Range: ${meta.version}' : ''}
|
|
53
57
|
|
|
54
58
|
${meta.docs?.description}
|
|
55
59
|
|
|
@@ -63,9 +67,10 @@ ${meta.docs?.description}
|
|
|
63
67
|
<!-- MANUAL-DOC:START -->
|
|
64
68
|
|
|
65
69
|
${docContent}`, {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
parser: 'markdown',
|
|
71
|
+
...prettierConfig,
|
|
72
|
+
});
|
|
73
|
+
(0, fs_1.writeFileSync)(docPath, newDoc);
|
|
74
|
+
}
|
|
70
75
|
}
|
|
71
76
|
//# sourceMappingURL=generate-docs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-docs.js","sourceRoot":"","sources":["../../../../modules/eslint-plugin/scripts/generate-docs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAA6D;AAC7D,2CAA6B;AAC7B,uCAAiD;AACjD,+DAAuE;AAEvE,MAAM,cAAc,GAAG,wBAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACrD,MAAM,WAAW,GAAG,2BAA2B,CAAC;AAChD,MAAM,
|
|
1
|
+
{"version":3,"file":"generate-docs.js","sourceRoot":"","sources":["../../../../modules/eslint-plugin/scripts/generate-docs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAA6D;AAC7D,2CAA6B;AAC7B,uCAAiD;AACjD,+DAAuE;AAEvE,MAAM,cAAc,GAAG,wBAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACrD,MAAM,WAAW,GAAG,2BAA2B,CAAC;AAChD,MAAM,WAAW,GAAG;IAClB,sDAAsD;IACtD,wDAAwD;CACzD,CAAC;AAEF,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;IAChC,KAAK,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,wBAAgB,CAAC,EAAE,CAAC;QACpE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,QAAQ,KAAK,CAAC,CAAC;QACnD,IAAI,CAAC,IAAA,eAAU,EAAC,OAAO,CAAC,EAAE,CAAC;YACzB,IAAA,kBAAa,EAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC7B,CAAC;QACD,MAAM,GAAG,GAAG,IAAA,iBAAY,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC3C,MAAM,UAAU,GAAG,GAAG,CAAC,SAAS,CAC9B,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC,MAAM,CAC9C,CAAC;QACF,MAAM,MAAM,GAAG,IAAA,iBAAM,EACnB,KAAK,QAAQ;;EAEjB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,gDAAgD,CAAC,CAAC,CAAC,EAAE;;EAEpE,IAAI,CAAC,IAAI,EAAE,WAAW;;cAEV,IAAI,CAAC,IAAI;iBACN,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;oBACxB,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;gCACtB,IAAI,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;sBAEtE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAC7D;;;;;EAKJ,UAAU,EAAE,EACR;YACE,MAAM,EAAE,UAAU;YAClB,GAAG,cAAc;SAClB,CACF,CAAC;QAEF,IAAA,kBAAa,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC;AACH,CAAC","sourcesContent":["import { readFileSync, writeFileSync, existsSync } from 'fs';\nimport * as path from 'path';\nimport { format, resolveConfig } from 'prettier';\nimport { rulesForGenerate } from '../src/utils/helper-functions/rules';\n\nconst prettierConfig = resolveConfig.sync(__dirname);\nconst PLACEHOLDER = '<!-- MANUAL-DOC:START -->';\nconst RULES_PATHS = [\n './projects/ngrx.io/content/guide/eslint-plugin/rules',\n './projects/www/src/app/pages/guide/eslint-plugin/rules',\n];\n\nfor (const rules of RULES_PATHS) {\n for (const [ruleName, { meta }] of Object.entries(rulesForGenerate)) {\n const docPath = path.join(rules, `${ruleName}.md`);\n if (!existsSync(docPath)) {\n writeFileSync(docPath, ``);\n }\n const doc = readFileSync(docPath, 'utf-8');\n const docContent = doc.substring(\n doc.indexOf(PLACEHOLDER) + PLACEHOLDER.length\n );\n const newDoc = format(\n `# ${ruleName}\n\n${meta.version ? '> Required NgRx Version Range: ${meta.version}' : ''}\n\n${meta.docs?.description}\n\n- **Type**: ${meta.type}\n- **Fixable**: ${meta.fixable ? 'Yes' : 'No'}\n- **Suggestion**: ${meta.hasSuggestions ? 'Yes' : 'No'}\n- **Requires type checking**: ${meta.docs?.requiresTypeChecking ? 'Yes' : 'No'}\n- **Configurable**: ${\n Array.isArray(meta.schema) && meta.schema.length ? 'Yes' : 'No'\n }\n\n<!-- Everything above this generated, do not edit -->\n<!-- MANUAL-DOC:START -->\n\n${docContent}`,\n {\n parser: 'markdown',\n ...prettierConfig,\n }\n );\n\n writeFileSync(docPath, newDoc);\n }\n}\n"]}
|
package/src/configs/all.js
CHANGED
|
@@ -38,6 +38,7 @@ exports.default = (plugin, parser) => [
|
|
|
38
38
|
'@ngrx/prefer-effect-callback-in-block-statement': 'error',
|
|
39
39
|
'@ngrx/use-effects-lifecycle-interface': 'error',
|
|
40
40
|
'@ngrx/prefer-concat-latest-from': 'error',
|
|
41
|
+
'@ngrx/enforce-type-call': 'error',
|
|
41
42
|
'@ngrx/prefer-protected-state': 'error',
|
|
42
43
|
'@ngrx/signal-state-no-arrays-at-root-level': 'error',
|
|
43
44
|
'@ngrx/signal-store-feature-should-use-generic-type': '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,+BAA+B,EAAE,OAAO;YACxC,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,8BAA8B,EAAE,OAAO;YACvC,4CAA4C,EAAE,OAAO;YACrD,oDAAoD,EAAE,OAAO;YAC7D,0CAA0C,EAAE,OAAO;YACnD,iCAAiC,EAAE,OAAO;YAC1C,uDAAuD,EAAE,OAAO;YAChE,0CAA0C,EAAE,OAAO;YACnD,+BAA+B,EAAE,OAAO;YACxC,2BAA2B,EAAE,OAAO;YACpC,iCAAiC,EAAE,OAAO;YAC1C,+BAA+B,EAAE,OAAO;YACxC,6BAA6B,EAAE,OAAO;YACtC,6BAA6B,EAAE,OAAO;YACtC,wCAAwC,EAAE,OAAO;YACjD,yCAAyC,EAAE,OAAO;YAClD,6BAA6B,EAAE,OAAO;YACtC,kCAAkC,EAAE,OAAO;YAC3C,yDAAyD,EAAE,OAAO;YAClE,iCAAiC,EAAE,OAAO;YAC1C,oCAAoC,EAAE,OAAO;YAC7C,oBAAoB,EAAE,OAAO;YAC7B,wCAAwC,EAAE,OAAO;SAClD;KACF;CACF,CAAC","sourcesContent":["/**\n * DO NOT EDIT\n * This file is generated\n */\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nexport default (\n plugin: TSESLint.FlatConfig.Plugin,\n parser: TSESLint.FlatConfig.Parser\n): TSESLint.FlatConfig.ConfigArray => [\n {\n name: 'ngrx/base',\n languageOptions: {\n parser,\n sourceType: 'module',\n },\n plugins: {\n '@ngrx': plugin,\n },\n },\n {\n name: 'ngrx/all',\n languageOptions: {\n parser,\n parserOptions: {\n ecmaVersion: 2020,\n sourceType: 'module',\n project: './tsconfig.json',\n },\n },\n rules: {\n '@ngrx/avoid-combining-component-store-selectors': 'error',\n '@ngrx/avoid-mapping-component-store-selectors': 'error',\n '@ngrx/require-super-ondestroy': '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/prefer-protected-state': 'error',\n '@ngrx/signal-state-no-arrays-at-root-level': 'error',\n '@ngrx/signal-store-feature-should-use-generic-type': 'error',\n '@ngrx/with-state-no-arrays-at-root-level': 'error',\n '@ngrx/avoid-combining-selectors': 'error',\n '@ngrx/avoid-dispatching-multiple-actions-sequentially': 'error',\n '@ngrx/avoid-duplicate-actions-in-reducer': 'error',\n '@ngrx/avoid-mapping-selectors': 'error',\n '@ngrx/good-action-hygiene': 'error',\n '@ngrx/no-multiple-global-stores': 'error',\n '@ngrx/no-reducer-in-key-names': 'error',\n '@ngrx/no-store-subscription': 'error',\n '@ngrx/no-typed-global-store': 'error',\n '@ngrx/on-function-explicit-return-type': 'error',\n '@ngrx/prefer-action-creator-in-dispatch': 'error',\n '@ngrx/prefer-action-creator': 'error',\n '@ngrx/prefer-inline-action-props': 'error',\n '@ngrx/prefer-one-generic-in-create-for-feature-selector': 'error',\n '@ngrx/prefer-selector-in-select': 'error',\n '@ngrx/prefix-selectors-with-select': 'error',\n '@ngrx/select-style': 'error',\n '@ngrx/use-consistent-global-store-name': 'error',\n },\n },\n];\n"]}
|
|
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,+BAA+B,EAAE,OAAO;YACxC,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,yBAAyB,EAAE,OAAO;YAClC,8BAA8B,EAAE,OAAO;YACvC,4CAA4C,EAAE,OAAO;YACrD,oDAAoD,EAAE,OAAO;YAC7D,0CAA0C,EAAE,OAAO;YACnD,iCAAiC,EAAE,OAAO;YAC1C,uDAAuD,EAAE,OAAO;YAChE,0CAA0C,EAAE,OAAO;YACnD,+BAA+B,EAAE,OAAO;YACxC,2BAA2B,EAAE,OAAO;YACpC,iCAAiC,EAAE,OAAO;YAC1C,+BAA+B,EAAE,OAAO;YACxC,6BAA6B,EAAE,OAAO;YACtC,6BAA6B,EAAE,OAAO;YACtC,wCAAwC,EAAE,OAAO;YACjD,yCAAyC,EAAE,OAAO;YAClD,6BAA6B,EAAE,OAAO;YACtC,kCAAkC,EAAE,OAAO;YAC3C,yDAAyD,EAAE,OAAO;YAClE,iCAAiC,EAAE,OAAO;YAC1C,oCAAoC,EAAE,OAAO;YAC7C,oBAAoB,EAAE,OAAO;YAC7B,wCAAwC,EAAE,OAAO;SAClD;KACF;CACF,CAAC","sourcesContent":["/**\n * DO NOT EDIT\n * This file is generated\n */\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nexport default (\n plugin: TSESLint.FlatConfig.Plugin,\n parser: TSESLint.FlatConfig.Parser\n): TSESLint.FlatConfig.ConfigArray => [\n {\n name: 'ngrx/base',\n languageOptions: {\n parser,\n sourceType: 'module',\n },\n plugins: {\n '@ngrx': plugin,\n },\n },\n {\n name: 'ngrx/all',\n languageOptions: {\n parser,\n parserOptions: {\n ecmaVersion: 2020,\n sourceType: 'module',\n project: './tsconfig.json',\n },\n },\n rules: {\n '@ngrx/avoid-combining-component-store-selectors': 'error',\n '@ngrx/avoid-mapping-component-store-selectors': 'error',\n '@ngrx/require-super-ondestroy': '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/enforce-type-call': 'error',\n '@ngrx/prefer-protected-state': 'error',\n '@ngrx/signal-state-no-arrays-at-root-level': 'error',\n '@ngrx/signal-store-feature-should-use-generic-type': 'error',\n '@ngrx/with-state-no-arrays-at-root-level': 'error',\n '@ngrx/avoid-combining-selectors': 'error',\n '@ngrx/avoid-dispatching-multiple-actions-sequentially': 'error',\n '@ngrx/avoid-duplicate-actions-in-reducer': 'error',\n '@ngrx/avoid-mapping-selectors': 'error',\n '@ngrx/good-action-hygiene': 'error',\n '@ngrx/no-multiple-global-stores': 'error',\n '@ngrx/no-reducer-in-key-names': 'error',\n '@ngrx/no-store-subscription': 'error',\n '@ngrx/no-typed-global-store': 'error',\n '@ngrx/on-function-explicit-return-type': 'error',\n '@ngrx/prefer-action-creator-in-dispatch': 'error',\n '@ngrx/prefer-action-creator': 'error',\n '@ngrx/prefer-inline-action-props': 'error',\n '@ngrx/prefer-one-generic-in-create-for-feature-selector': 'error',\n '@ngrx/prefer-selector-in-select': 'error',\n '@ngrx/prefix-selectors-with-select': 'error',\n '@ngrx/select-style': 'error',\n '@ngrx/use-consistent-global-store-name': 'error',\n },\n },\n];\n"]}
|
package/src/configs/all.json
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"@ngrx/prefer-effect-callback-in-block-statement": "error",
|
|
15
15
|
"@ngrx/use-effects-lifecycle-interface": "error",
|
|
16
16
|
"@ngrx/prefer-concat-latest-from": "error",
|
|
17
|
+
"@ngrx/enforce-type-call": "error",
|
|
17
18
|
"@ngrx/prefer-protected-state": "error",
|
|
18
19
|
"@ngrx/signal-state-no-arrays-at-root-level": "error",
|
|
19
20
|
"@ngrx/signal-store-feature-should-use-generic-type": "error",
|
package/src/configs/signals.js
CHANGED
|
@@ -26,6 +26,7 @@ exports.default = (plugin, parser) => [
|
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
rules: {
|
|
29
|
+
'@ngrx/enforce-type-call': 'error',
|
|
29
30
|
'@ngrx/prefer-protected-state': 'error',
|
|
30
31
|
'@ngrx/signal-state-no-arrays-at-root-level': 'error',
|
|
31
32
|
'@ngrx/signal-store-feature-should-use-generic-type': 'error',
|
|
@@ -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,8BAA8B,EAAE,OAAO;YACvC,4CAA4C,EAAE,OAAO;YACrD,oDAAoD,EAAE,OAAO;YAC7D,0CAA0C,EAAE,OAAO;SACpD;KACF;CACF,CAAC","sourcesContent":["/**\n * DO NOT EDIT\n * This file is generated\n */\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nexport default (\n plugin: TSESLint.FlatConfig.Plugin,\n parser: TSESLint.FlatConfig.Parser\n): TSESLint.FlatConfig.ConfigArray => [\n {\n name: 'ngrx/base',\n languageOptions: {\n parser,\n sourceType: 'module',\n },\n plugins: {\n '@ngrx': plugin,\n },\n },\n {\n name: 'ngrx/signals',\n languageOptions: {\n parser,\n parserOptions: {\n ecmaVersion: 2020,\n sourceType: 'module',\n project: './tsconfig.json',\n },\n },\n rules: {\n '@ngrx/prefer-protected-state': 'error',\n '@ngrx/signal-state-no-arrays-at-root-level': 'error',\n '@ngrx/signal-store-feature-should-use-generic-type': 'error',\n '@ngrx/with-state-no-arrays-at-root-level': 'error',\n },\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,yBAAyB,EAAE,OAAO;YAClC,8BAA8B,EAAE,OAAO;YACvC,4CAA4C,EAAE,OAAO;YACrD,oDAAoD,EAAE,OAAO;YAC7D,0CAA0C,EAAE,OAAO;SACpD;KACF;CACF,CAAC","sourcesContent":["/**\n * DO NOT EDIT\n * This file is generated\n */\n\nimport type { TSESLint } from '@typescript-eslint/utils';\n\nexport default (\n plugin: TSESLint.FlatConfig.Plugin,\n parser: TSESLint.FlatConfig.Parser\n): TSESLint.FlatConfig.ConfigArray => [\n {\n name: 'ngrx/base',\n languageOptions: {\n parser,\n sourceType: 'module',\n },\n plugins: {\n '@ngrx': plugin,\n },\n },\n {\n name: 'ngrx/signals',\n languageOptions: {\n parser,\n parserOptions: {\n ecmaVersion: 2020,\n sourceType: 'module',\n project: './tsconfig.json',\n },\n },\n rules: {\n '@ngrx/enforce-type-call': 'error',\n '@ngrx/prefer-protected-state': 'error',\n '@ngrx/signal-state-no-arrays-at-root-level': 'error',\n '@ngrx/signal-store-feature-should-use-generic-type': 'error',\n '@ngrx/with-state-no-arrays-at-root-level': 'error',\n },\n },\n];\n"]}
|
package/src/configs/signals.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"parser": "@typescript-eslint/parser",
|
|
3
3
|
"plugins": ["@ngrx"],
|
|
4
4
|
"rules": {
|
|
5
|
+
"@ngrx/enforce-type-call": "error",
|
|
5
6
|
"@ngrx/prefer-protected-state": "error",
|
|
6
7
|
"@ngrx/signal-state-no-arrays-at-root-level": "error",
|
|
7
8
|
"@ngrx/signal-store-feature-should-use-generic-type": "error",
|
package/src/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ declare const _default: {
|
|
|
16
16
|
"@ngrx/prefer-effect-callback-in-block-statement": string;
|
|
17
17
|
"@ngrx/use-effects-lifecycle-interface": string;
|
|
18
18
|
"@ngrx/prefer-concat-latest-from": string;
|
|
19
|
+
"@ngrx/enforce-type-call": string;
|
|
19
20
|
"@ngrx/prefer-protected-state": string;
|
|
20
21
|
"@ngrx/signal-state-no-arrays-at-root-level": string;
|
|
21
22
|
"@ngrx/signal-store-feature-should-use-generic-type": string;
|
|
@@ -108,6 +109,7 @@ declare const _default: {
|
|
|
108
109
|
parser: string;
|
|
109
110
|
plugins: string[];
|
|
110
111
|
rules: {
|
|
112
|
+
"@ngrx/enforce-type-call": string;
|
|
111
113
|
"@ngrx/prefer-protected-state": string;
|
|
112
114
|
"@ngrx/signal-state-no-arrays-at-root-level": string;
|
|
113
115
|
"@ngrx/signal-store-feature-should-use-generic-type": string;
|
|
@@ -157,6 +159,7 @@ declare const _default: {
|
|
|
157
159
|
'signal-store-feature-should-use-generic-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStoreFeatureShouldUseGenericType", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
158
160
|
'prefer-protected-state': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferProtectedState" | "preferProtectedStateSuggest", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
159
161
|
'with-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"withStateNoArraysAtRootLevel", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
162
|
+
'enforce-type-call': import("@typescript-eslint/utils/ts-eslint").RuleModule<"enforceTypeCall", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
160
163
|
};
|
|
161
164
|
};
|
|
162
165
|
export = _default;
|
package/src/rules/index.d.ts
CHANGED
|
@@ -35,4 +35,5 @@ export declare const rules: {
|
|
|
35
35
|
'signal-store-feature-should-use-generic-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStoreFeatureShouldUseGenericType", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
36
36
|
'prefer-protected-state': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferProtectedState" | "preferProtectedStateSuggest", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
37
37
|
'with-state-no-arrays-at-root-level': import("@typescript-eslint/utils/ts-eslint").RuleModule<"withStateNoArraysAtRootLevel", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
38
|
+
'enforce-type-call': import("@typescript-eslint/utils/ts-eslint").RuleModule<"enforceTypeCall", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
38
39
|
};
|
package/src/rules/index.js
CHANGED
|
@@ -43,6 +43,7 @@ const signal_state_no_arrays_at_root_level_1 = __importDefault(require("./signal
|
|
|
43
43
|
const signal_store_feature_should_use_generic_type_1 = __importDefault(require("./signals/signal-store-feature-should-use-generic-type"));
|
|
44
44
|
const with_state_no_arrays_at_root_level_1 = __importDefault(require("./signals/with-state-no-arrays-at-root-level"));
|
|
45
45
|
const prefer_protected_state_1 = __importDefault(require("./signals/prefer-protected-state"));
|
|
46
|
+
const enforce_type_call_1 = __importDefault(require("./signals/enforce-type-call"));
|
|
46
47
|
exports.rules = {
|
|
47
48
|
// component-store
|
|
48
49
|
'avoid-combining-component-store-selectors': avoid_combining_component_store_selectors_1.default,
|
|
@@ -83,5 +84,6 @@ exports.rules = {
|
|
|
83
84
|
'signal-store-feature-should-use-generic-type': signal_store_feature_should_use_generic_type_1.default,
|
|
84
85
|
'prefer-protected-state': prefer_protected_state_1.default,
|
|
85
86
|
'with-state-no-arrays-at-root-level': with_state_no_arrays_at_root_level_1.default,
|
|
87
|
+
'enforce-type-call': enforce_type_call_1.default,
|
|
86
88
|
};
|
|
87
89
|
//# 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,wGAA8E;AAC9E,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;
|
|
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,wGAA8E;AAC9E,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;AACpE,oFAA0D;AAE7C,QAAA,KAAK,GAAG;IACnB,kBAAkB;IAClB,2CAA2C,EACzC,mDAAqC;IACvC,yCAAyC,EACvC,iDAAmC;IACrC,8BAA8B,EAAE,sCAAyB;IACzD,yBAAyB,EAAE,iCAAqB;IAChD,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;IAClE,mBAAmB,EAAE,2BAAe;CACrC,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';\nimport requireSuperOnDestroy from './component-store/require-super-ondestroy';\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';\nimport enforceTypeCall from './signals/enforce-type-call';\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 'require-super-ondestroy': requireSuperOnDestroy,\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 'enforce-type-call': enforceTypeCall,\n};\n"]}
|
|
@@ -0,0 +1,79 @@
|
|
|
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 () {
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.enforceTypeCall = void 0;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const rule_creator_1 = require("../../rule-creator");
|
|
39
|
+
const utils_1 = require("../../utils");
|
|
40
|
+
exports.enforceTypeCall = 'enforceTypeCall';
|
|
41
|
+
exports.default = (0, rule_creator_1.createRule)({
|
|
42
|
+
name: path.parse(__filename).name,
|
|
43
|
+
meta: {
|
|
44
|
+
type: 'problem',
|
|
45
|
+
ngrxModule: 'signals',
|
|
46
|
+
docs: {
|
|
47
|
+
description: 'The `type` function must be called.',
|
|
48
|
+
},
|
|
49
|
+
fixable: 'code',
|
|
50
|
+
schema: [],
|
|
51
|
+
messages: {
|
|
52
|
+
[exports.enforceTypeCall]: 'The `{{name}}` function must be called.',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
defaultOptions: [],
|
|
56
|
+
create: (context) => {
|
|
57
|
+
// It's possible that we have multiple type import aliases, so we need to track them all.
|
|
58
|
+
const typeNames = new Set();
|
|
59
|
+
return {
|
|
60
|
+
[`ImportDeclaration[source.value='@ngrx/signals'] ImportSpecifier[imported.name='type']`](node) {
|
|
61
|
+
typeNames.add(node.local.name);
|
|
62
|
+
},
|
|
63
|
+
TSInstantiationExpression(node) {
|
|
64
|
+
const expression = node.expression;
|
|
65
|
+
if ((0, utils_1.isIdentifier)(expression) &&
|
|
66
|
+
typeNames.has(expression.name) &&
|
|
67
|
+
!(0, utils_1.isCallExpression)(node.parent)) {
|
|
68
|
+
context.report({
|
|
69
|
+
node: expression,
|
|
70
|
+
messageId: exports.enforceTypeCall,
|
|
71
|
+
data: { name: expression.name },
|
|
72
|
+
fix: (fixer) => fixer.insertTextAfter(node, '()'),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=enforce-type-call.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enforce-type-call.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/signals/enforce-type-call.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAA6D;AAEhD,QAAA,eAAe,GAAG,iBAAiB,CAAC;AAKjD,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,qCAAqC;SACnD;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,uBAAe,CAAC,EAAE,yCAAyC;SAC7D;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,yFAAyF;QACzF,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;QAEpC,OAAO;YACL,CAAC,uFAAuF,CAAC,CACvF,IAA8B;gBAE9B,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC;YAED,yBAAyB,CAAC,IAAwC;gBAChE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;gBACnC,IACE,IAAA,oBAAY,EAAC,UAAU,CAAC;oBACxB,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;oBAC9B,CAAC,IAAA,wBAAgB,EAAC,IAAI,CAAC,MAAM,CAAC,EAC9B,CAAC;oBACD,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,UAAU;wBAChB,SAAS,EAAE,uBAAe;wBAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE;wBAC/B,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;qBAClD,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 { isCallExpression, isIdentifier } from '../../utils';\n\nexport const enforceTypeCall = 'enforceTypeCall';\n\ntype MessageIds = typeof enforceTypeCall;\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: 'The `type` function must be called.',\n },\n fixable: 'code',\n schema: [],\n messages: {\n [enforceTypeCall]: 'The `{{name}}` function must be called.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n // It's possible that we have multiple type import aliases, so we need to track them all.\n const typeNames = new Set<string>();\n\n return {\n [`ImportDeclaration[source.value='@ngrx/signals'] ImportSpecifier[imported.name='type']`](\n node: TSESTree.ImportSpecifier\n ) {\n typeNames.add(node.local.name);\n },\n\n TSInstantiationExpression(node: TSESTree.TSInstantiationExpression) {\n const expression = node.expression;\n if (\n isIdentifier(expression) &&\n typeNames.has(expression.name) &&\n !isCallExpression(node.parent)\n ) {\n context.report({\n node: expression,\n messageId: enforceTypeCall,\n data: { name: expression.name },\n fix: (fixer) => fixer.insertTextAfter(node, '()'),\n });\n }\n },\n };\n },\n});\n"]}
|