-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy patheslint.config.ts
More file actions
72 lines (71 loc) · 1.79 KB
/
eslint.config.ts
File metadata and controls
72 lines (71 loc) · 1.79 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
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import globals from 'globals';
import { defineConfig } from 'eslint/config';
export default defineConfig(
// Base configs for all files
js.configs.recommended,
{
languageOptions: {
globals: {
...globals.node,
},
},
},
// TypeScript strict rules only for .ts files
{
files: ['**/*.ts'],
extends: [...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-base-to-string': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
},
},
// Disable type checking for all JS files
{
files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
...tseslint.configs.disableTypeChecked,
},
// Test files get Mocha globals
{
files: ['test/**/*.mjs', 'test/**/*.spec.mjs', 'test/**/*.spec.js'],
languageOptions: {
globals: {
...globals.mocha,
},
},
},
// Index files - allow CommonJS patterns
{
files: ['index.js', 'index.mjs'],
rules: {
'no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'no-delete-var': 'off', // Allow delete for dynamic properties
},
},
// Ignore patterns
{
ignores: ['node_modules/', 'data/', '.git/', 'coverage/', '*.config.js', '*.config.mjs', '.*.js', '.*.mjs'],
}
);