@yasainet/eslint 0.0.14 → 0.0.16
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/README.md +10 -10
- package/package.json +1 -1
- package/src/common/layers.mjs +21 -0
- package/src/common/naming.mjs +3 -3
package/README.md
CHANGED
|
@@ -100,22 +100,22 @@ export default [...eslintConfig];
|
|
|
100
100
|
|
|
101
101
|
## Release
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
Version is derived from the Git tag. CI automatically sets `package.json` version before publishing.
|
|
104
|
+
|
|
105
|
+
1. Commit and push to `main`
|
|
106
|
+
2. Create and push a tag:
|
|
106
107
|
|
|
107
108
|
```sh
|
|
108
109
|
git tag v1.0.0
|
|
109
110
|
git push --tags
|
|
110
111
|
```
|
|
111
112
|
|
|
112
|
-
|
|
113
|
+
3. GitHub Actions will automatically publish to npm
|
|
113
114
|
|
|
114
115
|
### With lazygit
|
|
115
116
|
|
|
116
|
-
1.
|
|
117
|
-
2.
|
|
118
|
-
3.
|
|
119
|
-
4.
|
|
120
|
-
5.
|
|
121
|
-
6. GitHub Actions will automatically publish to npm
|
|
117
|
+
1. Stage and commit in lazygit
|
|
118
|
+
2. Select the commit, press `T` to create a tag (e.g. `v1.0.0`)
|
|
119
|
+
3. Press `P` to push the commit
|
|
120
|
+
4. Switch to the Tags panel (`]`), select the tag, and press `P` to push it
|
|
121
|
+
5. GitHub Actions will automatically publish to npm
|
package/package.json
CHANGED
package/src/common/layers.mjs
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
/** @description Scope layer rules to the given feature root */
|
|
2
2
|
export function createLayersConfigs(featureRoot) {
|
|
3
|
+
const loggerSelector = "CallExpression[callee.object.name='logger']";
|
|
4
|
+
const loggerMessage =
|
|
5
|
+
"logger is not allowed outside actions. Logging belongs in actions.";
|
|
6
|
+
|
|
3
7
|
return [
|
|
8
|
+
// Logger/console: all features except actions
|
|
9
|
+
{
|
|
10
|
+
name: "layers/logger",
|
|
11
|
+
files: [`${featureRoot}/**/*.ts`],
|
|
12
|
+
ignores: [`${featureRoot}/**/actions/*.ts`],
|
|
13
|
+
rules: {
|
|
14
|
+
"no-console": "error",
|
|
15
|
+
"no-restricted-syntax": [
|
|
16
|
+
"error",
|
|
17
|
+
{ selector: loggerSelector, message: loggerMessage },
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
// Repositories: try-catch + if + logger
|
|
4
22
|
{
|
|
5
23
|
name: "layers/repositories",
|
|
6
24
|
files: [`${featureRoot}/**/repositories/*.ts`],
|
|
@@ -17,9 +35,11 @@ export function createLayersConfigs(featureRoot) {
|
|
|
17
35
|
message:
|
|
18
36
|
"if statements are not allowed in repositories. Conditional logic belongs in services.",
|
|
19
37
|
},
|
|
38
|
+
{ selector: loggerSelector, message: loggerMessage },
|
|
20
39
|
],
|
|
21
40
|
},
|
|
22
41
|
},
|
|
42
|
+
// Services: try-catch + logger
|
|
23
43
|
{
|
|
24
44
|
name: "layers/services",
|
|
25
45
|
files: [`${featureRoot}/**/services/*.ts`],
|
|
@@ -31,6 +51,7 @@ export function createLayersConfigs(featureRoot) {
|
|
|
31
51
|
message:
|
|
32
52
|
"try-catch is not allowed in services. Error handling belongs in actions.",
|
|
33
53
|
},
|
|
54
|
+
{ selector: loggerSelector, message: loggerMessage },
|
|
34
55
|
],
|
|
35
56
|
},
|
|
36
57
|
},
|
package/src/common/naming.mjs
CHANGED
|
@@ -51,7 +51,7 @@ export function createNamingConfigs(featureRoot, prefixLibMapping) {
|
|
|
51
51
|
rules: {
|
|
52
52
|
"check-file/filename-naming-convention": [
|
|
53
53
|
"error",
|
|
54
|
-
{ "**/*.ts": "shared.service" },
|
|
54
|
+
{ "**/*.ts": "@(shared).service" },
|
|
55
55
|
],
|
|
56
56
|
},
|
|
57
57
|
});
|
|
@@ -64,7 +64,7 @@ export function createNamingConfigs(featureRoot, prefixLibMapping) {
|
|
|
64
64
|
rules: {
|
|
65
65
|
"check-file/filename-naming-convention": [
|
|
66
66
|
"error",
|
|
67
|
-
{ "**/*.ts": "shared.repo" },
|
|
67
|
+
{ "**/*.ts": "@(shared).repo" },
|
|
68
68
|
],
|
|
69
69
|
},
|
|
70
70
|
});
|
|
@@ -159,7 +159,7 @@ export function createNamingConfigs(featureRoot, prefixLibMapping) {
|
|
|
159
159
|
rules: {
|
|
160
160
|
"check-file/filename-naming-convention": [
|
|
161
161
|
"error",
|
|
162
|
-
{ "**/*.ts": "shared.action" },
|
|
162
|
+
{ "**/*.ts": "@(shared).action" },
|
|
163
163
|
],
|
|
164
164
|
},
|
|
165
165
|
},
|