-
Notifications
You must be signed in to change notification settings - Fork 273
Expand file tree
/
Copy patheslint.config.mjs
More file actions
117 lines (109 loc) · 3.03 KB
/
eslint.config.mjs
File metadata and controls
117 lines (109 loc) · 3.03 KB
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
112
113
114
115
116
117
import eslint from '@eslint/js'
import eslintPluginImport from 'eslint-plugin-import'
import eslintPluginJest from 'eslint-plugin-jest'
import eslintPluginJsxA11y from 'eslint-plugin-jsx-a11y'
import eslintPluginPrettierConfigRecommended from 'eslint-plugin-prettier/recommended'
import eslintPluginReact from 'eslint-plugin-react'
import eslintPluginReactHooks from 'eslint-plugin-react-hooks'
import eslintPluginTestingLibrary from 'eslint-plugin-testing-library'
import eslintPluginUnicorn from 'eslint-plugin-unicorn'
import globals from 'globals'
import tseslint from 'typescript-eslint'
const config = tseslint.config(
{
ignores: [
'**/dist/**',
'**/node_modules/**',
'**/coverage/**',
'**/examples/**',
'**/docs/dist/**',
],
},
{
files: ['**/*.ts', '**/*.tsx'],
extends: [
eslint.configs.recommended,
tseslint.configs.eslintRecommended,
...tseslint.configs.recommendedTypeChecked,
eslintPluginImport.flatConfigs.recommended,
eslintPluginImport.flatConfigs.react,
eslintPluginImport.flatConfigs.typescript,
eslintPluginJest.configs['flat/recommended'],
eslintPluginJsxA11y.flatConfigs.recommended,
eslintPluginPrettierConfigRecommended,
eslintPluginReact.configs.flat.recommended,
eslintPluginReactHooks.configs.flat['recommended-latest'],
eslintPluginTestingLibrary.configs['flat/react'],
eslintPluginUnicorn.configs.all,
],
settings: {
react: {
version: 'detect',
},
},
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
// Base rules
curly: ['error', 'multi-line'],
'no-nested-ternary': 'error',
// `eslint-plugin-import` rules
'import/order': [
'warn',
{
groups: ['builtin', 'external', 'internal'],
pathGroups: [
{
pattern: 'react',
group: 'external',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['react'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
// `eslint-plugin-unicorn` rules
'unicorn/no-keyword-prefix': 'off',
'unicorn/no-null': 'off',
'unicorn/prefer-string-replace-all': 'off', // Since FA still supports Safari 12, which doesn't support String.prototype.replaceAll
'unicorn/prevent-abbreviations': 'off',
},
},
{
files: ['**/*.tsx'],
rules: {
'unicorn/filename-case': [
'error',
{
case: 'pascalCase',
},
],
},
},
{
files: ['**/hooks/**/*.ts', '**/use*.ts'],
rules: {
'unicorn/filename-case': [
'error',
{
case: 'camelCase',
},
],
},
},
)
export default config