-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
81 lines (78 loc) · 2.39 KB
/
Copy patheslint.config.js
File metadata and controls
81 lines (78 loc) · 2.39 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
import cspellPlugin from '@cspell/eslint-plugin';
import eslintJsPlugin from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import prettierPlugin from 'eslint-plugin-prettier';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import reactRefreshPlugin from 'eslint-plugin-react-refresh';
import globals from 'globals';
import tsEslint from 'typescript-eslint';
const typescriptConfigs = /** @type {import('eslint').Linter.Config[]} */ (
tsEslint.config({
plugins: {
'@typescript-eslint': tsEslint.plugin,
},
languageOptions: {
parser: tsEslint.parser,
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
globals: { ...globals.browser, ...globals.es2020 },
},
extends: [tsEslint.configs.strictTypeChecked, tsEslint.configs.stylisticTypeChecked],
})
);
/**
* @type {import('eslint').Linter.Config[]}
*/
const eslintConfig = [
{ ignores: ['node_modules', 'dist'] },
{ linterOptions: { reportUnusedDisableDirectives: true } },
eslintJsPlugin.configs.recommended,
...typescriptConfigs,
{
files: ['**/*.{,c,m}{j,t}s{,x}'],
plugins: {
'react-hooks': reactHooksPlugin,
'react-refresh': reactRefreshPlugin,
react: reactPlugin,
},
rules: {
...reactPlugin.configs.recommended.rules,
...reactPlugin.configs['jsx-runtime'].rules,
...reactHooksPlugin.configs.recommended.rules,
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
},
settings: {
react: { version: '18.3.1' },
},
},
{
plugins: { '@cspell': cspellPlugin },
rules: {
'@cspell/spellchecker': [
'warn',
/** @type {import('@cspell/eslint-plugin').Options} */ ({
autoFix: true,
generateSuggestions: true,
numSuggestions: 3,
configFile: new URL('./cspell.config.yaml', import.meta.url).toString(),
}),
],
},
},
eslintConfigPrettier,
{
plugins: { prettier: prettierPlugin },
rules: { 'prettier/prettier': 'error' },
},
{
rules: {
'@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true }],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'react/no-unknown-property': 'off',
},
},
];
export default eslintConfig;