-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
107 lines (107 loc) · 3.63 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
102
103
104
105
106
107
{
"root": true,
"extends": [
"eslint:recommended", // Eslint recommended configuration by eslint.
"plugin:import/recommended", // Linting of ES2015+ import/export syntax.
"plugin:react/recommended", // Recommended react linting configs.
"plugin:react-hooks/recommended", // Recommended react hooks linting configs.
"plugin:jsx-a11y/recommended", // Turns on a11y rules for JSX.
"plugin:@typescript-eslint/recommended", // Turns on rules from TypeScript-specific plugin.
"prettier" // Turns off all rules that are unnecessary or might conflict with Prettier.
],
"plugins": [
"react",
"react-hooks",
"jsx-a11y",
"@typescript-eslint",
"import",
"simple-import-sort" // Plugin for sorting imports in file.
],
"rules": {
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"import/no-named-as-default-member": "off",
"react/jsx-sort-props": [
"warn",
{
"callbacksLast": true,
"shorthandFirst": true,
"ignoreCase": true,
"reservedFirst": true,
"noSortAlphabetically": true
}
],
"simple-import-sort/imports": [
"error",
{
"groups": [
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
// Packages. `react` related packages come first.
["^react", "^@?\\w"],
// Absolute imports and other imports such as Vue-style `@/foo`.
// Anything that does not start with a dot.
["^[^.@]"],
["^@"],
["^\\x00?[^.].*\\.css$"],
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
["\\.s?css$"]
]
}
],
"simple-import-sort/exports": "error"
},
"env": {
"es6": true, // enable ES2015 features.
"browser": true, // enable use of global browser variables like `windows`.
"node": true // enable use of global node variables like `process`.
},
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser", // Allows Eslint to understand TypeScript syntax.
"parserOptions": {
"project": "./tsconfig.json", // Specify where to find the root tsconfig file of your project.
"ecmaVersion": 2021, // ECMAScript version supported in the project.
"sourceType": "module", // set to `module` because we ue ECMAScript modules.
"ecmaFeatures": {
"jsx": true // enable jsx for React.
}
},
"settings": {
"react": {
"version": "detect" // auto-detect React version from package.json.
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"] // use typescript-eslint parser for .ts|tsx files.
},
"import/resolver": {
"typescript": {
"projectConfig": "./tsconfig.json",
"alwaysTryTypes": true // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`.
}
}
},
"overrides": [
{
"files": [
"**/__tests__/**/*.[jt]s?(x)",
"**/?(*.)+(spec|test).[jt]s?(x)"
], // Override config for same files pattern as jest `testMatch` default value
"extends": [
"plugin:jest-dom/recommended",
"plugin:testing-library/react"
],
"plugins": ["jest-dom", "testing-library"],
"rules": {
"testing-library/await-async-query": "error",
"testing-library/no-await-sync-query": "error",
"testing-library/no-debugging-utils": "warn",
"testing-library/no-dom-import": "off"
}
}
]
}