@yasainet/eslint 0.0.17 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/common/naming.mjs +13 -49
package/package.json
CHANGED
package/src/common/naming.mjs
CHANGED
|
@@ -7,16 +7,10 @@ export function createNamingConfigs(featureRoot, prefixLibMapping) {
|
|
|
7
7
|
const prefixPattern = `@(${Object.keys(prefixLibMapping).join("|")})`;
|
|
8
8
|
const sharedPrefixPattern = `@(shared|${Object.keys(prefixLibMapping).join("|")})`;
|
|
9
9
|
|
|
10
|
-
// DB prefix: value contains "/" = sub-directory origin = DB client
|
|
11
|
-
const dbPrefixKeys = Object.entries(prefixLibMapping)
|
|
12
|
-
.filter(([, value]) => value.includes("/"))
|
|
13
|
-
.map(([key]) => key);
|
|
14
|
-
|
|
15
10
|
const configs = [
|
|
16
11
|
{
|
|
17
12
|
name: "naming/services",
|
|
18
13
|
files: featuresGlob(featureRoot, "**/services/*.ts"),
|
|
19
|
-
ignores: featuresGlob(featureRoot, "shared/services/*.ts"),
|
|
20
14
|
plugins: { "check-file": checkFile },
|
|
21
15
|
rules: {
|
|
22
16
|
"check-file/filename-naming-convention": [
|
|
@@ -25,49 +19,18 @@ export function createNamingConfigs(featureRoot, prefixLibMapping) {
|
|
|
25
19
|
],
|
|
26
20
|
},
|
|
27
21
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// Non-shared features: only DB prefixes allowed for repositories
|
|
31
|
-
if (dbPrefixKeys.length > 0) {
|
|
32
|
-
const dbPrefixPattern = `@(${dbPrefixKeys.join("|")})`;
|
|
33
|
-
configs.push({
|
|
22
|
+
{
|
|
34
23
|
name: "naming/repositories",
|
|
35
24
|
files: featuresGlob(featureRoot, "**/repositories/*.ts"),
|
|
36
|
-
ignores: featuresGlob(featureRoot, "shared/repositories/*.ts"),
|
|
37
25
|
plugins: { "check-file": checkFile },
|
|
38
26
|
rules: {
|
|
39
27
|
"check-file/filename-naming-convention": [
|
|
40
28
|
"error",
|
|
41
|
-
{ "**/*.ts": `${
|
|
29
|
+
{ "**/*.ts": `${prefixPattern}.repo` },
|
|
42
30
|
],
|
|
43
31
|
},
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
configs.push({
|
|
48
|
-
name: "naming/services-shared",
|
|
49
|
-
files: featuresGlob(featureRoot, "shared/services/*.ts"),
|
|
50
|
-
plugins: { "check-file": checkFile },
|
|
51
|
-
rules: {
|
|
52
|
-
"check-file/filename-naming-convention": [
|
|
53
|
-
"error",
|
|
54
|
-
{ "**/*.ts": "@(shared).service" },
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// Shared feature: only "shared" prefix allowed
|
|
60
|
-
configs.push({
|
|
61
|
-
name: "naming/repositories-shared",
|
|
62
|
-
files: featuresGlob(featureRoot, "shared/repositories/*.ts"),
|
|
63
|
-
plugins: { "check-file": checkFile },
|
|
64
|
-
rules: {
|
|
65
|
-
"check-file/filename-naming-convention": [
|
|
66
|
-
"error",
|
|
67
|
-
{ "**/*.ts": "@(shared).repo" },
|
|
68
|
-
],
|
|
69
32
|
},
|
|
70
|
-
|
|
33
|
+
];
|
|
71
34
|
|
|
72
35
|
configs.push(
|
|
73
36
|
{
|
|
@@ -131,35 +94,36 @@ export function createNamingConfigs(featureRoot, prefixLibMapping) {
|
|
|
131
94
|
},
|
|
132
95
|
{
|
|
133
96
|
name: "naming/constants",
|
|
134
|
-
files: featuresGlob(featureRoot, "
|
|
97
|
+
files: featuresGlob(featureRoot, "*/constants/*.constant.ts"),
|
|
98
|
+
ignores: featuresGlob(featureRoot, "shared/constants/*.ts"),
|
|
135
99
|
plugins: { "check-file": checkFile },
|
|
136
100
|
rules: {
|
|
137
101
|
"check-file/filename-naming-convention": [
|
|
138
102
|
"error",
|
|
139
|
-
{ "
|
|
103
|
+
{ "**/*/constants/*.ts": "<1>" },
|
|
104
|
+
{ ignoreMiddleExtensions: true },
|
|
140
105
|
],
|
|
141
106
|
},
|
|
142
107
|
},
|
|
143
108
|
{
|
|
144
|
-
name: "naming/
|
|
145
|
-
files: featuresGlob(featureRoot, "
|
|
146
|
-
ignores: featuresGlob(featureRoot, "shared/actions/*.ts"),
|
|
109
|
+
name: "naming/constants-shared",
|
|
110
|
+
files: featuresGlob(featureRoot, "shared/constants/*.ts"),
|
|
147
111
|
plugins: { "check-file": checkFile },
|
|
148
112
|
rules: {
|
|
149
113
|
"check-file/filename-naming-convention": [
|
|
150
114
|
"error",
|
|
151
|
-
{ "**/*.ts": `${
|
|
115
|
+
{ "**/*.ts": `${sharedPrefixPattern}.constant` },
|
|
152
116
|
],
|
|
153
117
|
},
|
|
154
118
|
},
|
|
155
119
|
{
|
|
156
|
-
name: "naming/actions
|
|
157
|
-
files: featuresGlob(featureRoot, "
|
|
120
|
+
name: "naming/actions",
|
|
121
|
+
files: featuresGlob(featureRoot, "**/actions/*.ts"),
|
|
158
122
|
plugins: { "check-file": checkFile },
|
|
159
123
|
rules: {
|
|
160
124
|
"check-file/filename-naming-convention": [
|
|
161
125
|
"error",
|
|
162
|
-
{ "**/*.ts":
|
|
126
|
+
{ "**/*.ts": `${prefixPattern}.action` },
|
|
163
127
|
],
|
|
164
128
|
},
|
|
165
129
|
},
|