-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy path.eslintrc.js
118 lines (118 loc) · 2.87 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
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
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'airbnb-typescript',
'plugin:prettier/recommended',
'prettier',
'plugin:@next/next/recommended',
],
settings: {
next: {
rootDir: 'site/',
},
},
parserOptions: {
project: 'tsconfig.eslint.json',
},
plugins: ['cup', 'header', 'prettier', 'react-hooks', 'import'],
env: {
jest: true,
},
globals: {
page: true,
browser: true,
context: true,
cy: true,
Cypress: true,
window: true,
},
rules: {
'no-undef': 'off',
'react/prop-types': 'off',
'react/forbid-prop-types': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/jsx-props-no-spreading': 'off',
'react/require-default-props': 'off',
// The latest eslint package will flag type imports and cannot be fixed by setting devDependencies to true.
// There is an open pr for this: https://github.com/import-js/eslint-plugin-import/issues/1618
// This rule has been disabled in individual files instead
'import/no-extraneous-dependencies': [
'error',
{optionalDependencies: false, devDependencies: true},
],
'import/prefer-default-export': 'off',
'arrow-body-style': ['error', 'as-needed'],
'react/jsx-one-expression-per-line': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'import/no-unresolved': ['error', {ignore: ['csstype']}],
'prettier/prettier': [
'error',
{
singleQuote: true,
trailingComma: 'all',
bracketSpacing: false,
arrowParens: 'avoid',
},
],
'no-plusplus': ['error', {allowForLoopAfterthoughts: true}],
},
overrides: [
{
files: ['*.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
{
files: ['*.tsx'],
env: {
browser: true,
},
},
{
files: ['*.test.ts', '*.test.tsx'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
{
files: ['src/!(test)/*.ts', 'src/!(test)/*.tsx'],
rules: {
'import/no-extraneous-dependencies': [
'error',
{optionalDependencies: false, devDependencies: false},
],
},
},
{
files: ['site/**/*.ts', 'site/**/*.tsx'],
rules: {
'react/display-name': 'off',
'import/no-unresolved': [
'error',
{ignore: ['newskit', 'csstype', '@components/page-title']},
],
},
},
{
files: ['cypress/**/*.spec.js'],
env: {
mocha: true,
},
},
{
files: ['site/**/*.tsx'],
rules: {
'import/no-anonymous-default-export': [
'error',
{
allowArrowFunction: false,
allowAnonymousClass: false,
allowAnonymousFunction: false,
},
],
},
},
],
};