Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
130 lines (116 loc) · 3.99 KB
/
Copy patheslint.config.js
File metadata and controls
130 lines (116 loc) · 3.99 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
130
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
import importPlugin from 'eslint-plugin-import'
import prettier from 'eslint-config-prettier'
export default tseslint.config(
// Global ignores
{
ignores: [
'**/dist/',
'node_modules/',
'tmp/',
'coverage/',
// Claude Code creates sibling worktrees here, each a full checkout
// with its own packages/, node_modules/, and tsconfigs. Without
// this ignore, eslint's projectService discovers every tsconfig in
// every worktree and OOMs on `eslint .`.
'.claude/worktrees/',
'vitest.config.ts',
'eslint.config.js',
'**/next-env.d.ts',
'**/.next/',
// cucumber-js config requires `export default` — ignore rather than override the rule
'e2e/cucumber.mjs',
// Standalone Node scripts not tracked by any tsconfig
'scripts/**',
],
},
// Base JS rules
eslint.configs.recommended,
// TypeScript strict rules (type-checked)
...tseslint.configs.strictTypeChecked,
// TypeScript-specific overrides
{
plugins: { import: importPlugin },
settings: {
'import/resolver': { typescript: true },
},
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
// Enforce `import type` for type-only imports (AGENTS.md convention)
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', fixStyle: 'separate-type-imports' },
],
// Merge imports from the same module (understands import type vs import value)
'import/no-duplicates': ['error', { 'prefer-inline': false }],
// Allow unused vars prefixed with _ (common pattern for intentional omission)
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
// These are too noisy for template-literal HTML and better-auth interop
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
// Allow non-null assertions — used sparingly with DOM getElementById etc.
'@typescript-eslint/no-non-null-assertion': 'off',
// Relax for Express handler patterns (void-returning async callbacks)
'@typescript-eslint/no-misused-promises': [
'error',
{ checksVoidReturn: { arguments: false } },
],
// No default exports (AGENTS.md convention)
'no-restricted-syntax': [
'error',
{
selector: 'ExportDefaultDeclaration',
message: 'Use named exports instead of default exports.',
},
],
},
},
// Next.js requires default exports for pages, layouts, and route handlers
{
files: ['packages/demo/**/*.{ts,tsx}'],
rules: {
'no-restricted-syntax': 'off',
},
},
// e2e TypeScript files use a standalone tsconfig not referenced by the root —
// disable projectService and point ESLint directly at e2e/tsconfig.e2e.json
{
files: ['e2e/**/*.ts'],
languageOptions: {
parserOptions: {
projectService: false,
project: 'e2e/tsconfig.e2e.json',
tsconfigRootDir: import.meta.dirname,
},
},
},
// This JavaScript helper is executed directly by the E2E workflow and is
// intentionally outside the TypeScript E2E project.
{
files: ['e2e/atmosphere/validate-access.mjs'],
languageOptions: {
globals: { console: 'readonly', process: 'readonly' },
parserOptions: {
projectService: {
allowDefaultProject: ['e2e/atmosphere/validate-access.mjs'],
},
tsconfigRootDir: import.meta.dirname,
},
},
},
// Disable formatting rules that conflict with Prettier
prettier,
)