-
-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy patheslint.config.js
More file actions
101 lines (98 loc) · 3.04 KB
/
Copy patheslint.config.js
File metadata and controls
101 lines (98 loc) · 3.04 KB
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
import js from '@eslint/js'
import { fixupPluginRules, includeIgnoreFile } from '@eslint/compat'
import { fileURLToPath } from 'node:url'
import globals from 'globals'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import './scripts/typescript-tooling-compat.mjs'
const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url))
const sourceFiles = ['**/*.{js,mjs,ts,mts,jsx,tsx}']
const typeScriptFiles = ['**/*.{ts,mts,tsx}']
const reactRecommended = react.configs.flat.recommended
const { default: tseslint } = await import('typescript-eslint')
export const reactConfig = {
...reactRecommended,
files: sourceFiles,
plugins: {
...reactRecommended.plugins,
react: fixupPluginRules(react),
'react-hooks': fixupPluginRules(reactHooks),
'react-refresh': fixupPluginRules(reactRefresh)
},
rules: {
...reactRecommended.rules,
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
'react/display-name': 'off',
'react/prop-types': 'off'
},
settings: {
react: {
version: 'detect'
}
}
}
export default tseslint.config(
includeIgnoreFile(gitignorePath),
{
linterOptions: {
reportUnusedDisableDirectives: 'off'
}
},
js.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.strict,
...tseslint.configs.stylistic,
{
files: sourceFiles,
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.node,
...globals.browser,
...globals.es2021,
...globals.jest
}
},
rules: {
'linebreak-style': 'off',
'no-async-promise-executor': 'off',
'no-case-declarations': 'off',
'no-cond-assign': 'off',
'no-console': 'off',
'no-constant-condition': 'off',
'no-empty': 'off',
'no-irregular-whitespace': 'off',
'no-undef': 'off',
'no-useless-assignment': 'off',
'no-useless-escape': 'off',
'no-var': 'off',
'preserve-caught-error': 'off',
'prefer-const': 'off',
'indent': ['off', 2],
'quotes': ['error', 'single', { allowTemplateLiterals: true }],
'semi': ['error', 'never'],
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/no-dynamic-delete': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-useless-constructor': 'off',
'@typescript-eslint/prefer-for-of': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off'
}
},
{
files: typeScriptFiles,
rules: {
quotes: 'off'
}
}
)