-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
187 lines (187 loc) · 6.15 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
module.exports = {
root: true,
env: {
node: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 6,
project: 'tsconfig(.*)?.json',
ecmaFeatures: {
jsx: true,
},
},
ignorePatterns: ['node_modules', 'dist', 'coverage', '.eslintrc.js', '.expo', '.expo-shared', 'web-build'],
settings: {
react: {
version: 'detect',
},
'react-native/style-sheet-object-names': ['EStyleSheet'],
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
plugins: ['@typescript-eslint', 'unused-imports', 'react', 'react-hooks', 'react-native', 'import'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'prettier',
],
rules: {
indent: ['warn', 2, { SwitchCase: 1 }],
quotes: ['warn', 'single', { allowTemplateLiterals: true }],
'arrow-parens': ['warn', 'always'],
'comma-dangle': ['warn', 'never'],
'no-var': 'warn',
'no-dupe-class-members': 'off',
'import/prefer-default-export': 'off',
'implicit-arrow-linebreak': ['warn', 'beside'],
'newline-per-chained-call': ['warn', { ignoreChainWithDepth: 2 }],
'function-call-argument-newline': ['warn', 'consistent'],
'function-paren-newline': ['warn', 'consistent'],
'array-element-newline': ['warn', 'consistent'],
'array-bracket-newline': ['warn', { multiline: true }],
'padding-line-between-statements': [
'warn',
{ blankLine: 'always', prev: '*', next: 'return' },
{ blankLine: 'always', prev: '*', next: 'multiline-block-like' },
],
'@typescript-eslint/no-use-before-define': ['warn', { variables: false }],
'@typescript-eslint/lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: true }],
'@typescript-eslint/no-inferrable-types': ['warn', { ignoreParameters: true }],
'@typescript-eslint/explicit-module-boundary-types': ['warn', { allowArgumentsExplicitlyTypedAsAny: true }],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-member-accessibility': [
'warn',
{ accessibility: 'explicit', overrides: { constructors: 'no-public' } },
],
'@typescript-eslint/explicit-function-return-type': ['warn', { allowExpressions: true }],
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/array-type': ['warn', { default: 'generic', readonly: 'generic' }],
'@typescript-eslint/member-ordering': [
'warn',
{
default: [
'public-static-field',
'protected-static-field',
'private-static-field',
'public-instance-field',
'protected-instance-field',
'private-instance-field',
'public-static-accessor',
'protected-static-accessor',
'private-static-accessor',
'public-instance-accessor',
'protected-instance-accessor',
'private-instance-accessor',
'public-constructor',
'protected-constructor',
'private-constructor',
'public-static-method',
'public-instance-method',
'protected-static-method',
'protected-instance-method',
'private-static-method',
'private-instance-method',
],
},
],
'@typescript-eslint/naming-convention': [
'warn',
{
selector: 'typeLike',
format: ['PascalCase'],
},
{
selector: ['parameter'],
format: ['camelCase', 'PascalCase'],
leadingUnderscore: 'allow',
},
{
selector: ['classProperty'],
format: ['camelCase', 'snake_case'],
leadingUnderscore: 'allow',
},
{
selector: ['method', 'accessor'],
format: ['camelCase'],
},
{
selector: ['function', 'typeProperty'],
format: ['camelCase', 'PascalCase'],
},
{
selector: 'variable',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
},
{
selector: 'enumMember',
format: ['UPPER_CASE'],
},
],
'unused-imports/no-unused-imports-ts': 'warn',
'unused-imports/no-unused-vars-ts': [
'warn',
{ vars: 'all', varsIgnorePattern: '^_', argsIgnorePattern: '^_', ignoreRestSiblings: true },
],
'jsx-quotes': ['warn', 'prefer-single'],
'react/jsx-boolean-value': 'off',
'react/self-closing-comp': ['warn', { component: true, html: true }],
'react/jsx-max-props-per-line': [1, { maximum: { single: 2, multi: 1 } }],
'react/jsx-first-prop-new-line': ['warn', 'multiline'],
'react/prop-types': 'off',
'react-native/no-unused-styles': 'warn',
'react-native/no-inline-styles': 'warn',
'react-native/no-single-element-style-arrays': 'warn',
'react/react-in-jsx-scope': 'off',
'react/jsx-fragments': ['warn', 'element'],
'import/newline-after-import': 'warn',
'import/no-unresolved': 'error',
'import/no-cycle': 'error',
'import/order': [
'warn',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
alphabetize: { order: 'asc' },
},
],
'import/no-duplicates': 'warn',
'react-hooks/exhaustive-deps': 'off',
},
overrides: [
{
files: ['*.js'],
rules: {
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
},
},
{
files: ['*actions.ts'],
rules: {
'function-call-argument-newline': ['warn', 'always'],
'function-paren-newline': ['warn', { minItems: 1 }],
},
},
{
files: ['*selectors.ts'],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'function-call-argument-newline': ['warn', 'always'],
'function-paren-newline': ['warn', 'multiline-arguments'],
},
},
],
};