-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
76 lines (74 loc) · 1.98 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
const assertFunctionGenerator = ({ variants, queries }) => {
const assertFunctions = []
variants.forEach((variant) => {
queries.forEach((query) => {
assertFunctions.push(`screen.${variant}${query}`)
})
})
return assertFunctions
}
module.exports = {
extends: [
'eslint:recommended',
'airbnb',
'airbnb/hooks',
'airbnb-typescript',
'plugin:@typescript-eslint/strict',
'next/core-web-vitals',
'plugin:prettier/recommended', // always keep this the last item in the list
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
},
plugins: ['@typescript-eslint', 'react-hooks'],
rules: {
'@typescript-eslint/no-unused-vars': 'error',
'import/prefer-default-export': 'off',
'react/function-component-definition': [
'error',
{ namedComponents: ['arrow-function', 'function-declaration'] },
],
'react/require-default-props': 'off',
},
overrides: [
{
files: ['src/components/ui/**'],
rules: {
'react/jsx-props-no-spreading': 'off',
},
},
{
files: ['**/*.test.ts*'],
plugins: ['vitest'],
extends: ['plugin:testing-library/react', 'plugin:vitest/recommended'],
rules: {
'import/no-extraneous-dependencies': 'off',
'@next/next/no-img-element': 'off',
'react/jsx-props-no-spreading': 'off',
'vitest/expect-expect': [
'error',
{
customExpressions: [
'expect',
...assertFunctionGenerator({
variants: ['get', 'getAll', 'find', 'findAll'],
queries: [
'ByLabelText',
'ByPlaceholderText',
'ByText',
'ByAltText',
'ByTitle',
'ByDisplayValue',
'ByRole',
'ByTestId',
'ByTextWithMarkup',
],
}),
],
},
],
},
},
],
}