-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy patheslint.config.mjs
73 lines (68 loc) · 2.22 KB
/
eslint.config.mjs
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
import path from 'path';
import { fileURLToPath } from 'url';
import eslint from '@eslint/js';
import { includeIgnoreFile } from '@eslint/compat';
import globals from 'globals';
import tsLint from 'typescript-eslint';
import reactRefresh from 'eslint-plugin-react-refresh';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import electronToolkit from '@electron-toolkit/eslint-config-ts';
import importPlugin from 'eslint-plugin-import';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import promiseConfigs from 'eslint-plugin-promise';
// mimic CommonJS variables -- not needed if using CommonJS
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, '.gitignore');
const data = includeIgnoreFile(gitignorePath);
export default tsLint.config(
{
...data,
ignores: [...data.ignores, 'prettier.config.cjs', 'postcss.config.cjs', 'eslint.config.mjs']
},
eslint.configs.recommended,
electronToolkit.configs.recommended,
jsxA11y.flatConfigs.recommended,
reactHooks.configs['recommended-latest'],
reactRefresh.configs.recommended,
{
files: ['**/**/*.{js,ts,jsx,tsx}'],
plugins: {
react: react
},
extends: [importPlugin.flatConfigs.recommended, importPlugin.flatConfigs.typescript],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx']
},
react: {
version: 'detect'
}
},
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node
}
}
},
tsLint.configs.recommended,
promiseConfigs.configs['flat/recommended'],
{
rules: {
'react-refresh/only-export-components': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'import/no-unresolved': 'off',
'import/named': 'off',
'promise/always-return': ['warn', { ignoreLastCallback: true }],
'@typescript-eslint/no-explicit-any': 'off',
'react/no-unescaped-entities': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'no-useless-escape': 'off'
}
}
);