@siberiacancode/eslint 2.1.0 → 2.3.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/README.md +3 -3
- package/index.d.ts +19 -18
- package/index.js +150 -130
- package/package.json +11 -9
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# 🔮 eslint configs
|
|
2
|
-
|
|
3
|
-
Пакет содержит eslint конфиг
|
|
1
|
+
# 🔮 eslint configs
|
|
2
|
+
|
|
3
|
+
Пакет содержит eslint конфиг
|
package/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
declare module '@siberiacancode/eslint' {
|
|
2
|
-
declare type Eslint = (
|
|
3
|
-
options?: import('@antfu/eslint-config').OptionsConfig & {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
| import('@antfu/eslint-config').TypedFlatConfigItem
|
|
9
|
-
| import('@antfu/eslint-config').
|
|
10
|
-
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import('@antfu/eslint-config').
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
declare module '@siberiacancode/eslint' {
|
|
2
|
+
declare type Eslint = (
|
|
3
|
+
options?: import('@antfu/eslint-config').OptionsConfig & {
|
|
4
|
+
jsxA11y?: boolean;
|
|
5
|
+
next?: boolean;
|
|
6
|
+
} & import('@antfu/eslint-config').TypedFlatConfigItem,
|
|
7
|
+
...userConfigs: import('@antfu/eslint-config').Awaitable<
|
|
8
|
+
| import('@antfu/eslint-config').TypedFlatConfigItem
|
|
9
|
+
| import('@antfu/eslint-config').TypedFlatConfigItem[]
|
|
10
|
+
| import('@antfu/eslint-config').FlatConfigComposer<any, any>
|
|
11
|
+
| Linter.Config[]
|
|
12
|
+
>[]
|
|
13
|
+
) => import('@antfu/eslint-config').FlatConfigComposer<
|
|
14
|
+
import('@antfu/eslint-config').TypedFlatConfigItem,
|
|
15
|
+
import('@antfu/eslint-config').ConfigNames
|
|
16
|
+
>;
|
|
17
|
+
|
|
18
|
+
export const eslint: Eslint;
|
|
19
|
+
}
|
package/index.js
CHANGED
|
@@ -1,130 +1,150 @@
|
|
|
1
|
-
import antfu from '@antfu/eslint-config';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
plugins: {
|
|
32
|
-
'siberiacancode-
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
'
|
|
65
|
-
'
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
'style/
|
|
81
|
-
'style/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
'
|
|
96
|
-
|
|
97
|
-
'
|
|
98
|
-
|
|
99
|
-
'no-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
'
|
|
112
|
-
'
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
+
import pluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
|
|
6
|
+
|
|
7
|
+
/** @type {import('@siberiacancode/eslint').Eslint} */
|
|
8
|
+
export const eslint = ({ jsxA11y = false, next = false, ...options }, ...configs) => {
|
|
9
|
+
const stylistic = options?.stylistic ?? false;
|
|
10
|
+
|
|
11
|
+
if (next) {
|
|
12
|
+
configs.unshift({
|
|
13
|
+
plugins: {
|
|
14
|
+
'siberiacancode-next': pluginNext
|
|
15
|
+
},
|
|
16
|
+
name: 'siberiacancode/next',
|
|
17
|
+
rules: {
|
|
18
|
+
...Object.entries({ ...pluginNext.configs.recommended.rules }).reduce(
|
|
19
|
+
(acc, [key, value]) => {
|
|
20
|
+
acc[key.replace('@next/next', 'siberiacancode-next')] = value;
|
|
21
|
+
return acc;
|
|
22
|
+
},
|
|
23
|
+
{}
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (jsxA11y) {
|
|
30
|
+
configs.unshift({
|
|
31
|
+
plugins: {
|
|
32
|
+
'siberiacancode-jsx-a11y': pluginJsxA11y
|
|
33
|
+
},
|
|
34
|
+
name: 'siberiacancode/jsx-a11y',
|
|
35
|
+
rules: {
|
|
36
|
+
...Object.entries(pluginJsxA11y.flatConfigs.recommended.rules).reduce(
|
|
37
|
+
(acc, [key, value]) => {
|
|
38
|
+
acc[key.replace('jsx-a11y', 'siberiacancode-jsx-a11y')] = value;
|
|
39
|
+
return acc;
|
|
40
|
+
},
|
|
41
|
+
{}
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (options.react) {
|
|
48
|
+
configs.unshift({
|
|
49
|
+
name: 'siberiacancode/react',
|
|
50
|
+
plugins: {
|
|
51
|
+
'siberiacancode-react': pluginReact
|
|
52
|
+
},
|
|
53
|
+
settings: {
|
|
54
|
+
react: {
|
|
55
|
+
version: 'detect'
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
rules: {
|
|
59
|
+
...Object.entries(pluginReact.configs.recommended.rules).reduce((acc, [key, value]) => {
|
|
60
|
+
acc[key.replace('react', 'siberiacancode-react')] = value;
|
|
61
|
+
return acc;
|
|
62
|
+
}, {}),
|
|
63
|
+
'siberiacancode-react/prop-types': 'off',
|
|
64
|
+
'siberiacancode-react/react-in-jsx-scope': 'off',
|
|
65
|
+
'siberiacancode-react/function-component-definition': [
|
|
66
|
+
'error',
|
|
67
|
+
{
|
|
68
|
+
namedComponents: ['arrow-function'],
|
|
69
|
+
unnamedComponents: 'arrow-function'
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (stylistic) {
|
|
77
|
+
configs.unshift({
|
|
78
|
+
name: 'siberiacancode/formatter',
|
|
79
|
+
rules: {
|
|
80
|
+
'style/multiline-ternary': 'off',
|
|
81
|
+
'style/jsx-curly-newline': 'off',
|
|
82
|
+
'style/jsx-one-expression-per-line': 'off',
|
|
83
|
+
'style/member-delimiter-style': 'off',
|
|
84
|
+
'style/quote-props': 'off',
|
|
85
|
+
'style/operator-linebreak': 'off',
|
|
86
|
+
'style/brace-style': 'off',
|
|
87
|
+
|
|
88
|
+
'style/max-len': [
|
|
89
|
+
'error',
|
|
90
|
+
100,
|
|
91
|
+
2,
|
|
92
|
+
{ ignoreComments: true, ignoreStrings: true, ignoreTemplateLiterals: true }
|
|
93
|
+
],
|
|
94
|
+
'style/quotes': ['error', 'single', { allowTemplateLiterals: true }],
|
|
95
|
+
'style/jsx-quotes': ['error', 'prefer-single'],
|
|
96
|
+
'style/comma-dangle': ['error', 'never'],
|
|
97
|
+
'style/semi': ['error', 'always'],
|
|
98
|
+
'style/indent': ['error', 2, { SwitchCase: 1 }],
|
|
99
|
+
'style/no-tabs': 'error',
|
|
100
|
+
'style/linebreak-style': ['error', 'unix'],
|
|
101
|
+
'style/arrow-parens': ['error', 'always']
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return antfu(
|
|
107
|
+
{ ...options, stylistic },
|
|
108
|
+
{
|
|
109
|
+
name: 'siberiacancode/rewrite',
|
|
110
|
+
rules: {
|
|
111
|
+
'antfu/top-level-function': 'off',
|
|
112
|
+
'antfu/if-newline': 'off',
|
|
113
|
+
'antfu/curly': 'off',
|
|
114
|
+
|
|
115
|
+
'react-hooks/exhaustive-deps': 'off',
|
|
116
|
+
|
|
117
|
+
'test/prefer-lowercase-title': 'off',
|
|
118
|
+
|
|
119
|
+
'no-console': 'warn'
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'siberiacancode/imports',
|
|
124
|
+
plugins: {
|
|
125
|
+
'plugin-simple-import-sort': pluginSimpleImportSort
|
|
126
|
+
},
|
|
127
|
+
rules: {
|
|
128
|
+
'sort-imports': 'off',
|
|
129
|
+
'import/order': 'off',
|
|
130
|
+
'import/extensions': 'off',
|
|
131
|
+
'plugin-simple-import-sort/exports': 'error',
|
|
132
|
+
'plugin-simple-import-sort/imports': [
|
|
133
|
+
'error',
|
|
134
|
+
{
|
|
135
|
+
groups: [
|
|
136
|
+
['^react', '^@?\\w'],
|
|
137
|
+
['^@(siberiacancode-core/.*|$)'],
|
|
138
|
+
['^@(([\\/.]?\\w)|assets|test-utils)'],
|
|
139
|
+
['^\\u0000'],
|
|
140
|
+
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
|
|
141
|
+
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
|
|
142
|
+
['^.+\\.s?css$']
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
...configs
|
|
149
|
+
);
|
|
150
|
+
};
|
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.3.0",
|
|
5
5
|
"description": "eslint configs",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "SIBERIA CAN CODE 🧊",
|
|
@@ -35,16 +35,18 @@
|
|
|
35
35
|
"lint-inspector": "npx @eslint/config-inspector"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"eslint": "^9.
|
|
38
|
+
"eslint": "^9.14.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@antfu/eslint-config": "^
|
|
42
|
-
"@eslint-react/eslint-plugin": "^1.
|
|
43
|
-
"eslint": "^
|
|
44
|
-
"
|
|
45
|
-
"eslint
|
|
46
|
-
"eslint-plugin-
|
|
47
|
-
"eslint-plugin-react
|
|
41
|
+
"@antfu/eslint-config": "^3.8.0",
|
|
42
|
+
"@eslint-react/eslint-plugin": "^1.15.2",
|
|
43
|
+
"@next/eslint-plugin-next": "^15.0.2",
|
|
44
|
+
"@vue/compiler-sfc": "^3.5.12",
|
|
45
|
+
"eslint": "^9.14.0",
|
|
46
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
47
|
+
"eslint-plugin-react": "^7.37.2",
|
|
48
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
49
|
+
"eslint-plugin-react-refresh": "^0.4.14",
|
|
48
50
|
"eslint-plugin-simple-import-sort": "^12.1.1"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|