-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslintrc.js
79 lines (77 loc) · 1.93 KB
/
eslintrc.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
/** @type {import('eslint').Linter.RulesRecord} */
const tsRules = {
'@typescript-eslint/object-curly-spacing': ['error', 'always'],
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/parameter-properties': ['error', {}],
'@typescript-eslint/quotes': 'off',
};
/** @type {import('eslint').Linter.RulesRecord} */
const rules = {
'react/react-in-jsx-scope': 'off',
'jsx-quotes': ['error', 'prefer-double'],
'arrow-parens': ['error', 'always'],
'object-curly-spacing': ['error', 'always'],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/no-unknown-property': 'off',
'func-names': ['error', 'always'],
eqeqeq: ['error', 'smart'],
'no-eq-null': 'off',
'capitalized-comments': 'off',
'import/named': 'off',
};
/** @type {import('eslint').Linter.BaseConfig} */
module.exports = {
env: {
browser: true,
es2021: true,
},
plugins: ['react', 'react-hooks', 'import'],
extends: ['xo-space', 'plugin:react/recommended', 'plugin:import/recommended', 'plugin:prettier/recommended'],
overrides: [
{
files: ['*.js', 'scripts/*.js'],
env: {
commonjs: true,
node: true,
},
},
{
files: ['**/*.{ts,tsx,mts,mtsx}'],
extends: ['xo-typescript/space'],
rules: {
...rules,
...tsRules,
},
parserOptions: {
project: './tsconfig.json',
},
},
{
files: ['*.test.*', '*.spec.*', '**/__test__/**'],
env: {
mocha: true,
jest: true,
},
},
{
files: ['**/*.config.*'],
rules: {
'import/no-default-export': 'off',
},
},
{
files: ['*.d.ts'],
rules: {
'@typescript-eslint/triple-slash-reference': 'off',
},
},
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules,
};