forked from shirumesu/NeoPot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
117 lines (106 loc) · 2.73 KB
/
Copy patheslint.config.js
File metadata and controls
117 lines (106 loc) · 2.73 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import js from '@eslint/js'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import reactPlugin from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import prettierConfig from 'eslint-config-prettier'
export default tseslint.config(
// Ignored paths
{
ignores: ['node_modules', 'dist', 'out', '.vite', 'spec', 'docs', 'test-results', '**/*.cjs'],
},
// Base JS rules
js.configs.recommended,
// TypeScript rules
...tseslint.configs.recommended,
// React core rules
{
files: ['**/*.{jsx,tsx}'],
plugins: {
react: reactPlugin,
},
rules: {
...reactPlugin.configs.recommended.rules,
...reactPlugin.configs['jsx-runtime'].rules,
'react/prop-types': 'off',
},
settings: {
react: {
version: 'detect',
},
},
},
// React Hooks rules
{
files: ['**/*.{jsx,tsx}'],
plugins: {
'react-hooks': reactHooks,
},
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
},
},
// TypeScript-specific adjustments
{
files: ['**/*.{ts,tsx}'],
rules: {
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-duplicate-enum-values': 'warn',
'@typescript-eslint/no-empty-function': 'warn',
'prefer-const': 'warn',
},
},
// Renderer files (browser + Electron APIs)
{
files: ['src/renderer/**/*.{ts,tsx,js}'],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'no-console': 'error',
},
},
// Main and preload process files (pure Node)
{
files: ['src/main/**/*.{ts,tsx}', 'src/preload/**/*.{ts,tsx}'],
languageOptions: {
globals: globals.node,
},
rules: {
'no-console': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
},
},
// Build configuration and scripts
{
files: ['*.config.{js,ts}', '.scripts/**/*.mjs'],
languageOptions: {
globals: globals.node,
},
rules: {
'prefer-const': 'warn',
'@typescript-eslint/no-require-imports': 'off',
},
},
// Automated tests execute in Node, with browser globals available to DOM and Electron journeys.
{
files: ['tests/**/*.{js,mjs,ts,tsx}'],
languageOptions: {
globals: {
...globals.node,
...globals.browser,
},
},
rules: {
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
},
},
// Disable rules that conflict with Prettier (must be last)
prettierConfig,
)