-
Notifications
You must be signed in to change notification settings - Fork 3
/
eslint.config.mjs
111 lines (104 loc) · 2.72 KB
/
eslint.config.mjs
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
106
107
108
109
110
111
import reactPlugin from 'eslint-plugin-react';
import importPlugin from 'eslint-plugin-import';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import reactRefreshPlugin from 'eslint-plugin-react-refresh';
import stylisticPlugin from '@stylistic/eslint-plugin'
import tsEslint from 'typescript-eslint';
import eslint from '@eslint/js';
import globals from 'globals';
import eslintTerrestris from '@terrestris/eslint-config-typescript';
export default tsEslint.config({
extends: [
eslint.configs.recommended,
...tsEslint.configs.recommended,
...tsEslint.configs.stylistic,
importPlugin.flatConfigs.recommended
],
files: [
'src/**/*.{js,mjs,cjs,ts,jsx,tsx}'
],
plugins: {
react: reactPlugin,
'@stylistic': stylisticPlugin,
'react-hooks': reactHooksPlugin,
'react-refresh': reactRefreshPlugin
},
languageOptions: {
globals: globals.browser,
ecmaVersion: 'latest',
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname
}
},
rules: {
...eslintTerrestris.rules,
...reactHooksPlugin.configs.recommended.rules,
'max-len': [
'warn',
{
'code': 160
}
],
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/member-ordering': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'no-unused-vars': 'warn',
'arrow-spacing': 'warn',
'comma-spacing': 'warn',
'comma-dangle': 'warn',
'eol-last': 'warn',
'no-multi-spaces': 'warn',
'no-multiple-empty-lines': ['warn', {
max: 1
}],
'object-property-newline': 'warn',
'object-curly-newline': ['warn', {
consistent: true,
minProperties: 2
}],
'space-before-function-paren': ['warn', {
anonymous: 'always',
named: 'never',
asyncArrow: 'always'
}],
'react/jsx-max-props-per-line': ['warn', {
maximum: 1
}],
'react/jsx-closing-tag-location': ['warn'],
'react/jsx-closing-bracket-location': ['warn'],
'import/no-unresolved': 'off',
'import/named': 'off',
'import/order': ['warn', {
groups: [
'builtin',
'external',
'parent',
'sibling',
'index',
'object'
],
'pathGroups': [{
pattern: 'react',
group: 'external',
position: 'before'
}, {
pattern: '@terrestris/**',
group: 'external',
position: 'after'
}],
'pathGroupsExcludedImportTypes': ['react'],
'newlines-between': 'always-and-inside-groups',
'alphabetize': {
order: 'asc',
caseInsensitive: true
}
}]
},
settings: {
react: {
version: 'detect'
}
}
});