11import typescriptEslint from "@typescript-eslint/eslint-plugin" ;
22import tsParser from "@typescript-eslint/parser" ;
33
4- export default [ {
5- files : [ "**/*.ts" ] ,
6- } , {
4+ export default [
5+ {
6+ ignores : [ "dist/**" , "node_modules/**" , "assets/**" , ".vscode-test/**" ] ,
7+ } ,
8+ {
9+ files : [ "src/**/*.ts" ] ,
710 plugins : {
8- "@typescript-eslint" : typescriptEslint ,
11+ "@typescript-eslint" : typescriptEslint ,
912 } ,
10-
1113 languageOptions : {
12- parser : tsParser ,
13- ecmaVersion : 2022 ,
14- sourceType : "module" ,
14+ parser : tsParser ,
15+ ecmaVersion : 2022 ,
16+ sourceType : "module" ,
17+ parserOptions : {
18+ project : true ,
19+ tsconfigRootDir : import . meta. dirname ,
20+ } ,
1521 } ,
16-
1722 rules : {
18- "@typescript-eslint/naming-convention" : [ "warn" , {
19- selector : "import" ,
20- format : [ "camelCase" , "PascalCase" ] ,
21- } ] ,
23+ // Naming
24+ "@typescript-eslint/naming-convention" : [
25+ "warn" ,
26+ { selector : "import" , format : [ "camelCase" , "PascalCase" ] } ,
27+ ] ,
28+
29+ // Correctness
30+ curly : "warn" ,
31+ eqeqeq : [ "warn" , "always" ] ,
32+ "@typescript-eslint/only-throw-error" : "warn" ,
33+ "@typescript-eslint/no-floating-promises" : "error" ,
34+ "@typescript-eslint/no-misused-promises" : "error" ,
35+ "@typescript-eslint/await-thenable" : "error" ,
2236
23- curly : "warn" ,
24- eqeqeq : "warn" ,
25- "no-throw-literal" : "warn" ,
26- semi : "warn" ,
37+ // Type safety
38+ "@typescript-eslint/no-explicit-any" : "warn" ,
39+ "@typescript-eslint/no-unsafe-assignment" : "warn" ,
40+ "@typescript-eslint/no-unsafe-member-access" : "warn" ,
41+ "@typescript-eslint/no-unsafe-call" : "warn" ,
42+ "@typescript-eslint/no-unsafe-return" : "warn" ,
43+
44+ // Dead code
45+ "@typescript-eslint/no-unused-vars" : [
46+ "warn" ,
47+ { argsIgnorePattern : "^_" , varsIgnorePattern : "^_" } ,
48+ ] ,
49+ "no-unused-vars" : "off" , // disabled in favour of @typescript -eslint/no-unused-vars
50+
51+ // Code style
52+ semi : "warn" ,
53+ "@typescript-eslint/consistent-type-imports" : [
54+ "warn" ,
55+ { prefer : "type-imports" , fixStyle : "inline-type-imports" } ,
56+ ] ,
57+ "@typescript-eslint/prefer-nullish-coalescing" : "warn" ,
58+ "@typescript-eslint/prefer-optional-chain" : "warn" ,
59+ } ,
60+ } ,
61+ {
62+ // Looser rules for config/test files — no type-aware linting needed
63+ files : [ "*.mjs" , "src/test/**/*.ts" ] ,
64+ plugins : {
65+ "@typescript-eslint" : typescriptEslint ,
66+ } ,
67+ languageOptions : {
68+ parser : tsParser ,
69+ ecmaVersion : 2022 ,
70+ sourceType : "module" ,
71+ } ,
72+ rules : {
73+ curly : "warn" ,
74+ eqeqeq : "warn" ,
75+ semi : "warn" ,
2776 } ,
28- } ] ;
77+ } ,
78+ ] ;
0 commit comments