-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy patheslint.config.js
More file actions
64 lines (58 loc) · 2.42 KB
/
eslint.config.js
File metadata and controls
64 lines (58 loc) · 2.42 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
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
export default tseslint.config(
{
ignores: ['dist/**', 'node_modules/**', '**/*.wgsl', 'examples/**', 'benchmarks/**'],
},
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ['src/**/*.ts'],
languageOptions: {
parserOptions: {
project: ['./tsconfig.json', './tsconfig.test.json'],
},
},
rules: {
// Naming conventions
'@typescript-eslint/naming-convention': [
'error',
{ selector: 'variable', format: ['camelCase', 'UPPER_CASE', 'PascalCase'], leadingUnderscore: 'allow' },
{ selector: 'function', format: ['camelCase', 'PascalCase'], leadingUnderscore: 'allow' },
{ selector: 'typeLike', format: ['PascalCase'] },
{ selector: 'interface', format: ['PascalCase'] },
{ selector: 'enum', format: ['PascalCase'] },
{ selector: 'enumMember', format: ['camelCase', 'PascalCase', 'UPPER_CASE'] },
{ selector: 'parameter', format: ['camelCase'], leadingUnderscore: 'allow' },
],
// Complexity thresholds
'complexity': ['warn', { max: 20 }],
'max-lines': ['warn', { max: 600, skipBlankLines: true, skipComments: true }],
// Code quality
'no-console': 'warn',
'no-debugger': 'error',
'no-duplicate-imports': 'off',
'prefer-const': 'error',
'eqeqeq': ['error', 'always', { null: 'ignore' }],
// TypeScript-specific
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
// Technical debt tracking
'no-warning-comments': ['warn', { terms: ['FIXME', 'HACK', 'XXX'], location: 'start' }],
// preserve-caught-error requires ES2022 Error cause option which conflicts with ES2020 target
'preserve-caught-error': 'off',
},
},
{
files: ['src/**/*.test.ts', 'src/__tests__/**/*.ts', 'src/**/__tests__/**/*.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
},
},
);