@ngrx/eslint-plugin 18.0.0-beta.0 → 18.0.0-rc.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/jest.config.d.ts +15 -0
- package/package.json +3 -5
- package/schematics/ng-add/index.d.ts +3 -0
- package/schematics/ng-add/index.js +32 -20
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/schema.d.ts +3 -0
- package/schematics/ng-add/schema.js.map +1 -1
- package/schematics/ng-add/schema.json +16 -51
- package/scripts/generate-config.d.ts +1 -0
- package/scripts/generate-config.js +73 -73
- package/scripts/generate-config.js.map +1 -1
- package/scripts/generate-docs.d.ts +1 -0
- package/scripts/generate-docs.js +33 -65
- package/scripts/generate-docs.js.map +1 -1
- package/scripts/generate-overview.d.ts +1 -0
- package/scripts/generate-overview.js +43 -75
- package/scripts/generate-overview.js.map +1 -1
- package/spec/utils/from-fixture.d.ts +8 -0
- package/spec/utils/from-fixture.js +62 -0
- package/spec/utils/from-fixture.js.map +1 -0
- package/spec/utils/index.d.ts +2 -0
- package/spec/utils/index.js +16 -19
- package/spec/utils/index.js.map +1 -1
- package/spec/utils/rule-tester.d.ts +5 -0
- package/spec/utils/rule-tester.js +23 -0
- package/spec/utils/rule-tester.js.map +1 -0
- package/src/configs/all.d.ts +7 -0
- package/src/configs/all.js +56 -32
- package/src/configs/all.js.map +1 -1
- package/src/configs/all.json +42 -0
- package/src/configs/component-store.d.ts +7 -0
- package/src/configs/component-store.js +23 -8
- package/src/configs/component-store.js.map +1 -1
- package/src/configs/component-store.json +9 -0
- package/src/configs/effects.d.ts +7 -0
- package/src/configs/effects.js +32 -11
- package/src/configs/effects.js.map +1 -1
- package/src/configs/effects.json +13 -0
- package/src/configs/operators.d.ts +7 -0
- package/src/configs/operators.js +28 -0
- package/src/configs/operators.js.map +1 -0
- package/src/configs/operators.json +7 -0
- package/src/configs/signals.d.ts +7 -0
- package/src/configs/signals.js +34 -0
- package/src/configs/signals.js.map +1 -0
- package/src/configs/signals.json +8 -0
- package/src/configs/store.d.ts +7 -0
- package/src/configs/store.js +38 -23
- package/src/configs/store.js.map +1 -1
- package/src/configs/store.json +24 -0
- package/src/index.d.ts +141 -0
- package/src/index.js +18 -3
- package/src/index.js.map +1 -1
- package/src/rule-creator.d.ts +24 -0
- package/src/rule-creator.js +12 -58
- package/src/rule-creator.js.map +1 -1
- package/src/rules/component-store/avoid-combining-component-store-selectors.d.ts +3 -0
- package/src/rules/component-store/avoid-combining-component-store-selectors.js +22 -47
- package/src/rules/component-store/avoid-combining-component-store-selectors.js.map +1 -1
- package/src/rules/component-store/avoid-mapping-component-store-selectors.d.ts +3 -0
- package/src/rules/component-store/avoid-mapping-component-store-selectors.js +17 -20
- package/src/rules/component-store/avoid-mapping-component-store-selectors.js.map +1 -1
- package/src/rules/component-store/updater-explicit-return-type.d.ts +3 -0
- package/src/rules/component-store/updater-explicit-return-type.js +17 -20
- package/src/rules/component-store/updater-explicit-return-type.js.map +1 -1
- package/src/rules/effects/avoid-cyclic-effects.d.ts +4 -0
- package/src/rules/effects/avoid-cyclic-effects.js +47 -109
- package/src/rules/effects/avoid-cyclic-effects.js.map +1 -1
- package/src/rules/effects/no-dispatch-in-effects.d.ts +5 -0
- package/src/rules/effects/no-dispatch-in-effects.js +17 -21
- package/src/rules/effects/no-dispatch-in-effects.js.map +1 -1
- package/src/rules/effects/no-effects-in-providers.d.ts +3 -0
- package/src/rules/effects/no-effects-in-providers.js +18 -49
- package/src/rules/effects/no-effects-in-providers.js.map +1 -1
- package/src/rules/effects/no-multiple-actions-in-effects.d.ts +5 -0
- package/src/rules/effects/no-multiple-actions-in-effects.js +31 -24
- package/src/rules/effects/no-multiple-actions-in-effects.js.map +1 -1
- package/src/rules/effects/prefer-action-creator-in-of-type.d.ts +3 -0
- package/src/rules/effects/prefer-action-creator-in-of-type.js +10 -13
- package/src/rules/effects/prefer-action-creator-in-of-type.js.map +1 -1
- package/src/rules/effects/prefer-effect-callback-in-block-statement.d.ts +4 -0
- package/src/rules/effects/prefer-effect-callback-in-block-statement.js +24 -43
- package/src/rules/effects/prefer-effect-callback-in-block-statement.js.map +1 -1
- package/src/rules/effects/use-effects-lifecycle-interface.d.ts +3 -0
- package/src/rules/effects/use-effects-lifecycle-interface.js +21 -24
- package/src/rules/effects/use-effects-lifecycle-interface.js.map +1 -1
- package/src/rules/index.d.ts +33 -0
- package/src/rules/index.js +69 -53
- package/src/rules/index.js.map +1 -1
- package/src/rules/operators/prefer-concat-latest-from.d.ts +7 -0
- package/src/rules/operators/prefer-concat-latest-from.js +123 -0
- package/src/rules/operators/prefer-concat-latest-from.js.map +1 -0
- package/src/rules/signals/signal-state-no-arrays-at-root-level.d.ts +3 -0
- package/src/rules/signals/signal-state-no-arrays-at-root-level.js +59 -0
- package/src/rules/signals/signal-state-no-arrays-at-root-level.js.map +1 -0
- package/src/rules/signals/with-state-no-arrays-at-root-level.d.ts +4 -0
- package/src/rules/signals/with-state-no-arrays-at-root-level.js +72 -0
- package/src/rules/signals/with-state-no-arrays-at-root-level.js.map +1 -0
- package/src/rules/store/avoid-combining-selectors.d.ts +3 -0
- package/src/rules/store/avoid-combining-selectors.js +20 -45
- package/src/rules/store/avoid-combining-selectors.js.map +1 -1
- package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.d.ts +3 -0
- package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js +20 -47
- package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js.map +1 -1
- package/src/rules/store/avoid-duplicate-actions-in-reducer.d.ts +5 -0
- package/src/rules/store/avoid-duplicate-actions-in-reducer.js +33 -101
- package/src/rules/store/avoid-duplicate-actions-in-reducer.js.map +1 -1
- package/src/rules/store/avoid-mapping-selectors.d.ts +3 -0
- package/src/rules/store/avoid-mapping-selectors.js +24 -30
- package/src/rules/store/avoid-mapping-selectors.js.map +1 -1
- package/src/rules/store/good-action-hygiene.d.ts +3 -0
- package/src/rules/store/good-action-hygiene.js +14 -34
- package/src/rules/store/good-action-hygiene.js.map +1 -1
- package/src/rules/store/no-multiple-global-stores.d.ts +6 -0
- package/src/rules/store/no-multiple-global-stores.js +34 -96
- package/src/rules/store/no-multiple-global-stores.js.map +1 -1
- package/src/rules/store/no-reducer-in-key-names.d.ts +5 -0
- package/src/rules/store/no-reducer-in-key-names.js +16 -20
- package/src/rules/store/no-reducer-in-key-names.js.map +1 -1
- package/src/rules/store/no-store-subscription.d.ts +3 -0
- package/src/rules/store/no-store-subscription.js +13 -16
- package/src/rules/store/no-store-subscription.js.map +1 -1
- package/src/rules/store/no-typed-global-store.d.ts +5 -0
- package/src/rules/store/no-typed-global-store.js +29 -70
- package/src/rules/store/no-typed-global-store.js.map +1 -1
- package/src/rules/store/on-function-explicit-return-type.d.ts +6 -0
- package/src/rules/store/on-function-explicit-return-type.js +23 -43
- package/src/rules/store/on-function-explicit-return-type.js.map +1 -1
- package/src/rules/store/prefer-action-creator-in-dispatch.d.ts +3 -0
- package/src/rules/store/prefer-action-creator-in-dispatch.js +15 -18
- package/src/rules/store/prefer-action-creator-in-dispatch.js.map +1 -1
- package/src/rules/store/prefer-action-creator.d.ts +3 -0
- package/src/rules/store/prefer-action-creator.js +10 -13
- package/src/rules/store/prefer-action-creator.js.map +1 -1
- package/src/rules/store/prefer-inline-action-props.d.ts +5 -0
- package/src/rules/store/prefer-inline-action-props.js +14 -18
- package/src/rules/store/prefer-inline-action-props.js.map +1 -1
- package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.d.ts +5 -0
- package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js +16 -37
- package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js.map +1 -1
- package/src/rules/store/prefer-selector-in-select.d.ts +3 -0
- package/src/rules/store/prefer-selector-in-select.js +21 -46
- package/src/rules/store/prefer-selector-in-select.js.map +1 -1
- package/src/rules/store/prefix-selectors-with-select.d.ts +5 -0
- package/src/rules/store/prefix-selectors-with-select.js +26 -39
- package/src/rules/store/prefix-selectors-with-select.js.map +1 -1
- package/src/rules/store/select-style.d.ts +11 -0
- package/src/rules/store/select-style.js +53 -108
- package/src/rules/store/select-style.js.map +1 -1
- package/src/rules/store/use-consistent-global-store-name.d.ts +6 -0
- package/src/rules/store/use-consistent-global-store-name.js +24 -80
- package/src/rules/store/use-consistent-global-store-name.js.map +1 -1
- package/src/utils/helper-functions/docs.d.ts +1 -0
- package/src/utils/helper-functions/docs.js +1 -3
- package/src/utils/helper-functions/docs.js.map +1 -1
- package/src/utils/helper-functions/folder.d.ts +5 -0
- package/src/utils/helper-functions/folder.js +16 -88
- package/src/utils/helper-functions/folder.js.map +1 -1
- package/src/utils/helper-functions/guards.d.ts +97 -0
- package/src/utils/helper-functions/guards.js +27 -31
- package/src/utils/helper-functions/guards.js.map +1 -1
- package/src/utils/helper-functions/index.d.ts +6 -0
- package/src/utils/helper-functions/ngrx-modules.d.ts +8 -0
- package/src/utils/helper-functions/ngrx-modules.js +7 -6
- package/src/utils/helper-functions/ngrx-modules.js.map +1 -1
- package/src/utils/helper-functions/rules.d.ts +3 -0
- package/src/utils/helper-functions/rules.js +47 -0
- package/src/utils/helper-functions/rules.js.map +1 -0
- package/src/utils/helper-functions/utils.d.ts +48 -0
- package/src/utils/helper-functions/utils.js +68 -143
- package/src/utils/helper-functions/utils.js.map +1 -1
- package/src/utils/helper-functions/versions.d.ts +1 -0
- package/src/utils/helper-functions/versions.js +9 -10
- package/src/utils/helper-functions/versions.js.map +1 -1
- package/src/utils/index.d.ts +2 -0
- package/src/utils/selectors/index.d.ts +29 -0
- package/src/utils/selectors/index.js +30 -44
- package/src/utils/selectors/index.js.map +1 -1
- package/v9/index.d.ts +29 -0
- package/v9/index.js +38 -0
- package/v9/index.js.map +1 -0
- package/src/configs/all-requiring-type-checking.js +0 -46
- package/src/configs/all-requiring-type-checking.js.map +0 -1
- package/src/configs/component-store-strict.js +0 -15
- package/src/configs/component-store-strict.js.map +0 -1
- package/src/configs/effects-requiring-type-checking.js +0 -25
- package/src/configs/effects-requiring-type-checking.js.map +0 -1
- package/src/configs/effects-strict-requiring-type-checking.js +0 -25
- package/src/configs/effects-strict-requiring-type-checking.js.map +0 -1
- package/src/configs/effects-strict.js +0 -18
- package/src/configs/effects-strict.js.map +0 -1
- package/src/configs/index.js +0 -33
- package/src/configs/index.js.map +0 -1
- package/src/configs/recommended-requiring-type-checking.js +0 -46
- package/src/configs/recommended-requiring-type-checking.js.map +0 -1
- package/src/configs/recommended.js +0 -39
- package/src/configs/recommended.js.map +0 -1
- package/src/configs/store-strict.js +0 -30
- package/src/configs/store-strict.js.map +0 -1
- package/src/configs/strict-requiring-type-checking.js +0 -46
- package/src/configs/strict-requiring-type-checking.js.map +0 -1
- package/src/configs/strict.js +0 -39
- package/src/configs/strict.js.map +0 -1
- package/src/rules/effects/prefer-concat-latest-from.js +0 -153
- package/src/rules/effects/prefer-concat-latest-from.js.map +0 -1
|
@@ -22,12 +22,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var _a;
|
|
26
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
26
|
exports.messageId = void 0;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const rule_creator_1 = require("../../rule-creator");
|
|
29
|
+
const utils_1 = require("../../utils");
|
|
31
30
|
exports.messageId = 'useEffectsLifecycleInterface';
|
|
32
31
|
exports.default = (0, rule_creator_1.createRule)({
|
|
33
32
|
name: path.parse(__filename).name,
|
|
@@ -36,53 +35,51 @@ exports.default = (0, rule_creator_1.createRule)({
|
|
|
36
35
|
ngrxModule: 'effects',
|
|
37
36
|
docs: {
|
|
38
37
|
description: 'Ensures classes implement lifecycle interfaces corresponding to the declared lifecycle methods.',
|
|
39
|
-
recommended: 'warn',
|
|
40
38
|
},
|
|
41
39
|
fixable: 'code',
|
|
42
40
|
schema: [],
|
|
43
|
-
messages:
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
messages: {
|
|
42
|
+
[exports.messageId]: 'Lifecycle interface `{{ interfaceName }}` should be implemented for method `{{ methodName }}`.',
|
|
43
|
+
},
|
|
46
44
|
},
|
|
47
45
|
defaultOptions: [],
|
|
48
|
-
create:
|
|
49
|
-
|
|
50
|
-
var lifecycleMapper = {
|
|
46
|
+
create: (context) => {
|
|
47
|
+
const lifecycleMapper = {
|
|
51
48
|
ngrxOnIdentifyEffects: 'OnIdentifyEffects',
|
|
52
49
|
ngrxOnInitEffects: 'OnInitEffects',
|
|
53
50
|
ngrxOnRunEffects: 'OnRunEffects',
|
|
54
51
|
};
|
|
55
|
-
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
const lifecyclesPattern = Object.keys(lifecycleMapper).join('|');
|
|
53
|
+
return {
|
|
54
|
+
[`ClassDeclaration > ClassBody > MethodDefinition > Identifier[name=/${lifecyclesPattern}/]`](node) {
|
|
55
|
+
const classDeclaration = node.parent.parent.parent;
|
|
56
|
+
const methodName = node.name;
|
|
57
|
+
const interfaceName = lifecycleMapper[methodName];
|
|
61
58
|
if ((0, utils_1.getInterface)(classDeclaration, interfaceName)) {
|
|
62
59
|
return;
|
|
63
60
|
}
|
|
64
61
|
context.report({
|
|
65
|
-
fix:
|
|
66
|
-
|
|
62
|
+
fix: (fixer) => {
|
|
63
|
+
const { implementsNodeReplace, implementsTextReplace } = (0, utils_1.getImplementsSchemaFixer)(classDeclaration, interfaceName);
|
|
67
64
|
return [
|
|
68
65
|
fixer.insertTextAfter(implementsNodeReplace, implementsTextReplace),
|
|
69
66
|
].concat((0, utils_1.getImportAddFix)({
|
|
70
67
|
compatibleWithTypeOnlyImport: true,
|
|
71
|
-
fixer
|
|
68
|
+
fixer,
|
|
72
69
|
importName: interfaceName,
|
|
73
70
|
moduleName: utils_1.NGRX_MODULE_PATHS.effects,
|
|
74
71
|
node: classDeclaration,
|
|
75
72
|
}));
|
|
76
73
|
},
|
|
77
|
-
node
|
|
74
|
+
node,
|
|
78
75
|
messageId: exports.messageId,
|
|
79
76
|
data: {
|
|
80
|
-
interfaceName
|
|
81
|
-
methodName
|
|
77
|
+
interfaceName,
|
|
78
|
+
methodName,
|
|
82
79
|
},
|
|
83
80
|
});
|
|
84
81
|
},
|
|
85
|
-
|
|
82
|
+
};
|
|
86
83
|
},
|
|
87
84
|
});
|
|
88
85
|
//# sourceMappingURL=use-effects-lifecycle-interface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-effects-lifecycle-interface.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/use-effects-lifecycle-interface.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-effects-lifecycle-interface.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/use-effects-lifecycle-interface.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAKqB;AAER,QAAA,SAAS,GAAG,8BAA8B,CAAC;AAKxD,kBAAe,IAAA,yBAAU,EAAsB;IAC7C,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE,SAAS;QACrB,IAAI,EAAE;YACJ,WAAW,EACT,iGAAiG;SACpG;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EACT,gGAAgG;SACnG;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,MAAM,eAAe,GAAG;YACtB,qBAAqB,EAAE,mBAAmB;YAC1C,iBAAiB,EAAE,eAAe;YAClC,gBAAgB,EAAE,cAAc;SACxB,CAAC;QACX,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEjE,OAAO;YACL,CAAC,sEAAsE,iBAAiB,IAAI,CAAC,CAC3F,IAKC;gBAED,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;gBACnD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC;gBAC7B,MAAM,aAAa,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;gBAElD,IAAI,IAAA,oBAAY,EAAC,gBAAgB,EAAE,aAAa,CAAC,EAAE,CAAC;oBAClD,OAAO;gBACT,CAAC;gBAED,OAAO,CAAC,MAAM,CAAC;oBACb,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;wBACb,MAAM,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,GACpD,IAAA,gCAAwB,EAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;wBAC5D,OAAO;4BACL,KAAK,CAAC,eAAe,CACnB,qBAAqB,EACrB,qBAAqB,CACtB;yBACF,CAAC,MAAM,CACN,IAAA,uBAAe,EAAC;4BACd,4BAA4B,EAAE,IAAI;4BAClC,KAAK;4BACL,UAAU,EAAE,aAAa;4BACzB,UAAU,EAAE,yBAAiB,CAAC,OAAO;4BACrC,IAAI,EAAE,gBAAgB;yBACvB,CAAC,CACH,CAAC;oBACJ,CAAC;oBACD,IAAI;oBACJ,SAAS,EAAT,iBAAS;oBACT,IAAI,EAAE;wBACJ,aAAa;wBACb,UAAU;qBACX;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n getImplementsSchemaFixer,\n getImportAddFix,\n getInterface,\n NGRX_MODULE_PATHS,\n} from '../../utils';\n\nexport const messageId = 'useEffectsLifecycleInterface';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n ngrxModule: 'effects',\n docs: {\n description:\n 'Ensures classes implement lifecycle interfaces corresponding to the declared lifecycle methods.',\n },\n fixable: 'code',\n schema: [],\n messages: {\n [messageId]:\n 'Lifecycle interface `{{ interfaceName }}` should be implemented for method `{{ methodName }}`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const lifecycleMapper = {\n ngrxOnIdentifyEffects: 'OnIdentifyEffects',\n ngrxOnInitEffects: 'OnInitEffects',\n ngrxOnRunEffects: 'OnRunEffects',\n } as const;\n const lifecyclesPattern = Object.keys(lifecycleMapper).join('|');\n\n return {\n [`ClassDeclaration > ClassBody > MethodDefinition > Identifier[name=/${lifecyclesPattern}/]`](\n node: TSESTree.Identifier & {\n name: keyof typeof lifecycleMapper;\n parent: TSESTree.MethodDefinition & {\n parent: TSESTree.ClassBody & { parent: TSESTree.ClassDeclaration };\n };\n }\n ) {\n const classDeclaration = node.parent.parent.parent;\n const methodName = node.name;\n const interfaceName = lifecycleMapper[methodName];\n\n if (getInterface(classDeclaration, interfaceName)) {\n return;\n }\n\n context.report({\n fix: (fixer) => {\n const { implementsNodeReplace, implementsTextReplace } =\n getImplementsSchemaFixer(classDeclaration, interfaceName);\n return [\n fixer.insertTextAfter(\n implementsNodeReplace,\n implementsTextReplace\n ),\n ].concat(\n getImportAddFix({\n compatibleWithTypeOnlyImport: true,\n fixer,\n importName: interfaceName,\n moduleName: NGRX_MODULE_PATHS.effects,\n node: classDeclaration,\n })\n );\n },\n node,\n messageId,\n data: {\n interfaceName,\n methodName,\n },\n });\n },\n };\n },\n});\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const rules: {
|
|
2
|
+
'avoid-combining-component-store-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCombiningComponentStoreSelectors", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
3
|
+
'avoid-mapping-component-store-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidMappingComponentStoreSelectors", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
4
|
+
'updater-explicit-return-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"updaterExplicitReturnType", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
5
|
+
'avoid-cyclic-effects': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCyclicEffects", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
6
|
+
'no-dispatch-in-effects': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noDispatchInEffects" | "noDispatchInEffectsSuggest", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
7
|
+
'no-effects-in-providers': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noEffectsInProviders", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
8
|
+
'no-multiple-actions-in-effects': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMultipleActionsInEffects", readonly unknown[], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
9
|
+
'prefer-action-creator-in-of-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreatorInOfType", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
10
|
+
'prefer-effect-callback-in-block-statement': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferEffectCallbackInBlockStatement", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
11
|
+
'use-effects-lifecycle-interface': import("@typescript-eslint/utils/ts-eslint").RuleModule<"useEffectsLifecycleInterface", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
12
|
+
'avoid-combining-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidCombiningSelectors", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
13
|
+
'avoid-dispatching-multiple-actions-sequentially': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidDispatchingMultipleActionsSequentially", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
14
|
+
'avoid-duplicate-actions-in-reducer': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidDuplicateActionsInReducer" | "avoidDuplicateActionsInReducerSuggest", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
15
|
+
'avoid-mapping-selectors': import("@typescript-eslint/utils/ts-eslint").RuleModule<"avoidMapppingSelectors", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
16
|
+
'good-action-hygiene': import("@typescript-eslint/utils/ts-eslint").RuleModule<"goodActionHygiene", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
17
|
+
'no-multiple-global-stores': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noMultipleGlobalStores" | "noMultipleGlobalStoresSuggest", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
18
|
+
'no-reducer-in-key-names': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noReducerInKeyNames" | "noReducerInKeyNamesSuggest", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
19
|
+
'no-store-subscription': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noStoreSubscription", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
20
|
+
'no-typed-global-store': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noTypedStore" | "noTypedStoreSuggest", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
21
|
+
'on-function-explicit-return-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"onFunctionExplicitReturnType" | "onFunctionExplicitReturnTypeSuggest", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
22
|
+
'prefer-action-creator': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreator", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
23
|
+
'prefer-action-creator-in-dispatch': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferActionCreatorInDispatch", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
24
|
+
'prefer-inline-action-props': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferInlineActionProps" | "preferInlineActionPropsSuggest", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
25
|
+
'prefer-one-generic-in-create-for-feature-selector': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferOneGenericInCreateForFeatureSelector" | "preferOneGenericInCreateForFeatureSelectorSuggest", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
26
|
+
'prefer-selector-in-select': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferSelectorInSelect", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
27
|
+
'prefix-selectors-with-select': import("@typescript-eslint/utils/ts-eslint").RuleModule<"prefixSelectorsWithSelect" | "prefixSelectorsWithSelectSuggest", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
28
|
+
'select-style': import("@typescript-eslint/utils/ts-eslint").RuleModule<"operator" | "method", readonly ["operator" | "method"], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
29
|
+
'use-consistent-global-store-name': import("@typescript-eslint/utils/ts-eslint").RuleModule<"useConsistentGlobalStoreName" | "useConsistentGlobalStoreNameSuggest", readonly [string], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
30
|
+
'prefer-concat-latest-from': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferConcatLatestFrom", readonly [{
|
|
31
|
+
readonly strict: boolean;
|
|
32
|
+
}], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
33
|
+
};
|
package/src/rules/index.js
CHANGED
|
@@ -1,59 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
35
4
|
};
|
|
36
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
6
|
exports.rules = void 0;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
7
|
+
// component-store
|
|
8
|
+
const avoid_combining_component_store_selectors_1 = __importDefault(require("./component-store/avoid-combining-component-store-selectors"));
|
|
9
|
+
const avoid_mapping_component_store_selectors_1 = __importDefault(require("./component-store/avoid-mapping-component-store-selectors"));
|
|
10
|
+
const updater_explicit_return_type_1 = __importDefault(require("./component-store/updater-explicit-return-type"));
|
|
11
|
+
// effects
|
|
12
|
+
const avoid_cyclic_effects_1 = __importDefault(require("./effects/avoid-cyclic-effects"));
|
|
13
|
+
const no_dispatch_in_effects_1 = __importDefault(require("./effects/no-dispatch-in-effects"));
|
|
14
|
+
const no_effects_in_providers_1 = __importDefault(require("./effects/no-effects-in-providers"));
|
|
15
|
+
const no_multiple_actions_in_effects_1 = __importDefault(require("./effects/no-multiple-actions-in-effects"));
|
|
16
|
+
const prefer_action_creator_in_of_type_1 = __importDefault(require("./effects/prefer-action-creator-in-of-type"));
|
|
17
|
+
const prefer_effect_callback_in_block_statement_1 = __importDefault(require("./effects/prefer-effect-callback-in-block-statement"));
|
|
18
|
+
const use_effects_lifecycle_interface_1 = __importDefault(require("./effects/use-effects-lifecycle-interface"));
|
|
19
|
+
// store
|
|
20
|
+
const avoid_combining_selectors_1 = __importDefault(require("./store/avoid-combining-selectors"));
|
|
21
|
+
const avoid_dispatching_multiple_actions_sequentially_1 = __importDefault(require("./store/avoid-dispatching-multiple-actions-sequentially"));
|
|
22
|
+
const avoid_duplicate_actions_in_reducer_1 = __importDefault(require("./store/avoid-duplicate-actions-in-reducer"));
|
|
23
|
+
const avoid_mapping_selectors_1 = __importDefault(require("./store/avoid-mapping-selectors"));
|
|
24
|
+
const good_action_hygiene_1 = __importDefault(require("./store/good-action-hygiene"));
|
|
25
|
+
const no_multiple_global_stores_1 = __importDefault(require("./store/no-multiple-global-stores"));
|
|
26
|
+
const no_reducer_in_key_names_1 = __importDefault(require("./store/no-reducer-in-key-names"));
|
|
27
|
+
const no_store_subscription_1 = __importDefault(require("./store/no-store-subscription"));
|
|
28
|
+
const no_typed_global_store_1 = __importDefault(require("./store/no-typed-global-store"));
|
|
29
|
+
const on_function_explicit_return_type_1 = __importDefault(require("./store/on-function-explicit-return-type"));
|
|
30
|
+
const prefer_action_creator_1 = __importDefault(require("./store/prefer-action-creator"));
|
|
31
|
+
const prefer_action_creator_in_dispatch_1 = __importDefault(require("./store/prefer-action-creator-in-dispatch"));
|
|
32
|
+
const prefer_inline_action_props_1 = __importDefault(require("./store/prefer-inline-action-props"));
|
|
33
|
+
const prefer_one_generic_in_create_for_feature_selector_1 = __importDefault(require("./store/prefer-one-generic-in-create-for-feature-selector"));
|
|
34
|
+
const prefer_selector_in_select_1 = __importDefault(require("./store/prefer-selector-in-select"));
|
|
35
|
+
const prefix_selectors_with_select_1 = __importDefault(require("./store/prefix-selectors-with-select"));
|
|
36
|
+
const select_style_1 = __importDefault(require("./store/select-style"));
|
|
37
|
+
const use_consistent_global_store_name_1 = __importDefault(require("./store/use-consistent-global-store-name"));
|
|
38
|
+
// operators
|
|
39
|
+
const prefer_concat_latest_from_1 = __importDefault(require("./operators/prefer-concat-latest-from"));
|
|
40
|
+
exports.rules = {
|
|
41
|
+
// component-store
|
|
42
|
+
'avoid-combining-component-store-selectors': avoid_combining_component_store_selectors_1.default,
|
|
43
|
+
'avoid-mapping-component-store-selectors': avoid_mapping_component_store_selectors_1.default,
|
|
44
|
+
'updater-explicit-return-type': updater_explicit_return_type_1.default,
|
|
45
|
+
//effects
|
|
46
|
+
'avoid-cyclic-effects': avoid_cyclic_effects_1.default,
|
|
47
|
+
'no-dispatch-in-effects': no_dispatch_in_effects_1.default,
|
|
48
|
+
'no-effects-in-providers': no_effects_in_providers_1.default,
|
|
49
|
+
'no-multiple-actions-in-effects': no_multiple_actions_in_effects_1.default,
|
|
50
|
+
'prefer-action-creator-in-of-type': prefer_action_creator_in_of_type_1.default,
|
|
51
|
+
'prefer-effect-callback-in-block-statement': prefer_effect_callback_in_block_statement_1.default,
|
|
52
|
+
'use-effects-lifecycle-interface': use_effects_lifecycle_interface_1.default,
|
|
53
|
+
// store
|
|
54
|
+
'avoid-combining-selectors': avoid_combining_selectors_1.default,
|
|
55
|
+
'avoid-dispatching-multiple-actions-sequentially': avoid_dispatching_multiple_actions_sequentially_1.default,
|
|
56
|
+
'avoid-duplicate-actions-in-reducer': avoid_duplicate_actions_in_reducer_1.default,
|
|
57
|
+
'avoid-mapping-selectors': avoid_mapping_selectors_1.default,
|
|
58
|
+
'good-action-hygiene': good_action_hygiene_1.default,
|
|
59
|
+
'no-multiple-global-stores': no_multiple_global_stores_1.default,
|
|
60
|
+
'no-reducer-in-key-names': no_reducer_in_key_names_1.default,
|
|
61
|
+
'no-store-subscription': no_store_subscription_1.default,
|
|
62
|
+
'no-typed-global-store': no_typed_global_store_1.default,
|
|
63
|
+
'on-function-explicit-return-type': on_function_explicit_return_type_1.default,
|
|
64
|
+
'prefer-action-creator': prefer_action_creator_1.default,
|
|
65
|
+
'prefer-action-creator-in-dispatch': prefer_action_creator_in_dispatch_1.default,
|
|
66
|
+
'prefer-inline-action-props': prefer_inline_action_props_1.default,
|
|
67
|
+
'prefer-one-generic-in-create-for-feature-selector': prefer_one_generic_in_create_for_feature_selector_1.default,
|
|
68
|
+
'prefer-selector-in-select': prefer_selector_in_select_1.default,
|
|
69
|
+
'prefix-selectors-with-select': prefix_selectors_with_select_1.default,
|
|
70
|
+
'select-style': select_style_1.default,
|
|
71
|
+
'use-consistent-global-store-name': use_consistent_global_store_name_1.default,
|
|
72
|
+
// operators
|
|
73
|
+
'prefer-concat-latest-from': prefer_concat_latest_from_1.default,
|
|
48
74
|
};
|
|
49
|
-
var rulesDir = __dirname;
|
|
50
|
-
var excludedFiles = ['index'];
|
|
51
|
-
exports.rules = Array.from((0, utils_1.traverseFolder)(rulesDir))
|
|
52
|
-
.filter(function (rule) { return !excludedFiles.includes(rule.file); })
|
|
53
|
-
.reduce(function (allRules, rule) {
|
|
54
|
-
var _a;
|
|
55
|
-
var ruleModule = importDefault(rule.path);
|
|
56
|
-
ruleModule.meta.ngrxModule = path.basename(path.dirname(rule.path));
|
|
57
|
-
return __assign(__assign({}, allRules), (_a = {}, _a[rule.file] = ruleModule, _a));
|
|
58
|
-
}, {});
|
|
59
75
|
//# 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":"
|
|
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;AAE9D,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;CACpD,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\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};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
export declare const messageId = "preferConcatLatestFrom";
|
|
3
|
+
type Options = readonly [{
|
|
4
|
+
readonly strict: boolean;
|
|
5
|
+
}];
|
|
6
|
+
declare const _default: TSESLint.RuleModule<"preferConcatLatestFrom", Options, TSESLint.RuleListener>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,123 @@
|
|
|
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 utils_1 = require("@typescript-eslint/utils");
|
|
28
|
+
const path = __importStar(require("path"));
|
|
29
|
+
const rule_creator_1 = require("../../rule-creator");
|
|
30
|
+
const utils_2 = require("../../utils");
|
|
31
|
+
exports.messageId = 'preferConcatLatestFrom';
|
|
32
|
+
const defaultOptions = { strict: false };
|
|
33
|
+
const concatLatestFromKeyword = 'concatLatestFrom';
|
|
34
|
+
const withLatestFromKeyword = 'withLatestFrom';
|
|
35
|
+
exports.default = (0, rule_creator_1.createRule)({
|
|
36
|
+
name: path.parse(__filename).name,
|
|
37
|
+
meta: {
|
|
38
|
+
type: 'problem',
|
|
39
|
+
ngrxModule: 'operators',
|
|
40
|
+
docs: {
|
|
41
|
+
description: `Use \`${concatLatestFromKeyword}\` instead of \`${withLatestFromKeyword}\` to prevent the selector from firing until the correct \`Action\` is dispatched.`,
|
|
42
|
+
},
|
|
43
|
+
fixable: 'code',
|
|
44
|
+
schema: [
|
|
45
|
+
{
|
|
46
|
+
type: 'object',
|
|
47
|
+
properties: {
|
|
48
|
+
strict: {
|
|
49
|
+
type: 'boolean',
|
|
50
|
+
default: defaultOptions.strict,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
additionalProperties: false,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
messages: {
|
|
57
|
+
[exports.messageId]: `Use \`${concatLatestFromKeyword}\` instead of \`${withLatestFromKeyword}\`.`,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
defaultOptions: [defaultOptions],
|
|
61
|
+
create: (context, [options]) => {
|
|
62
|
+
if (options.strict) {
|
|
63
|
+
return {
|
|
64
|
+
[`${utils_2.createEffectExpression} CallExpression > Identifier[name='withLatestFrom']`](node) {
|
|
65
|
+
context.report({
|
|
66
|
+
node,
|
|
67
|
+
messageId: exports.messageId,
|
|
68
|
+
fix: (fixer) => getFixes(context.getSourceCode(), fixer, node),
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const { identifiers = [], sourceCode } = (0, utils_2.getNgRxEffectActions)(context);
|
|
74
|
+
const actionsNames = identifiers.length > 0 ? (0, utils_2.asPattern)(identifiers) : null;
|
|
75
|
+
if (!actionsNames) {
|
|
76
|
+
return {};
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
[`${utils_2.createEffectExpression} ${(0, utils_2.namedExpression)(actionsNames)} > CallExpression[arguments.length=1] > Identifier[name='${withLatestFromKeyword}']`](node) {
|
|
80
|
+
context.report({
|
|
81
|
+
node,
|
|
82
|
+
messageId: exports.messageId,
|
|
83
|
+
fix: (fixer) => getFixes(sourceCode, fixer, node),
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
[`${utils_2.createEffectExpression} ${(0, utils_2.namedExpression)(actionsNames)} > CallExpression[arguments.length>1] > Identifier[name='${withLatestFromKeyword}']`](node) {
|
|
87
|
+
context.report({
|
|
88
|
+
node,
|
|
89
|
+
messageId: exports.messageId,
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
function getFixes(sourceCode, fixer, node) {
|
|
96
|
+
const { parent } = node;
|
|
97
|
+
const isUsingDeprecatedProjectorArgument = parent.arguments.length > 1;
|
|
98
|
+
const [firstArgument] = parent.arguments;
|
|
99
|
+
const nextToken = isUsingDeprecatedProjectorArgument &&
|
|
100
|
+
sourceCode.getTokenAfter(firstArgument);
|
|
101
|
+
return [
|
|
102
|
+
fixer.replaceText(node, concatLatestFromKeyword),
|
|
103
|
+
...(firstArgument.type == utils_1.AST_NODE_TYPES.ArrowFunctionExpression
|
|
104
|
+
? []
|
|
105
|
+
: [fixer.insertTextBefore(firstArgument, '() => ')]),
|
|
106
|
+
].concat((0, utils_2.getImportAddFix)({
|
|
107
|
+
fixer,
|
|
108
|
+
importName: concatLatestFromKeyword,
|
|
109
|
+
moduleName: utils_2.NGRX_MODULE_PATHS.operators,
|
|
110
|
+
node,
|
|
111
|
+
}), ...(isUsingDeprecatedProjectorArgument && nextToken
|
|
112
|
+
? [
|
|
113
|
+
(0, utils_2.getImportAddFix)({
|
|
114
|
+
fixer,
|
|
115
|
+
importName: 'map',
|
|
116
|
+
moduleName: 'rxjs/operators',
|
|
117
|
+
node,
|
|
118
|
+
}),
|
|
119
|
+
fixer.insertTextAfterRange(nextToken.range, '), map('),
|
|
120
|
+
]
|
|
121
|
+
: []));
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=prefer-concat-latest-from.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-concat-latest-from.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/operators/prefer-concat-latest-from.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n AST_NODE_TYPES,\n type TSESLint,\n type TSESTree,\n} from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n createEffectExpression,\n getImportAddFix,\n getNgRxEffectActions,\n namedExpression,\n NGRX_MODULE_PATHS,\n} from '../../utils';\n\nexport const messageId = 'preferConcatLatestFrom';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [{ readonly strict: boolean }];\ntype WithLatestFromIdentifier = TSESTree.Identifier & {\n parent: TSESTree.CallExpression;\n};\n\nconst defaultOptions: Options[number] = { strict: false };\nconst concatLatestFromKeyword = 'concatLatestFrom';\nconst withLatestFromKeyword = 'withLatestFrom';\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n ngrxModule: 'operators',\n docs: {\n description: `Use \\`${concatLatestFromKeyword}\\` instead of \\`${withLatestFromKeyword}\\` to prevent the selector from firing until the correct \\`Action\\` is dispatched.`,\n },\n fixable: 'code',\n schema: [\n {\n type: 'object',\n properties: {\n strict: {\n type: 'boolean',\n default: defaultOptions.strict,\n },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n [messageId]: `Use \\`${concatLatestFromKeyword}\\` instead of \\`${withLatestFromKeyword}\\`.`,\n },\n },\n defaultOptions: [defaultOptions],\n create: (context, [options]) => {\n if (options.strict) {\n return {\n [`${createEffectExpression} CallExpression > Identifier[name='withLatestFrom']`](\n node: WithLatestFromIdentifier\n ) {\n context.report({\n node,\n messageId,\n fix: (fixer) => getFixes(context.getSourceCode(), fixer, node),\n });\n },\n };\n }\n\n const { identifiers = [], sourceCode } = getNgRxEffectActions(context);\n const actionsNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!actionsNames) {\n return {};\n }\n\n return {\n [`${createEffectExpression} ${namedExpression(\n actionsNames\n )} > CallExpression[arguments.length=1] > Identifier[name='${withLatestFromKeyword}']`](\n node: WithLatestFromIdentifier\n ) {\n context.report({\n node,\n messageId,\n fix: (fixer) => getFixes(sourceCode, fixer, node),\n });\n },\n [`${createEffectExpression} ${namedExpression(\n actionsNames\n )} > CallExpression[arguments.length>1] > Identifier[name='${withLatestFromKeyword}']`](\n node: WithLatestFromIdentifier\n ) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n\nfunction getFixes(\n sourceCode: Readonly<TSESLint.SourceCode>,\n fixer: TSESLint.RuleFixer,\n node: WithLatestFromIdentifier\n) {\n const { parent } = node;\n const isUsingDeprecatedProjectorArgument = parent.arguments.length > 1;\n const [firstArgument] = parent.arguments;\n const nextToken =\n isUsingDeprecatedProjectorArgument &&\n sourceCode.getTokenAfter(firstArgument);\n return [\n fixer.replaceText(node, concatLatestFromKeyword),\n ...(firstArgument.type == AST_NODE_TYPES.ArrowFunctionExpression\n ? []\n : [fixer.insertTextBefore(firstArgument, '() => ')]),\n ].concat(\n getImportAddFix({\n fixer,\n importName: concatLatestFromKeyword,\n moduleName: NGRX_MODULE_PATHS.operators,\n node,\n }),\n ...(isUsingDeprecatedProjectorArgument && nextToken\n ? [\n getImportAddFix({\n fixer,\n importName: 'map',\n moduleName: 'rxjs/operators',\n node,\n }),\n fixer.insertTextAfterRange(nextToken.range, '), map('),\n ]\n : [])\n );\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const messageId = "signalStateNoArraysAtRootLevel";
|
|
2
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"signalStateNoArraysAtRootLevel", readonly [], import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,59 @@
|
|
|
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 = 'signalStateNoArraysAtRootLevel';
|
|
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: `signalState should accept a record or dictionary as an input argument.`,
|
|
38
|
+
},
|
|
39
|
+
schema: [],
|
|
40
|
+
messages: {
|
|
41
|
+
[exports.messageId]: `Wrap the array in an record or dictionary.`,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
defaultOptions: [],
|
|
45
|
+
create: (context) => {
|
|
46
|
+
return {
|
|
47
|
+
[`CallExpression[callee.name=signalState]`](node) {
|
|
48
|
+
const [argument] = node.arguments;
|
|
49
|
+
if ((0, utils_1.isArrayExpression)(argument)) {
|
|
50
|
+
context.report({
|
|
51
|
+
node: argument,
|
|
52
|
+
messageId: exports.messageId,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=signal-state-no-arrays-at-root-level.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-state-no-arrays-at-root-level.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/signals/signal-state-no-arrays-at-root-level.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAAgD;AAEnC,QAAA,SAAS,GAAG,gCAAgC,CAAC;AAK1D,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,wEAAwE;SACtF;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,iBAAS,CAAC,EAAE,4CAA4C;SAC1D;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO;YACL,CAAC,yCAAyC,CAAC,CACzC,IAA6B;gBAE7B,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;gBAClC,IAAI,IAAA,yBAAiB,EAAC,QAAQ,CAAC,EAAE,CAAC;oBAChC,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,QAAQ;wBACd,SAAS,EAAT,iBAAS;qBACV,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { type TSESTree } from '@typescript-eslint/utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { isArrayExpression } from '../../utils';\n\nexport const messageId = 'signalStateNoArraysAtRootLevel';\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: `signalState should accept a record or dictionary as an input argument.`,\n },\n schema: [],\n messages: {\n [messageId]: `Wrap the array in an record or dictionary.`,\n },\n },\n defaultOptions: [],\n create: (context) => {\n return {\n [`CallExpression[callee.name=signalState]`](\n node: TSESTree.CallExpression\n ) {\n const [argument] = node.arguments;\n if (isArrayExpression(argument)) {\n context.report({\n node: argument,\n messageId,\n });\n }\n },\n };\n },\n});\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
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 utils_1 = require("@typescript-eslint/utils");
|
|
28
|
+
const path = __importStar(require("path"));
|
|
29
|
+
const rule_creator_1 = require("../../rule-creator");
|
|
30
|
+
const utils_2 = require("../../utils");
|
|
31
|
+
exports.messageId = 'withStateNoArraysAtRootLevel';
|
|
32
|
+
exports.default = (0, rule_creator_1.createRule)({
|
|
33
|
+
name: path.parse(__filename).name,
|
|
34
|
+
meta: {
|
|
35
|
+
type: 'problem',
|
|
36
|
+
ngrxModule: 'signals',
|
|
37
|
+
docs: {
|
|
38
|
+
description: `withState should accept a record or dictionary as an input argument.`,
|
|
39
|
+
requiresTypeChecking: true,
|
|
40
|
+
},
|
|
41
|
+
schema: [],
|
|
42
|
+
messages: {
|
|
43
|
+
[exports.messageId]: `Wrap the array in an record or dictionary.`,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
defaultOptions: [],
|
|
47
|
+
create: (context) => {
|
|
48
|
+
return {
|
|
49
|
+
[`CallExpression[callee.name=withState]`](node) {
|
|
50
|
+
const [argument] = node.arguments;
|
|
51
|
+
if ((0, utils_2.isArrayExpression)(argument)) {
|
|
52
|
+
context.report({
|
|
53
|
+
node: argument,
|
|
54
|
+
messageId: exports.messageId,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
else if (argument) {
|
|
58
|
+
const services = utils_1.ESLintUtils.getParserServices(context);
|
|
59
|
+
const typeChecker = services.program.getTypeChecker();
|
|
60
|
+
const type = services.getTypeAtLocation(argument);
|
|
61
|
+
if (typeChecker.isArrayType(type)) {
|
|
62
|
+
context.report({
|
|
63
|
+
node: argument,
|
|
64
|
+
messageId: exports.messageId,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=with-state-no-arrays-at-root-level.js.map
|