@siberiacancode/eslint 2.0.6 → 2.0.7

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