-
Notifications
You must be signed in to change notification settings - Fork 226
/
.eslintrc.js
84 lines (76 loc) · 2.35 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
80
81
82
83
84
module.exports = {
// https://eslint.org/docs/user-guide/configuring#specifying-parser-options
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module',
ecmaFeatures: {
// Supports JSX syntax (not the same as supporting React).
jsx: true,
},
},
// commonly used envs
env: {
browser: true,
node: true,
es6: true,
jest: true,
},
overrides: [
{
files: ['**/*.ts', '**/*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['**/tsconfig.json'],
},
extends: [
'plugin:import/typescript',
// https://www.npmjs.com/package/@typescript-eslint/eslint-plugin
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
// NOTE: To override other configs, Prettier must be the last extension
'plugin:prettier/recommended',
],
rules: {
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
},
},
],
// we use recommended configurations
extends: [
// https://eslint.org/docs/rules/
'eslint:recommended',
// https://github.com/yannickcr/eslint-plugin-react
'plugin:react/recommended',
// https://www.npmjs.com/package/eslint-plugin-react-hooks
'plugin:react-hooks/recommended',
// https://github.com/benmosher/eslint-plugin-import
'plugin:import/recommended',
// NOTE: To override other configs, Prettier must be the last extension
// https://github.com/prettier/eslint-plugin-prettier
'plugin:prettier/recommended',
],
plugins: ['react-hooks', '@typescript-eslint'],
rules: {
// disable nice-to-have rules for migrate convenience
'react/prop-types': 'off',
'react/no-find-dom-node': 'off',
'react/display-name': 'off',
// recommended rules
'prefer-const': 'error',
'no-var': 'error',
// hooks
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
},
settings: {
// https://github.com/yannickcr/eslint-plugin-react#configuration
react: {
version: '16',
},
},
}