-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patheslint.config.mjs
More file actions
120 lines (116 loc) · 3.99 KB
/
eslint.config.mjs
File metadata and controls
120 lines (116 loc) · 3.99 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
110
111
112
113
114
115
116
117
118
119
120
import js from '@eslint/js';
import prettier from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import tseslint from 'typescript-eslint';
export default tseslint.config(
// Base JavaScript configuration for all files
js.configs.recommended,
// TypeScript configuration for .ts files only
{
files: ['src/**/*.ts'],
extends: [...tseslint.configs.recommended, ...tseslint.configs.recommendedTypeChecked],
plugins: {
import: importPlugin,
},
languageOptions: {
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
project: './tsconfig.node.json',
tsconfigRootDir: import.meta.dirname,
},
},
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: './tsconfig.node.json',
},
},
},
rules: {
'no-debugger': 'off',
// Import ordering and organization rules
'import/order': [
'error',
{
groups: [
'builtin', // Node.js built-in modules
'external', // npm packages
'internal', // Internal modules (configured with path mapping)
'parent', // ../
'sibling', // ./
'index', // ./index
],
'newlines-between': 'never',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'import/first': 'error',
'import/no-duplicates': 'error',
'import/no-unresolved': 'off', // TypeScript handles this
'import/extensions': ['error', 'ignorePackages', { ts: 'never' }],
// TypeScript import rules
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
disallowTypeAnnotations: false,
fixStyle: 'separate-type-imports',
},
],
'@typescript-eslint/consistent-type-exports': [
'error',
{
fixMixedExportsWithInlineTypeSpecifier: true,
},
],
// Custom rules - balanced approach for development
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/no-base-to-string': 'off', // Common pattern in VS Code
'@typescript-eslint/no-duplicate-type-constituents': 'off', // False positives
'@typescript-eslint/no-explicit-any': 'off', // Allowing any for flexibility... for now
'@typescript-eslint/no-floating-promises': 'off', // Too strict for VS Code extension patterns
'@typescript-eslint/no-misused-promises': 'off', // Common in VS Code APIs
'@typescript-eslint/no-redundant-type-constituents': 'off', // False positives
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'@typescript-eslint/no-unsafe-assignment': 'off', // Too strict for dynamic APIs
'@typescript-eslint/no-unsafe-member-access': 'off', // Too strict for dynamic APIs
'@typescript-eslint/no-unsafe-argument': 'off', // Too strict for dynamic APIs
'@typescript-eslint/no-unsafe-return': 'off', // Too strict for dynamic APIs
'@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: false }],
'@typescript-eslint/prefer-optional-chain': 'warn',
'@typescript-eslint/prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
'@typescript-eslint/restrict-template-expressions': 'off', // Too strict for logging
'@typescript-eslint/unbound-method': 'off', // Too strict for VS Code APIs
},
},
{
ignores: [
'dist/',
'node_modules/',
'*.js',
'webpack.config.mjs',
'scripts/',
'.vscode-test/',
'.vscode-test-web/',
'LICENSE',
'ThirdPartyNotices.txt',
],
},
prettier,
);