@ngrx/eslint-plugin 18.0.0-beta.1 → 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
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
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
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
3
|
if (k2 === undefined) k2 = k;
|
|
15
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -33,39 +22,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
33
22
|
__setModuleDefault(result, mod);
|
|
34
23
|
return result;
|
|
35
24
|
};
|
|
36
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
37
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
38
|
-
if (!m) return o;
|
|
39
|
-
var i = m.call(o), r, ar = [], e;
|
|
40
|
-
try {
|
|
41
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
42
|
-
}
|
|
43
|
-
catch (error) { e = { error: error }; }
|
|
44
|
-
finally {
|
|
45
|
-
try {
|
|
46
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
47
|
-
}
|
|
48
|
-
finally { if (e) throw e.error; }
|
|
49
|
-
}
|
|
50
|
-
return ar;
|
|
51
|
-
};
|
|
52
|
-
var __values = (this && this.__values) || function(o) {
|
|
53
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
54
|
-
if (m) return m.call(o);
|
|
55
|
-
if (o && typeof o.length === "number") return {
|
|
56
|
-
next: function () {
|
|
57
|
-
if (o && i >= o.length) o = void 0;
|
|
58
|
-
return { value: o && o[i++], done: !o };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
62
|
-
};
|
|
63
|
-
var _a;
|
|
64
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
26
|
exports.useConsistentGlobalStoreNameSuggest = exports.useConsistentGlobalStoreName = void 0;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const rule_creator_1 = require("../../rule-creator");
|
|
29
|
+
const utils_1 = require("../../utils");
|
|
69
30
|
exports.useConsistentGlobalStoreName = 'useConsistentGlobalStoreName';
|
|
70
31
|
exports.useConsistentGlobalStoreNameSuggest = 'useConsistentGlobalStoreNameSuggest';
|
|
71
32
|
exports.default = (0, rule_creator_1.createRule)({
|
|
@@ -76,62 +37,45 @@ exports.default = (0, rule_creator_1.createRule)({
|
|
|
76
37
|
ngrxModule: 'store',
|
|
77
38
|
docs: {
|
|
78
39
|
description: 'Use a consistent name for the global store.',
|
|
79
|
-
recommended: 'warn',
|
|
80
|
-
suggestion: true,
|
|
81
40
|
},
|
|
82
41
|
schema: [
|
|
83
42
|
{
|
|
84
43
|
type: 'string',
|
|
85
|
-
additionalProperties: false,
|
|
86
44
|
},
|
|
87
45
|
],
|
|
88
|
-
messages:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
46
|
+
messages: {
|
|
47
|
+
[exports.useConsistentGlobalStoreName]: 'Global store should be named as `{{ storeName }}`.',
|
|
48
|
+
[exports.useConsistentGlobalStoreNameSuggest]: 'Rename it to `{{ storeName }}`.',
|
|
49
|
+
},
|
|
92
50
|
},
|
|
93
51
|
defaultOptions: ['store'],
|
|
94
|
-
create:
|
|
95
|
-
var _b = __read(_a, 1), storeName = _b[0];
|
|
52
|
+
create: (context, [storeName]) => {
|
|
96
53
|
return {
|
|
97
|
-
Program
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return { value: void 0 };
|
|
54
|
+
Program() {
|
|
55
|
+
const { identifiers = [] } = (0, utils_1.getNgRxStores)(context);
|
|
56
|
+
for (const { loc, name, range, typeAnnotation } of identifiers) {
|
|
57
|
+
if (name === storeName) {
|
|
58
|
+
return;
|
|
103
59
|
}
|
|
104
|
-
|
|
60
|
+
const data = { storeName };
|
|
105
61
|
context.report({
|
|
106
|
-
loc:
|
|
62
|
+
loc: {
|
|
63
|
+
...loc,
|
|
64
|
+
end: {
|
|
65
|
+
...loc.start,
|
|
66
|
+
column: loc.start.column + name.length,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
107
69
|
messageId: exports.useConsistentGlobalStoreName,
|
|
108
|
-
data
|
|
70
|
+
data,
|
|
109
71
|
suggest: [
|
|
110
72
|
{
|
|
111
73
|
messageId: exports.useConsistentGlobalStoreNameSuggest,
|
|
112
|
-
data
|
|
113
|
-
fix:
|
|
114
|
-
var _a;
|
|
115
|
-
return fixer.replaceTextRange([range[0], (_a = typeAnnotation === null || typeAnnotation === void 0 ? void 0 : typeAnnotation.range[0]) !== null && _a !== void 0 ? _a : range[1]], storeName);
|
|
116
|
-
},
|
|
74
|
+
data,
|
|
75
|
+
fix: (fixer) => fixer.replaceTextRange([range[0], typeAnnotation?.range[0] ?? range[1]], storeName),
|
|
117
76
|
},
|
|
118
77
|
],
|
|
119
78
|
});
|
|
120
|
-
};
|
|
121
|
-
try {
|
|
122
|
-
for (var identifiers_1 = __values(identifiers), identifiers_1_1 = identifiers_1.next(); !identifiers_1_1.done; identifiers_1_1 = identifiers_1.next()) {
|
|
123
|
-
var _c = identifiers_1_1.value, loc = _c.loc, name_1 = _c.name, range = _c.range, typeAnnotation = _c.typeAnnotation;
|
|
124
|
-
var state_1 = _loop_1(loc, name_1, range, typeAnnotation);
|
|
125
|
-
if (typeof state_1 === "object")
|
|
126
|
-
return state_1.value;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
130
|
-
finally {
|
|
131
|
-
try {
|
|
132
|
-
if (identifiers_1_1 && !identifiers_1_1.done && (_a = identifiers_1.return)) _a.call(identifiers_1);
|
|
133
|
-
}
|
|
134
|
-
finally { if (e_1) throw e_1.error; }
|
|
135
79
|
}
|
|
136
80
|
},
|
|
137
81
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-consistent-global-store-name.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/use-consistent-global-store-name.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-consistent-global-store-name.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/rules/store/use-consistent-global-store-name.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,qDAAgD;AAChD,uCAA4C;AAE/B,QAAA,4BAA4B,GAAG,8BAA8B,CAAC;AAC9D,QAAA,mCAAmC,GAC9C,qCAAqC,CAAC;AAOxC,kBAAe,IAAA,yBA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E,cAAc,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,EAChD,SAAS,CACV;6BACJ;yBACF;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import * as path from 'path';\nimport { createRule } from '../../rule-creator';\nimport { getNgRxStores } from '../../utils';\n\nexport const useConsistentGlobalStoreName = 'useConsistentGlobalStoreName';\nexport const useConsistentGlobalStoreNameSuggest =\n 'useConsistentGlobalStoreNameSuggest';\n\ntype MessageIds =\n | typeof useConsistentGlobalStoreName\n | typeof useConsistentGlobalStoreNameSuggest;\ntype Options = readonly [string];\n\nexport default createRule<Options, MessageIds>({\n name: path.parse(__filename).name,\n meta: {\n type: 'suggestion',\n hasSuggestions: true,\n ngrxModule: 'store',\n docs: {\n description: 'Use a consistent name for the global store.',\n },\n schema: [\n {\n type: 'string',\n },\n ],\n messages: {\n [useConsistentGlobalStoreName]:\n 'Global store should be named as `{{ storeName }}`.',\n [useConsistentGlobalStoreNameSuggest]: 'Rename it to `{{ storeName }}`.',\n },\n },\n defaultOptions: ['store'],\n create: (context, [storeName]) => {\n return {\n Program() {\n const { identifiers = [] } = getNgRxStores(context);\n\n for (const { loc, name, range, typeAnnotation } of identifiers) {\n if (name === storeName) {\n return;\n }\n\n const data = { storeName };\n context.report({\n loc: {\n ...loc,\n end: {\n ...loc.start,\n column: loc.start.column + name.length,\n },\n },\n messageId: useConsistentGlobalStoreName,\n data,\n suggest: [\n {\n messageId: useConsistentGlobalStoreNameSuggest,\n data,\n fix: (fixer) =>\n fixer.replaceTextRange(\n [range[0], typeAnnotation?.range[0] ?? range[1]],\n storeName\n ),\n },\n ],\n });\n }\n },\n };\n },\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const docsUrl: (ruleName: string) => string;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.docsUrl = void 0;
|
|
4
|
-
|
|
5
|
-
return "https://ngrx.io/guide/eslint-plugin/rules/".concat(ruleName);
|
|
6
|
-
};
|
|
4
|
+
const docsUrl = (ruleName) => `https://ngrx.io/guide/eslint-plugin/rules/${ruleName}`;
|
|
7
5
|
exports.docsUrl = docsUrl;
|
|
8
6
|
//# sourceMappingURL=docs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/docs.ts"],"names":[],"mappings":";;;AAAO,
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/docs.ts"],"names":[],"mappings":";;;AAAO,MAAM,OAAO,GAAG,CAAC,QAAgB,EAAE,EAAE,CAC1C,6CAA6C,QAAQ,EAAE,CAAC;AAD7C,QAAA,OAAO,WACsC","sourcesContent":["export const docsUrl = (ruleName: string) =>\n `https://ngrx.io/guide/eslint-plugin/rules/${ruleName}`;\n"]}
|
|
@@ -22,97 +22,25 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
27
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
-
function step(op) {
|
|
30
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
-
switch (op[0]) {
|
|
35
|
-
case 0: case 1: t = op; break;
|
|
36
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
-
default:
|
|
40
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
-
if (t[2]) _.ops.pop();
|
|
45
|
-
_.trys.pop(); continue;
|
|
46
|
-
}
|
|
47
|
-
op = body.call(thisArg, _);
|
|
48
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
var __values = (this && this.__values) || function(o) {
|
|
53
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
54
|
-
if (m) return m.call(o);
|
|
55
|
-
if (o && typeof o.length === "number") return {
|
|
56
|
-
next: function () {
|
|
57
|
-
if (o && i >= o.length) o = void 0;
|
|
58
|
-
return { value: o && o[i++], done: !o };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
62
|
-
};
|
|
63
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
26
|
exports.traverseFolder = void 0;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
function traverseFolder(folder, extensions) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
case 2:
|
|
81
|
-
if (!!folders_1_1.done) return [3 /*break*/, 7];
|
|
82
|
-
folderEntry = folders_1_1.value;
|
|
83
|
-
entryPath = path.resolve(folder, folderEntry.name);
|
|
84
|
-
if (!folderEntry.isDirectory()) return [3 /*break*/, 4];
|
|
85
|
-
return [5 /*yield**/, __values(traverseFolder(entryPath, extensions))];
|
|
86
|
-
case 3:
|
|
87
|
-
_b.sent();
|
|
88
|
-
return [3 /*break*/, 6];
|
|
89
|
-
case 4:
|
|
90
|
-
if (!extensions.includes(path.extname(entryPath))) return [3 /*break*/, 6];
|
|
91
|
-
return [4 /*yield*/, {
|
|
92
|
-
folder: folder,
|
|
93
|
-
file: path.parse(folderEntry.name).name,
|
|
94
|
-
path: entryPath,
|
|
95
|
-
}];
|
|
96
|
-
case 5:
|
|
97
|
-
_b.sent();
|
|
98
|
-
_b.label = 6;
|
|
99
|
-
case 6:
|
|
100
|
-
folders_1_1 = folders_1.next();
|
|
101
|
-
return [3 /*break*/, 2];
|
|
102
|
-
case 7: return [3 /*break*/, 10];
|
|
103
|
-
case 8:
|
|
104
|
-
e_1_1 = _b.sent();
|
|
105
|
-
e_1 = { error: e_1_1 };
|
|
106
|
-
return [3 /*break*/, 10];
|
|
107
|
-
case 9:
|
|
108
|
-
try {
|
|
109
|
-
if (folders_1_1 && !folders_1_1.done && (_a = folders_1.return)) _a.call(folders_1);
|
|
110
|
-
}
|
|
111
|
-
finally { if (e_1) throw e_1.error; }
|
|
112
|
-
return [7 /*endfinally*/];
|
|
113
|
-
case 10: return [2 /*return*/];
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
const path = __importStar(require("path"));
|
|
29
|
+
function* traverseFolder(folder, extensions) {
|
|
30
|
+
const folders = fs.readdirSync(folder, { withFileTypes: true });
|
|
31
|
+
for (const folderEntry of folders) {
|
|
32
|
+
const entryPath = path.resolve(folder, folderEntry.name);
|
|
33
|
+
if (folderEntry.isDirectory()) {
|
|
34
|
+
yield* traverseFolder(entryPath, extensions);
|
|
35
|
+
}
|
|
36
|
+
else if (extensions.includes(path.extname(entryPath))) {
|
|
37
|
+
yield {
|
|
38
|
+
folder,
|
|
39
|
+
file: path.parse(folderEntry.name).name,
|
|
40
|
+
path: entryPath,
|
|
41
|
+
};
|
|
114
42
|
}
|
|
115
|
-
}
|
|
43
|
+
}
|
|
116
44
|
}
|
|
117
45
|
exports.traverseFolder = traverseFolder;
|
|
118
46
|
//# sourceMappingURL=folder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/folder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"folder.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/folder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,QAAe,CAAC,CAAC,cAAc,CAC7B,MAAc,EACd,UAAoB;IAEpB,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,KAAK,MAAM,WAAW,IAAI,OAAO,EAAE,CAAC;QAClC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QACzD,IAAI,WAAW,CAAC,WAAW,EAAE,EAAE,CAAC;YAC9B,KAAK,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC/C,CAAC;aAAM,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;YACxD,MAAM;gBACJ,MAAM;gBACN,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI;gBACvC,IAAI,EAAE,SAAS;aAChB,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAjBD,wCAiBC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n\nexport function* traverseFolder(\n folder: string,\n extensions: string[]\n): Generator<{ folder: string; file: string; path: string }> {\n const folders = fs.readdirSync(folder, { withFileTypes: true });\n for (const folderEntry of folders) {\n const entryPath = path.resolve(folder, folderEntry.name);\n if (folderEntry.isDirectory()) {\n yield* traverseFolder(entryPath, extensions);\n } else if (extensions.includes(path.extname(entryPath))) {\n yield {\n folder,\n file: path.parse(folderEntry.name).name,\n path: entryPath,\n };\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
import type * as ts from 'typescript';
|
|
3
|
+
export declare const isArrowFunctionExpression: (node: TSESTree.Node) => node is TSESTree.ArrowFunctionExpression & {
|
|
4
|
+
type: TSESTree.AST_NODE_TYPES.ArrowFunctionExpression;
|
|
5
|
+
};
|
|
6
|
+
export declare const isReturnStatement: (node: TSESTree.Node) => node is TSESTree.ReturnStatement & {
|
|
7
|
+
type: TSESTree.AST_NODE_TYPES.ReturnStatement;
|
|
8
|
+
};
|
|
9
|
+
export declare const isMethodDefinition: (node: TSESTree.Node) => node is (TSESTree.MethodDefinitionComputedName & {
|
|
10
|
+
type: TSESTree.AST_NODE_TYPES.MethodDefinition;
|
|
11
|
+
}) | (TSESTree.MethodDefinitionNonComputedName & {
|
|
12
|
+
type: TSESTree.AST_NODE_TYPES.MethodDefinition;
|
|
13
|
+
});
|
|
14
|
+
export declare const isCallExpression: (node: TSESTree.Node) => node is TSESTree.CallExpression & {
|
|
15
|
+
type: TSESTree.AST_NODE_TYPES.CallExpression;
|
|
16
|
+
};
|
|
17
|
+
export declare const isClassDeclaration: (node: TSESTree.Node) => node is (TSESTree.ClassDeclarationWithName & {
|
|
18
|
+
type: TSESTree.AST_NODE_TYPES.ClassDeclaration;
|
|
19
|
+
}) | (TSESTree.ClassDeclarationWithOptionalName & {
|
|
20
|
+
type: TSESTree.AST_NODE_TYPES.ClassDeclaration;
|
|
21
|
+
});
|
|
22
|
+
export declare const isPropertyDefinition: (node: TSESTree.Node) => node is (TSESTree.PropertyDefinitionComputedName & {
|
|
23
|
+
type: TSESTree.AST_NODE_TYPES.PropertyDefinition;
|
|
24
|
+
}) | (TSESTree.PropertyDefinitionNonComputedName & {
|
|
25
|
+
type: TSESTree.AST_NODE_TYPES.PropertyDefinition;
|
|
26
|
+
});
|
|
27
|
+
export declare const isFunctionExpression: (node: TSESTree.Node) => node is TSESTree.FunctionExpression & {
|
|
28
|
+
type: TSESTree.AST_NODE_TYPES.FunctionExpression;
|
|
29
|
+
};
|
|
30
|
+
export declare const isIdentifier: (node: TSESTree.Node) => node is TSESTree.Identifier & {
|
|
31
|
+
type: TSESTree.AST_NODE_TYPES.Identifier;
|
|
32
|
+
};
|
|
33
|
+
export declare const isImportDeclaration: (node: TSESTree.Node) => node is TSESTree.ImportDeclaration & {
|
|
34
|
+
type: TSESTree.AST_NODE_TYPES.ImportDeclaration;
|
|
35
|
+
};
|
|
36
|
+
export declare const isImportDefaultSpecifier: (node: TSESTree.Node) => node is TSESTree.ImportDefaultSpecifier & {
|
|
37
|
+
type: TSESTree.AST_NODE_TYPES.ImportDefaultSpecifier;
|
|
38
|
+
};
|
|
39
|
+
export declare const isImportNamespaceSpecifier: (node: TSESTree.Node) => node is TSESTree.ImportNamespaceSpecifier & {
|
|
40
|
+
type: TSESTree.AST_NODE_TYPES.ImportNamespaceSpecifier;
|
|
41
|
+
};
|
|
42
|
+
export declare const isImportSpecifier: (node: TSESTree.Node) => node is TSESTree.ImportSpecifier & {
|
|
43
|
+
type: TSESTree.AST_NODE_TYPES.ImportSpecifier;
|
|
44
|
+
};
|
|
45
|
+
export declare const isLiteral: (node: TSESTree.Node) => node is (TSESTree.BigIntLiteral & {
|
|
46
|
+
type: TSESTree.AST_NODE_TYPES.Literal;
|
|
47
|
+
}) | (TSESTree.BooleanLiteral & {
|
|
48
|
+
type: TSESTree.AST_NODE_TYPES.Literal;
|
|
49
|
+
}) | (TSESTree.NullLiteral & {
|
|
50
|
+
type: TSESTree.AST_NODE_TYPES.Literal;
|
|
51
|
+
}) | (TSESTree.NumberLiteral & {
|
|
52
|
+
type: TSESTree.AST_NODE_TYPES.Literal;
|
|
53
|
+
}) | (TSESTree.RegExpLiteral & {
|
|
54
|
+
type: TSESTree.AST_NODE_TYPES.Literal;
|
|
55
|
+
}) | (TSESTree.StringLiteral & {
|
|
56
|
+
type: TSESTree.AST_NODE_TYPES.Literal;
|
|
57
|
+
});
|
|
58
|
+
export declare const isTemplateElement: (node: TSESTree.Node) => node is TSESTree.TemplateElement & {
|
|
59
|
+
type: TSESTree.AST_NODE_TYPES.TemplateElement;
|
|
60
|
+
};
|
|
61
|
+
export declare const isTemplateLiteral: (node: TSESTree.Node) => node is TSESTree.TemplateLiteral & {
|
|
62
|
+
type: TSESTree.AST_NODE_TYPES.TemplateLiteral;
|
|
63
|
+
};
|
|
64
|
+
export declare const isMemberExpression: (node: TSESTree.Node) => node is (TSESTree.MemberExpressionComputedName & {
|
|
65
|
+
type: TSESTree.AST_NODE_TYPES.MemberExpression;
|
|
66
|
+
}) | (TSESTree.MemberExpressionNonComputedName & {
|
|
67
|
+
type: TSESTree.AST_NODE_TYPES.MemberExpression;
|
|
68
|
+
});
|
|
69
|
+
export declare const isProgram: (node: TSESTree.Node) => node is TSESTree.Program & {
|
|
70
|
+
type: TSESTree.AST_NODE_TYPES.Program;
|
|
71
|
+
};
|
|
72
|
+
export declare const isThisExpression: (node: TSESTree.Node) => node is TSESTree.ThisExpression & {
|
|
73
|
+
type: TSESTree.AST_NODE_TYPES.ThisExpression;
|
|
74
|
+
};
|
|
75
|
+
export declare const isTSParameterProperty: (node: TSESTree.Node) => node is TSESTree.TSParameterProperty & {
|
|
76
|
+
type: TSESTree.AST_NODE_TYPES.TSParameterProperty;
|
|
77
|
+
};
|
|
78
|
+
export declare const isTSTypeAnnotation: (node: TSESTree.Node) => node is TSESTree.TSTypeAnnotation & {
|
|
79
|
+
type: TSESTree.AST_NODE_TYPES.TSTypeAnnotation;
|
|
80
|
+
};
|
|
81
|
+
export declare const isTSTypeReference: (node: TSESTree.Node) => node is TSESTree.TSTypeReference & {
|
|
82
|
+
type: TSESTree.AST_NODE_TYPES.TSTypeReference;
|
|
83
|
+
};
|
|
84
|
+
export declare const isTSInstantiationExpression: (node: TSESTree.Node) => node is TSESTree.TSInstantiationExpression & {
|
|
85
|
+
type: TSESTree.AST_NODE_TYPES.TSInstantiationExpression;
|
|
86
|
+
};
|
|
87
|
+
export declare const isProperty: (node: TSESTree.Node) => node is (TSESTree.PropertyComputedName & {
|
|
88
|
+
type: TSESTree.AST_NODE_TYPES.Property;
|
|
89
|
+
}) | (TSESTree.PropertyNonComputedName & {
|
|
90
|
+
type: TSESTree.AST_NODE_TYPES.Property;
|
|
91
|
+
});
|
|
92
|
+
export declare const isArrayExpression: (node: TSESTree.Node) => node is TSESTree.ArrayExpression & {
|
|
93
|
+
type: TSESTree.AST_NODE_TYPES.ArrayExpression;
|
|
94
|
+
};
|
|
95
|
+
export declare function isIdentifierOrMemberExpression(node: TSESTree.Node): node is TSESTree.Identifier | TSESTree.MemberExpression;
|
|
96
|
+
export declare function isTypeReference(type: ts.Type): type is ts.TypeReference;
|
|
97
|
+
export declare function isCallExpressionWith(node: TSESTree.CallExpression, objectName: RegExp | string, propertyName: string): boolean;
|
|
@@ -1,36 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCallExpressionWith = exports.isTypeReference = exports.isIdentifierOrMemberExpression = exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
30
|
-
exports.isTSTypeReference = isNodeOfType(experimental_utils_1.AST_NODE_TYPES.TSTypeReference);
|
|
31
|
-
exports.isTSInstantiationExpression = isNodeOfType(experimental_utils_1.AST_NODE_TYPES.TSInstantiationExpression);
|
|
32
|
-
exports.isObjectExpression = isNodeOfType(experimental_utils_1.AST_NODE_TYPES.ObjectExpression);
|
|
33
|
-
exports.isProperty = isNodeOfType(experimental_utils_1.AST_NODE_TYPES.Property);
|
|
3
|
+
exports.isCallExpressionWith = exports.isTypeReference = exports.isIdentifierOrMemberExpression = exports.isArrayExpression = exports.isProperty = exports.isTSInstantiationExpression = exports.isTSTypeReference = exports.isTSTypeAnnotation = exports.isTSParameterProperty = exports.isThisExpression = exports.isProgram = exports.isMemberExpression = exports.isTemplateLiteral = exports.isTemplateElement = exports.isLiteral = exports.isImportSpecifier = exports.isImportNamespaceSpecifier = exports.isImportDefaultSpecifier = exports.isImportDeclaration = exports.isIdentifier = exports.isFunctionExpression = exports.isPropertyDefinition = exports.isClassDeclaration = exports.isCallExpression = exports.isMethodDefinition = exports.isReturnStatement = exports.isArrowFunctionExpression = void 0;
|
|
4
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
5
|
+
const isNodeOfType = (nodeType) => (node) => node.type === nodeType;
|
|
6
|
+
exports.isArrowFunctionExpression = isNodeOfType(utils_1.AST_NODE_TYPES.ArrowFunctionExpression);
|
|
7
|
+
exports.isReturnStatement = isNodeOfType(utils_1.AST_NODE_TYPES.ReturnStatement);
|
|
8
|
+
exports.isMethodDefinition = isNodeOfType(utils_1.AST_NODE_TYPES.MethodDefinition);
|
|
9
|
+
exports.isCallExpression = isNodeOfType(utils_1.AST_NODE_TYPES.CallExpression);
|
|
10
|
+
exports.isClassDeclaration = isNodeOfType(utils_1.AST_NODE_TYPES.ClassDeclaration);
|
|
11
|
+
exports.isPropertyDefinition = isNodeOfType(utils_1.AST_NODE_TYPES.PropertyDefinition);
|
|
12
|
+
exports.isFunctionExpression = isNodeOfType(utils_1.AST_NODE_TYPES.FunctionExpression);
|
|
13
|
+
exports.isIdentifier = isNodeOfType(utils_1.AST_NODE_TYPES.Identifier);
|
|
14
|
+
exports.isImportDeclaration = isNodeOfType(utils_1.AST_NODE_TYPES.ImportDeclaration);
|
|
15
|
+
exports.isImportDefaultSpecifier = isNodeOfType(utils_1.AST_NODE_TYPES.ImportDefaultSpecifier);
|
|
16
|
+
exports.isImportNamespaceSpecifier = isNodeOfType(utils_1.AST_NODE_TYPES.ImportNamespaceSpecifier);
|
|
17
|
+
exports.isImportSpecifier = isNodeOfType(utils_1.AST_NODE_TYPES.ImportSpecifier);
|
|
18
|
+
exports.isLiteral = isNodeOfType(utils_1.AST_NODE_TYPES.Literal);
|
|
19
|
+
exports.isTemplateElement = isNodeOfType(utils_1.AST_NODE_TYPES.TemplateElement);
|
|
20
|
+
exports.isTemplateLiteral = isNodeOfType(utils_1.AST_NODE_TYPES.TemplateLiteral);
|
|
21
|
+
exports.isMemberExpression = isNodeOfType(utils_1.AST_NODE_TYPES.MemberExpression);
|
|
22
|
+
exports.isProgram = isNodeOfType(utils_1.AST_NODE_TYPES.Program);
|
|
23
|
+
exports.isThisExpression = isNodeOfType(utils_1.AST_NODE_TYPES.ThisExpression);
|
|
24
|
+
exports.isTSParameterProperty = isNodeOfType(utils_1.AST_NODE_TYPES.TSParameterProperty);
|
|
25
|
+
exports.isTSTypeAnnotation = isNodeOfType(utils_1.AST_NODE_TYPES.TSTypeAnnotation);
|
|
26
|
+
exports.isTSTypeReference = isNodeOfType(utils_1.AST_NODE_TYPES.TSTypeReference);
|
|
27
|
+
exports.isTSInstantiationExpression = isNodeOfType(utils_1.AST_NODE_TYPES.TSInstantiationExpression);
|
|
28
|
+
exports.isProperty = isNodeOfType(utils_1.AST_NODE_TYPES.Property);
|
|
29
|
+
exports.isArrayExpression = isNodeOfType(utils_1.AST_NODE_TYPES.ArrayExpression);
|
|
34
30
|
function isIdentifierOrMemberExpression(node) {
|
|
35
31
|
return (0, exports.isIdentifier)(node) || (0, exports.isMemberExpression)(node);
|
|
36
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/guards.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/guards.ts"],"names":[],"mappings":";;;AACA,oDAA0D;AAG1D,MAAM,YAAY,GAChB,CAAkC,QAAkB,EAAE,EAAE,CACxD,CAAC,IAAmB,EAA8C,EAAE,CAClE,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;AAEd,QAAA,yBAAyB,GAAG,YAAY,CACnD,sBAAc,CAAC,uBAAuB,CACvC,CAAC;AACW,QAAA,iBAAiB,GAAG,YAAY,CAAC,sBAAc,CAAC,eAAe,CAAC,CAAC;AACjE,QAAA,kBAAkB,GAAG,YAAY,CAAC,sBAAc,CAAC,gBAAgB,CAAC,CAAC;AACnE,QAAA,gBAAgB,GAAG,YAAY,CAAC,sBAAc,CAAC,cAAc,CAAC,CAAC;AAC/D,QAAA,kBAAkB,GAAG,YAAY,CAAC,sBAAc,CAAC,gBAAgB,CAAC,CAAC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AAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAC5D,CAAC;AACJ,CAAC;AAhBD,oDAgBC","sourcesContent":["import type { TSESTree } from '@typescript-eslint/utils';\nimport { AST_NODE_TYPES } from '@typescript-eslint/utils';\nimport type * as ts from 'typescript';\n\nconst isNodeOfType =\n <NodeType extends AST_NODE_TYPES>(nodeType: NodeType) =>\n (node: TSESTree.Node): node is TSESTree.Node & { type: NodeType } =>\n node.type === nodeType;\n\nexport const isArrowFunctionExpression = isNodeOfType(\n AST_NODE_TYPES.ArrowFunctionExpression\n);\nexport const isReturnStatement = isNodeOfType(AST_NODE_TYPES.ReturnStatement);\nexport const isMethodDefinition = isNodeOfType(AST_NODE_TYPES.MethodDefinition);\nexport const isCallExpression = isNodeOfType(AST_NODE_TYPES.CallExpression);\nexport const isClassDeclaration = isNodeOfType(AST_NODE_TYPES.ClassDeclaration);\nexport const isPropertyDefinition = isNodeOfType(\n AST_NODE_TYPES.PropertyDefinition\n);\nexport const isFunctionExpression = isNodeOfType(\n AST_NODE_TYPES.FunctionExpression\n);\nexport const isIdentifier = isNodeOfType(AST_NODE_TYPES.Identifier);\nexport const isImportDeclaration = isNodeOfType(\n AST_NODE_TYPES.ImportDeclaration\n);\nexport const isImportDefaultSpecifier = isNodeOfType(\n AST_NODE_TYPES.ImportDefaultSpecifier\n);\nexport const isImportNamespaceSpecifier = isNodeOfType(\n AST_NODE_TYPES.ImportNamespaceSpecifier\n);\nexport const isImportSpecifier = isNodeOfType(AST_NODE_TYPES.ImportSpecifier);\nexport const isLiteral = isNodeOfType(AST_NODE_TYPES.Literal);\nexport const isTemplateElement = isNodeOfType(AST_NODE_TYPES.TemplateElement);\nexport const isTemplateLiteral = isNodeOfType(AST_NODE_TYPES.TemplateLiteral);\nexport const isMemberExpression = isNodeOfType(AST_NODE_TYPES.MemberExpression);\nexport const isProgram = isNodeOfType(AST_NODE_TYPES.Program);\nexport const isThisExpression = isNodeOfType(AST_NODE_TYPES.ThisExpression);\nexport const isTSParameterProperty = isNodeOfType(\n AST_NODE_TYPES.TSParameterProperty\n);\nexport const isTSTypeAnnotation = isNodeOfType(AST_NODE_TYPES.TSTypeAnnotation);\nexport const isTSTypeReference = isNodeOfType(AST_NODE_TYPES.TSTypeReference);\nexport const isTSInstantiationExpression = isNodeOfType(\n AST_NODE_TYPES.TSInstantiationExpression\n);\nexport const isProperty = isNodeOfType(AST_NODE_TYPES.Property);\nexport const isArrayExpression = isNodeOfType(AST_NODE_TYPES.ArrayExpression);\n\nexport function isIdentifierOrMemberExpression(\n node: TSESTree.Node\n): node is TSESTree.Identifier | TSESTree.MemberExpression {\n return isIdentifier(node) || isMemberExpression(node);\n}\n\nexport function isTypeReference(type: ts.Type): type is ts.TypeReference {\n return type.hasOwnProperty('target');\n}\n\nfunction equalTo(one: RegExp | string, other: string) {\n return typeof one === 'string' ? one === other : one.test(other);\n}\n\nexport function isCallExpressionWith(\n node: TSESTree.CallExpression,\n objectName: RegExp | string,\n propertyName: string\n) {\n return (\n isMemberExpression(node.callee) &&\n !node.callee.computed &&\n node.callee.property.name === propertyName &&\n ((isIdentifier(node.callee.object) &&\n equalTo(objectName, node.callee.object.name)) ||\n (isMemberExpression(node.callee.object) &&\n isThisExpression(node.callee.object.object) &&\n isIdentifier(node.callee.object.property) &&\n equalTo(objectName, node.callee.object.property.name)))\n );\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const NGRX_MODULE_PATHS: {
|
|
2
|
+
readonly "component-store": "@ngrx/component-store";
|
|
3
|
+
readonly effects: "@ngrx/effects";
|
|
4
|
+
readonly store: "@ngrx/store";
|
|
5
|
+
readonly operators: "@ngrx/operators";
|
|
6
|
+
readonly signals: "@ngrx/signals";
|
|
7
|
+
};
|
|
8
|
+
export type NGRX_MODULE = keyof typeof NGRX_MODULE_PATHS;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.NGRX_MODULE_PATHS = void 0;
|
|
5
|
-
exports.NGRX_MODULE_PATHS =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
exports.NGRX_MODULE_PATHS = {
|
|
5
|
+
['component-store']: '@ngrx/component-store',
|
|
6
|
+
effects: '@ngrx/effects',
|
|
7
|
+
store: '@ngrx/store',
|
|
8
|
+
operators: '@ngrx/operators',
|
|
9
|
+
signals: '@ngrx/signals',
|
|
10
|
+
};
|
|
10
11
|
//# sourceMappingURL=ngrx-modules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngrx-modules.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/ngrx-modules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ngrx-modules.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/ngrx-modules.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG;IAC/B,CAAC,iBAAiB,CAAC,EAAE,uBAAuB;IAC5C,OAAO,EAAE,eAAe;IACxB,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,iBAAiB;IAC5B,OAAO,EAAE,eAAe;CAChB,CAAC","sourcesContent":["export const NGRX_MODULE_PATHS = {\n ['component-store']: '@ngrx/component-store',\n effects: '@ngrx/effects',\n store: '@ngrx/store',\n operators: '@ngrx/operators',\n signals: '@ngrx/signals',\n} as const;\n\nexport type NGRX_MODULE = keyof typeof NGRX_MODULE_PATHS;\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
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.configsForGenerate = exports.rulesForGenerate = void 0;
|
|
27
|
+
const folder_1 = require("./folder");
|
|
28
|
+
const path = __importStar(require("path"));
|
|
29
|
+
const interopRequireDefault = (obj) => obj && obj.__esModule ? obj : { default: obj };
|
|
30
|
+
const importDefault = (moduleName) =>
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
32
|
+
interopRequireDefault(require(moduleName)).default;
|
|
33
|
+
const rulesDir = path.join(__dirname, '../../rules');
|
|
34
|
+
const configsDir = path.join(__dirname, '../../configs');
|
|
35
|
+
const excludedFiles = ['index'];
|
|
36
|
+
exports.rulesForGenerate = Array.from((0, folder_1.traverseFolder)(rulesDir, ['.ts']))
|
|
37
|
+
.filter((rule) => !excludedFiles.includes(rule.file))
|
|
38
|
+
.reduce((allRules, rule) => {
|
|
39
|
+
const ruleModule = importDefault(rule.path);
|
|
40
|
+
ruleModule.meta.ngrxModule = path.basename(path.dirname(rule.path));
|
|
41
|
+
return {
|
|
42
|
+
...allRules,
|
|
43
|
+
[rule.file]: ruleModule,
|
|
44
|
+
};
|
|
45
|
+
}, {});
|
|
46
|
+
exports.configsForGenerate = Array.from((0, folder_1.traverseFolder)(configsDir, ['.json'])).map((config) => config.file);
|
|
47
|
+
//# sourceMappingURL=rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../../../../modules/eslint-plugin/src/utils/helper-functions/rules.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAA0C;AAE1C,2CAA6B;AAE7B,MAAM,qBAAqB,GAAG,CAAC,GAAQ,EAAwB,EAAE,CAC/D,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;AAEjD,MAAM,aAAa,GAAG,CAAC,UAAkB,EAAE,EAAE;AAC3C,8DAA8D;AAC9D,qBAAqB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;AAErD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AACrD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;AACzD,MAAM,aAAa,GAAG,CAAC,OAAO,CAAC,CAAC;AAEnB,QAAA,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,IAAA,uBAAc,EAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;KAC1E,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACpD,MAAM,CAA6C,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE;IACrE,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAA+B,CAAC;IAC1E,UAAU,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,QAAQ,CACxC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CACT,CAAC;IACjB,OAAO;QACL,GAAG,QAAQ;QACX,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,UAAU;KACxB,CAAC;AACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AAEI,QAAA,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAC1C,IAAA,uBAAc,EAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC,CACtC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import { NgRxRuleModule } from '../../rule-creator';\nimport { traverseFolder } from './folder';\nimport { NGRX_MODULE } from './ngrx-modules';\nimport * as path from 'path';\n\nconst interopRequireDefault = (obj: any): { default: unknown } =>\n obj && 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 rulesDir = path.join(__dirname, '../../rules');\nconst configsDir = path.join(__dirname, '../../configs');\nconst excludedFiles = ['index'];\n\nexport const rulesForGenerate = Array.from(traverseFolder(rulesDir, ['.ts']))\n .filter((rule) => !excludedFiles.includes(rule.file))\n .reduce<Record<string, NgRxRuleModule<[], string>>>((allRules, rule) => {\n const ruleModule = importDefault(rule.path) as NgRxRuleModule<[], string>;\n ruleModule.meta.ngrxModule = path.basename(\n path.dirname(rule.path)\n ) as NGRX_MODULE;\n return {\n ...allRules,\n [rule.file]: ruleModule,\n };\n }, {});\n\nexport const configsForGenerate = Array.from(\n traverseFolder(configsDir, ['.json'])\n).map((config) => config.file);\n"]}
|