@labeg/code-style 3.1.4 → 4.0.2
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 +38 -17
- package/README.md +11 -1
- package/package.json +4 -2
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: {
|
|
@@ -81,6 +105,7 @@ module.exports = {
|
|
|
81
105
|
},
|
|
82
106
|
extends: [
|
|
83
107
|
"eslint:all",
|
|
108
|
+
"plugin:@stylistic/all-extends",
|
|
84
109
|
"plugin:@typescript-eslint/all",
|
|
85
110
|
"plugin:react/all",
|
|
86
111
|
"plugin:react-hooks/recommended",
|
|
@@ -99,9 +124,6 @@ module.exports = {
|
|
|
99
124
|
"@typescript-eslint/no-confusing-void-expression": "off", // More nice
|
|
100
125
|
"@typescript-eslint/member-ordering": "off", // Need correct priority
|
|
101
126
|
|
|
102
|
-
"@typescript-eslint/keyword-spacing": "off", // Bug, remove later
|
|
103
|
-
"@typescript-eslint/no-import-type-side-effects": "off", // Bug, remove later
|
|
104
|
-
|
|
105
127
|
"react/jsx-filename-extension": ["error", {extensions: [".tsx"]}], // Added typescript file extension
|
|
106
128
|
"react/jsx-no-literals": "off", // Broken rule, not work with ??
|
|
107
129
|
"react/jsx-max-depth": ["error", {max: 10}], // To small by default
|
|
@@ -109,7 +131,6 @@ module.exports = {
|
|
|
109
131
|
"react/forbid-component-props": "off", // Conflict with styled-components
|
|
110
132
|
"react/jsx-uses-react": "off", // https://ru.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
|
|
111
133
|
"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
134
|
}
|
|
114
135
|
}
|
|
115
136
|
]
|
package/README.md
CHANGED
|
@@ -17,7 +17,17 @@ npm i -D @labeg/code-style
|
|
|
17
17
|
module.exports = {
|
|
18
18
|
extends: ["./node_modules/@labeg/code-style/.eslintrc.js"],
|
|
19
19
|
rules:{
|
|
20
|
-
//
|
|
20
|
+
// Override here
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Версия для NextJS:
|
|
26
|
+
```Javascript
|
|
27
|
+
module.exports = {
|
|
28
|
+
extends: ["next/core-web-vitals", "./node_modules/@labeg/code-style/.eslintrc.js"],
|
|
29
|
+
rules: {
|
|
30
|
+
// Override here
|
|
21
31
|
}
|
|
22
32
|
};
|
|
23
33
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labeg/code-style",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepublishOnly": "npm version patch"
|
|
6
6
|
},
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
"eslint": "^8.55.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.4.1",
|
|
25
|
+
"@stylistic/eslint-plugin-migrate": "^1.4.1"
|
|
24
26
|
}
|
|
25
27
|
}
|