@siberiacancode/eslint 2.0.7 → 2.2.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 CHANGED
@@ -1,3 +1,3 @@
1
- # 🔮 eslint configs
2
-
3
- Пакет содержит eslint конфиг
1
+ # 🔮 eslint configs
2
+
3
+ Пакет содержит eslint конфиг
package/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  declare module '@siberiacancode/eslint' {
2
2
  declare type Eslint = (
3
3
  options?: import('@antfu/eslint-config').OptionsConfig & {
4
- 'jsx-a11y'?: boolean
4
+ jsxA11y?: boolean;
5
+ next?: boolean;
5
6
  } & import('@antfu/eslint-config').TypedFlatConfigItem,
6
7
  ...userConfigs: import('@antfu/eslint-config').Awaitable<
7
8
  | import('@antfu/eslint-config').TypedFlatConfigItem
@@ -12,7 +13,7 @@ declare module '@siberiacancode/eslint' {
12
13
  ) => import('@antfu/eslint-config').FlatConfigComposer<
13
14
  import('@antfu/eslint-config').TypedFlatConfigItem,
14
15
  import('@antfu/eslint-config').ConfigNames
15
- >
16
+ >;
16
17
 
17
- export const eslint: Eslint
18
+ export const eslint: Eslint;
18
19
  }
package/index.js CHANGED
@@ -1,57 +1,78 @@
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'
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';
5
6
 
6
7
  /** @type {import('@siberiacancode/eslint').Eslint} */
7
- export const eslint = (options = { stylistics: false }, ...configs) => {
8
- if (options['jsx-a11y']) {
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) {
9
30
  configs.unshift({
10
31
  plugins: {
11
- 'siberiacancode-jsx-a11y': pluginJsxA11y,
32
+ 'siberiacancode-jsx-a11y': pluginJsxA11y
12
33
  },
13
34
  name: 'siberiacancode/jsx-a11y',
14
35
  rules: {
15
36
  ...Object.entries(pluginJsxA11y.flatConfigs.recommended.rules).reduce(
16
37
  (acc, [key, value]) => {
17
- acc[key.replace('jsx-a11y', 'siberiacancode-jsx-a11y')] = value
18
- return acc
38
+ acc[key.replace('jsx-a11y', 'siberiacancode-jsx-a11y')] = value;
39
+ return acc;
19
40
  },
20
- {},
21
- ),
22
- },
23
- })
41
+ {}
42
+ )
43
+ }
44
+ });
24
45
  }
25
46
 
26
47
  if (options.react) {
27
48
  configs.unshift({
28
49
  name: 'siberiacancode/react',
29
50
  plugins: {
30
- 'siberiacancode-react': pluginReact,
51
+ 'siberiacancode-react': pluginReact
31
52
  },
32
53
  settings: {
33
54
  react: {
34
- version: 'detect',
35
- },
55
+ version: 'detect'
56
+ }
36
57
  },
37
58
  rules: {
38
59
  ...Object.entries(pluginReact.configs.recommended.rules).reduce((acc, [key, value]) => {
39
- acc[key.replace('react', 'siberiacancode-react')] = value
40
- return acc
60
+ acc[key.replace('react', 'siberiacancode-react')] = value;
61
+ return acc;
41
62
  }, {}),
42
63
  'siberiacancode-react/react-in-jsx-scope': 'off',
43
64
  'siberiacancode-react/function-component-definition': [
44
65
  'error',
45
66
  {
46
67
  namedComponents: ['arrow-function'],
47
- unnamedComponents: 'arrow-function',
48
- },
49
- ],
50
- },
51
- })
68
+ unnamedComponents: 'arrow-function'
69
+ }
70
+ ]
71
+ }
72
+ });
52
73
  }
53
74
 
54
- if (options.stylistics) {
75
+ if (stylistic) {
55
76
  configs.unshift({
56
77
  name: 'siberiacancode/formatter',
57
78
  rules: {
@@ -67,7 +88,7 @@ export const eslint = (options = { stylistics: false }, ...configs) => {
67
88
  'error',
68
89
  100,
69
90
  2,
70
- { ignoreComments: true, ignoreStrings: true, ignoreTemplateLiterals: true },
91
+ { ignoreComments: true, ignoreStrings: true, ignoreTemplateLiterals: true }
71
92
  ],
72
93
  'style/quotes': ['error', 'single', { allowTemplateLiterals: true }],
73
94
  'style/jsx-quotes': ['error', 'prefer-single'],
@@ -76,13 +97,13 @@ export const eslint = (options = { stylistics: false }, ...configs) => {
76
97
  'style/indent': ['error', 2, { SwitchCase: 1 }],
77
98
  'style/no-tabs': 'error',
78
99
  'style/linebreak-style': ['error', 'unix'],
79
- 'style/arrow-parens': ['error', 'always'],
80
- },
81
- })
100
+ 'style/arrow-parens': ['error', 'always']
101
+ }
102
+ });
82
103
  }
83
104
 
84
105
  return antfu(
85
- options,
106
+ { ...options, stylistic },
86
107
  {
87
108
  name: 'siberiacancode/rewrite',
88
109
  rules: {
@@ -94,13 +115,13 @@ export const eslint = (options = { stylistics: false }, ...configs) => {
94
115
 
95
116
  'test/prefer-lowercase-title': 'off',
96
117
 
97
- 'no-console': 'warn',
98
- },
118
+ 'no-console': 'warn'
119
+ }
99
120
  },
100
121
  {
101
122
  name: 'siberiacancode/imports',
102
123
  plugins: {
103
- 'plugin-simple-import-sort': pluginSimpleImportSort,
124
+ 'plugin-simple-import-sort': pluginSimpleImportSort
104
125
  },
105
126
  rules: {
106
127
  'sort-imports': 'off',
@@ -117,12 +138,12 @@ export const eslint = (options = { stylistics: false }, ...configs) => {
117
138
  ['^\\u0000'],
118
139
  ['^\\.\\.(?!/?$)', '^\\.\\./?$'],
119
140
  ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
120
- ['^.+\\.s?css$'],
121
- ],
122
- },
123
- ],
124
- },
141
+ ['^.+\\.s?css$']
142
+ ]
143
+ }
144
+ ]
145
+ }
125
146
  },
126
- ...configs,
127
- )
128
- }
147
+ ...configs
148
+ );
149
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@siberiacancode/eslint",
3
3
  "type": "module",
4
- "version": "2.0.7",
4
+ "version": "2.2.0",
5
5
  "description": "eslint configs",
6
6
  "author": {
7
7
  "name": "SIBERIA CAN CODE 🧊",
@@ -40,6 +40,8 @@
40
40
  "dependencies": {
41
41
  "@antfu/eslint-config": "^2.25.1",
42
42
  "@eslint-react/eslint-plugin": "^1.10.0",
43
+ "@next/eslint-plugin-next": "^14.2.5",
44
+ "@vue/compiler-sfc": "^3.4.38",
43
45
  "eslint": "^9.9.0",
44
46
  "eslint-plugin-jsx-a11y": "^6.9.0",
45
47
  "eslint-plugin-react": "^7.35.0",