@siberiacancode/eslint 2.5.2 → 2.7.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.
Files changed (2) hide show
  1. package/index.js +198 -203
  2. package/package.json +61 -64
package/index.js CHANGED
@@ -1,203 +1,198 @@
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: 'always',
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-union-types': [
177
- 'error',
178
- {
179
- groups: [
180
- 'conditional',
181
- 'function',
182
- 'import',
183
- 'intersection',
184
- 'keyword',
185
- 'literal',
186
- 'named',
187
- 'object',
188
- 'operator',
189
- 'tuple',
190
- 'union',
191
- 'nullish'
192
- ],
193
- matcher: 'minimatch',
194
- order: 'asc',
195
- specialCharacters: 'keep',
196
- type: 'alphabetical'
197
- }
198
- ]
199
- }
200
- },
201
- ...configs
202
- );
203
- };
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
+ order: 'asc',
128
+ type: 'alphabetical'
129
+ }
130
+ ],
131
+ 'perfectionist/sort-imports': [
132
+ 'error',
133
+ {
134
+ groups: [
135
+ 'type',
136
+ ['builtin', 'external'],
137
+ 'internal-type',
138
+ ['internal'],
139
+ ['parent-type', 'sibling-type', 'index-type'],
140
+ ['parent', 'sibling', 'index'],
141
+ 'object',
142
+ 'style',
143
+ 'side-effect-style',
144
+ 'unknown'
145
+ ],
146
+ internalPattern: ['^~/.*', '^@/.*'],
147
+ newlinesBetween: 'always',
148
+ order: 'asc',
149
+ type: 'natural'
150
+ }
151
+ ],
152
+ 'perfectionist/sort-interfaces': [
153
+ 'error',
154
+ {
155
+ groups: ['unknown', 'method', 'multiline'],
156
+ order: 'asc',
157
+ type: 'alphabetical'
158
+ }
159
+ ],
160
+ 'perfectionist/sort-jsx-props': [
161
+ 'error',
162
+ {
163
+ customGroups: {
164
+ callback: 'on*',
165
+ reserved: ['key', 'ref']
166
+ },
167
+ groups: ['shorthand', 'reserved', 'multiline', 'unknown', 'callback'],
168
+ order: 'asc',
169
+ type: 'alphabetical'
170
+ }
171
+ ],
172
+ 'perfectionist/sort-union-types': [
173
+ 'error',
174
+ {
175
+ groups: [
176
+ 'conditional',
177
+ 'function',
178
+ 'import',
179
+ 'intersection',
180
+ 'keyword',
181
+ 'literal',
182
+ 'named',
183
+ 'object',
184
+ 'operator',
185
+ 'tuple',
186
+ 'union',
187
+ 'nullish'
188
+ ],
189
+ order: 'asc',
190
+ specialCharacters: 'keep',
191
+ type: 'alphabetical'
192
+ }
193
+ ]
194
+ }
195
+ },
196
+ ...configs
197
+ );
198
+ };
package/package.json CHANGED
@@ -1,64 +1,61 @@
1
- {
2
- "name": "@siberiacancode/eslint",
3
- "type": "module",
4
- "version": "2.5.2",
5
- "description": "eslint configs",
6
- "author": {
7
- "name": "SIBERIA CAN CODE 🧊",
8
- "url": "https://github.com/siberiacancode"
9
- },
10
- "license": "MIT",
11
- "homepage": "https://github.com/siberiacancode/core",
12
- "repository": {
13
- "url": "https://github.com/siberiacancode/core"
14
- },
15
- "bugs": {
16
- "url": "https://github.com/siberiacancode/core/issues"
17
- },
18
- "keywords": [
19
- "eslint",
20
- "react",
21
- "node"
22
- ],
23
- "publishConfig": {
24
- "access": "public"
25
- },
26
- "main": "index.js",
27
- "types": "index.d.ts",
28
- "files": [
29
- "index.d.ts",
30
- "index.js"
31
- ],
32
- "scripts": {
33
- "format": "prettier --write \"*.js\"",
34
- "lint": "eslint . --fix",
35
- "lint-inspector": "npx @eslint/config-inspector"
36
- },
37
- "peerDependencies": {
38
- "eslint": "^9.15.0"
39
- },
40
- "dependencies": {
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
- "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"
50
- },
51
- "devDependencies": {
52
- "@siberiacancode/prettier": "*"
53
- },
54
- "lint-staged": {
55
- "*.js": [
56
- "prettier --write",
57
- "eslint --fix"
58
- ],
59
- "*.ts": [
60
- "prettier --write",
61
- "eslint --fix"
62
- ]
63
- }
64
- }
1
+ {
2
+ "name": "@siberiacancode/eslint",
3
+ "type": "module",
4
+ "version": "2.7.0",
5
+ "description": "eslint configs",
6
+ "author": {
7
+ "name": "SIBERIA CAN CODE 🧊",
8
+ "url": "https://github.com/siberiacancode"
9
+ },
10
+ "license": "MIT",
11
+ "homepage": "https://github.com/siberiacancode/core",
12
+ "repository": {
13
+ "url": "https://github.com/siberiacancode/core"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/siberiacancode/core/issues"
17
+ },
18
+ "keywords": [
19
+ "eslint",
20
+ "react",
21
+ "node"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "main": "index.js",
27
+ "types": "index.d.ts",
28
+ "files": [
29
+ "index.d.ts",
30
+ "index.js"
31
+ ],
32
+ "scripts": {
33
+ "format": "prettier --write \"*.js\"",
34
+ "lint": "eslint . --fix",
35
+ "lint-inspector": "npx @eslint/config-inspector"
36
+ },
37
+ "dependencies": {
38
+ "@antfu/eslint-config": "3.14.0",
39
+ "@eslint-react/eslint-plugin": "1.23.2",
40
+ "@next/eslint-plugin-next": "15.1.4",
41
+ "@vue/compiler-sfc": "3.5.13",
42
+ "eslint": "9.18.0",
43
+ "eslint-plugin-jsx-a11y": "6.10.2",
44
+ "eslint-plugin-react": "7.37.4",
45
+ "eslint-plugin-react-hooks": "5.1.0",
46
+ "eslint-plugin-react-refresh": "0.4.18"
47
+ },
48
+ "devDependencies": {
49
+ "@siberiacancode/prettier": "*"
50
+ },
51
+ "lint-staged": {
52
+ "*.js": [
53
+ "prettier --write",
54
+ "eslint --fix"
55
+ ],
56
+ "*.ts": [
57
+ "prettier --write",
58
+ "eslint --fix"
59
+ ]
60
+ }
61
+ }