@siberiacancode/eslint 2.0.3 → 2.0.4

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 +34 -41
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4,11 +4,38 @@ import pluginReact from 'eslint-plugin-react';
4
4
  import simpleImportSort from 'eslint-plugin-simple-import-sort';
5
5
 
6
6
  /** @type {import('@siberiacancode/eslint').Eslint} */
7
- export const eslint = (...args) =>
8
- antfu(
9
- {
10
- typescript: true
11
- },
7
+ export const eslint = (options = {}, ...configs) => {
8
+ if (options['jsx-a11y']) {
9
+ configs.push({
10
+ ...pluginJsxA11y.flatConfigs.recommended,
11
+ name: 'siberiacancode/jsx-a11y'
12
+ });
13
+ }
14
+
15
+ if (options.react) {
16
+ configs.push({
17
+ name: 'siberiacancode/react',
18
+ plugins: {
19
+ 'plugin-react': pluginReact
20
+ },
21
+ settings: {
22
+ react: {
23
+ version: 'detect'
24
+ }
25
+ },
26
+ rules: {
27
+ 'plugin-react/function-component-definition': [
28
+ 'error',
29
+ {
30
+ namedComponents: ['arrow-function'],
31
+ unnamedComponents: 'arrow-function'
32
+ }
33
+ ]
34
+ }
35
+ });
36
+ }
37
+
38
+ return antfu(
12
39
  {
13
40
  name: 'siberiacancode/rewrite',
14
41
  rules: {
@@ -75,40 +102,6 @@ export const eslint = (...args) =>
75
102
  'style/arrow-parens': ['error', 'always']
76
103
  }
77
104
  },
78
- ...args.reduce((acc, config) => {
79
- if (config['jsx-a11y']) {
80
- acc.push({
81
- ...pluginJsxA11y.flatConfigs.recommended,
82
- name: 'siberiacancode/jsx-a11y'
83
- });
84
- return acc;
85
- }
86
-
87
- if (config.react) {
88
- acc.push({
89
- name: 'siberiacancode/react',
90
- plugins: {
91
- 'plugin-react': pluginReact
92
- },
93
- settings: {
94
- react: {
95
- version: 'detect'
96
- }
97
- },
98
- rules: {
99
- 'plugin-react/function-component-definition': [
100
- 'error',
101
- {
102
- namedComponents: ['arrow-function'],
103
- unnamedComponents: 'arrow-function'
104
- }
105
- ]
106
- }
107
- });
108
- }
109
-
110
- acc.push(config);
111
-
112
- return acc;
113
- }, [])
105
+ ...configs
114
106
  );
107
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@siberiacancode/eslint",
3
3
  "type": "module",
4
- "version": "2.0.3",
4
+ "version": "2.0.4",
5
5
  "description": "eslint configs",
6
6
  "author": {
7
7
  "name": "SIBERIA CAN CODE 🧊",