-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.js
More file actions
109 lines (108 loc) · 2.9 KB
/
eslint.config.js
File metadata and controls
109 lines (108 loc) · 2.9 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
import js from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
export default [
js.configs.recommended,
{
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
...globals.es2025,
// Third-party library globals (loaded via script tags)
Chart: 'readonly',
d3: 'readonly',
Papa: 'readonly',
ChartUtils: 'readonly',
},
},
rules: {
// Override/add rules here
'no-unused-vars': ['warn', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
}],
'no-console': 'off', // Allow console in scripts
'no-undef': 'error',
'no-unreachable': 'error',
'no-constant-condition': ['error', { checkLoops: false }],
},
},
{
// TypeScript file configuration with type-safety rules
files: ['**/*.ts'],
plugins: {
'@typescript-eslint': tseslint.plugin,
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
globals: {
...globals.node,
...globals.es2025,
},
},
rules: {
'no-unused-vars': 'off', // TypeScript compiler handles this via noUnusedLocals
'no-undef': 'off', // TypeScript compiler handles this
'no-redeclare': 'off', // TypeScript handles this
'no-console': 'off',
// Type-safety rules — warn to flag existing usage, enforce in new code
'@typescript-eslint/no-explicit-any': 'warn',
},
},
{
// Test-specific configuration
files: ['tests/**/*.test.js', 'tests/**/*.test.ts', '**/*.test.js', '**/*.test.ts'],
languageOptions: {
globals: {
...globals.node,
...globals.es2025,
describe: 'readonly',
it: 'readonly',
expect: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
beforeAll: 'readonly',
afterAll: 'readonly',
vi: 'readonly',
},
},
},
{
// Service Worker — runs in ServiceWorkerGlobalScope, not Window
files: ['public/sw.js'],
languageOptions: {
globals: {
...globals.serviceworker,
},
},
},
{
// Ignore patterns
ignores: [
'node_modules/**',
'dist/**',
'coverage/**',
'cypress/**',
'builds/**',
'docs/coverage/**',
'docs/test-results/**',
'docs/cypress/**',
'docs/dependencies/**',
'docs/api/assets/**', // Ignore generated TypeDoc assets
'*.min.js',
'js/lib/**', // Ignore vendored libraries
'dashboard/lib/**',
'api/scripts/**', // Ignore generated JSDoc prettify scripts
'docs/api/scripts/**', // Ignore generated JSDoc prettify scripts
'api/assets/**', // Ignore TypeDoc generated assets
],
},
];