-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
99 lines (88 loc) · 3.19 KB
/
eslint.config.js
File metadata and controls
99 lines (88 loc) · 3.19 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
// Flat config — minimal rule set that mechanises the conventions
// already written in CLAUDE.md. See HARNESS.md for the steering loop
// (when a class of issue recurs, prefer encoding it here over re-stating
// it in docs).
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import svelte from 'eslint-plugin-svelte';
import prettier from 'eslint-config-prettier';
import svelteParser from 'svelte-eslint-parser';
import globals from 'globals';
export default [
{
ignores: ['.svelte-kit/**', 'build/**', 'coverage/**', 'node_modules/**', 'static/**', '.wrangler/**', 'dist/**']
},
js.configs.recommended,
...tseslint.configs.recommended,
...svelte.configs['flat/recommended'],
prettier,
...svelte.configs['flat/prettier'],
{
languageOptions: {
globals: { ...globals.browser, ...globals.node },
ecmaVersion: 2024,
sourceType: 'module',
parserOptions: { extraFileExtensions: ['.svelte'] }
},
rules: {
// CLAUDE.md: "No `as any` or `@ts-ignore` — type properly".
// Warn for now — full cleanup is tracked separately; `validate`
// fails only on errors so existing call sites don't block.
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/ban-ts-comment': 'error',
// Stop merge of forgotten _-debugging without blocking intentional
// throwaway names. Soft-landed (warn) so existing call sites
// don't block; new code stays clean via the .claude post-tool-use
// hook surfacing warnings during edit.
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}
],
// Cloudflare Workers: secrets/config flow through platform.env,
// not process.env. Test setup needs a process.env override
// (configured in the test override below).
'no-restricted-globals': [
'error',
{ name: 'process', message: 'Use platform.env (Cloudflare Workers). Tests may override.' }
],
// Catch the typical AI-leaning slop.
'no-console': ['warn', { allow: ['warn', 'error'] }],
// We do not use `eval` / `new Function`.
'no-eval': 'error',
'no-implied-eval': 'error',
// Style/best-practice rules that flag real-but-stylistic issues
// across the existing codebase. Soft-landed as warn so `validate`
// stays green; HARNESS.md documents the path to promote them.
'svelte/require-each-key': 'warn',
'svelte/no-navigation-without-resolve': 'warn',
'svelte/prefer-svelte-reactivity': 'warn',
'svelte/no-useless-mustaches': 'warn',
'svelte/no-at-html-tags': 'warn',
'no-useless-escape': 'warn',
'no-useless-assignment': 'warn',
'prefer-const': 'warn'
}
},
{
files: ['**/*.svelte'],
languageOptions: {
parser: svelteParser,
parserOptions: { parser: tseslint.parser, extraFileExtensions: ['.svelte'] }
}
},
// Test files and test infra freely use `any`, `process.env`, and
// console.log. That's not a lapse — mocks and seed scripts need it.
{
files: ['**/*.{test,spec}.{ts,js}', 'src/lib/test/**', 'src/smoke-tests/**', 'scripts/**'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'no-restricted-globals': 'off',
'no-console': 'off'
}
}
];