-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
80 lines (76 loc) · 2.18 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// @ts-check
import globals from 'globals'
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
import reactPlugin from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import eslintPluginImport from 'eslint-plugin-import'
import eslintConfigPrettier from 'eslint-config-prettier'
import jest from 'eslint-plugin-jest'
import { FlatCompat } from '@eslint/eslintrc'
const compat = new FlatCompat()
const reactRecommended = {
...reactPlugin.configs.recommended
}
delete reactRecommended.parserOptions
delete reactRecommended.plugins
/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigFile} */
export default [
eslint.configs.recommended,
...tseslint.configs.recommended,
...compat.extends('eslint-config-standard'),
eslintConfigPrettier,
{
ignores: [
'**/dist',
'**/.yarn'
]
},
{
files: ['**/*.test.js'],
...jest.configs['flat/recommended'],
rules: {
...jest.configs['flat/recommended'].rules,
'jest/expect-expect': 0,
'jest/no-standalone-expect': 0
}
},
{
files: ['**/*.js', '**/*.ts', '**/*.jsx', '**/*.tsx'],
...reactRecommended,
languageOptions: {
...reactPlugin.configs.recommended.languageOptions,
globals: {
...globals.serviceworker,
...globals.browser
}
},
plugins: {
react: reactPlugin,
'react-hooks': reactHooks,
import: eslintPluginImport
},
rules: {
...eslint.configs.recommended.rules,
...tseslint.configs.recommended.rules,
'react/prop-types': 0,
'jsx-quotes': ['error', 'prefer-single'],
// Safe to disable the following rules as TSC will throw, ESLint doesn't understand interfaces properly,
// https://github.com/eslint/typescript-eslint-parser/issues/437
// source: https://github.com/ts-engine/ts-engine/blob/master/packages/eslint-config/index.js#L31
'no-undef': 'off',
// "@typescript-eslint/no-unused-vars",
'no-unused-vars': 'off',
'import/named': 'off',
'import/no-unresolved': 'off'
},
settings: {
react: {
version: 'detect'
},
jest: {
version: 'detect'
}
}
}
]