-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
130 lines (125 loc) · 3.85 KB
/
Copy patheslint.config.js
File metadata and controls
130 lines (125 loc) · 3.85 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
118
119
120
121
122
123
124
125
126
127
128
129
// ESLint v9 flat config for TypeScript + React (ESM)
// See: https://typescript-eslint.io/getting-started/typed-linting/
import js from '@eslint/js';
import globals from 'globals';
import reactPlugin from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import tseslint from 'typescript-eslint';
export default [
// Global linter options
{
linterOptions: {
reportUnusedDisableDirectives: 'off'
}
},
{
ignores: [
'dist/**',
'playwright-report/**',
'test-results/**',
'node_modules/**',
'public/**',
'artifacts/**',
'retired_files/**',
// Generated or externalized types; lint lightly later
'src/types/**'
]
},
js.configs.recommended,
// Node scripts: recognize Node globals and common patterns
{
files: ['scripts/**/*.{js,mjs,ts}'],
languageOptions: {
globals: {
...globals.node
}
},
rules: {
// Script utilities often log intentionally
'no-console': 'off',
// Allow CommonJS in .js files (require/module)
'no-undef': 'off',
// Mirror the application convention: ignore intentionally-unused caught
// errors and `_`-prefixed bindings so diagnostic scripts stay clean.
'no-unused-vars': ['error', {
args: 'none',
caughtErrors: 'none',
varsIgnorePattern: '^_',
ignoreRestSiblings: true
}]
}
},
...tseslint.config({
files: ['**/*.{ts,tsx}'],
extends: [
...tseslint.configs.recommended,
...tseslint.configs.stylistic
],
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
},
plugins: {
react: reactPlugin,
'react-hooks': reactHooks
},
rules: {
// React
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'react-hooks/rules-of-hooks': 'error',
// Disable exhaustive-deps for now due to numerous false positives with Zustand store hooks
'react-hooks/exhaustive-deps': 'off',
// TypeScript
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrors: 'none', ignoreRestSiblings: true }],
'@typescript-eslint/consistent-type-imports': ['warn', { prefer: 'type-imports' }],
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/consistent-generic-constructors': 'off',
'@typescript-eslint/prefer-function-type': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/consistent-type-definitions': ['warn', 'interface'],
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': 'allow-with-description' }],
'@typescript-eslint/no-empty-function': 'off',
// General
// Allow console usage broadly; consider migrating to structured logger later
'no-console': 'off',
'no-empty': 'off',
'no-async-promise-executor': 'error',
'no-constant-condition': 'warn'
},
settings: {
react: {
version: 'detect'
}
}
}),
// Test files overrides: relax React Hooks and typing strictness for Playwright/Vitest
{
files: [
'tests/**/*.{ts,tsx}',
'**/*.test.{ts,tsx}',
'**/*.spec.{ts,tsx}',
'src/**/__tests__/**/*.{ts,tsx}'
],
rules: {
'react-hooks/rules-of-hooks': 'off',
'react-hooks/exhaustive-deps': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/consistent-generic-constructors': 'off'
}
},
// Final global softeners to keep broadened lint green during migration
{
files: ['**/*.{ts,tsx,js,mjs}'],
rules: {
'no-empty-function': 'off',
'no-constant-condition': 'warn',
'prefer-const': 'warn'
}
}
];