-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.js
152 lines (152 loc) · 3.87 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
module.exports = {
env: {
browser: true,
es6: true,
'react-native/react-native': true,
jest: true,
node: true,
},
extends: '@react-native-community',
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: '@babel/eslint-parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2020,
sourceType: 'module',
},
root: true,
plugins: ['react', 'react-native', 'detox', 'import'],
settings: {
react: {
version: 'detect',
},
'import/core-modules': [
'react-native',
'react',
'react-redux',
'prop-types',
'lodash',
'detox',
],
},
rules: {
// General rules
'no-unused-vars': [
'error',
{vars: 'all', args: 'after-used', ignoreRestSiblings: false},
],
'no-multiple-empty-lines': ['error', {max: 1}],
indent: ['error', 'tab', {SwitchCase: 1}],
quotes: ['error', 'single'],
semi: ['error', 'always'],
'import/extensions': ['error', 'always'],
'comma-dangle': [
'error',
{
arrays: 'never',
objects: 'always',
imports: 'always',
exports: 'always',
functions: 'never',
},
],
eqeqeq: ['error', 'always'],
'no-var': ['error'],
'prefer-arrow-callback': ['error'],
'no-useless-return': ['error'],
'max-len': [
'warn',
{
code: 240,
tabWidth: 4,
ignoreUrls: true,
ignoreTrailingComments: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
},
],
'no-console': ['error'],
'no-case-declarations': 'off',
'no-mixed-spaces-and-tabs': ['error'],
'key-spacing': ['error', {afterColon: true, mode: 'strict'}],
// React rules
'react/button-has-type': ['error'],
'react/destructuring-assignment': ['error', 'always'],
'react/no-deprecated': ['error'],
'react/no-direct-mutation-state': ['error'],
'react/no-multi-comp': ['error'],
'react/no-redundant-should-component-update': ['error'],
'react/no-typos': ['error'],
'react/no-unescaped-entities': ['error'],
'react/no-unsafe': ['error'],
'react/no-unused-state': ['error'],
'react/prefer-es6-class': ['warn'],
'react/prefer-read-only-props': ['error'],
'react/react-in-jsx-scope': ['error'],
'react/require-render-return': ['error'],
'react/state-in-constructor': ['error'],
'react/jsx-curly-spacing': [
2,
{
when: 'always',
spacing: {
objectLiterals: 'never',
},
},
],
'react/jsx-indent': ['error', 'tab'],
'react/jsx-key': ['error'],
'react/jsx-no-bind': ['error'],
'react/jsx-no-duplicate-props': ['error'],
'react/jsx-no-target-blank': ['error'],
'react/jsx-no-undef': ['error'],
'react/jsx-no-useless-fragment': ['error'],
'react/jsx-props-no-multi-spaces': ['error'],
'react/jsx-props-no-spreading': ['warn'],
'react/prop-types': ['off'],
'react/jsx-first-prop-new-line': ['error', 'multiline'],
'react/jsx-max-props-per-line': ['error', {maximum: 1}],
'react/jsx-no-comment-textnodes': ['error'],
'react/jsx-newline': [
'error',
{
prevent: true,
},
],
'arrow-parens': ['error', 'as-needed'],
'react/jsx-indent-props': ['error', 'tab'],
'react-native/no-raw-text': 0,
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'index',
'sibling',
'parent',
'object',
],
pathGroups: [
{
pattern: 'react',
group: 'builtin',
position: 'before',
},
],
'newlines-between': 'never',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
},
};