1+ /**
2+ * ESLint Configuration for VS Code Python Extension
3+ * This file configures linting rules for the TypeScript/JavaScript codebase.
4+ * It uses the new flat config format introduced in ESLint 8.21.0
5+ */
6+
7+ // Import essential ESLint plugins and configurations
18import tseslint from '@typescript-eslint/eslint-plugin' ;
29import tsParser from '@typescript-eslint/parser' ;
310import noOnlyTests from 'eslint-plugin-no-only-tests' ;
@@ -6,8 +13,8 @@ import importPlugin from 'eslint-plugin-import';
613import js from '@eslint/js' ;
714
815export default [
16+ // Base configuration for all files
917 {
10- // Base JS recommended config
1118 ignores : [ '**/node_modules/**' , '**/out/**' ] ,
1219 linterOptions : {
1320 reportUnusedDisableDirectives : 'off' ,
@@ -17,6 +24,7 @@ export default [
1724 'no-undef' : 'off' ,
1825 } ,
1926 } ,
27+ // TypeScript-specific configuration
2028 {
2129 files : [ '**/*.ts' , '**/*.tsx' ] ,
2230 languageOptions : {
@@ -53,47 +61,91 @@ export default [
5361 } ,
5462 } ,
5563 rules : {
56- 'import/no-unresolved' : 'off' , // ✅ Suppresses errors for "import/no-unresolved"
57- // ✅ Suppresses undefined variable errors (e.g., "suite" not defined)
58- '@typescript-eslint/explicit-module-boundary-types' : 'off' , // ✅ Suppresses function return type errors
64+ // Base configurations
5965 ...tseslint . configs . recommended . rules ,
6066 ...prettier . rules ,
6167
68+ // TypeScript-specific rules
6269 '@typescript-eslint/ban-ts-comment' : [
6370 'error' ,
6471 {
6572 'ts-ignore' : 'allow-with-description' ,
6673 } ,
6774 ] ,
68- 'no-bitwise' : 'off' ,
69- 'no-dupe-class-members' : 'off' ,
70- '@typescript-eslint/no-dupe-class-members' : 'error' ,
75+ '@typescript-eslint/ban-types' : 'off' ,
76+ '@typescript-eslint/explicit-module-boundary-types' : 'off' ,
7177 '@typescript-eslint/no-empty-interface' : 'off' ,
78+ '@typescript-eslint/no-explicit-any' : 'off' ,
79+ '@typescript-eslint/no-namespace' : 'off' ,
7280 '@typescript-eslint/no-non-null-assertion' : 'off' ,
81+ '@typescript-eslint/no-loss-of-precision' : 'off' ,
82+ '@typescript-eslint/no-unused-vars' : [
83+ 'warn' ,
84+ {
85+ varsIgnorePattern : '^_' ,
86+ argsIgnorePattern : '^_' ,
87+ } ,
88+ ] ,
89+ '@typescript-eslint/no-var-requires' : 'off' ,
7390 '@typescript-eslint/no-use-before-define' : [
7491 'error' ,
7592 {
7693 functions : false ,
7794 } ,
7895 ] ,
7996
80- 'no-useless-constructor' : 'off' ,
81- '@typescript-eslint/no-useless-constructor' : 'error' ,
82- '@typescript-eslint/no-var-requires' : 'off' ,
83- 'func-names' : 'off' ,
97+ // Import rules
8498 'import/extensions' : 'off' ,
8599 'import/namespace' : 'off' ,
86100 'import/no-extraneous-dependencies' : 'off' ,
101+ 'import/no-unresolved' : 'off' ,
87102 'import/prefer-default-export' : 'off' ,
103+
104+ // Testing rules
105+ 'no-only-tests/no-only-tests' : [
106+ 'error' ,
107+ {
108+ block : [ 'test' , 'suite' ] ,
109+ focus : [ 'only' ] ,
110+ } ,
111+ ] ,
112+
113+ // Code style rules
88114 'linebreak-style' : 'off' ,
89- 'no-await-in-loop ' : 'off' ,
115+ 'no-bitwise ' : 'off' ,
90116 'no-console' : 'off' ,
117+ 'no-underscore-dangle' : 'off' ,
118+ 'operator-assignment' : 'off' ,
119+ 'func-names' : 'off' ,
120+
121+ // Error handling and control flow
122+ 'no-empty' : [ 'error' , { allowEmptyCatch : true } ] ,
123+ 'no-async-promise-executor' : 'off' ,
124+ 'no-await-in-loop' : 'off' ,
125+ 'no-unreachable' : 'off' ,
126+ 'no-void' : 'off' ,
127+
128+ // Duplicates and overrides (TypeScript handles these)
129+ 'no-dupe-class-members' : 'off' ,
130+ '@typescript-eslint/no-dupe-class-members' : 'error' ,
131+ 'no-redeclare' : 'off' ,
132+ 'no-undef' : 'off' ,
133+ 'no-useless-constructor' : 'off' ,
134+ '@typescript-eslint/no-useless-constructor' : 'error' ,
135+
136+ // Miscellaneous rules
91137 'no-control-regex' : 'off' ,
92138 'no-extend-native' : 'off' ,
139+ 'no-inner-declarations' : 'off' ,
93140 'no-multi-str' : 'off' ,
94- 'no-shadow' : 'off' ,
95141 'no-param-reassign' : 'off' ,
96142 'no-prototype-builtins' : 'off' ,
143+ 'no-empty-function' : 'off' ,
144+ 'no-template-curly-in-string' : 'off' ,
145+ 'no-useless-escape' : 'off' ,
146+ strict : 'off' ,
147+
148+ // Restricted syntax
97149 'no-restricted-syntax' : [
98150 'error' ,
99151 {
@@ -112,30 +164,6 @@ export default [
112164 '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.' ,
113165 } ,
114166 ] ,
115- 'no-template-curly-in-string' : 'off' ,
116- 'no-underscore-dangle' : 'off' ,
117- 'no-useless-escape' : 'off' ,
118- 'no-void' : 'off' ,
119- 'operator-assignment' : 'off' ,
120- strict : 'off' ,
121- 'no-only-tests/no-only-tests' : [ 'error' , { block : [ 'test' , 'suite' ] , focus : [ 'only' ] } ] ,
122- 'class-methods-use-this' : 'off' ,
123- '@typescript-eslint/ban-types' : 'off' ,
124- // '@typescript-eslint/no-empty-function': 'off',
125- // 'import/no-unresolved': ['error', { ignore: ['vscode'] }],
126- '@typescript-eslint/no-explicit-any' : 'off' ,
127- // add no-unreachable
128- 'no-unreachable' : 'off' ,
129- //add @typescript -eslint/no-empty-function
130- 'no-empty-function' : 'off' ,
131- 'no-redeclare' : 'off' ,
132- '@typescript-eslint/no-loss-of-precision' : 'off' , // add @typescript -eslint/no-loss-of-precision
133- 'no-empty' : [ 'error' , { allowEmptyCatch : true } ] ,
134- 'no-inner-declarations' : 'off' ,
135- 'no-async-promise-executor' : 'off' ,
136- '@typescript-eslint/no-namespace' : 'off' ,
137- '@typescript-eslint/no-unused-vars' : [ 'warn' , { varsIgnorePattern : '^_' , argsIgnorePattern : '^_' } ] ,
138- 'no-undef' : 'off' ,
139167 } ,
140168 } ,
141169] ;
0 commit comments