@siberiacancode/eslint 2.3.0 → 2.4.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 +145 -150
  2. package/package.json +8 -9
package/index.js CHANGED
@@ -1,150 +1,145 @@
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
- };
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
+ plugins: {
13
+ 'siberiacancode-next': pluginNext
14
+ },
15
+ name: 'siberiacancode/next',
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
+ plugins: {
31
+ 'siberiacancode-jsx-a11y': pluginJsxA11y
32
+ },
33
+ name: 'siberiacancode/jsx-a11y',
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
+ settings: {
53
+ react: {
54
+ version: 'detect'
55
+ }
56
+ },
57
+ rules: {
58
+ ...Object.entries(pluginReact.configs.recommended.rules).reduce((acc, [key, value]) => {
59
+ acc[key.replace('react', 'siberiacancode-react')] = value;
60
+ return acc;
61
+ }, {}),
62
+ 'siberiacancode-react/prop-types': 'off',
63
+ 'siberiacancode-react/react-in-jsx-scope': 'off',
64
+ 'siberiacancode-react/function-component-definition': [
65
+ 'error',
66
+ {
67
+ namedComponents: ['arrow-function'],
68
+ unnamedComponents: 'arrow-function'
69
+ }
70
+ ]
71
+ }
72
+ });
73
+ }
74
+
75
+ if (stylistic) {
76
+ configs.unshift({
77
+ name: 'siberiacancode/formatter',
78
+ rules: {
79
+ 'style/multiline-ternary': 'off',
80
+ 'style/jsx-curly-newline': 'off',
81
+ 'style/jsx-one-expression-per-line': 'off',
82
+ 'style/member-delimiter-style': 'off',
83
+ 'style/quote-props': 'off',
84
+ 'style/operator-linebreak': 'off',
85
+ 'style/brace-style': 'off',
86
+
87
+ 'style/max-len': [
88
+ 'error',
89
+ 100,
90
+ 2,
91
+ { ignoreComments: true, ignoreStrings: true, ignoreTemplateLiterals: true }
92
+ ],
93
+ 'style/quotes': ['error', 'single', { allowTemplateLiterals: true }],
94
+ 'style/jsx-quotes': ['error', 'prefer-single'],
95
+ 'style/comma-dangle': ['error', 'never'],
96
+ 'style/semi': ['error', 'always'],
97
+ 'style/indent': ['error', 2, { SwitchCase: 1 }],
98
+ 'style/no-tabs': 'error',
99
+ 'style/linebreak-style': ['error', 'unix'],
100
+ 'style/arrow-parens': ['error', 'always']
101
+ }
102
+ });
103
+ }
104
+
105
+ return antfu(
106
+ { ...options, stylistic },
107
+ {
108
+ name: 'siberiacancode/rewrite',
109
+ rules: {
110
+ 'antfu/top-level-function': 'off',
111
+ 'antfu/if-newline': 'off',
112
+ 'antfu/curly': 'off',
113
+
114
+ 'react-hooks/exhaustive-deps': 'off',
115
+
116
+ 'test/prefer-lowercase-title': 'off',
117
+
118
+ 'no-console': 'warn',
119
+
120
+ 'perfectionist/sort-imports': [
121
+ 'error',
122
+ {
123
+ groups: [
124
+ 'type',
125
+ ['builtin', 'external'],
126
+ 'internal-type',
127
+ ['internal'],
128
+ ['parent-type', 'sibling-type', 'index-type'],
129
+ ['parent', 'sibling', 'index'],
130
+ 'object',
131
+ 'style',
132
+ 'side-effect-style',
133
+ 'unknown'
134
+ ],
135
+ internalPattern: ['~/**', '@/**'],
136
+ newlinesBetween: 'ignore',
137
+ order: 'asc',
138
+ type: 'natural'
139
+ }
140
+ ]
141
+ }
142
+ },
143
+ ...configs
144
+ );
145
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@siberiacancode/eslint",
3
3
  "type": "module",
4
- "version": "2.3.0",
4
+ "version": "2.4.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.14.0"
38
+ "eslint": "^9.15.0"
39
39
  },
40
40
  "dependencies": {
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",
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": "*"