@siberiacancode/eslint 1.1.0 → 2.0.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.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # 🔮 eslint configs
2
2
 
3
- Пакет содержит eslint-конфиги
3
+ Пакет содержит eslint конфиг
package/index.d.ts ADDED
@@ -0,0 +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
+ }
package/index.js CHANGED
@@ -1,4 +1,98 @@
1
- const eslintReact = require('./.eslintrc.react.js');
2
- const eslintNode = require('./.eslintrc.node.js');
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';
3
5
 
4
- module.exports = { eslint: { react: eslintReact, node: eslintNode } };
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
+ );
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@siberiacancode/eslint",
3
3
  "description": "eslint configs",
4
4
  "license": "MIT",
5
- "version": "1.1.0",
5
+ "version": "2.0.0",
6
6
  "keywords": [
7
7
  "eslint",
8
8
  "react",
@@ -23,35 +23,30 @@
23
23
  "access": "public"
24
24
  },
25
25
  "files": [
26
- ".eslintrc.node.js",
27
- ".eslintrc.react.js"
26
+ "index.js",
27
+ "index.d.ts"
28
28
  ],
29
29
  "main": "index.js",
30
+ "types": "index.d.ts",
30
31
  "scripts": {
31
- "format": "prettier --write \"*.js\""
32
+ "format": "prettier --write \"*.js\"",
33
+ "lint-inspector": "npx @eslint/config-inspector"
32
34
  },
33
35
  "lint-staged": {
34
36
  "*.js": "prettier --write"
35
37
  },
36
38
  "peerDependencies": {
37
- "eslint": "^8.48.0"
39
+ "eslint": "^9.9.0"
38
40
  },
39
41
  "dependencies": {
40
- "@typescript-eslint/eslint-plugin": "^6.7.3",
41
- "@typescript-eslint/parser": "^6.7.3",
42
- "eslint": "^8.50.0",
43
- "eslint-config-airbnb": "^19.0.4",
44
- "eslint-config-airbnb-typescript": "^17.1.0",
45
- "eslint-config-prettier": "^9.0.0",
46
- "eslint-import-resolver-typescript": "^3.6.1",
47
- "eslint-plugin-eslint-comments": "^3.2.0",
48
- "eslint-plugin-import": "^2.28.1",
49
- "eslint-plugin-jsx-a11y": "^6.7.1",
50
- "eslint-plugin-prettier": "^5.0.0",
51
- "eslint-plugin-promise": "^6.1.1",
52
- "eslint-plugin-react": "^7.33.2",
53
- "eslint-plugin-react-hooks": "^4.6.0",
54
- "eslint-plugin-simple-import-sort": "^10.0.0"
42
+ "@antfu/eslint-config": "^2.25.1",
43
+ "@eslint-react/eslint-plugin": "^1.10.0",
44
+ "eslint": "^9.9.0",
45
+ "eslint-plugin-jsx-a11y": "^6.9.0",
46
+ "eslint-plugin-react": "^7.35.0",
47
+ "eslint-plugin-react-hooks": "^4.6.2",
48
+ "eslint-plugin-react-refresh": "^0.4.9",
49
+ "eslint-plugin-simple-import-sort": "^12.1.1"
55
50
  },
