@labeg/code-style 3.1.4 → 4.0.3
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/.eslintrc.js +40 -18
- package/README.md +11 -3
- package/package.json +7 -5
package/.eslintrc.js
CHANGED
|
@@ -6,7 +6,18 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const jsAndTsRules = {
|
|
9
|
+
// Eslint rules
|
|
9
10
|
"sort-imports": "off", // Need found sorter
|
|
11
|
+
"sort-keys": "off", // More nice
|
|
12
|
+
"one-var": ["error", "never"], // More nice
|
|
13
|
+
"no-ternary": "off", // More nice
|
|
14
|
+
"no-void": "off", // Strange rule
|
|
15
|
+
"no-bitwise": "off", // Used in many projects
|
|
16
|
+
"no-inline-comments": "off", // Maybe later?
|
|
17
|
+
"line-comment-position": "off", // Maybe later?
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
// Eslint moved to Stylistic, but now to buggy for js. Remove after fix bugs in new versions Stylistic
|
|
10
21
|
"max-len": [
|
|
11
22
|
"error", {
|
|
12
23
|
code: 140,
|
|
@@ -22,27 +33,40 @@ const jsAndTsRules = {
|
|
|
22
33
|
], // More nice
|
|
23
34
|
"function-call-argument-newline": ["error", "consistent"], // More nice
|
|
24
35
|
"quote-props": ["error", "as-needed"], // More nice
|
|
25
|
-
"sort-keys": "off", // More nice
|
|
26
|
-
"class-methods-use-this": "off", // False positives
|
|
27
|
-
"one-var": ["error", "never"], // More nice
|
|
28
|
-
"no-ternary": "off", // More nice
|
|
29
36
|
"multiline-ternary": ["error", "always-multiline"], // More nice
|
|
30
37
|
"array-element-newline": ["error", "consistent"], // More nice
|
|
31
38
|
"operator-linebreak": ["error", "after"], // More nice
|
|
32
|
-
"no-void": "off", // Strange rule
|
|
33
|
-
"max-params": ["error", {max: 4}], // Maybe later?
|
|
34
|
-
"no-bitwise": "off", // Used in many projects
|
|
35
|
-
"prefer-named-capture-group": "off", // Maybe later?
|
|
36
|
-
"dot-location": ["error", "property"], // More nice
|
|
37
|
-
"no-inline-comments": "off", // Maybe later?
|
|
38
|
-
"line-comment-position": "off", // Maybe later?
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
// Stylistic rules
|
|
42
|
+
"@stylistic/max-len": [
|
|
43
|
+
"error", {
|
|
44
|
+
code: 140,
|
|
45
|
+
comments: 140
|
|
46
|
+
}
|
|
47
|
+
], // More nice, for modern screens
|
|
48
|
+
"@stylistic/padded-blocks": [
|
|
49
|
+
"error", {
|
|
50
|
+
classes: "always",
|
|
51
|
+
blocks: "never",
|
|
52
|
+
switches: "never"
|
|
53
|
+
}
|
|
54
|
+
], // More nice
|
|
55
|
+
"@stylistic/function-call-argument-newline": ["error", "consistent"], // More nice
|
|
56
|
+
"@stylistic/quote-props": ["error", "as-needed"], // More nice
|
|
57
|
+
"@stylistic/multiline-ternary": ["error", "always-multiline"], // More nice
|
|
58
|
+
"@stylistic/array-element-newline": ["error", "consistent"], // More nice
|
|
59
|
+
"@stylistic/operator-linebreak": ["error", "after"], // More nice
|
|
60
|
+
"@stylistic/no-extra-parens": "off"
|
|
41
61
|
};
|
|
42
62
|
|
|
43
63
|
module.exports = {
|
|
44
64
|
extends: [
|
|
45
|
-
"eslint:all" // There is no React because they are used strictly with Typescript.
|
|
65
|
+
"eslint:all", // There is no React because they are used strictly with Typescript.
|
|
66
|
+
// "plugin:@stylistic/all-extends" // Bug, begin incorrect formatting, check in new versions
|
|
67
|
+
],
|
|
68
|
+
plugins: [
|
|
69
|
+
"@stylistic/migrate"
|
|
46
70
|
],
|
|
47
71
|
root: true,
|
|
48
72
|
env: {
|
|
@@ -52,7 +76,8 @@ module.exports = {
|
|
|
52
76
|
},
|
|
53
77
|
ignorePatterns: ["node_modules/*"],
|
|
54
78
|
rules: {
|
|
55
|
-
...jsAndTsRules
|
|
79
|
+
...jsAndTsRules,
|
|
80
|
+
"no-duplicate-imports": "off", // Bug, conflict between TS import and import type
|
|
56
81
|
},
|
|
57
82
|
overrides: [
|
|
58
83
|
{
|
|
@@ -81,6 +106,7 @@ module.exports = {
|
|
|
81
106
|
},
|
|
82
107
|
extends: [
|
|
83
108
|
"eslint:all",
|
|
109
|
+
"plugin:@stylistic/all-extends",
|
|
84
110
|
"plugin:@typescript-eslint/all",
|
|
85
111
|
"plugin:react/all",
|
|
86
112
|
"plugin:react-hooks/recommended",
|
|
@@ -99,9 +125,6 @@ module.exports = {
|
|
|
99
125
|
"@typescript-eslint/no-confusing-void-expression": "off", // More nice
|
|
100
126
|
"@typescript-eslint/member-ordering": "off", // Need correct priority
|
|
101
127
|
|
|
102
|
-
"@typescript-eslint/keyword-spacing": "off", // Bug, remove later
|
|
103
|
-
"@typescript-eslint/no-import-type-side-effects": "off", // Bug, remove later
|
|
104
|
-
|
|
105
128
|
"react/jsx-filename-extension": ["error", {extensions: [".tsx"]}], // Added typescript file extension
|
|
106
129
|
"react/jsx-no-literals": "off", // Broken rule, not work with ??
|
|
107
130
|
"react/jsx-max-depth": ["error", {max: 10}], // To small by default
|
|
@@ -109,7 +132,6 @@ module.exports = {
|
|
|
109
132
|
"react/forbid-component-props": "off", // Conflict with styled-components
|
|
110
133
|
"react/jsx-uses-react": "off", // https://ru.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
|
|
111
134
|
"react/react-in-jsx-scope": "off", // https://ru.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
|
|
112
|
-
"react/sort-comp": "off" // Need write priority
|
|
113
135
|
}
|
|
114
136
|
}
|
|
115
137
|
]
|
package/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-

|
|
2
|
-

|
|
3
1
|

|
|
4
2
|
|
|
5
3
|
|
|
@@ -17,7 +15,17 @@ npm i -D @labeg/code-style
|
|
|
17
15
|
module.exports = {
|
|
18
16
|
extends: ["./node_modules/@labeg/code-style/.eslintrc.js"],
|
|
19
17
|
rules:{
|
|
20
|
-
//
|
|
18
|
+
// Override here
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Версия для NextJS:
|
|
24
|
+
```Javascript
|
|
25
|
+
module.exports = {
|
|
26
|
+
extends: ["next/core-web-vitals", "./node_modules/@labeg/code-style/.eslintrc.js"],
|
|
27
|
+
rules: {
|
|
28
|
+
// Override here
|
|
21
29
|
}
|
|
22
30
|
};
|
|
23
31
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labeg/code-style",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepublishOnly": "npm version patch"
|
|
6
6
|
},
|
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
},
|
|
16
16
|
"homepage": "https://github.com/LabEG/code-style#readme",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
19
|
-
"@typescript-eslint/parser": "^6.
|
|
20
|
-
"eslint": "^8.
|
|
18
|
+
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
19
|
+
"@typescript-eslint/parser": "^6.14.0",
|
|
20
|
+
"eslint": "^8.56.0",
|
|
21
21
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
22
22
|
"eslint-plugin-react": "^7.33.2",
|
|
23
|
-
"eslint-plugin-react-hooks": "^4.6.0"
|
|
23
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
24
|
+
"@stylistic/eslint-plugin": "^1.5.1",
|
|
25
|
+
"@stylistic/eslint-plugin-migrate": "^1.5.1"
|
|
24
26
|
}
|
|
25
27
|
}
|