-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
133 lines (133 loc) · 4.64 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
{
"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.
"plugin:storybook/recommended" // Recommended storybook linting configs.
],
"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": "off",
"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.
["^[^.@]"],
["^@yourorg"], // FIXME
["^@"],
["^\\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`.
},
"parser": "@typescript-eslint/parser", // Allows Eslint to understand TypeScript syntax.
"parserOptions": {
"project": "./tsconfig.eslint.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.eslint.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/recommended",
"plugin:jest/style",
"plugin:jest-dom/recommended",
"plugin:testing-library/react"
],
"plugins": ["jest", "jest-dom", "testing-library"],
"rules": {
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error",
"jest-dom/prefer-checked": "error",
"jest-dom/prefer-enabled-disabled": "error",
"jest-dom/prefer-required": "error",
"jest-dom/prefer-to-have-attribute": "error",
"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"
},
"env": {
"jest/globals": true // enable Jest global variables.
}
},
{
"files": ["./cypress/**/*.cy.ts"],
"extends": ["plugin:cypress/recommended"],
"plugins": ["cypress"],
"rules": {
"cypress/no-force": "warn",
"cypress/assertion-before-screenshot": "warn",
"cypress/require-data-selectors": "warn",
"cypress/no-pause": "error"
},
"env": {
"cypress/globals": true // enable Cypress global variables.
}
}
]
}