-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy patheslint.config.js
More file actions
68 lines (63 loc) · 2.09 KB
/
eslint.config.js
File metadata and controls
68 lines (63 loc) · 2.09 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
import tseslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import prettier from 'eslint-config-prettier'
export default [
// --------------------------------------------------
// Base TypeScript rules – no type-aware linting here
// --------------------------------------------------
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: tsParser,
parserOptions: {sourceType: 'module'}, // ⬅️ removed project:true
},
plugins: {'@typescript-eslint': tseslint},
rules: {
...tseslint.configs.recommended.rules,
},
},
// --------------------------------------------------
// Backend – type-aware (uses its tsconfig.json)
// --------------------------------------------------
{
files: ['apps/backend/**/*.{ts,tsx}'],
languageOptions: {
parserOptions: {
project: ['./apps/backend/tsconfig.json'],
tsconfigRootDir: new URL('.', import.meta.url).pathname,
},
},
},
// --------------------------------------------------
// UI – React + type-aware (uses both tsconfigs)
// --------------------------------------------------
{
files: ['apps/ui/**/*.{ts,tsx}'],
plugins: {react, 'react-hooks': reactHooks},
languageOptions: {
globals: {JSX: 'readonly'},
parserOptions: {
project: ['./apps/ui/tsconfig.app.json', './apps/ui/tsconfig.node.json'],
tsconfigRootDir: new URL('.', import.meta.url).pathname,
},
},
rules: {
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
// stylistic rules handled by Prettier
'react/jsx-indent': 'off',
'react/jsx-indent-props': 'off',
'react/jsx-closing-bracket-location': 'off',
'react/jsx-curly-newline': 'off',
// React 17+ JSX transform: React import no longer needed
'react/react-in-jsx-scope': 'off',
},
settings: {react: {version: 'detect'}},
},
// --------------------------------------------------
// Disable any rule that clashes with Prettier
// --------------------------------------------------
prettier,
]