@siberiacancode/eslint 2.3.0 → 2.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/index.js +221 -150
- package/package.json +8 -9
package/index.js
CHANGED
|
@@ -1,150 +1,221 @@
|
|
|
1
|
-
import antfu from '@antfu/eslint-config';
|
|
2
|
-
import pluginNext from '@next/eslint-plugin-next';
|
|
3
|
-
import pluginJsxA11y from 'eslint-plugin-jsx-a11y';
|
|
4
|
-
import pluginReact from 'eslint-plugin-react';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
plugins: {
|
|
14
|
-
'siberiacancode-next': pluginNext
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
acc
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
plugins: {
|
|
32
|
-
'siberiacancode-jsx-a11y': pluginJsxA11y
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
acc
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
'siberiacancode-react/
|
|
65
|
-
'siberiacancode-react/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
'style/
|
|
81
|
-
'style/
|
|
82
|
-
'style/
|
|
83
|
-
'style/
|
|
84
|
-
'style/
|
|
85
|
-
'style/
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
'style/max-len': [
|
|
89
|
-
'error',
|
|
90
|
-
100,
|
|
91
|
-
2,
|
|
92
|
-
{ ignoreComments: true, ignoreStrings: true, ignoreTemplateLiterals: true }
|
|
93
|
-
],
|
|
94
|
-
'style/
|
|
95
|
-
'style/
|
|
96
|
-
'style/
|
|
97
|
-
'style/
|
|
98
|
-
'style/
|
|
99
|
-
'style/
|
|
100
|
-
'style/
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
'antfu/
|
|
112
|
-
'antfu/
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
'
|
|
133
|
-
'error',
|
|
134
|
-
{
|
|
135
|
-
groups: [
|
|
136
|
-
|
|
137
|
-
['
|
|
138
|
-
|
|
139
|
-
['
|
|
140
|
-
['
|
|
141
|
-
['
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
1
|
+
import antfu from '@antfu/eslint-config';
|
|
2
|
+
import pluginNext from '@next/eslint-plugin-next';
|
|
3
|
+
import pluginJsxA11y from 'eslint-plugin-jsx-a11y';
|
|
4
|
+
import pluginReact from 'eslint-plugin-react';
|
|
5
|
+
|
|
6
|
+
/** @type {import('@siberiacancode/eslint').Eslint} */
|
|
7
|
+
export const eslint = ({ jsxA11y = false, next = false, ...options }, ...configs) => {
|
|
8
|
+
const stylistic = options?.stylistic ?? false;
|
|
9
|
+
|
|
10
|
+
if (next) {
|
|
11
|
+
configs.unshift({
|
|
12
|
+
name: 'siberiacancode/next',
|
|
13
|
+
plugins: {
|
|
14
|
+
'siberiacancode-next': pluginNext
|
|
15
|
+
},
|
|
16
|
+
rules: {
|
|
17
|
+
...Object.entries({ ...pluginNext.configs.recommended.rules }).reduce(
|
|
18
|
+
(acc, [key, value]) => {
|
|
19
|
+
acc[key.replace('@next/next', 'siberiacancode-next')] = value;
|
|
20
|
+
return acc;
|
|
21
|
+
},
|
|
22
|
+
{}
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (jsxA11y) {
|
|
29
|
+
configs.unshift({
|
|
30
|
+
name: 'siberiacancode/jsx-a11y',
|
|
31
|
+
plugins: {
|
|
32
|
+
'siberiacancode-jsx-a11y': pluginJsxA11y
|
|
33
|
+
},
|
|
34
|
+
rules: {
|
|
35
|
+
...Object.entries(pluginJsxA11y.flatConfigs.recommended.rules).reduce(
|
|
36
|
+
(acc, [key, value]) => {
|
|
37
|
+
acc[key.replace('jsx-a11y', 'siberiacancode-jsx-a11y')] = value;
|
|
38
|
+
return acc;
|
|
39
|
+
},
|
|
40
|
+
{}
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (options.react) {
|
|
47
|
+
configs.unshift({
|
|
48
|
+
name: 'siberiacancode/react',
|
|
49
|
+
plugins: {
|
|
50
|
+
'siberiacancode-react': pluginReact
|
|
51
|
+
},
|
|
52
|
+
rules: {
|
|
53
|
+
...Object.entries(pluginReact.configs.recommended.rules).reduce((acc, [key, value]) => {
|
|
54
|
+
acc[key.replace('react', 'siberiacancode-react')] = value;
|
|
55
|
+
return acc;
|
|
56
|
+
}, {}),
|
|
57
|
+
'siberiacancode-react/function-component-definition': [
|
|
58
|
+
'error',
|
|
59
|
+
{
|
|
60
|
+
namedComponents: ['arrow-function'],
|
|
61
|
+
unnamedComponents: 'arrow-function'
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
'siberiacancode-react/prop-types': 'off',
|
|
65
|
+
'siberiacancode-react/react-in-jsx-scope': 'off'
|
|
66
|
+
},
|
|
67
|
+
settings: {
|
|
68
|
+
react: {
|
|
69
|
+
version: 'detect'
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (stylistic) {
|
|
76
|
+
configs.unshift({
|
|
77
|
+
name: 'siberiacancode/formatter',
|
|
78
|
+
rules: {
|
|
79
|
+
'style/arrow-parens': ['error', 'always'],
|
|
80
|
+
'style/brace-style': 'off',
|
|
81
|
+
'style/comma-dangle': ['error', 'never'],
|
|
82
|
+
'style/indent': ['error', 2, { SwitchCase: 1 }],
|
|
83
|
+
'style/jsx-curly-newline': 'off',
|
|
84
|
+
'style/jsx-one-expression-per-line': 'off',
|
|
85
|
+
'style/jsx-quotes': ['error', 'prefer-single'],
|
|
86
|
+
|
|
87
|
+
'style/linebreak-style': ['error', 'unix'],
|
|
88
|
+
'style/max-len': [
|
|
89
|
+
'error',
|
|
90
|
+
100,
|
|
91
|
+
2,
|
|
92
|
+
{ ignoreComments: true, ignoreStrings: true, ignoreTemplateLiterals: true }
|
|
93
|
+
],
|
|
94
|
+
'style/member-delimiter-style': 'off',
|
|
95
|
+
'style/multiline-ternary': 'off',
|
|
96
|
+
'style/no-tabs': 'error',
|
|
97
|
+
'style/operator-linebreak': 'off',
|
|
98
|
+
'style/quote-props': 'off',
|
|
99
|
+
'style/quotes': ['error', 'single', { allowTemplateLiterals: true }],
|
|
100
|
+
'style/semi': ['error', 'always']
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return antfu(
|
|
106
|
+
{ ...options, stylistic },
|
|
107
|
+
{
|
|
108
|
+
name: 'siberiacancode/rewrite',
|
|
109
|
+
rules: {
|
|
110
|
+
'antfu/curly': 'off',
|
|
111
|
+
'antfu/if-newline': 'off',
|
|
112
|
+
'antfu/top-level-function': 'off',
|
|
113
|
+
|
|
114
|
+
'no-console': 'warn',
|
|
115
|
+
|
|
116
|
+
'react-hooks/exhaustive-deps': 'off',
|
|
117
|
+
|
|
118
|
+
'test/prefer-lowercase-title': 'off'
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: 'siberiacancode/sort',
|
|
123
|
+
rules: {
|
|
124
|
+
'perfectionist/sort-array-includes': [
|
|
125
|
+
'error',
|
|
126
|
+
{
|
|
127
|
+
matcher: 'minimatch',
|
|
128
|
+
order: 'asc',
|
|
129
|
+
type: 'alphabetical'
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
'perfectionist/sort-imports': [
|
|
133
|
+
'error',
|
|
134
|
+
{
|
|
135
|
+
groups: [
|
|
136
|
+
'type',
|
|
137
|
+
['builtin', 'external'],
|
|
138
|
+
'internal-type',
|
|
139
|
+
['internal'],
|
|
140
|
+
['parent-type', 'sibling-type', 'index-type'],
|
|
141
|
+
['parent', 'sibling', 'index'],
|
|
142
|
+
'object',
|
|
143
|
+
'style',
|
|
144
|
+
'side-effect-style',
|
|
145
|
+
'unknown'
|
|
146
|
+
],
|
|
147
|
+
internalPattern: ['~/**', '@/**'],
|
|
148
|
+
matcher: 'minimatch',
|
|
149
|
+
newlinesBetween: 'ignore',
|
|
150
|
+
order: 'asc',
|
|
151
|
+
type: 'natural'
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
'perfectionist/sort-interfaces': [
|
|
155
|
+
'error',
|
|
156
|
+
{
|
|
157
|
+
groups: ['unknown', 'method', 'multiline'],
|
|
158
|
+
matcher: 'minimatch',
|
|
159
|
+
order: 'asc',
|
|
160
|
+
type: 'alphabetical'
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
'perfectionist/sort-jsx-props': [
|
|
164
|
+
'error',
|
|
165
|
+
{
|
|
166
|
+
customGroups: {
|
|
167
|
+
callback: 'on*',
|
|
168
|
+
reserved: ['key', 'ref']
|
|
169
|
+
},
|
|
170
|
+
groups: ['shorthand', 'reserved', 'multiline', 'unknown', 'callback'],
|
|
171
|
+
matcher: 'minimatch',
|
|
172
|
+
order: 'asc',
|
|
173
|
+
type: 'alphabetical'
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
'perfectionist/sort-object-types': [
|
|
177
|
+
'error',
|
|
178
|
+
{
|
|
179
|
+
matcher: 'minimatch',
|
|
180
|
+
order: 'asc',
|
|
181
|
+
specialCharacters: 'keep',
|
|
182
|
+
type: 'alphabetical'
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
'perfectionist/sort-objects': [
|
|
186
|
+
'error',
|
|
187
|
+
{
|
|
188
|
+
matcher: 'minimatch',
|
|
189
|
+
order: 'asc',
|
|
190
|
+
specialCharacters: 'keep',
|
|
191
|
+
type: 'alphabetical'
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
'perfectionist/sort-union-types': [
|
|
195
|
+
'error',
|
|
196
|
+
{
|
|
197
|
+
groups: [
|
|
198
|
+
'conditional',
|
|
199
|
+
'function',
|
|
200
|
+
'import',
|
|
201
|
+
'intersection',
|
|
202
|
+
'keyword',
|
|
203
|
+
'literal',
|
|
204
|
+
'named',
|
|
205
|
+
'object',
|
|
206
|
+
'operator',
|
|
207
|
+
'tuple',
|
|
208
|
+
'union',
|
|
209
|
+
'nullish'
|
|
210
|
+
],
|
|
211
|
+
matcher: 'minimatch',
|
|
212
|
+
order: 'asc',
|
|
213
|
+
specialCharacters: 'keep',
|
|
214
|
+
type: 'alphabetical'
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
...configs
|
|
220
|
+
);
|
|
221
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siberiacancode/eslint",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.5.0",
|
|
5
5
|
"description": "eslint configs",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "SIBERIA CAN CODE 🧊",
|
|
@@ -35,19 +35,18 @@
|
|
|
35
35
|
"lint-inspector": "npx @eslint/config-inspector"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"eslint": "^9.
|
|
38
|
+
"eslint": "^9.15.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@antfu/eslint-config": "^3.
|
|
42
|
-
"@eslint-react/eslint-plugin": "^1.
|
|
43
|
-
"@next/eslint-plugin-next": "^15.0.
|
|
44
|
-
"@vue/compiler-sfc": "^3.5.
|
|
45
|
-
"eslint": "^9.
|
|
41
|
+
"@antfu/eslint-config": "^3.9.1",
|
|
42
|
+
"@eslint-react/eslint-plugin": "^1.16.1",
|
|
43
|
+
"@next/eslint-plugin-next": "^15.0.3",
|
|
44
|
+
"@vue/compiler-sfc": "^3.5.13",
|
|
45
|
+
"eslint": "^9.15.0",
|
|
46
46
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
47
47
|
"eslint-plugin-react": "^7.37.2",
|
|
48
48
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
49
|
-
"eslint-plugin-react-refresh": "^0.4.14"
|
|
50
|
-
"eslint-plugin-simple-import-sort": "^12.1.1"
|
|
49
|
+
"eslint-plugin-react-refresh": "^0.4.14"
|
|
51
50
|
},
|
|
52
51
|
"devDependencies": {
|
|
53
52
|
"@siberiacancode/prettier": "*"
|