forked from Commencement-Technology/react-native-template_
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eslintrc.js
More file actions
80 lines (80 loc) · 2.15 KB
/
Copy path.eslintrc.js
File metadata and controls
80 lines (80 loc) · 2.15 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
module.exports = {
root: true,
extends: [
'@react-native',
'plugin:jest/recommended',
'plugin:@tanstack/query/recommended',
],
plugins: ['eslint-comments', 'import', 'unused-imports'],
rules: {
// don't allow disabling of react-hooks/exhaustive-deps
'eslint-comments/no-restricted-disable': [
'error',
'react-hooks/exhaustive-deps',
],
// prefer named exports
'import/no-default-export': 'error',
// alphabetize imports
'import/order': [
'error',
{ alphabetize: { order: 'asc', caseInsensitive: true } },
],
// don't allow nested ternaries
'no-nested-ternary': 'error',
// don't allow default React import
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'react',
importNames: ['default'],
message:
"As of React 17, you don't need to import React to use JSX. Please remove the default import.",
},
{
name: 'react-native',
importNames: ['Image'],
message:
'Use <Image /> from expo-image instead of <Image /> from react-native.',
},
{
name: 'react-native',
importNames: ['Text'],
message:
'Use <ThemedText /> instead of <Text /> from react-native.',
},
],
},
],
// don't allow unused styles
'react-native/no-unused-styles': 'error',
// make sure all maps have a key
'react/jsx-key': 'error',
// guard against leaked values in renders
'react/jsx-no-leaked-render': 'error',
// removes unused imports with --fix
'unused-imports/no-unused-imports': 'warn',
},
overrides: [
{
// Test files only
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
extends: ['plugin:testing-library/react'],
},
{
// Expo Dynamic Config
files: ['app.config.ts'],
rules: {
'import/no-default-export': 'off',
},
},
{
// Expo Router
files: ['src/app/**/*.tsx'],
rules: {
'import/no-default-export': 'off',
},
},
],
};