-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy patheslint.config.js
99 lines (98 loc) · 2.58 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import js from '@eslint/js';
import importPlugin from 'eslint-plugin-import';
import prettierRecommended from 'eslint-plugin-prettier/recommended';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import unusedImports from 'eslint-plugin-unused-imports';
import globals from 'globals';
import tseslint from 'typescript-eslint';
/** @type {import('eslint').Linter.Config[]} */
export default [
{
ignores: [
'**/*.d.ts',
'**/*.tgz',
'**/dist/**',
'**/esm/**',
'**/cache/**',
'.yarn/**',
'.pnp.*',
'coverage',
'docs',
'node_modules',
'eslint.*',
'tsup.*',
'vitest.*',
'.vitepress',
],
},
{
languageOptions: {
globals: globals.browser,
parserOptions: {
project: './tsconfig.json',
},
},
},
js.configs.recommended,
...tseslint.configs.recommended,
react.configs.flat.recommended,
reactHooks.configs['recommended-latest'],
{
plugins: {
'simple-import-sort': simpleImportSort,
'unused-imports': unusedImports,
import: importPlugin,
},
rules: {
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/strict-boolean-expressions': 'error',
'@typescript-eslint/consistent-type-definitions': ['warn', 'type'],
'react/react-in-jsx-scope': 'off',
'import/extensions': [
'error',
{
'': 'always',
ts: 'ignorePackages',
tsx: 'ignorePackages',
},
],
'simple-import-sort/imports': [
'warn',
{
groups: [
// Side effect imports.
['^\\u0000'],
// Packages. `react` related packages come first.
['^react', '^@?\\w'],
// Internal packages.
['^(src)(/.*|$)'],
// Parent imports. Put `..` last.
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
// Other relative imports. Put same-folder imports and `.` last.
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
],
},
],
'simple-import-sort/exports': 'warn',
'no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'warn',
'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_|key$',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
},
settings: {
react: {
version: 'detect',
},
},
},
prettierRecommended,
];