@labeg/code-style 5.3.3 → 5.5.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/eslint.config.js +87 -71
- package/package.json +2 -1
package/eslint.config.js
CHANGED
|
@@ -3,22 +3,50 @@ import js from "@eslint/js";
|
|
|
3
3
|
import tseslint from "typescript-eslint";
|
|
4
4
|
import stylistic from "@stylistic/eslint-plugin";
|
|
5
5
|
import reactPlugin from "eslint-plugin-react";
|
|
6
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
6
7
|
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
7
8
|
import globals from "globals";
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Help by links:
|
|
12
|
+
* https://github.com/eslint/eslint/discussions/18304
|
|
13
|
+
*/
|
|
14
|
+
|
|
9
15
|
/** @type {import("eslint").Linter.Config} */
|
|
10
|
-
export default
|
|
16
|
+
export default [
|
|
17
|
+
// DO NOT PUT OTHER PROPS IN THIS OBJECT
|
|
11
18
|
{ignores: ["**/node_modules/**", "dist/"]},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
|
|
20
|
+
// THE IGNORES IS APPLIED ALSO TO THESE FOLLOWING CONFIGS
|
|
21
|
+
{files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"]},
|
|
22
|
+
|
|
23
|
+
js.configs.all,
|
|
24
|
+
...tseslint.configs.strict,
|
|
25
|
+
...tseslint.configs.stylistic,
|
|
26
|
+
stylistic.configs["all-flat"],
|
|
27
|
+
reactPlugin.configs.flat.all,
|
|
28
|
+
jsxA11y.flatConfigs.strict,
|
|
29
|
+
|
|
30
|
+
{ // Don't support flat config yet
|
|
31
|
+
plugins: {
|
|
32
|
+
"react-hooks": reactHooks
|
|
33
|
+
},
|
|
34
|
+
rules: reactHooks.configs.recommended.rules
|
|
15
35
|
},
|
|
16
|
-
|
|
17
|
-
|
|
36
|
+
|
|
37
|
+
...tseslint.config({
|
|
38
|
+
files: ["**/*.ts"],
|
|
18
39
|
extends: [
|
|
19
|
-
|
|
20
|
-
tseslint.configs.
|
|
40
|
+
...tseslint.configs.strictTypeCheckedOnly,
|
|
41
|
+
...tseslint.configs.stylisticTypeCheckedOnly
|
|
21
42
|
],
|
|
43
|
+
languageOptions: {
|
|
44
|
+
parser: tseslint.parser,
|
|
45
|
+
parserOptions: {
|
|
46
|
+
projectService: true,
|
|
47
|
+
tsconfigRootDir: import.meta.dirname
|
|
48
|
+
}
|
|
49
|
+
},
|
|
22
50
|
rules: {
|
|
23
51
|
"@typescript-eslint/no-inferrable-types": "off", // Need for reflection
|
|
24
52
|
"@typescript-eslint/no-magic-numbers": "off",
|
|
@@ -31,77 +59,28 @@ export default tseslint.config(
|
|
|
31
59
|
"@typescript-eslint/no-confusing-void-expression": "off", // More nice
|
|
32
60
|
"@typescript-eslint/member-ordering": "off" // Need correct priority
|
|
33
61
|
}
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
extends: [stylistic.configs["all-flat"]],
|
|
37
|
-
rules: {
|
|
38
|
-
// Stylistic rules
|
|
39
|
-
"@stylistic/max-len": [
|
|
40
|
-
"error", {
|
|
41
|
-
code: 140,
|
|
42
|
-
comments: 140
|
|
43
|
-
}
|
|
44
|
-
], // More nice, for modern screens
|
|
45
|
-
"@stylistic/padded-blocks": [
|
|
46
|
-
"error", {
|
|
47
|
-
classes: "always",
|
|
48
|
-
blocks: "never",
|
|
49
|
-
switches: "never"
|
|
50
|
-
}
|
|
51
|
-
], // More nice
|
|
52
|
-
"@stylistic/function-call-argument-newline": ["error", "consistent"], // More nice
|
|
53
|
-
"@stylistic/quote-props": ["error", "as-needed"], // More nice
|
|
54
|
-
"@stylistic/multiline-ternary": ["error", "always-multiline"], // More nice
|
|
55
|
-
"@stylistic/array-element-newline": ["error", "consistent"], // More nice
|
|
56
|
-
"@stylistic/operator-linebreak": ["error", "after"], // More nice
|
|
57
|
-
"@stylistic/no-extra-parens": "off",
|
|
58
|
-
"@stylistic/dot-location": ["error", "property"] // Maybe later?
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
files: ["**/*.{jsx,tsx}"],
|
|
63
|
-
extends: [reactPlugin.configs.flat.all],
|
|
64
|
-
settings: {
|
|
65
|
-
react: {
|
|
66
|
-
version: "detect"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
rules: {
|
|
70
|
-
"react/jsx-filename-extension": ["error", {extensions: [".jsx", ".tsx"]}], // Added typescript file extension
|
|
71
|
-
"react/jsx-no-literals": "off", // Broken rule, not work with ??
|
|
72
|
-
"react/jsx-max-depth": ["error", {max: 10}], // To small by default
|
|
73
|
-
"react/function-component-definition": ["error", {namedComponents: "arrow-function"}], // Same as eslint func-styles
|
|
74
|
-
"react/forbid-component-props": "off", // Conflict with styled-components
|
|
75
|
-
"react/require-default-props": "off", // Don't used in modern react
|
|
76
|
-
"react/jsx-uses-react": "off", // https://ru.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
|
|
77
|
-
"react/react-in-jsx-scope": "off" // https://ru.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
extends: [jsxA11y.flatConfigs.strict],
|
|
82
|
-
rules: {
|
|
62
|
+
}),
|
|
83
63
|
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
64
|
{
|
|
87
65
|
languageOptions: {
|
|
88
|
-
ecmaVersion:
|
|
66
|
+
ecmaVersion: "latest",
|
|
89
67
|
sourceType: "module",
|
|
90
68
|
globals: {
|
|
91
69
|
...globals.browser,
|
|
92
70
|
...globals.node
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
ecmaFeatures: {
|
|
99
|
-
jsx: true
|
|
100
|
-
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
settings: {
|
|
74
|
+
react: {
|
|
75
|
+
version: "detect"
|
|
101
76
|
}
|
|
102
77
|
},
|
|
103
78
|
rules: {
|
|
104
|
-
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Eslint rules
|
|
82
|
+
*/
|
|
83
|
+
"no-magic-numbers": "off", // Conflict with void 0
|
|
105
84
|
"sort-imports": "off", // Need found sorter
|
|
106
85
|
"sort-keys": "off", // More nice
|
|
107
86
|
"one-var": ["error", "never"], // More nice
|
|
@@ -130,7 +109,44 @@ export default tseslint.config(
|
|
|
130
109
|
"quote-props": ["error", "as-needed"], // More nice
|
|
131
110
|
"multiline-ternary": ["error", "always-multiline"], // More nice
|
|
132
111
|
"array-element-newline": ["error", "consistent"], // More nice
|
|
133
|
-
"operator-linebreak": ["error", "after"] // More nice
|
|
112
|
+
"operator-linebreak": ["error", "after"], // More nice
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Stylistic rules
|
|
117
|
+
*/
|
|
118
|
+
"@stylistic/max-len": [
|
|
119
|
+
"error", {
|
|
120
|
+
code: 140,
|
|
121
|
+
comments: 140
|
|
122
|
+
}
|
|
123
|
+
], // More nice, for modern screens
|
|
124
|
+
"@stylistic/padded-blocks": [
|
|
125
|
+
"error", {
|
|
126
|
+
classes: "always",
|
|
127
|
+
blocks: "never",
|
|
128
|
+
switches: "never"
|
|
129
|
+
}
|
|
130
|
+
], // More nice
|
|
131
|
+
"@stylistic/function-call-argument-newline": ["error", "consistent"], // More nice
|
|
132
|
+
"@stylistic/quote-props": ["error", "as-needed"], // More nice
|
|
133
|
+
"@stylistic/multiline-ternary": ["error", "always-multiline"], // More nice
|
|
134
|
+
"@stylistic/array-element-newline": ["error", "consistent"], // More nice
|
|
135
|
+
"@stylistic/operator-linebreak": ["error", "after"], // More nice
|
|
136
|
+
"@stylistic/no-extra-parens": "off",
|
|
137
|
+
"@stylistic/dot-location": ["error", "property"], // Maybe later?
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* React rules
|
|
141
|
+
*/
|
|
142
|
+
"react/jsx-filename-extension": ["error", {extensions: [".jsx", ".tsx"]}], // Added typescript file extension
|
|
143
|
+
"react/jsx-no-literals": "off", // Broken rule, not work with ??
|
|
144
|
+
"react/jsx-max-depth": ["error", {max: 10}], // To small by default
|
|
145
|
+
"react/function-component-definition": ["error", {namedComponents: "arrow-function"}], // Same as eslint func-styles
|
|
146
|
+
"react/forbid-component-props": "off", // Conflict with styled-components
|
|
147
|
+
"react/require-default-props": "off", // Don't used in modern react
|
|
148
|
+
"react/jsx-uses-react": "off", // https://ru.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
|
|
149
|
+
"react/react-in-jsx-scope": "off" // https://ru.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
|
|
134
150
|
}
|
|
135
151
|
}
|
|
136
|
-
|
|
152
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labeg/code-style",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"author": "Eugene Labutin",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/LabEG/code-style#readme",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"eslint": "^9.17.0",
|
|
38
38
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
39
39
|
"eslint-plugin-react": "^7.37.3",
|
|
40
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
40
41
|
"typescript-eslint": "^8.18.2"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|