-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mts
More file actions
65 lines (64 loc) · 1.7 KB
/
eslint.config.mts
File metadata and controls
65 lines (64 loc) · 1.7 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
import js from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import pluginReact from 'eslint-plugin-react';
import pluginN from 'eslint-plugin-n';
import prettierConfig from 'eslint-config-prettier';
import { defineConfig } from 'eslint/config';
export default defineConfig([
{
ignores: ['eslint.config.mts'],
},
{
files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
plugins: { js },
extends: ['js/recommended'],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},
...tseslint.configs.recommendedTypeChecked.map((config: any) => ({
...config,
languageOptions: {
...config.languageOptions,
parserOptions: {
...config.languageOptions!.parserOptions,
project: ['./src/server/tsconfig.json', './src/client/tsconfig.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})),
{
files: ['**/*.{ts,mts,cts,tsx}'],
// Ignore unused variables starting with an underscore
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
},
pluginReact.configs.flat.recommended,
{
// React 17+ with new JSX transform doesn't require React in scope
rules: {
'react/react-in-jsx-scope': 'off',
},
},
// Inject Node.js rules into the backend
{
files: ['src/server/**/*.{js,mjs,cjs,ts,mts,cts}'],
...pluginN.configs['flat/recommended-script'],
rules: {
'n/no-missing-import': 'off', // TypeScript handles import resolution
},
},
prettierConfig,
]);