-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc.js
94 lines (94 loc) · 2.55 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
module.exports = {
env: {
browser: false,
es6: true
},
parser: '@typescript-eslint/parser',
ignorePatterns: ['node_modules/'],
extends: [
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
'plugin:import/recommended',
'plugin:import/typescript'
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true
}
},
plugins: ['react-hooks', 'eslint-plugin-prettier', 'import'],
rules: {
'react/prop-types': 'off',
'react/display-name': 'off',
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off',
'import/no-unresolved': 'error',
'import/order': [
'error',
{
groups: [
'external', // External libraries like 'react', 'react-native'
'builtin', // Built-in Node.js modules like 'fs'
'internal', // Internal imports (e.g., aliases like '@components')
['sibling', 'parent'], // Relative imports
'index', // Index imports like './'
'object', // Imports of objects
'type' // Type imports (TypeScript)
],
pathGroups: [
{
pattern: 'react',
group: 'external',
position: 'before'
},
{
pattern: 'react-native',
group: 'external',
position: 'before'
}
],
pathGroupsExcludedImportTypes: ['react', 'react-native'],
alphabetize: {
order: 'asc',
caseInsensitive: true
}
}
],
'prettier/prettier': [
'error',
{
semi: true
}
],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'max-len': [0, 150, 2, { ignoreUrls: true }],
'no-duplicate-imports': 'error',
'camelcase': 'error',
'prefer-arrow-callback': 'error',
'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 1 }]
},
settings: {
'react': {
version: 'detect'
},
'import/core-modules': ['react', 'react-native'],
'import/resolver': {
typescript: {
alwaysTryTypes: true // TypeScript paths are respected
},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
}
}
};