-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc.js
81 lines (81 loc) · 2.53 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
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'next',
'next/core-web-vitals',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'react', 'import', 'unused-imports'],
rules: {
quotes: ['error', 'single', { avoidEscape: true }],
semi: 'off',
'@typescript-eslint/semi': ['error'],
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'react/no-unescaped-entities': ['error', { forbid: ['>', '"', '}'] }],
'@typescript-eslint/no-empty-interface': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-shadow': 'error',
'padding-line-between-statements': 'off',
'@typescript-eslint/padding-line-between-statements': [
'error',
{
blankLine: 'always',
prev: '*',
next: ['interface', 'type'],
},
],
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'react-native-gesture-handler',
importNames: ['TouchableOpacity'],
message: 'Import TouchableOpacity from react-native instead',
},
],
},
],
'react/no-unstable-nested-components': 'warn',
// Sort imports
'import/order': [
'warn',
{
pathGroups: [{ pattern: '@*', group: 'internal' }],
alphabetize: { order: 'asc', caseInsensitive: true },
'newlines-between': 'never',
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
},
],
'sort-imports': ['warn', { ignoreCase: true, ignoreDeclarationSort: true }],
// Format imports
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'error',
'import/no-duplicates': 'warn',
'import/no-useless-path-segments': 'warn',
// Rules regarding minimize code complexity
'no-param-reassign': ['error'],
'max-lines': ['error', { max: 250, skipBlankLines: true }],
complexity: ['error', { max: 20 }],
'max-nested-callbacks': ['error', { max: 3 }],
'max-depth': ['error', { max: 3 }],
'max-params': ['error', { max: 4 }],
'no-console': ['error', { allow: ['log', 'warn'] }],
// disable import React necessity
'react-hooks/exhaustive-deps': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
},
};