-
Notifications
You must be signed in to change notification settings - Fork 11
/
.eslintrc.cjs
125 lines (123 loc) · 3.85 KB
/
.eslintrc.cjs
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
/**
* @type {import("eslint").Linter.Config}
*/
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
warnOnUnsupportedTypeScriptVersion: false,
// this config is needed for type aware lint rules
project: true,
tsconfigRootDir: __dirname,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/strict',
'plugin:@typescript-eslint/stylistic',
'plugin:jsx-a11y/recommended',
'plugin:react/recommended',
'prettier',
'plugin:react-hook-form/recommended',
'plugin:import/recommended',
],
plugins: [
'@typescript-eslint',
'react-hooks',
'prettier',
'jsx-a11y',
'react-hook-form',
'import',
],
settings: {
react: {
version: 'detect',
},
},
env: {
node: true,
},
rules: {
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-empty-object-type': [
'error',
{ allowInterfaces: 'with-single-extends' },
],
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-duplicate-type-constituents': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
],
// disabling the type-aware rules we don't like
// https://typescript-eslint.io/getting-started/typed-linting/
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/only-throw-error': 'off',
'@typescript-eslint/unbound-method': 'off',
eqeqeq: ['error', 'always', { null: 'ignore' }],
'import/no-default-export': 'error',
'import/no-unresolved': 'off', // plugin doesn't know anything
'jsx-a11y/label-has-associated-control': [2, { controlComponents: ['button'] }],
'no-param-reassign': 'error',
'no-restricted-imports': [
'error',
{
paths: [
'.', // preventing confusion due to auto-imports and barrel files
],
patterns: [
// import all CSS except index.css at top level through CSS @import statements
// to avoid bad ordering situations. See https://github.com/oxidecomputer/console/pull/2035
'*.css',
],
},
],
'no-return-assign': 'error',
'no-unused-vars': 'off',
'prefer-arrow-callback': 'off',
'prettier/prettier': 'error',
radix: 'error',
'react-hooks/exhaustive-deps': 'error',
'react-hooks/rules-of-hooks': 'error',
'react/button-has-type': 'error',
'react/jsx-boolean-value': 'error',
'react/display-name': 'off',
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
},
ignorePatterns: ['dist/', 'node_modules/', 'tools/deno/'],
overrides: [
{
// default export is needed in config files
files: ['*.config.ts'],
rules: { 'import/no-default-export': 'off' },
},
{
files: ['*.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
{
files: ['*.e2e.ts'],
extends: ['plugin:playwright/playwright-test'],
rules: {
'playwright/expect-expect': [
'warn',
{ assertFunctionNames: ['expectVisible', 'expectRowVisible', 'expectOptions'] },
],
'playwright/no-force-option': 'off',
},
},
],
}