-
Notifications
You must be signed in to change notification settings - Fork 217
/
eslint.config.js
58 lines (55 loc) · 1.5 KB
/
eslint.config.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
// @ts-expect-error no types
import js from '@eslint/js'
// @ts-expect-error no types
import { FlatCompat } from '@eslint/eslintrc'
import globals from 'globals'
import eslintTsParser from '@typescript-eslint/parser'
import tsPlugin from '@typescript-eslint/eslint-plugin'
const compat = new FlatCompat()
export default [
js.configs.recommended,
...compat.extends('plugin:@typescript-eslint/recommended'),
{
languageOptions: {
parser: eslintTsParser,
globals: {
...globals.browser,
},
},
files: ['**/*.{ts,tsx}'],
plugins: {
'@typescript-eslint': tsPlugin,
},
rules: {
...tsPlugin.configs.recommended?.rules,
'@typescript-eslint/no-unused-vars': [
'warn', // or "error"
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-inferrable-types': 'off', // always allow explicit typings
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }],
'@typescript-eslint/ban-ts-comment': [
'error',
{ 'ts-ignore': 'allow-with-description' },
],
'no-constant-condition': ['error', { checkLoops: false }],
eqeqeq: ['error'],
},
},
{
files: ['**/*.cjs'],
languageOptions: {
globals: {
...globals.node,
},
},
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
]