-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
138 lines (136 loc) · 3.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
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
134
135
136
137
138
// SPDX-FileCopyrightText: Meta Platforms, Inc. and its affiliates
// SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com>
//
// SPDX-License-Identifier: Apache-2.0
// copied and adapted from https://github.com/opossum-tool/OpossumUIconst
sharedRules = {
'@typescript-eslint/array-type': ['error', { default: 'generic' }],
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-magic-numbers': [
'error',
{
ignore: [-1, 0, 1, 2, 100],
ignoreArrayIndexes: true,
ignoreTypeIndexes: true,
},
],
'@typescript-eslint/no-misused-promises': [
'error',
{ checksVoidReturn: false },
],
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/require-await': 'error',
'@typescript-eslint/restrict-template-expressions': [
'error',
{ allowBoolean: true, allowNumber: true, allowNever: true },
],
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'filenames/match-regex': [
'error',
'^[a-zA-Z0-9\\-]+(.d|.test|.style|.util|.util.test)?$',
true,
],
'no-alert': 'error',
'no-console': 'off',
'no-duplicate-imports': 'error',
'no-else-return': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-lone-blocks': 'error',
'no-lonely-if': 'error',
'no-magic-numbers': 'off',
'no-multi-assign': 'error',
'no-nested-ternary': 'off',
'no-new-func': 'error',
'no-restricted-imports': 'error',
'no-return-assign': 'error',
'no-return-await': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-shadow': 'off',
'no-template-curly-in-string': 'error',
'no-throw-literal': 'error',
'no-unused-expressions': 'off',
'no-unused-vars': 'off',
'no-use-before-define': 'off',
'no-useless-call': 'error',
'no-useless-computed-key': 'error',
'no-useless-concat': 'error',
'no-useless-constructor': 'off',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'object-shorthand': 'error',
'prefer-arrow-callback': 'error',
'prefer-template': 'error',
curly: 'error',
eqeqeq: 'error',
quotes: [
'warn',
'single',
{ avoidEscape: true, allowTemplateLiterals: false },
],
yoda: 'error',
};
module.exports = {
env: {
browser: true,
es6: true,
node: true,
jest: true,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
project: ['tsconfig.json'],
},
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:@tanstack/eslint-plugin-query/recommended',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
plugins: ['filenames'],
settings: {
react: {
version: 'detect',
},
},
ignorePatterns: ['.eslintrc.js'],
reportUnusedDisableDirectives: true,
rules: {
...sharedRules,
'react/display-name': 'off',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'testing-library/no-node-access': 'off', // TODO: remove this line and fix warnings
},
overrides: [
{
files: ['**/*.test.ts', '**/*.test.tsx', 'src/testing/**/*'],
rules: {
'@typescript-eslint/no-magic-numbers': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
],
};