-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
96 lines (95 loc) · 3.14 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
// basic eslint settings to use via CLI
module.exports = {
plugins: ['no-array-any'],
extends: [
'airbnb',
'airbnb/hooks',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/strict',
'airbnb-typescript', // must be below `@typescript-eslint/recommended`
'plugin:mobx/recommended',
'plugin:compat/recommended',
'plugin:eslint-comments/recommended',
],
rules: {
'arrow-body-style': 'off', // code can get ugly
'prefer-arrow-callback': 'off', // prevents using of named components as `observer` args
'consistent-return': 'off', // not needed in TS
'no-restricted-syntax': 'off', // TODO?
'multiline-ternary': ['error', 'always-multiline'],
'object-curly-newline': ['error', { 'multiline': true }],
'max-len': ['error', { 'code': 120, 'ignoreComments': true }],
'no-array-any/no-array-any': 'error',
'react/react-in-jsx-scope': 'off', // new jsx transform
'react/require-default-props': 'off', // not needed in TS
'react/jsx-indent': [
'error',
2,
{ indentLogicalExpressions: true },
],
'jsx-a11y/anchor-is-valid': 'off',
'eslint-comments/disable-enable-pair': ['error', {allowWholeFile: true}],
'eslint-comments/require-description': 'warn',
'mobx/missing-observer': 'off', // false positive
'import/extensions': 'off',
'import/prefer-default-export': 'off', // https://t.me/why_not_export_default
'@typescript-eslint/array-type': ['error', {
default: 'generic',
readonly: 'generic',
}], // more explicit
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/explicit-member-accessibility': ['error', {
accessibility: 'explicit',
overrides: {
constructors: 'off',
}
}],
'@typescript-eslint/no-use-before-define': ['error', {
functions: false,
classes: true,
variables: true,
allowNamedExports: false,
enums: true,
typedefs: true,
ignoreTypeReferences: true,
}],
'import/order': [
'error',
{
'pathGroups': [
{
'pattern': '@/**',
'group': 'internal'
}
],
groups: [['builtin', 'external'], 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'always',
},
],
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
env: {
browser: true,
node: true,
},
globals: {
window: 'readonly',
},
settings: {
'import/extensions': [
'.js',
'.jsx',
'.ts',
'.tsx',
],
'import/resolver': {
node: {
paths: ['src'],
},
},
},
};