Repository navigation
Expand file tree
/
Copy path.eslintrc.js
More file actions
166 lines (165 loc) · 4.31 KB
/
Copy path.eslintrc.js
File metadata and controls
166 lines (165 loc) · 4.31 KB
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
module.exports = {
root: true,
extends: [
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'jest',
'import',
'react',
'react-hooks',
'react-native',
'prettier',
'pressto',
'refined',
'local-rules',
],
ignorePatterns: [
'node_modules/',
'**/node_modules/',
'build/',
'dist/',
'coverage/',
'android/',
'ios/',
'web-build/',
'.expo/',
'scripts/',
],
rules: {
// eslint-plugin-refined rules (enable one at a time as needed)
'refined/border-radius-with-curve': 'warn',
'refined/prefer-hairline-width': 'warn',
'refined/prefer-box-shadow': 'warn',
'refined/require-hitslop-small-touchables': 'warn',
'refined/spring-config-consistency': [
'warn',
{
reanimatedVersion: 'v4',
},
],
'refined/avoid-touchable-opacity': 'warn',
'pressto/require-worklet-directive': 'error',
// Shared values: enforce .get()/.set() over .value (type-aware local rule)
'local-rules/no-shared-value-dot-value': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'import/no-useless-path-segments': 'off',
'no-unused-vars': 'off',
'prettier/prettier': 'error',
'@typescript-eslint/consistent-type-imports': 'off',
'@typescript-eslint/no-unused-vars': 'off',
// Gesture Handler 3 deprecates the `Gesture.*` builder in favour of the
// hook API. The builder still works on v3; moving every demo to hooks is
// its own migration, so only the builder is allowed here — any other
// deprecated API is still an error.
'@typescript-eslint/no-deprecated': [
'error',
{
allow: [
{
from: 'package',
package: 'react-native-gesture-handler',
name: [
'Gesture',
'Tap',
'Pan',
'Pinch',
'Rotation',
'Fling',
'LongPress',
'ForceTouch',
'Native',
'Manual',
'Hover',
'Race',
'Simultaneous',
'Exclusive',
],
},
],
},
],
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'react/display-name': 'off',
'react/no-unescaped-entities': 'off',
'react-native/no-unused-styles': 'warn',
'react-native/no-inline-styles': 'off',
'react-native/no-color-literals': 'off',
'react-native/no-unused-styles': 'warn',
'react-native/sort-styles': [
'error',
'asc',
{
ignoreClassNames: false,
ignoreStyleProperties: false,
},
],
// Import ordering rules to ensure styles are always at the top
'import/order': [
'error',
{
groups: [
['builtin', 'external'], // Node built-ins and external packages
'internal', // Internal modules
['parent', 'sibling'], // Parent and sibling imports
'index', // Index file imports
'object', // Object imports
'type', // Type imports
],
pathGroups: [
{
pattern: '*.{css,scss,sass,less,styl,stylus,pcss,postcss}',
group: 'builtin',
position: 'before',
},
{
pattern: '**/*.{css,scss,sass,less,styl,stylus,pcss,postcss}',
group: 'builtin',
position: 'before',
},
{
pattern: 'react-native',
group: 'external',
position: 'before',
},
{
pattern: 'react',
group: 'external',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['type'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'import/newline-after-import': ['error', { count: 1 }],
'import/no-duplicates': 'error',
},
env: {
'jest/globals': true,
node: true,
es6: true,
},
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: './tsconfig.json',
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: 'detect',
},
},
};