@siberiacancode/eslint 2.0.1 → 2.0.2

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 (4) hide show
  1. package/README.md +3 -3
  2. package/index.d.ts +18 -18
  3. package/index.js +117 -98
  4. package/package.json +26 -18
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,18 +1,18 @@
1
- declare module '@siberiacancode/eslint' {
2
- declare type Eslint = (
3
- options?: import('@antfu/eslint-config').OptionsConfig & {
4
- 'jsx-a11y': boolean;
5
- } & import('@antfu/eslint-config').TypedFlatConfigItem,
6
- ...userConfigs: import('@antfu/eslint-config').Awaitable<
7
- | import('@antfu/eslint-config').TypedFlatConfigItem
8
- | import('@antfu/eslint-config').TypedFlatConfigItem[]
9
- | import('@antfu/eslint-config').FlatConfigComposer<any, any>
10
- | Linter.Config[]
11
- >[]
12
- ) => import('@antfu/eslint-config').FlatConfigComposer<
13
- import('@antfu/eslint-config').TypedFlatConfigItem,
14
- import('@antfu/eslint-config').ConfigNames
15
- >;
16
-
17
- export const eslint: Eslint;
18
- }
1
+ declare module '@siberiacancode/eslint' {
2
+ declare type Eslint = (
3
+ options?: import('@antfu/eslint-config').OptionsConfig & {
4
+ 'jsx-a11y': boolean;
5
+ } & import('@antfu/eslint-config').TypedFlatConfigItem,
6
+ ...userConfigs: import('@antfu/eslint-config').Awaitable<
7
+ | import('@antfu/eslint-config').TypedFlatConfigItem
8
+ | import('@antfu/eslint-config').TypedFlatConfigItem[]
9
+ | import('@antfu/eslint-config').FlatConfigComposer<any, any>
10
+ | Linter.Config[]
11
+ >[]
12
+ ) => import('@antfu/eslint-config').FlatConfigComposer<
13
+ import('@antfu/eslint-config').TypedFlatConfigItem,
14
+ import('@antfu/eslint-config').ConfigNames
15
+ >;
16
+
17
+ export const eslint: Eslint;
18
+ }
package/index.js CHANGED
@@ -1,98 +1,117 @@
1
- import antfu from '@antfu/eslint-config';
2
- import pluginReact from 'eslint-plugin-react';
3
- import simpleImportSort from 'eslint-plugin-simple-import-sort';
4
- import pluginJsxA11y from 'eslint-plugin-jsx-a11y';
5
-
6
- /** @type {import('@siberiacancode/eslint').Eslint} */
7
- export const eslint = (...args) =>
8
- antfu(
9
- {
10
- react: true,
11
- typescript: true,
12
- jsx: true
13
- },
14
- {
15
- name: 'siberiacancode/rewrite',
16
- rules: {
17
- 'style/semi': 'off',
18
- 'style/jsx-one-expression-per-line': 'off',
19
- 'style/member-delimiter-style': 'off',
20
- 'style/jsx-quotes': ['error', 'prefer-single'],
21
- 'style/comma-dangle': 'off',
22
- 'style/arrow-parens': 'off',
23
- 'style/quote-props': 'off',
24
-
25
- 'antfu/top-level-function': 'off',
26
- 'antfu/if-newline': 'off',
27
- 'antfu/curly': 'off',
28
-
29
- 'react-hooks/exhaustive-deps': 'off',
30
-
31
- 'test/prefer-lowercase-title': 'off',
32
-
33
- 'no-console': 'warn'
34
- }
35
- },
36
- {
37
- name: 'siberiacancode/react',
38
- plugins: {
39
- 'plugin-react': pluginReact
40
- },
41
- settings: {
42
- react: {
43
- version: 'detect'
44
- }
45
- },
46
- rules: {
47
- 'plugin-react/function-component-definition': [
48
- 'error',
49
- {
50
- namedComponents: ['arrow-function'],
51
- unnamedComponents: 'arrow-function'
52
- }
53
- ]
54
- }
55
- },
56
- {
57
- name: 'siberiacancode/imports',
58
- plugins: {
59
- 'simple-import-sort': simpleImportSort
60
- },
61
- rules: {
62
- 'sort-imports': 'off',
63
- 'import/order': 'off',
64
- 'import/extensions': 'off',
65
- 'simple-import-sort/exports': 'error',
66
- 'simple-import-sort/imports': [
67
- 'error',
68
- {
69
- groups: [
70
- ['^react', '^@?\\w'],
71
- ['^@(siberiacancode-core/.*|$)'],
72
- ['^@(([\\/.]?\\w)|assets|test-utils)'],
73
- ['^\\u0000'],
74
- ['^\\.\\.(?!/?$)', '^\\.\\./?$'],
75
- ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
76
- ['^.+\\.s?css$']
77
- ]
78
- }
79
- ]
80
- }
81
- },
82
- ...args.reduce((acc, config) => {
83
- if (config['jsx-a11y']) {
84
- acc.push({
85
- ...pluginJsxA11y.flatConfigs.recommended,
86
- name: 'siberiacancode/jsx-a11y'
87
- });
88
- return acc;
89
- }
90
-
91
- acc.push({
92
- ...config,
93
- name: `siberiacancode/${config.name}`
94
- });
95
-
96
- return acc;
97
- }, [])
98
- );
1
+ import antfu from '@antfu/eslint-config';
2
+ import pluginJsxA11y from 'eslint-plugin-jsx-a11y';
3
+ import pluginReact from 'eslint-plugin-react';
4
+ import simpleImportSort from 'eslint-plugin-simple-import-sort';
5
+
6
+ /** @type {import('@siberiacancode/eslint').Eslint} */
7
+ export const eslint = (...args) =>
8
+ antfu(
9
+ {
10
+ typescript: true
11
+ },
12
+ {
13
+ name: 'siberiacancode/rewrite',
14
+ rules: {
15
+ 'antfu/top-level-function': 'off',
16
+ 'antfu/if-newline': 'off',
17
+ 'antfu/curly': 'off',
18
+
19
+ 'react-hooks/exhaustive-deps': 'off',
20
+
21
+ 'test/prefer-lowercase-title': 'off',
22
+
23
+ 'no-console': 'warn'
24
+ }
25
+ },
26
+
27
+ {
28
+ name: 'siberiacancode/imports',
29
+ plugins: {
30
+ 'simple-import-sort': simpleImportSort
31
+ },
32
+ rules: {
33
+ 'sort-imports': 'off',
34
+ 'import/order': 'off',
35
+ 'import/extensions': 'off',
36
+ 'simple-import-sort/exports': 'error',
37
+ 'simple-import-sort/imports': [
38
+ 'error',
39
+ {
40
+ groups: [
41
+ ['^react', '^@?\\w'],
42
+ ['^@(siberiacancode-core/.*|$)'],
43
+ ['^@(([\\/.]?\\w)|assets|test-utils)'],
44
+ ['^\\u0000'],
45
+ ['^\\.\\.(?!/?$)', '^\\.\\./?$'],
46
+ ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
47
+ ['^.+\\.s?css$']
48
+ ]
49
+ }
50
+ ]
51
+ }
52
+ },
53
+ {
54
+ name: 'siberiacancode/formatter',
55
+ rules: {
56
+ 'style/jsx-one-expression-per-line': 'off',
57
+ 'style/member-delimiter-style': 'off',
58
+ 'style/quote-props': 'off',
59
+ 'style/operator-linebreak': 'off',
60
+ 'style/brace-style': 'off',
61
+
62
+ 'style/max-len': [
63
+ 'error',
64
+ 100,
65
+ 2,
66
+ { ignoreComments: true, ignoreStrings: true, ignoreTemplateLiterals: true }
67
+ ],
68
+ 'style/quotes': ['error', 'single', { allowTemplateLiterals: true }],
69
+ 'style/jsx-quotes': ['error', 'prefer-single'],
70
+ 'style/comma-dangle': ['error', 'never'],
71
+ 'style/semi': ['error', 'always'],
72
+ 'style/indent': ['error', 2, { SwitchCase: 1 }],
73
+ 'style/no-tabs': 'error',
74
+ 'style/linebreak-style': ['error', 'unix'],
75
+ 'style/arrow-parens': ['error', 'always']
76
+ }
77
+ },
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({
111
+ ...config,
112
+ name: `siberiacancode/${config.name}`
113
+ });
114
+
115
+ return acc;
116
+ }, [])
117
+ );
package/package.json CHANGED
@@ -1,41 +1,39 @@
1
1
  {
2
2
  "name": "@siberiacancode/eslint",
3
- "description": "eslint configs",
4
- "license": "MIT",
5
3
  "type": "module",
6
- "version": "2.0.1",
7
- "keywords": [
8
- "eslint",
9
- "react",
10
- "node"
11
- ],
4
+ "version": "2.0.2",
5
+ "description": "eslint configs",
12
6
  "author": {
13
7
  "name": "SIBERIA CAN CODE 🧊",
14
8
  "url": "https://github.com/siberiacancode"
15
9
  },
16
- "bugs": {
17
- "url": "https://github.com/siberiacancode/core/issues"
18
- },
10
+ "license": "MIT",
19
11
  "homepage": "https://github.com/siberiacancode/core",
20
12
  "repository": {
21
13
  "url": "https://github.com/siberiacancode/core"
22
14
  },
15
+ "bugs": {
16
+ "url": "https://github.com/siberiacancode/core/issues"
17
+ },
18
+ "keywords": [
19
+ "eslint",
20
+ "react",
21
+ "node"
22
+ ],
23
23
  "publishConfig": {
24
24
  "access": "public"
25
25
  },
26
- "files": [
27
- "index.js",
28
- "index.d.ts"
29
- ],
30
26
  "main": "index.js",
31
27
  "types": "index.d.ts",
28
+ "files": [
29
+ "index.d.ts",
30
+ "index.js"
31
+ ],
32
32
  "scripts": {
33
33
  "format": "prettier --write \"*.js\"",
34
+ "lint": "eslint . --fix",
34
35
  "lint-inspector": "npx @eslint/config-inspector"
35
36
  },
36
- "lint-staged": {
37
- "*.js": "prettier --write"
38
- },
39
37
  "peerDependencies": {
40
38
  "eslint": "^9.9.0"
41
39
  },
@@ -51,5 +49,15 @@
51
49
  },
52
50
  "devDependencies": {
53
51
  "@siberiacancode/prettier": "*"
52
+ },
53
+ "lint-staged": {
54
+ "*.js": [
55
+ "prettier --write",
56
+ "eslint --fix"
57
+ ],
58
+ "*.ts": [
59
+ "prettier --write",
60
+ "eslint --fix"
61
+ ]
54
62
  }
55
63
  }