56
51
  "devDependencies": {
57
52
  "@siberiacancode/prettier": "*"
package/.eslintrc.node.js DELETED
@@ -1,99 +0,0 @@
1
- /** @type {import('eslint').Linter.Config} */
2
- module.exports = {
3
- env: {
4
- browser: true,
5
- es2021: true
6
- },
7
- extends: [
8
- 'airbnb-base',
9
- 'plugin:eslint-comments/recommended',
10
- 'plugin:promise/recommended',
11
- 'plugin:prettier/recommended'
12
- ],
13
- plugins: ['simple-import-sort', 'prettier'],
14
- ignorePatterns: ['dist', 'coverage'],
15
- parserOptions: {
16
- ecmaVersion: 'latest',
17
- sourceType: 'module'
18
- },
19
- rules: {
20
- 'max-len': 'off',
21
- 'consistent-return': 'off',
22
- 'no-shadow': 'off',
23
- 'no-param-reassign': 'warn',
24
- 'no-console': ['warn', { allow: ['info', 'error'] }],
25
- 'sort-imports': 'off',
26
- 'import/order': 'off',
27
- 'import/extensions': 'off',
28
- 'import/prefer-default-export': 'off',
29
- 'import/no-extraneous-dependencies': 'off',
30
- 'simple-import-sort/exports': 'error',
31
- 'simple-import-sort/imports': [
32
- 'error',
33
- {
34
- groups: [
35
- // External packages:
36
- ['^react', '^@?\\w'],
37
- // Internal packages:
38
- ['^@(siberiacancode-core/.*|$)'],
39
- // Alias imports:
40
- ['^@(([\\/.]?\\w)|assets|test-utils)'],
41
- // Side effect imports:
42
- ['^\\u0000'],
43
- // Parent imports:
44
- ['^\\.\\.(?!/?$)', '^\\.\\./?$'],
45
- // Other relative imports:
46
- ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
47
- // Style imports:
48
- ['^.+\\.s?css$']
49
- ]
50
- }
51
- ],
52
- 'require-await': 'error'
53
- },
54
- overrides: [
55
- {
56
- files: ['*.ts', '*.tsx'],
57
- parser: '@typescript-eslint/parser',
58
- parserOptions: {
59
- project: './tsconfig.json'
60
- },
61
- extends: [
62
- 'airbnb-typescript/base',
63
- 'plugin:@typescript-eslint/recommended',
64
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
65
- 'plugin:prettier/recommended'
66
- ],
67
- settings: {
68
- 'import/parsers': {
69
- '@typescript-eslint/parser': ['.ts', '.tsx']
70
- },
71
- 'import/resolver': {
72
- typescript: {
73
- project: './tsconfig.json'
74
- }
75
- }
76
- },
77
- rules: {
78
- 'import/order': 'off',
79
- 'import/extensions': 'off',
80
- 'import/prefer-default-export': 'off',
81
- 'import/no-extraneous-dependencies': 'off',
82
- '@typescript-eslint/no-explicit-any': 'off',
83
- '@typescript-eslint/no-unsafe-return': 'off',
84
- '@typescript-eslint/ban-ts-comment': 'off',
85
- '@typescript-eslint/no-shadow': 'off',
86
- '@typescript-eslint/restrict-template-expressions': [
87
- 'warn',
88
- { allowBoolean: true, allowNullish: true }
89
- ],
90
- '@typescript-eslint/consistent-type-imports': [
91
- 'error',
92
- { prefer: 'type-imports', disallowTypeAnnotations: false }
93
- ],
94
- 'require-await': 'off',
95
- '@typescript-eslint/require-await': 'error'
96
- }
97
- }
98
- ]
99
- };
@@ -1,110 +0,0 @@
1
- /** @type {import('eslint').Linter.Config} */
2
- module.exports = {
3
- env: {
4
- browser: true,
5
- es2021: true
6
- },
7
- extends: [
8
- 'airbnb',
9
- 'airbnb/hooks',
10
- 'plugin:eslint-comments/recommended',
11
- 'plugin:promise/recommended',
12
- 'plugin:prettier/recommended'
13
- ],
14
- plugins: ['simple-import-sort', 'prettier'],
15
- ignorePatterns: ['dist', 'coverage'],
16
- parserOptions: {
17
- ecmaFeatures: { jsx: true },
18
- ecmaVersion: 'latest',
19
- sourceType: 'module'
20
- },
21
- rules: {
22
- 'max-len': 'off',
23
- 'consistent-return': 'off',
24
- 'no-shadow': 'off',
25
- 'no-param-reassign': 'warn',
26
- 'no-template-curly-in-string': 'off',
27
- 'no-console': ['warn', { allow: ['info', 'error'] }],
28
- 'react/prop-types': 'off',
29
- 'react/jsx-indent': 'off',
30
- 'react/no-children-prop': 'off',
31
- 'react/react-in-jsx-scope': 'off',
32
- 'react/no-unused-prop-types': 'off',
33
- 'react/require-default-props': 'off',
34
- 'react/jsx-props-no-spreading': 'off',
35
- 'react/button-has-type': 'warn',
36
- 'react/no-array-index-key': 'warn',
37
- 'react-hooks/exhaustive-deps': 'warn',
38
- 'react/function-component-definition': [
39
- 'error',
40
- {
41
- namedComponents: ['arrow-function'],
42
- unnamedComponents: 'arrow-function'
43
- }
44
- ],
45
- 'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
46
- 'sort-imports': 'off',
47
- 'import/order': 'off',
48
- 'import/extensions': 'off',
49
- 'import/prefer-default-export': 'off',
50
- 'import/no-extraneous-dependencies': 'off',
51
- 'simple-import-sort/exports': 'error',
52
- 'simple-import-sort/imports': [
53
- 'error',
54
- {
55
- groups: [
56
- // External packages:
57
- ['^react', '^@?\\w'],
58
- // Internal packages:
59
- ['^@(siberiacancode-core/.*|$)'],
60
- // Alias imports:
61
- ['^@(([\\/.]?\\w)|assets|test-utils)'],
62
- // Side effect imports:
63
- ['^\\u0000'],
64
- // Parent imports:
65
- ['^\\.\\.(?!/?$)', '^\\.\\./?$'],
66
- // Other relative imports:
67
- ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
68
- // Style imports:
69
- ['^.+\\.s?css$']
70
- ]
71
- }
72
- ],
73
- 'require-await': 'error'
74
- },
75
- overrides: [
76
- {
77
- files: ['*.ts', '*.tsx'],
78
- parser: '@typescript-eslint/parser',
79
- parserOptions: {
80
- project: './tsconfig.json'
81
- },
82
- extends: [
83
- 'airbnb-typescript',
84
- 'plugin:@typescript-eslint/recommended',
85
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
86
- 'plugin:prettier/recommended'
87
- ],
88
- rules: {
89
- 'import/order': 'off',
90
- 'import/extensions': 'off',
91
- 'import/prefer-default-export': 'off',
92
- 'import/no-extraneous-dependencies': 'off',
93
- '@typescript-eslint/no-explicit-any': 'off',
94
- '@typescript-eslint/no-unsafe-return': 'off',
95
- '@typescript-eslint/ban-ts-comment': 'off',
96
- '@typescript-eslint/no-shadow': 'off',
97
- '@typescript-eslint/restrict-template-expressions': [
98
- 'warn',
99
- { allowBoolean: true, allowNullish: true }
100
- ],
101
- '@typescript-eslint/consistent-type-imports': [
102
- 'error',
103
- { prefer: 'type-imports', disallowTypeAnnotations: false }
104
- ],
105
- 'require-await': 'off',
106
- '@typescript-eslint/require-await': 'error'
107
- }
108
- }
109
- ]
110
- };