-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
105 lines (95 loc) · 2.94 KB
/
eslint.config.js
File metadata and controls
105 lines (95 loc) · 2.94 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
import js from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsparser from '@typescript-eslint/parser';
import prettier from 'eslint-plugin-prettier';
import prettierConfig from 'eslint-config-prettier';
export default [
js.configs.recommended,
{
files: ['src/**/*.ts'],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: './tsconfig.eslint.json'
}
},
plugins: {
'@typescript-eslint': tseslint,
prettier: prettier
},
rules: {
// TypeScript ESLint recommended rules
...tseslint.configs.recommended.rules,
// Prettier integration
'prettier/prettier': 'error',
// Converted from TSLint rules
'curly': ['error', 'multi-line', 'consistent'],
'max-classes-per-file': ['error', 5],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'variable',
format: ['camelCase', 'PascalCase'],
leadingUnderscore: 'allow'
}
],
'sort-imports': 'off', // equivalent to ordered-imports: false
'sort-keys': 'off', // equivalent to object-literal-sort-keys: false
// Additional TypeScript-specific rules
'@typescript-eslint/no-unused-vars': ['error', {argsIgnorePattern: '^_'}],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
// Allow multiple variable declarations per statement (from TSLint config)
'one-var': 'off',
// Disable some rules that might be too strict for this project
'@typescript-eslint/no-inferrable-types': 'off'
}
},
// Configuration for test files
{
files: ['test/**/*.ts'],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: './tsconfig.eslint.json'
},
globals: {
describe: 'readonly',
it: 'readonly',
test: 'readonly',
expect: 'readonly',
beforeAll: 'readonly',
afterAll: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
jest: 'readonly'
}
},
plugins: {
'@typescript-eslint': tseslint,
prettier: prettier
},
rules: {
// TypeScript ESLint recommended rules
...tseslint.configs.recommended.rules,
// Prettier integration
'prettier/prettier': 'error',
// Test-specific rule overrides
'@typescript-eslint/no-unused-vars': ['error', {argsIgnorePattern: '^_'}],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-expressions': 'off', // Allow for Chai expressions
// Allow multiple variable declarations per statement
'one-var': 'off',
// Disable some rules that might be too strict for test files
'@typescript-eslint/no-inferrable-types': 'off'
}
},
prettierConfig // This should be last to override other formatting rules
];