-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.json
101 lines (101 loc) · 2.71 KB
/
.eslintrc.json
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
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"airbnb",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [
"react",
"@typescript-eslint",
"react-hooks",
"prettier",
"unused-imports",
"eslint-plugin-import-helpers"
],
"rules": {
// ESlint mostra erro caso as regras do Prettier forem violadas
"prettier/prettier": "error",
"react-hooks/rules-of-hooks": "error", // Verifica as regras dos Hooks
"react-hooks/exhaustive-deps": "warn", // Verifica as dependências de effects
"react/jsx-filename-extension": [1, { "extensions": [".tsx"] }],
"import/prefer-default-export": "off",
"react/jsx-props-no-spreading": "off",
"func-names": "off",
"no-nested-ternary": "off",
"jsx-a11y/anchor-is-valid": [ "error", {
"components": [ "Link" ],
"specialLink": ["hrefLeft", "hrefRight"],
"aspects": ["invalidHref", "preferButton"]
}],
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
"dot-notation": "off",
// caso tenha algum aviso na importação do React ou variável/constante
"no-use-before-define": "off",
// para que as importações de arquivos .tsx não precise da extensão
"import/extensions": [
"error",
"ignorePackages",
{
"ts": "never",
"tsx": "never"
}
],
"react/function-component-definition": [
2, {
"namedComponents": ["function-declaration", "function-expression", "arrow-function"],
"unnamedComponents": ["function-expression", "arrow-function"]
}
],
"import-helpers/order-imports": [
"warn",
{
"newlinesBetween": "always",
"groups": [
"/^react/",
"/^next/",
"module",
"/^@components/",
"/^@pages/",
"/^@assets/",
"/^@styles/",
"/^@services/",
"/^@hooks/",
"/^@utils/",
["parent", "sibling", "index"]
],
"alphabetize": { "order": "asc", "ignoreCase": true }
}
],
"no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
]
},
// para o React entender arquivos Typescript nas importações
"settings": {
"import/resolver": {
"typescript": {}
}
}
}