@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.
Files changed (4) hide show
  1. package/README.md +3 -3
  2. package/index.d.ts +19 -18
  3. package/index.js +150 -130
  4. 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
- 'jsx-a11y'?: boolean;
5
- } & import('@antfu/eslint-config').TypedFlatConfigItem,
6
- ...userConfigs: import('@antfu/eslint-config').Awaitable<
7
- | import('@antfu/eslint-config').TypedFlatConfigItem
8
- | import('@antfu/eslint-config').TypedFlatConfigItem[]
9
- | import('@antfu/eslint-config').FlatConfigComposer<any, any>
10
- | Linter.Config[]
11
- >[]
12
- ) => import('@antfu/eslint-config').FlatConfigComposer<
13
- import('@antfu/eslint-config').TypedFlatConfigItem,
14
- import('@antfu/eslint-config').ConfigNames
15
- >;
16
-
17
- export const eslint: Eslint;
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 pluginJsxA11y from 'eslint-plugin-jsx-a11y';
3
- import pluginReact from 'eslint-plugin-react';
4
- import pluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
5
-
6
- /** @type {import('@siberiacancode/eslint').Eslint} */
7
- export const eslint = (options, ...configs) => {
8
- const stylistic = options.stylistic ?? false;
9
-
10
- if (options['jsx-a11y']) {
11
- configs.unshift({
12
- plugins: {
13
- 'siberiacancode-jsx-a11y': pluginJsxA11y
14
- },
15
- name: 'siberiacancode/jsx-a11y',
16
- rules: {
17
- ...Object.entries(pluginJsxA11y.flatConfigs.recommended.rules).reduce(
18
- (acc, [key, value]) => {
19
- acc[key.replace('jsx-a11y', 'siberiacancode-jsx-a11y')] = value;
20
- return acc;
21
- },
22
- {}
23
- )
24
- }
25
- });
26
- }
27
-
28
- if (options.react) {
29
- configs.unshift({
30
- name: 'siberiacancode/react',
31
- plugins: {
32
- 'siberiacancode-react': pluginReact
33
- },
34
- settings: {
35
- react: {
36
- version: 'detect'
37
- }
38
- },
39
- rules: {
40
- ...Object.entries(pluginReact.configs.recommended.rules).reduce((acc, [key, value]) => {
41
- acc[key.replace('react', 'siberiacancode-react')] = value;
42
- return acc;
43
- }, {}),
44
- 'siberiacancode-react/react-in-jsx-scope': 'off',
45
- 'siberiacancode-react/function-component-definition': [
46
- 'error',
47
- {
48
- namedComponents: ['arrow-function'],
49
- unnamedComponents: 'arrow-function'
50
- }
51
- ]
52
- }
53
- });
54
- }
55
-
56
- if (stylistic) {
57
- configs.unshift({
58
- name: 'siberiacancode/formatter',
59
- rules: {
60
- 'style/multiline-ternary': 'off',
61
- 'style/jsx-curly-newline': 'off',
62
- 'style/jsx-one-expression-per-line': 'off',
63
- 'style/member-delimiter-style': 'off',
64
- 'style/quote-props': 'off',
65
- 'style/operator-linebreak': 'off',
66
- 'style/brace-style': 'off',
67
-
68
- 'style/max-len': [
69
- 'error',
70
- 100,
71
- 2,
72
- { ignoreComments: true, ignoreStrings: true, ignoreTemplateLiterals: true }
73
- ],
74
- 'style/quotes': ['error', 'single', { allowTemplateLiterals: true }],
75
- 'style/jsx-quotes': ['error', 'prefer-single'],
76
- 'style/comma-dangle': ['error', 'never'],
77
- 'style/semi': ['error', 'always'],
78
- 'style/indent': ['error', 2, { SwitchCase: 1 }],
79
- 'style/no-tabs': 'error',
80
- 'style/linebreak-style': ['error', 'unix'],
81
- 'style/arrow-parens': ['error', 'always']
82
- }
83
- });
84
- }
85
-
86
- return antfu(
87
- { ...options, stylistic },
88
- {
89
- name: 'siberiacancode/rewrite',
90
- rules: {
91
- 'antfu/top-level-function': 'off',
92
- 'antfu/if-newline': 'off',
93
- 'antfu/curly': 'off',
94
-
95
- 'react-hooks/exhaustive-deps': 'off',
96
-
97
- 'test/prefer-lowercase-title': 'off',
98
-
99
- 'no-console': 'warn'
100
- }
101
- },
102
- {
103
- name: 'siberiacancode/imports',
104
- plugins: {
105
- 'plugin-simple-import-sort': pluginSimpleImportSort
106
- },
107
- rules: {
108
- 'sort-imports': 'off',
109
- 'import/order': 'off',
110
- 'import/extensions': 'off',
111
- 'plugin-simple-import-sort/exports': 'error',
112
- 'plugin-simple-import-sort/imports': [
113
- 'error',
114
- {
115
- groups: [
116
- ['^react', '^@?\\w'],
117
- ['^@(siberiacancode-core/.*|$)'],
118
- ['^@(([\\/.]?\\w)|assets|test-utils)'],
119
- ['^\\u0000'],
120
- ['^\\.\\.(?!/?$)', '^\\.\\./?$'],
121
- ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
122
- ['^.+\\.s?css$']
123
- ]
124
- }
125
- ]
126
- }
127
- },
128
- ...configs
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.1.0",
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.9.0"
38
+ "eslint": "^9.14.0"
39
39
  },
40
40
  "dependencies": {
41
- "@antfu/eslint-config": "^2.25.1",
42
- "@eslint-react/eslint-plugin": "^1.10.0",
43
- "eslint": "^9.9.0",
44
- "eslint-plugin-jsx-a11y": "^6.9.0",
45
- "eslint-plugin-react": "^7.35.0",
46
- "eslint-plugin-react-hooks": "^4.6.2",
47
- "eslint-plugin-react-refresh": "^0.4.9",
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": {