-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
118 lines (118 loc) · 2.77 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
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
118
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: process.cwd()
},
settings: {
react: {
version: 'detect'
}
},
env: {
browser: true,
'jest/globals': true
},
plugins: [
'@typescript-eslint/eslint-plugin',
'react',
'react-hooks',
'jest',
'jsx-a11y',
'prettier'
],
extends: [
'eslint:recommended',
'airbnb-base',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'prettier'
],
rules: {
// Vanilla rules
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'comma-dangle': 'off',
'implicit-arrow-linebreak': 'off',
'max-len': [
'error',
{
code: 120,
ignoreComments: true,
ignoreStrings: true,
ignoreTemplateLiterals: true
}
],
'no-extra-semi': 'off',
'no-param-reassign': ['error', { props: true, ignorePropertyModificationsFor: ['state', 'r'] }],
'no-tabs': 'off',
'no-underscore-dangle': 'off',
'no-unused-expressions': [
'warn',
{
allowShortCircuit: true,
allowTernary: true
}
],
'no-use-before-define': 'off',
semi: ['error', 'always'],
'prefer-arrow-callback': 'off',
// @typescript-eslint
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/prefer-interface': 'off',
// import
'import/export': 'off',
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never'
}
],
'import/first': 'off',
'import/named': 'off',
'import/no-extraneous-dependencies': 'warn',
'import/prefer-default-export': 'off',
// prettier
'prettier/prettier': 'error',
// react-hooks
'react-hooks/exhaustive-deps': 'error',
'react-hooks/rules-of-hooks': 'error',
// react
'react/jsx-boolean-value': 1,
'react/jsx-indent-props': ['error', 'tab'],
'react/jsx-indent': ['error', 'tab'],
'react/prop-types': 'off',
'react/jsx-filename-extension': [
'warn',
{
extensions: ['.jsx', '.tsx', '.js', '.ts']
}
]
},
overrides: [
{
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
// enable the rule specifically for TypeScript files
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/explicit-function-return-type': ['error'],
'@typescript-eslint/explicit-module-boundary-types': ['error']
}
},
{
files: ['sdk/**/*'],
rules: {
'@typescript-eslint/no-var-requires': 0
}
}
]
};