@siberiacancode/eslint 2.0.3 → 2.0.5

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 +55 -45
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,14 +1,56 @@
1
1
  import antfu from '@antfu/eslint-config';
2
2
  import pluginJsxA11y from 'eslint-plugin-jsx-a11y';
3
3
  import pluginReact from 'eslint-plugin-react';
4
- import simpleImportSort from 'eslint-plugin-simple-import-sort';
4
+ import pluginSimpleImportSort 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
+ plugins: {
11
+ 'siberiacancode-jsx-a11y': pluginJsxA11y
12
+ },
13
+ name: 'siberiacancode/jsx-a11y',
14
+ rules: {
15
+ ...Object.entries(pluginJsxA11y.flatConfigs.recommended.rules).reduce(
16
+ (acc, [key, value]) => {
17
+ acc[key.replace('jsx-a11y', 'siberiacancode-jsx-a11y')] = value;
18
+ return acc;
19
+ },
20
+ {}
21
+ )
22
+ }
23
+ });
24
+ }
25
+
26
+ if (options.react) {
27
+ configs.push({
28
+ name: 'siberiacancode/react',
29
+ plugins: {
30
+ 'siberiacancode-react': pluginReact
31
+ },
32
+ settings: {
33
+ react: {
34
+ version: 'detect'
35
+ }
36
+ },
37
+ rules: {
38
+ ...Object.entries(pluginReact.configs.recommended.rules).reduce((acc, [key, value]) => {
39
+ acc[key.replace('react', 'siberiacancode-react')] = value;
40
+ return acc;
41
+ }, {}),
42
+ 'siberiacancode-react/function-component-definition': [
43
+ 'error',
44
+ {
45
+ namedComponents: ['arrow-function'],
46
+ unnamedComponents: 'arrow-function'
47
+ }
48
+ ]
49
+ }
50
+ });
51
+ }
52
+
53
+ return antfu(
12
54
  {
13
55
  name: 'siberiacancode/rewrite',
14
56
  rules: {
@@ -27,14 +69,14 @@ export const eslint = (...args) =>
27
69
  {
28
70
  name: 'siberiacancode/imports',
29
71
  plugins: {
30
- 'simple-import-sort': simpleImportSort
72
+ 'plugin-simple-import-sort': pluginSimpleImportSort
31
73
  },
32
74
  rules: {
33
75
  'sort-imports': 'off',
34
76
  'import/order': 'off',
35
77
  'import/extensions': 'off',
36
- 'simple-import-sort/exports': 'error',
37
- 'simple-import-sort/imports': [
78
+ 'plugin-simple-import-sort/exports': 'error',
79
+ 'plugin-simple-import-sort/imports': [
38
80
  'error',
39
81
  {
40
82
  groups: [
@@ -53,6 +95,8 @@ export const eslint = (...args) =>
53
95
  {
54
96
  name: 'siberiacancode/formatter',
55
97
  rules: {
98
+ 'style/multiline-ternary': 'off',
99
+ 'style/jsx-curly-newline': 'off',
56
100
  'style/jsx-one-expression-per-line': 'off',
57
101
  'style/member-delimiter-style': 'off',
58
102
  'style/quote-props': 'off',
@@ -75,40 +119,6 @@ export const eslint = (...args) =>
75
119
  'style/arrow-parens': ['error', 'always']
76
120
  }
77
121
  },
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
- }, [])
122
+ ...configs
114
123
  );
124
+ };
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.5",
5
5
  "description": "eslint configs",
6
6
  "author": {
7
7
  "name": "SIBERIA CAN CODE 🧊",