forked from kbysiec/vite-vanilla-ts-lib-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
105 lines (104 loc) · 3.6 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
100
101
102
103
104
105
import js from '@eslint/js'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import * as regexpPlugin from 'eslint-plugin-regexp'
import simpleImportSort from 'eslint-plugin-simple-import-sort'
import globals from 'globals'
import tseslint from 'typescript-eslint'
export default [
js.configs.recommended,
...tseslint.configs.recommended,
eslintPluginPrettierRecommended,
regexpPlugin.configs['flat/recommended'],
{
files: ['**/*.{ts,tsx,js,mjs,cjs}'],
plugins: {
'simple-import-sort': simpleImportSort,
ts: tseslint.plugin
},
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 'es2022',
sourceType: 'module'
},
globals: {
...globals.browser,
...globals.node,
...globals.es2021
}
},
rules: {
indent: ['error', 4],
'no-console': ['warn', { allow: ['warn', 'error'] }],
'consistent-return': 'error',
'space-before-function-paren': [
'error',
{
anonymous: 'always',
named: 'never',
asyncArrow: 'always'
}
],
'no-redeclare': 'off',
'simple-import-sort/imports': [
'error',
{
groups: [
[
// Side effect imports.
'^\\u0000',
'^@?\\w',
// Internal packages.
'^(src|components|config|utils|pages|hooks|api)(/.*|$)',
// Parent imports. Put `..` last.
'^\\.\\.(?!/?$)',
'^\\.\\./?$',
// Other relative imports. Put same-folder imports and `.` last.
'^\\./(?=.*/)(?!/?$)',
'^\\.(?!/?$)',
'^\\./?$',
// Style imports.
'^.+\\.s?css$'
]
]
}
],
'simple-import-sort/exports': 'error',
'func-call-spacing': 'off',
'@typescript-eslint/func-call-spacing': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports'
}
],
'no-undef': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': [
'error',
{
enums: false,
typedefs: false,
ignoreTypeReferences: false,
functions: false
}
],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
ignoreRestSiblings: true
}
],
'@typescript-eslint/no-explicit-any': 'off'
}
}
]