@@ -5,35 +5,31 @@ const vitest = require("@vitest/eslint-plugin");
55const globals = require ( "globals" ) ;
66const prettier = require ( "eslint-config-prettier" ) ;
77
8- /** @type {import("eslint").Linter.Config[] } */
9- module . exports = [
8+ module . exports = tseslint . config ( [
9+ { ignores : [ "dist/" , "tests/env/" , "coverage/" , "playgrounds/" , "docs/" ] } ,
10+ eslint . configs . recommended ,
1011 {
11- ignores : [ "dist/" , "tests/env/" , "coverage/" , "playgrounds/" , "docs/" ] ,
12+ files : [ "**/*.js" ] ,
13+ languageOptions : { sourceType : "commonjs" , globals : globals . node } ,
1214 } ,
13- // Standard linting for js files
15+ // TSDoc
1416 {
15- files : [ "**/*.js" ] ,
16- languageOptions : { sourceType : "script" , globals : globals . node } ,
17- plugins : { eslint } ,
18- rules : eslint . configs . recommended . rules ,
17+ files : [ "src/**/*.ts" ] ,
18+ plugins : { tsdoc } ,
19+ rules : { "tsdoc/syntax" : "error" } ,
1920 } ,
20- // TypeScript linting for ts files
21- ...tseslint . configs . recommendedTypeChecked . map ( ( config ) => ( {
22- ...config ,
21+ // TypeScript
22+ {
2323 files : [ "**/*.ts" ] ,
24+ extends : [ tseslint . configs . recommendedTypeChecked ] ,
2425 languageOptions : {
25- ...config . languageOptions ,
26- globals : { ...config . languageOptions ?. globals , ...globals . node } ,
2726 parserOptions : {
28- ... config . languageOptions ?. parserOptions ,
29- project : "tsconfig.eslint.json" ,
27+ projectService : true ,
28+ tsconfigRootDir : __dirname ,
3029 } ,
3130 } ,
32- plugins : { ...config . plugins , tsdoc } ,
3331 rules : {
34- ...config . rules ,
35- "tsdoc/syntax" : "error" ,
36- // @TODO : Remove the ones between "~~", adapt code
32+ // TODO: Remove the ones between "~~", adapt code
3733 // ~~
3834 "@typescript-eslint/prefer-as-const" : "off" ,
3935 "@typescript-eslint/ban-ts-comment" : "off" ,
@@ -45,7 +41,7 @@ module.exports = [
4541 "@typescript-eslint/no-floating-promises" : "off" ,
4642 // ~~
4743 "@typescript-eslint/array-type" : [ "warn" , { default : "array-simple" } ] ,
48- // @ TODO : Should be careful with this rule, should leave it be and disable
44+ // TODO: Should be careful with this rule, should leave it be and disable
4945 // it within files where necessary with explanations
5046 "@typescript-eslint/no-explicit-any" : "off" ,
5147 "@typescript-eslint/no-unused-vars" : [
@@ -54,16 +50,16 @@ module.exports = [
5450 // varsIgnorePattern: https://eslint.org/docs/latest/rules/no-unused-vars#varsignorepattern
5551 { args : "all" , argsIgnorePattern : "^_" , varsIgnorePattern : "^_" } ,
5652 ] ,
57- // @ TODO : Not recommended to disable rule, should instead disable locally
53+ // TODO: Not recommended to disable rule, should instead disable locally
5854 // with explanation
5955 "@typescript-eslint/ban-ts-ignore" : "off" ,
6056 } ,
61- } ) ) ,
62- // Vitest linting for test files
57+ } ,
58+ // Vitest
6359 {
64- files : [ "tests/*.ts" ] ,
65- plugins : { vitest } ,
66- rules : vitest . configs . recommended . rules ,
60+ files : [ "tests/**/*.test.ts" ] ,
61+ extends : [ vitest . configs . recommended ] ,
6762 } ,
63+ // Disable any style linting, as prettier takes care of that separately
6864 prettier ,
69- ] ;
65+ ] ) ;
0 commit comments