@ngrx/eslint-plugin 15.4.0 → 16.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.js +17 -14
- package/jest.config.js.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +6 -6
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/schema.js +1 -1
- package/scripts/generate-config.js +2 -2
- package/scripts/generate-docs.js +2 -2
- package/scripts/generate-overview.js +1 -1
- package/spec/utils/index.js +3 -3
- package/src/configs/all-requiring-type-checking.js +3 -3
- package/src/configs/all.js +2 -2
- package/src/configs/component-store-strict.js +1 -1
- package/src/configs/component-store.js +1 -1
- package/src/configs/effects-requiring-type-checking.js +3 -3
- package/src/configs/effects-strict-requiring-type-checking.js +3 -3
- package/src/configs/effects-strict.js +2 -2
- package/src/configs/effects.js +2 -2
- package/src/configs/index.js +3 -3
- package/src/configs/index.js.map +1 -1
- package/src/configs/recommended-requiring-type-checking.js +3 -3
- package/src/configs/recommended.js +2 -2
- package/src/configs/store-strict.js +2 -2
- package/src/configs/store.js +2 -2
- package/src/configs/strict-requiring-type-checking.js +3 -3
- package/src/configs/strict.js +2 -2
- package/src/index.js +1 -1
- package/src/rule-creator.js +1 -1
- package/src/rules/component-store/updater-explicit-return-type.js +6 -6
- package/src/rules/component-store/updater-explicit-return-type.js.map +1 -1
- package/src/rules/effects/avoid-cyclic-effects.js +8 -8
- package/src/rules/effects/avoid-cyclic-effects.js.map +1 -1
- package/src/rules/effects/no-dispatch-in-effects.js +7 -7
- package/src/rules/effects/no-dispatch-in-effects.js.map +1 -1
- package/src/rules/effects/no-effects-in-providers.js +7 -7
- package/src/rules/effects/no-effects-in-providers.js.map +1 -1
- package/src/rules/effects/no-multiple-actions-in-effects.js +6 -6
- package/src/rules/effects/no-multiple-actions-in-effects.js.map +1 -1
- package/src/rules/effects/prefer-action-creator-in-of-type.js +6 -6
- package/src/rules/effects/prefer-action-creator-in-of-type.js.map +1 -1
- package/src/rules/effects/prefer-concat-latest-from.js +13 -13
- package/src/rules/effects/prefer-concat-latest-from.js.map +1 -1
- package/src/rules/effects/prefer-effect-callback-in-block-statement.js +6 -6
- package/src/rules/effects/prefer-effect-callback-in-block-statement.js.map +1 -1
- package/src/rules/effects/use-effects-lifecycle-interface.js +9 -9
- package/src/rules/effects/use-effects-lifecycle-interface.js.map +1 -1
- package/src/rules/index.js +3 -3
- package/src/rules/index.js.map +1 -1
- package/src/rules/store/avoid-combining-selectors.js +7 -7
- package/src/rules/store/avoid-combining-selectors.js.map +1 -1
- package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js +7 -7
- package/src/rules/store/avoid-dispatching-multiple-actions-sequentially.js.map +1 -1
- package/src/rules/store/avoid-duplicate-actions-in-reducer.js +10 -10
- package/src/rules/store/avoid-duplicate-actions-in-reducer.js.map +1 -1
- package/src/rules/store/avoid-mapping-selectors.js +6 -6
- package/src/rules/store/avoid-mapping-selectors.js.map +1 -1
- package/src/rules/store/good-action-hygiene.js +7 -7
- package/src/rules/store/good-action-hygiene.js.map +1 -1
- package/src/rules/store/no-multiple-global-stores.js +10 -10
- package/src/rules/store/no-multiple-global-stores.js.map +1 -1
- package/src/rules/store/no-reducer-in-key-names.js +7 -7
- package/src/rules/store/no-reducer-in-key-names.js.map +1 -1
- package/src/rules/store/no-store-subscription.js +6 -6
- package/src/rules/store/no-store-subscription.js.map +1 -1
- package/src/rules/store/no-typed-global-store.js +9 -9
- package/src/rules/store/no-typed-global-store.js.map +1 -1
- package/src/rules/store/on-function-explicit-return-type.js +7 -7
- package/src/rules/store/on-function-explicit-return-type.js.map +1 -1
- package/src/rules/store/prefer-action-creator-in-dispatch.js +6 -6
- package/src/rules/store/prefer-action-creator-in-dispatch.js.map +1 -1
- package/src/rules/store/prefer-action-creator.js +6 -6
- package/src/rules/store/prefer-action-creator.js.map +1 -1
- package/src/rules/store/prefer-inline-action-props.js +7 -7
- package/src/rules/store/prefer-inline-action-props.js.map +1 -1
- package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js +7 -7
- package/src/rules/store/prefer-one-generic-in-create-for-feature-selector.js.map +1 -1
- package/src/rules/store/prefer-selector-in-select.js +7 -7
- package/src/rules/store/prefer-selector-in-select.js.map +1 -1
- package/src/rules/store/prefix-selectors-with-select.js +9 -9
- package/src/rules/store/prefix-selectors-with-select.js.map +1 -1
- package/src/rules/store/select-style.js +12 -12
- package/src/rules/store/select-style.js.map +1 -1
- package/src/rules/store/use-consistent-global-store-name.js +10 -10
- package/src/rules/store/use-consistent-global-store-name.js.map +1 -1
- package/src/utils/helper-functions/docs.js +1 -1
- package/src/utils/helper-functions/folder.js +4 -4
- package/src/utils/helper-functions/guards.js +1 -1
- package/src/utils/helper-functions/index.js +1 -1
- package/src/utils/helper-functions/ngrx-modules.js +1 -1
- package/src/utils/helper-functions/utils.js +3 -3
- package/src/utils/helper-functions/versions.js +1 -1
- package/src/utils/index.js +1 -1
- package/src/utils/selectors/index.js +1 -1
package/jest.config.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/* eslint-disable */
|
|
4
|
-
exports
|
|
4
|
+
exports.default = {
|
|
5
5
|
displayName: 'eslint-plugin',
|
|
6
6
|
preset: '../../jest.preset.js',
|
|
7
|
-
coverageDirectory: '../../coverage/modules/
|
|
7
|
+
coverageDirectory: '../../coverage/modules/eslint-plugin',
|
|
8
8
|
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
transform: {
|
|
10
|
+
'^.+\\.(ts|mjs|js|html)$': [
|
|
11
|
+
'jest-preset-angular',
|
|
12
|
+
{
|
|
13
|
+
tsconfig: '<rootDir>/tsconfig.spec.json',
|
|
14
|
+
stringifyContentPathRegex: '\\.(html|svg)$',
|
|
15
|
+
},
|
|
16
|
+
],
|
|
15
17
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
|
|
19
|
+
snapshotSerializers: [
|
|
20
|
+
'jest-preset-angular/build/serializers/no-ng-attributes',
|
|
21
|
+
'jest-preset-angular/build/serializers/ng-snapshot',
|
|
22
|
+
'jest-preset-angular/build/serializers/html-comment',
|
|
23
|
+
],
|
|
21
24
|
};
|
|
22
25
|
//# sourceMappingURL=jest.config.js.map
|
package/jest.config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest.config.js","sourceRoot":"","sources":["../../../modules/eslint-plugin/jest.config.ts"],"names":[],"mappings":";;AAAA,oBAAoB;AACpB,
|
|
1
|
+
{"version":3,"file":"jest.config.js","sourceRoot":"","sources":["../../../modules/eslint-plugin/jest.config.ts"],"names":[],"mappings":";;AAAA,oBAAoB;AACpB,kBAAe;IACb,WAAW,EAAE,eAAe;IAC5B,MAAM,EAAE,sBAAsB;IAC9B,iBAAiB,EAAE,sCAAsC;IACzD,kBAAkB,EAAE,CAAC,yBAAyB,CAAC;IAC/C,SAAS,EAAE;QACT,yBAAyB,EAAE;YACzB,qBAAqB;YACrB;gBACE,QAAQ,EAAE,8BAA8B;gBACxC,yBAAyB,EAAE,gBAAgB;aAC5C;SACF;KACF;IACD,uBAAuB,EAAE,CAAC,4BAA4B,CAAC;IACvD,mBAAmB,EAAE;QACnB,wDAAwD;QACxD,mDAAmD;QACnD,oDAAoD;KACrD;CACF,CAAC","sourcesContent":["/* eslint-disable */\nexport default {\n displayName: 'eslint-plugin',\n preset: '../../jest.preset.js',\n coverageDirectory: '../../coverage/modules/eslint-plugin',\n setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],\n transform: {\n '^.+\\\\.(ts|mjs|js|html)$': [\n 'jest-preset-angular',\n {\n tsconfig: '<rootDir>/tsconfig.spec.json',\n stringifyContentPathRegex: '\\\\.(html|svg)$',\n },\n ],\n },\n transformIgnorePatterns: ['node_modules/(?!.*\\\\.mjs$)'],\n snapshotSerializers: [\n 'jest-preset-angular/build/serializers/no-ng-attributes',\n 'jest-preset-angular/build/serializers/ng-snapshot',\n 'jest-preset-angular/build/serializers/html-comment',\n ],\n};\n"]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var strip_json_comments_1 = __importDefault(require("strip-json-comments"));
|
|
7
7
|
function addNgRxESLintPlugin(schema) {
|
|
8
8
|
return function (host, context) {
|
|
@@ -15,18 +15,18 @@ function addNgRxESLintPlugin(schema) {
|
|
|
15
15
|
return host;
|
|
16
16
|
}
|
|
17
17
|
try {
|
|
18
|
-
var json = JSON.parse((0, strip_json_comments_1
|
|
18
|
+
var json = JSON.parse((0, strip_json_comments_1.default)(eslint));
|
|
19
19
|
if (json.overrides) {
|
|
20
20
|
if (!json.overrides.some(function (override) {
|
|
21
21
|
var _a;
|
|
22
|
-
return (_a = override
|
|
22
|
+
return (_a = override.extends) === null || _a === void 0 ? void 0 : _a.some(function (extend) {
|
|
23
23
|
return extend.startsWith('plugin:@ngrx');
|
|
24
24
|
});
|
|
25
25
|
})) {
|
|
26
26
|
json.overrides.push(configurePlugin(schema.config));
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
else if (!((_b = json
|
|
29
|
+
else if (!((_b = json.extends) === null || _b === void 0 ? void 0 : _b.some(function (extend) { return extend.startsWith('plugin:@ngrx'); }))) {
|
|
30
30
|
json.overrides = [configurePlugin(schema.config)];
|
|
31
31
|
}
|
|
32
32
|
host.overwrite(eslintConfigPath, JSON.stringify(json, null, 2));
|
|
@@ -43,9 +43,9 @@ function addNgRxESLintPlugin(schema) {
|
|
|
43
43
|
function configurePlugin(config) {
|
|
44
44
|
return {
|
|
45
45
|
files: ['*.ts'],
|
|
46
|
-
|
|
46
|
+
extends: ["plugin:@ngrx/".concat(config)],
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
exports
|
|
50
|
+
exports.default = addNgRxESLintPlugin;
|
|
51
51
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/schematics/ng-add/index.ts"],"names":[],"mappings":";;;;;AACA,4EAAoD;AAGpD,SAAwB,mBAAmB,CAAC,MAAc;IACxD,OAAO,UAAC,IAAU,EAAE,OAAyB;;QAC3C,IAAM,gBAAgB,GAAG,gBAAgB,CAAC;QAC1C,IAAM,IAAI,GAAG,qCAAqC,CAAC;QAEnD,IAAM,MAAM,GAAG,MAAA,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,0CAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC9D,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,iDACc,gBAAgB,uFAG3C,IAAI,4CAChB,CAAC,CAAC;YACG,OAAO,IAAI,CAAC;SACb;QAED,IAAI;YACF,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/schematics/ng-add/index.ts"],"names":[],"mappings":";;;;;AACA,4EAAoD;AAGpD,SAAwB,mBAAmB,CAAC,MAAc;IACxD,OAAO,UAAC,IAAU,EAAE,OAAyB;;QAC3C,IAAM,gBAAgB,GAAG,gBAAgB,CAAC;QAC1C,IAAM,IAAI,GAAG,qCAAqC,CAAC;QAEnD,IAAM,MAAM,GAAG,MAAA,IAAI,CAAC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AG,YAAY,KAAK;gBAClB,CAAC,CAAC,sBAEV,GAAG,CAAC,OAAO,OACZ;gBACS,CAAC,CAAC,EAAE,CAAC;YACT,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,6IAIb,IAAI,oDACf,cAAc,OACf,CAAC,CAAC;SACE;IACH,CAAC,CAAC;IACF,SAAS,eAAe,CAAC,MAAwB;QAC/C,OAAO;YACL,KAAK,EAAE,CAAC,MAAM,CAAC;YACf,OAAO,EAAE,CAAC,uBAAgB,MAAM,CAAE,CAAC;SACpC,CAAC;IACJ,CAAC;AACH,CAAC;AAjED,sCAiEC","sourcesContent":["import type { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport stripJsonComments from 'strip-json-comments';\nimport type { Schema } from './schema';\n\nexport default function addNgRxESLintPlugin(schema: Schema): Rule {\n return (host: Tree, context: SchematicContext) => {\n const eslintConfigPath = '.eslintrc.json';\n const docs = 'https://ngrx.io/guide/eslint-plugin';\n\n const eslint = host.read(eslintConfigPath)?.toString('utf-8');\n if (!eslint) {\n context.logger.warn(`\nCould not find the ESLint config at \\`${eslintConfigPath}\\`.\nThe NgRx ESLint Plugin is installed but not configured.\n\nPlease see ${docs} to configure the NgRx ESLint Plugin.\n`);\n return host;\n }\n\n try {\n const json = JSON.parse(stripJsonComments(eslint));\n if (json.overrides) {\n if (\n !json.overrides.some((override: any) =>\n override.extends?.some((extend: any) =>\n extend.startsWith('plugin:@ngrx')\n )\n )\n ) {\n json.overrides.push(configurePlugin(schema.config));\n }\n } else if (\n !json.extends?.some((extend: any) => extend.startsWith('plugin:@ngrx'))\n ) {\n json.overrides = [configurePlugin(schema.config)];\n }\n\n host.overwrite(eslintConfigPath, JSON.stringify(json, null, 2));\n\n context.logger.info(`\n The NgRx ESLint Plugin is installed and configured with the '${schema.config}' config.\n\n Take a look at the docs at ${docs} if you want to change the default configuration.\n `);\n return host;\n } catch (err) {\n const detailsContent =\n err instanceof Error\n ? `\nDetails:\n${err.message}\n`\n : '';\n context.logger.warn(`\nSomething went wrong while adding the NgRx ESLint Plugin.\nThe NgRx ESLint Plugin is installed but not configured.\n\nPlease see ${docs} to configure the NgRx ESLint Plugin.\n${detailsContent}\n`);\n }\n };\n function configurePlugin(config: Schema['config']): Record<string, unknown> {\n return {\n files: ['*.ts'],\n extends: [`plugin:@ngrx/${config}`],\n };\n }\n}\n"]}
|
|
@@ -26,7 +26,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
26
26
|
}
|
|
27
27
|
return ar;
|
|
28
28
|
};
|
|
29
|
-
exports
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
var fs_1 = require("fs");
|
|
31
31
|
var path_1 = require("path");
|
|
32
32
|
var prettier_1 = require("prettier");
|
|
@@ -75,7 +75,7 @@ function writeConfig(configName, predicate, setting) {
|
|
|
75
75
|
? {
|
|
76
76
|
ecmaVersion: 2020,
|
|
77
77
|
sourceType: 'module',
|
|
78
|
-
project: './tsconfig.json'
|
|
78
|
+
project: './tsconfig.json',
|
|
79
79
|
}
|
|
80
80
|
: null;
|
|
81
81
|
var code = "\n/**\n * DO NOT EDIT\n * This file is generated\n */\n\nexport = {\n parser: \"@typescript-eslint/parser\",\n ".concat(parserOptions ? "parserOptions: ".concat(JSON.stringify(parserOptions), ",") : '', "\n plugins: [\"").concat(RULE_MODULE, "\"],\n rules: ").concat(JSON.stringify(configRules), ",\n}\n");
|
package/scripts/generate-docs.js
CHANGED
|
@@ -62,7 +62,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
62
62
|
};
|
|
63
63
|
var e_1, _a;
|
|
64
64
|
var _b, _c, _d;
|
|
65
|
-
exports
|
|
65
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
66
|
var fs_1 = require("fs");
|
|
67
67
|
var path = __importStar(require("path"));
|
|
68
68
|
var prettier_1 = require("prettier");
|
|
@@ -83,7 +83,7 @@ try {
|
|
|
83
83
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
84
84
|
finally {
|
|
85
85
|
try {
|
|
86
|
-
if (_f && !_f.done && (_a = _e
|
|
86
|
+
if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
|
|
87
87
|
}
|
|
88
88
|
finally { if (e_1) throw e_1.error; }
|
|
89
89
|
}
|
|
@@ -35,7 +35,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
35
35
|
}
|
|
36
36
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
37
|
};
|
|
38
|
-
exports
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
var fs_1 = require("fs");
|
|
40
40
|
var os_1 = require("os");
|
|
41
41
|
var prettier_1 = require("prettier");
|
package/spec/utils/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ruleTester = void 0;
|
|
4
4
|
var experimental_utils_1 = require("@typescript-eslint/experimental-utils");
|
|
5
5
|
var path_1 = require("path");
|
|
@@ -14,8 +14,8 @@ function ruleTester(environment) {
|
|
|
14
14
|
parserOptions: {
|
|
15
15
|
project: (0, path_1.resolve)('./modules/eslint-plugin/spec/tsconfig.json'),
|
|
16
16
|
ecmaVersion: 2020,
|
|
17
|
-
sourceType: 'module'
|
|
18
|
-
}
|
|
17
|
+
sourceType: 'module',
|
|
18
|
+
},
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
exports.ruleTester = ruleTester;
|
|
@@ -8,7 +8,7 @@ module.exports = {
|
|
|
8
8
|
parserOptions: {
|
|
9
9
|
ecmaVersion: 2020,
|
|
10
10
|
sourceType: 'module',
|
|
11
|
-
project: './tsconfig.json'
|
|
11
|
+
project: './tsconfig.json',
|
|
12
12
|
},
|
|
13
13
|
plugins: ['@ngrx'],
|
|
14
14
|
rules: {
|
|
@@ -38,7 +38,7 @@ module.exports = {
|
|
|
38
38
|
'@ngrx/prefer-selector-in-select': 'warn',
|
|
39
39
|
'@ngrx/prefix-selectors-with-select': 'warn',
|
|
40
40
|
'@ngrx/select-style': 'warn',
|
|
41
|
-
'@ngrx/use-consistent-global-store-name': 'warn'
|
|
42
|
-
}
|
|
41
|
+
'@ngrx/use-consistent-global-store-name': 'warn',
|
|
42
|
+
},
|
|
43
43
|
};
|
|
44
44
|
//# sourceMappingURL=all-requiring-type-checking.js.map
|
package/src/configs/all.js
CHANGED
|
@@ -31,7 +31,7 @@ module.exports = {
|
|
|
31
31
|
'@ngrx/prefer-selector-in-select': 'warn',
|
|
32
32
|
'@ngrx/prefix-selectors-with-select': 'warn',
|
|
33
33
|
'@ngrx/select-style': 'warn',
|
|
34
|
-
'@ngrx/use-consistent-global-store-name': 'warn'
|
|
35
|
-
}
|
|
34
|
+
'@ngrx/use-consistent-global-store-name': 'warn',
|
|
35
|
+
},
|
|
36
36
|
};
|
|
37
37
|
//# sourceMappingURL=all.js.map
|
|
@@ -8,7 +8,7 @@ module.exports = {
|
|
|
8
8
|
parserOptions: {
|
|
9
9
|
ecmaVersion: 2020,
|
|
10
10
|
sourceType: 'module',
|
|
11
|
-
project: './tsconfig.json'
|
|
11
|
+
project: './tsconfig.json',
|
|
12
12
|
},
|
|
13
13
|
plugins: ['@ngrx'],
|
|
14
14
|
rules: {
|
|
@@ -19,7 +19,7 @@ module.exports = {
|
|
|
19
19
|
'@ngrx/prefer-action-creator-in-of-type': 'warn',
|
|
20
20
|
'@ngrx/prefer-concat-latest-from': 'warn',
|
|
21
21
|
'@ngrx/prefer-effect-callback-in-block-statement': 'warn',
|
|
22
|
-
'@ngrx/use-effects-lifecycle-interface': 'warn'
|
|
23
|
-
}
|
|
22
|
+
'@ngrx/use-effects-lifecycle-interface': 'warn',
|
|
23
|
+
},
|
|
24
24
|
};
|
|
25
25
|
//# sourceMappingURL=effects-requiring-type-checking.js.map
|
|
@@ -8,7 +8,7 @@ module.exports = {
|
|
|
8
8
|
parserOptions: {
|
|
9
9
|
ecmaVersion: 2020,
|
|
10
10
|
sourceType: 'module',
|
|
11
|
-
project: './tsconfig.json'
|
|
11
|
+
project: './tsconfig.json',
|
|
12
12
|
},
|
|
13
13
|
plugins: ['@ngrx'],
|
|
14
14
|
rules: {
|
|
@@ -19,7 +19,7 @@ module.exports = {
|
|
|
19
19
|
'@ngrx/prefer-action-creator-in-of-type': 'error',
|
|
20
20
|
'@ngrx/prefer-concat-latest-from': 'error',
|
|
21
21
|
'@ngrx/prefer-effect-callback-in-block-statement': 'error',
|
|
22
|
-
'@ngrx/use-effects-lifecycle-interface': 'error'
|
|
23
|
-
}
|
|
22
|
+
'@ngrx/use-effects-lifecycle-interface': 'error',
|
|
23
|
+
},
|
|
24
24
|
};
|
|
25
25
|
//# sourceMappingURL=effects-strict-requiring-type-checking.js.map
|
|
@@ -12,7 +12,7 @@ module.exports = {
|
|
|
12
12
|
'@ngrx/prefer-action-creator-in-of-type': 'error',
|
|
13
13
|
'@ngrx/prefer-concat-latest-from': 'error',
|
|
14
14
|
'@ngrx/prefer-effect-callback-in-block-statement': 'error',
|
|
15
|
-
'@ngrx/use-effects-lifecycle-interface': 'error'
|
|
16
|
-
}
|
|
15
|
+
'@ngrx/use-effects-lifecycle-interface': 'error',
|
|
16
|
+
},
|
|
17
17
|
};
|
|
18
18
|
//# sourceMappingURL=effects-strict.js.map
|
package/src/configs/effects.js
CHANGED
|
@@ -12,7 +12,7 @@ module.exports = {
|
|
|
12
12
|
'@ngrx/prefer-action-creator-in-of-type': 'warn',
|
|
13
13
|
'@ngrx/prefer-concat-latest-from': 'warn',
|
|
14
14
|
'@ngrx/prefer-effect-callback-in-block-statement': 'warn',
|
|
15
|
-
'@ngrx/use-effects-lifecycle-interface': 'warn'
|
|
16
|
-
}
|
|
15
|
+
'@ngrx/use-effects-lifecycle-interface': 'warn',
|
|
16
|
+
},
|
|
17
17
|
};
|
|
18
18
|
//# sourceMappingURL=effects.js.map
|
package/src/configs/index.js
CHANGED
|
@@ -10,16 +10,16 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.configs = void 0;
|
|
15
15
|
var utils_1 = require("../utils");
|
|
16
16
|
// Copied from https://github.com/jest-community/eslint-plugin-jest/blob/main/src/index.ts
|
|
17
17
|
var interopRequireDefault = function (obj) {
|
|
18
|
-
return (obj === null || obj === void 0 ? void 0 : obj.__esModule) ? obj : {
|
|
18
|
+
return (obj === null || obj === void 0 ? void 0 : obj.__esModule) ? obj : { default: obj };
|
|
19
19
|
};
|
|
20
20
|
var importDefault = function (moduleName) {
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
22
|
-
return interopRequireDefault(require(moduleName))
|
|
22
|
+
return interopRequireDefault(require(moduleName)).default;
|
|
23
23
|
};
|
|
24
24
|
var configDir = __dirname;
|
|
25
25
|
var excludedFiles = ['index'];
|
package/src/configs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/configs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,kCAA0C;AAE1C,0FAA0F;AAE1F,IAAM,qBAAqB,GAAG,UAAC,GAAQ;IACrC,OAAA,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,UAAU,EAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/eslint-plugin/src/configs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,kCAA0C;AAE1C,0FAA0F;AAE1F,IAAM,qBAAqB,GAAG,UAAC,GAAQ;IACrC,OAAA,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,UAAU,EAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE;AAAxC,CAAwC,CAAC;AAE3C,IAAM,aAAa,GAAG,UAAC,UAAkB;IACvC,8DAA8D;IAC9D,OAAA,qBAAqB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO;AAAlD,CAAkD,CAAC;AAErD,IAAM,SAAS,GAAG,SAAS,CAAC;AAC5B,IAAM,aAAa,GAAG,CAAC,OAAO,CAAC,CAAC;AAEnB,QAAA,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAA,sBAAc,EAAC,SAAS,CAAC,CAAC;KACzD,MAAM,CAAC,UAAC,MAAM,IAAK,OAAA,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAApC,CAAoC,CAAC;KACxD,MAAM,CAA4C,UAAC,UAAU,EAAE,MAAM;;IACpE,IAAM,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAA8B,CAAC;IACtE,6BACK,UAAU,gBACZ,MAAM,CAAC,IAAI,IAAG,KAAK,OACpB;AACJ,CAAC,EAAE,EAAE,CAAC,CAAC","sourcesContent":["import type { TSESLint } from '@typescript-eslint/experimental-utils';\nimport { traverseFolder } from '../utils';\n\n// Copied from https://github.com/jest-community/eslint-plugin-jest/blob/main/src/index.ts\n\nconst interopRequireDefault = (obj: any): { default: unknown } =>\n obj?.__esModule ? obj : { default: obj };\n\nconst importDefault = (moduleName: string) =>\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n interopRequireDefault(require(moduleName)).default;\n\nconst configDir = __dirname;\nconst excludedFiles = ['index'];\n\nexport const configs = Array.from(traverseFolder(configDir))\n .filter((config) => !excludedFiles.includes(config.file))\n .reduce<Record<string, TSESLint.Linter.RuleEntry>>((allConfigs, config) => {\n const entry = importDefault(config.path) as TSESLint.Linter.RuleEntry;\n return {\n ...allConfigs,\n [config.file]: entry,\n };\n }, {});\n"]}
|
|
@@ -8,7 +8,7 @@ module.exports = {
|
|
|
8
8
|
parserOptions: {
|
|
9
9
|
ecmaVersion: 2020,
|
|
10
10
|
sourceType: 'module',
|
|
11
|
-
project: './tsconfig.json'
|
|
11
|
+
project: './tsconfig.json',
|
|
12
12
|
},
|
|
13
13
|
plugins: ['@ngrx'],
|
|
14
14
|
rules: {
|
|
@@ -38,7 +38,7 @@ module.exports = {
|
|
|
38
38
|
'@ngrx/prefer-selector-in-select': 'warn',
|
|
39
39
|
'@ngrx/prefix-selectors-with-select': 'warn',
|
|
40
40
|
'@ngrx/select-style': 'warn',
|
|
41
|
-
'@ngrx/use-consistent-global-store-name': 'warn'
|
|
42
|
-
}
|
|
41
|
+
'@ngrx/use-consistent-global-store-name': 'warn',
|
|
42
|
+
},
|
|
43
43
|
};
|
|
44
44
|
//# sourceMappingURL=recommended-requiring-type-checking.js.map
|
|
@@ -31,7 +31,7 @@ module.exports = {
|
|
|
31
31
|
'@ngrx/prefer-selector-in-select': 'warn',
|
|
32
32
|
'@ngrx/prefix-selectors-with-select': 'warn',
|
|
33
33
|
'@ngrx/select-style': 'warn',
|
|
34
|
-
'@ngrx/use-consistent-global-store-name': 'warn'
|
|
35
|
-
}
|
|
34
|
+
'@ngrx/use-consistent-global-store-name': 'warn',
|
|
35
|
+
},
|
|
36
36
|
};
|
|
37
37
|
//# sourceMappingURL=recommended.js.map
|
|
@@ -24,7 +24,7 @@ module.exports = {
|
|
|
24
24
|
'@ngrx/prefer-selector-in-select': 'error',
|
|
25
25
|
'@ngrx/prefix-selectors-with-select': 'error',
|
|
26
26
|
'@ngrx/select-style': 'error',
|
|
27
|
-
'@ngrx/use-consistent-global-store-name': 'error'
|
|
28
|
-
}
|
|
27
|
+
'@ngrx/use-consistent-global-store-name': 'error',
|
|
28
|
+
},
|
|
29
29
|
};
|
|
30
30
|
//# sourceMappingURL=store-strict.js.map
|
package/src/configs/store.js
CHANGED
|
@@ -24,7 +24,7 @@ module.exports = {
|
|
|
24
24
|
'@ngrx/prefer-selector-in-select': 'warn',
|
|
25
25
|
'@ngrx/prefix-selectors-with-select': 'warn',
|
|
26
26
|
'@ngrx/select-style': 'warn',
|
|
27
|
-
'@ngrx/use-consistent-global-store-name': 'warn'
|
|
28
|
-
}
|
|
27
|
+
'@ngrx/use-consistent-global-store-name': 'warn',
|
|
28
|
+
},
|
|
29
29
|
};
|
|
30
30
|
//# sourceMappingURL=store.js.map
|
|
@@ -8,7 +8,7 @@ module.exports = {
|
|
|
8
8
|
parserOptions: {
|
|
9
9
|
ecmaVersion: 2020,
|
|
10
10
|
sourceType: 'module',
|
|
11
|
-
project: './tsconfig.json'
|
|
11
|
+
project: './tsconfig.json',
|
|
12
12
|
},
|
|
13
13
|
plugins: ['@ngrx'],
|
|
14
14
|
rules: {
|
|
@@ -38,7 +38,7 @@ module.exports = {
|
|
|
38
38
|
'@ngrx/prefer-selector-in-select': 'error',
|
|
39
39
|
'@ngrx/prefix-selectors-with-select': 'error',
|
|
40
40
|
'@ngrx/select-style': 'error',
|
|
41
|
-
'@ngrx/use-consistent-global-store-name': 'error'
|
|
42
|
-
}
|
|
41
|
+
'@ngrx/use-consistent-global-store-name': 'error',
|
|
42
|
+
},
|
|
43
43
|
};
|
|
44
44
|
//# sourceMappingURL=strict-requiring-type-checking.js.map
|
package/src/configs/strict.js
CHANGED
|
@@ -31,7 +31,7 @@ module.exports = {
|
|
|
31
31
|
'@ngrx/prefer-selector-in-select': 'error',
|
|
32
32
|
'@ngrx/prefix-selectors-with-select': 'error',
|
|
33
33
|
'@ngrx/select-style': 'error',
|
|
34
|
-
'@ngrx/use-consistent-global-store-name': 'error'
|
|
35
|
-
}
|
|
34
|
+
'@ngrx/use-consistent-global-store-name': 'error',
|
|
35
|
+
},
|
|
36
36
|
};
|
|
37
37
|
//# sourceMappingURL=strict.js.map
|
package/src/index.js
CHANGED
package/src/rule-creator.js
CHANGED
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.createRule = void 0;
|
|
15
15
|
var experimental_utils_1 = require("@typescript-eslint/experimental-utils");
|
|
16
16
|
var utils_1 = require("./utils");
|
|
@@ -23,25 +23,25 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
var _a;
|
|
26
|
-
exports
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
27
|
exports.messageId = void 0;
|
|
28
28
|
var path = __importStar(require("path"));
|
|
29
29
|
var rule_creator_1 = require("../../rule-creator");
|
|
30
30
|
var utils_1 = require("../../utils");
|
|
31
31
|
exports.messageId = 'updaterExplicitReturnType';
|
|
32
|
-
exports
|
|
32
|
+
exports.default = (0, rule_creator_1.createRule)({
|
|
33
33
|
name: path.parse(__filename).name,
|
|
34
34
|
meta: {
|
|
35
35
|
type: 'problem',
|
|
36
36
|
ngrxModule: 'component-store',
|
|
37
37
|
docs: {
|
|
38
38
|
description: '`Updater` should have an explicit return type.',
|
|
39
|
-
recommended: 'warn'
|
|
39
|
+
recommended: 'warn',
|
|
40
40
|
},
|
|
41
41
|
schema: [],
|
|
42
42
|
messages: (_a = {},
|
|
43
43
|
_a[exports.messageId] = '`Updater` should have an explicit return type when using arrow functions: `this.store.updater((state, value): State => {}`.',
|
|
44
|
-
_a)
|
|
44
|
+
_a),
|
|
45
45
|
},
|
|
46
46
|
defaultOptions: [],
|
|
47
47
|
create: function (context) {
|
|
@@ -60,10 +60,10 @@ exports["default"] = (0, rule_creator_1.createRule)({
|
|
|
60
60
|
_a[selectors] = function (node) {
|
|
61
61
|
context.report({
|
|
62
62
|
node: node,
|
|
63
|
-
messageId: exports.messageId
|
|
63
|
+
messageId: exports.messageId,
|
|
64
64
|
});
|
|
65
65
|
},
|
|
66
66
|
_a;
|
|
67
|
-
}
|
|
67
|
+
},
|
|
68
68
|
});
|
|
69
69
|
//# sourceMappingURL=updater-explicit-return-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updater-explicit-return-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/updater-explicit-return-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAIqB;AAER,QAAA,SAAS,GAAG,2BAA2B,CAAC;AAKrD,
|
|
1
|
+
{"version":3,"file":"updater-explicit-return-type.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/component-store/updater-explicit-return-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6B;AAC7B,mDAAgD;AAChD,qCAIqB;AAER,QAAA,SAAS,GAAG,2BAA2B,CAAC;AAKrD,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,iBAAiB;QAC7B,IAAI,EAAE;YACJ,WAAW,EAAE,gDAAgD;YAC7D,WAAW,EAAE,MAAM;SACpB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IACR,6HAA6H;eAChI;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACN,IAAA,KAAqB,IAAA,8BAAsB,EAAC,OAAO,CAAC,YAApC,EAAhB,WAAW,mBAAG,EAAE,KAAA,CAAqC;QAC7D,IAAM,UAAU,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1E,IAAM,qBAAqB,GAAG,0DAA0D,CAAC;QACzF,IAAM,SAAS,GAAG;YAChB,mJAA4I,qBAAqB,CAAE;YACnK,UAAU;gBACR,UAAG,IAAA,uBAAe,EAChB,UAAU,CACX,gDAAsC,qBAAqB,CAAE;SACjE;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb;YACE,GAAC,SAAS,IAAV,UAAY,IAAsC;gBAChD,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,MAAA;oBACJ,SAAS,mBAAA;iBACV,CAAC,CAAC;YACL,CAAC;eACD;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n getNgRxComponentStores,\n namedExpression,\n} from '../../utils';\n\nexport const messageId = 'updaterExplicitReturnType';\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: 'component-store',\n docs: {\n description: '`Updater` should have an explicit return type.',\n recommended: 'warn',\n },\n schema: [],\n messages: {\n [messageId]:\n '`Updater` should have an explicit return type when using arrow functions: `this.store.updater((state, value): State => {}`.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxComponentStores(context);\n const storeNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n const withoutTypeAnnotation = `ArrowFunctionExpression:not([returnType.typeAnnotation])`;\n const selectors = [\n `ClassDeclaration[superClass.name='ComponentStore'] CallExpression[callee.object.type='ThisExpression'][callee.property.name='updater'] > ${withoutTypeAnnotation}`,\n storeNames &&\n `${namedExpression(\n storeNames\n )}[callee.property.name='updater'] > ${withoutTypeAnnotation}`,\n ]\n .filter(Boolean)\n .join(',');\n\n return {\n [selectors](node: TSESTree.ArrowFunctionExpression) {\n context.report({\n node,\n messageId,\n });\n },\n };\n },\n});\n"]}
|
|
@@ -59,7 +59,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
59
59
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
60
60
|
};
|
|
61
61
|
var _a;
|
|
62
|
-
exports
|
|
62
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
63
|
exports.messageId = void 0;
|
|
64
64
|
var eslint_etc_1 = require("eslint-etc");
|
|
65
65
|
var path = __importStar(require("path"));
|
|
@@ -70,7 +70,7 @@ exports.messageId = 'avoidCyclicEffects';
|
|
|
70
70
|
// This rule is a modified version (to support dispatch: false) from the eslint-plugin-rxjs plugin.
|
|
71
71
|
// The original implementation can be found at https://github.com/cartant/eslint-plugin-rxjs/blob/main/source/rules/no-cyclic-action.ts
|
|
72
72
|
// Thank you Nicholas Jamieson (@cartant).
|
|
73
|
-
exports
|
|
73
|
+
exports.default = (0, rule_creator_1.createRule)({
|
|
74
74
|
name: path.parse(__filename).name,
|
|
75
75
|
meta: {
|
|
76
76
|
type: 'problem',
|
|
@@ -78,12 +78,12 @@ exports["default"] = (0, rule_creator_1.createRule)({
|
|
|
78
78
|
docs: {
|
|
79
79
|
description: 'Avoid `Effect` that re-emit filtered actions.',
|
|
80
80
|
recommended: 'warn',
|
|
81
|
-
requiresTypeChecking: true
|
|
81
|
+
requiresTypeChecking: true,
|
|
82
82
|
},
|
|
83
83
|
schema: [],
|
|
84
84
|
messages: (_a = {},
|
|
85
85
|
_a[exports.messageId] = '`Effect` that re-emit filtered actions are forbidden.',
|
|
86
|
-
_a)
|
|
86
|
+
_a),
|
|
87
87
|
},
|
|
88
88
|
defaultOptions: [],
|
|
89
89
|
create: function (context) {
|
|
@@ -133,7 +133,7 @@ exports["default"] = (0, rule_creator_1.createRule)({
|
|
|
133
133
|
if (pipeActionTypes.includes(actionType)) {
|
|
134
134
|
context.report({
|
|
135
135
|
node: pipeCallExpression.callee,
|
|
136
|
-
messageId: exports.messageId
|
|
136
|
+
messageId: exports.messageId,
|
|
137
137
|
});
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
@@ -142,7 +142,7 @@ exports["default"] = (0, rule_creator_1.createRule)({
|
|
|
142
142
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
143
143
|
finally {
|
|
144
144
|
try {
|
|
145
|
-
if (operatorActionTypes_1_1 && !operatorActionTypes_1_1.done && (_a = operatorActionTypes_1
|
|
145
|
+
if (operatorActionTypes_1_1 && !operatorActionTypes_1_1.done && (_a = operatorActionTypes_1.return)) _a.call(operatorActionTypes_1);
|
|
146
146
|
}
|
|
147
147
|
finally { if (e_1) throw e_1.error; }
|
|
148
148
|
}
|
|
@@ -173,7 +173,7 @@ exports["default"] = (0, rule_creator_1.createRule)({
|
|
|
173
173
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
174
174
|
finally {
|
|
175
175
|
try {
|
|
176
|
-
if (_c && !_c.done && (_a = _b
|
|
176
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
177
177
|
}
|
|
178
178
|
finally { if (e_2) throw e_2.error; }
|
|
179
179
|
}
|
|
@@ -197,6 +197,6 @@ exports["default"] = (0, rule_creator_1.createRule)({
|
|
|
197
197
|
return _a = {},
|
|
198
198
|
_a["".concat(utils_1.createEffectExpression, ":not([arguments.1]:has(Property[key.name='dispatch'][value.value=false])) CallExpression[callee.property.name='pipe'][callee.object.property.name=").concat(actionsNames, "]")] = checkNode,
|
|
199
199
|
_a;
|
|
200
|
-
}
|
|
200
|
+
},
|
|
201
201
|
});
|
|
202
202
|
//# sourceMappingURL=avoid-cyclic-effects.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avoid-cyclic-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/avoid-cyclic-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6C;AAC7C,yCAA6B;AAC7B,6CAAiC;AACjC,mDAAgD;AAChD,qCAOqB;AAER,QAAA,SAAS,GAAG,oBAAoB,CAAC;AAK9C,mGAAmG;AACnG,uIAAuI;AACvI,0CAA0C;AAE1C,
|
|
1
|
+
{"version":3,"file":"avoid-cyclic-effects.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/effects/avoid-cyclic-effects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6C;AAC7C,yCAA6B;AAC7B,6CAAiC;AACjC,mDAAgD;AAChD,qCAOqB;AAER,QAAA,SAAS,GAAG,oBAAoB,CAAC;AAK9C,mGAAmG;AACnG,uIAAuI;AACvI,0CAA0C;AAE1C,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,+CAA+C;YAC5D,WAAW,EAAE,MAAM;YACnB,oBAAoB,EAAE,IAAI;SAC3B;QACD,MAAM,EAAE,EAAE;QACV,QAAQ;YACN,GAAC,iBAAS,IAAG,uDAAuD;eACrE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,UAAC,OAAO;;QACN,IAAA,KAAqB,IAAA,4BAAoB,EAAC,OAAO,CAAC,YAAlC,EAAhB,WAAW,mBAAG,EAAE,KAAA,CAAmC;QAC3D,IAAM,YAAY,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAE5E,IAAI,CAAC,YAAY,EAAE;YACjB,OAAO,EAAE,CAAC;SACX;QAEK,IAAA,KAA2B,IAAA,4BAAe,EAAC,OAAO,CAAC,EAAjD,OAAO,aAAA,EAAE,WAAW,iBAA6B,CA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,CAAC,CAAC;YAE3D,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,EAAE,CAAC;aACX;YAED,IAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;YAEzC,IAAI,CAAC,UAAU,EAAE;gBACf,OAAO,EAAE,CAAC;aACX;YAED,gCAAgC;YAChC,iFAAiF;YACjF,IAAI,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE;gBACrD,OAAO,EAAE,CAAC;aACX;YACD,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;QAChD,CAAC;QAED;YACE,GAAC,UAAG,8BAAsB,+JAAqJ,YAAY,MAAG,IAC5L,SAAS;eACX;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/experimental-utils';\nimport { getTypeServices } from 'eslint-etc';\nimport * as path from 'path';\nimport * as ts from 'typescript';\nimport { createRule } from '../../rule-creator';\nimport {\n asPattern,\n createEffectExpression,\n getNgRxEffectActions,\n isCallExpression,\n isIdentifier,\n isTypeReference,\n} from '../../utils';\n\nexport const messageId = 'avoidCyclicEffects';\n\ntype MessageIds = typeof messageId;\ntype Options = readonly [];\n\n// This rule is a modified version (to support dispatch: false) from the eslint-plugin-rxjs plugin.\n// The original implementation can be found at https://github.com/cartant/eslint-plugin-rxjs/blob/main/source/rules/no-cyclic-action.ts\n// Thank you Nicholas Jamieson (@cartant).\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'problem',\n ngrxModule: 'effects',\n docs: {\n description: 'Avoid `Effect` that re-emit filtered actions.',\n recommended: 'warn',\n requiresTypeChecking: true,\n },\n schema: [],\n messages: {\n [messageId]: '`Effect` that re-emit filtered actions are forbidden.',\n },\n },\n defaultOptions: [],\n create: (context) => {\n const { identifiers = [] } = getNgRxEffectActions(context);\n const actionsNames = identifiers.length > 0 ? asPattern(identifiers) : null;\n\n if (!actionsNames) {\n return {};\n }\n\n const { getType, typeChecker } = getTypeServices(context);\n\n function checkNode(pipeCallExpression: TSESTree.CallExpression) {\n const operatorCallExpression = pipeCallExpression.arguments.find(\n (arg) =>\n isCallExpression(arg) &&\n isIdentifier(arg.callee) &&\n arg.callee.name === 'ofType'\n );\n if (!operatorCallExpression) {\n return;\n }\n const operatorType = getType(operatorCallExpression);\n const [signature] = typeChecker.getSignaturesOfType(\n operatorType,\n ts.SignatureKind.Call\n );\n\n if (!signature) {\n return;\n }\n const operatorReturnType =\n typeChecker.getReturnTypeOfSignature(signature);\n if (!isTypeReference(operatorReturnType)) {\n return;\n }\n const [operatorElementType] =\n typeChecker.getTypeArguments(operatorReturnType);\n if (!operatorElementType) {\n return;\n }\n\n const pipeType = getType(pipeCallExpression);\n if (!isTypeReference(pipeType)) {\n return;\n }\n const [pipeElementType] = typeChecker.getTypeArguments(pipeType);\n if (!pipeElementType) {\n return;\n }\n\n const operatorActionTypes = getActionTypes(operatorElementType);\n const pipeActionTypes = getActionTypes(pipeElementType);\n\n for (const actionType of operatorActionTypes) {\n if (pipeActionTypes.includes(actionType)) {\n context.report({\n node: pipeCallExpression.callee,\n messageId,\n });\n return;\n }\n }\n }\n\n function getActionType(symbol: ts.Symbol): ts.Type | null {\n const { valueDeclaration } = symbol;\n\n if (!valueDeclaration) {\n return null;\n }\n\n if (valueDeclaration.kind === ts.SyntaxKind.PropertyDeclaration) {\n const { parent } = symbol as typeof symbol & { parent: ts.Symbol };\n return parent.valueDeclaration\n ? typeChecker.getTypeOfSymbolAtLocation(\n parent,\n parent.valueDeclaration\n )\n : null;\n }\n\n return typeChecker.getTypeOfSymbolAtLocation(symbol, valueDeclaration);\n }\n\n function getActionTypes(type: ts.Type): string[] {\n if (type.isUnion()) {\n const memberActionTypes: string[] = [];\n for (const memberType of type.types) {\n memberActionTypes.push(...getActionTypes(memberType));\n }\n return memberActionTypes;\n }\n\n const symbol = typeChecker.getPropertyOfType(type, 'type');\n\n if (!symbol) {\n return [];\n }\n\n const actionType = getActionType(symbol);\n\n if (!actionType) {\n return [];\n }\n\n // TODO: support \"dynamic\" types\n // e.g. const genericFoo = createAction(`${subject} FOO`); (resolves to 'string')\n if (typeChecker.typeToString(actionType) === 'string') {\n return [];\n }\n return [typeChecker.typeToString(actionType)];\n }\n\n return {\n [`${createEffectExpression}:not([arguments.1]:has(Property[key.name='dispatch'][value.value=false])) CallExpression[callee.property.name='pipe'][callee.object.property.name=${actionsNames}]`]:\n checkNode,\n };\n },\n});\n"]}
|