1+ /*!
2+ Copyright (C) 2020 Evolved Binary
3+
4+ This program is free software: you can redistribute it and/or modify
5+ it under the terms of the GNU Affero General Public License as
6+ published by the Free Software Foundation, either version 3 of the
7+ License, or (at your option) any later version.
8+
9+ This program is distributed in the hope that it will be useful,
10+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+ GNU Affero General Public License for more details.
13+
14+ You should have received a copy of the GNU Affero General Public License
15+ along with this program. If not, see <https://www.gnu.org/licenses/>.
16+ */
17+
18+ import js from "@eslint/js" ;
19+ import globals from "globals" ;
20+ import tseslint from "typescript-eslint" ;
21+ import { defineConfig } from "eslint/config" ;
22+ import notice from "eslint-plugin-notice" ;
23+ import tsdoc from "eslint-plugin-tsdoc" ;
24+ import { fileURLToPath } from "url" ;
25+ import path , { dirname } from "path" ;
26+
27+ const __filename = fileURLToPath ( import . meta. url ) ;
28+ const __dirname = dirname ( __filename ) ;
29+
30+ export default defineConfig ( [
31+ {
32+ ignores : [
33+ "**/dist/**" ,
34+ "**/node_modules/**" ,
35+ "**/coverage/**"
36+ ]
37+ } ,
38+
39+ // JS base config
40+ {
41+ files : [ "**/*.{js,mjs,cjs,ts,mts,cts}" ] ,
42+ plugins : { js } ,
43+ extends : [ "js/recommended" ] ,
44+ languageOptions : {
45+ globals : { ...globals . browser , ...globals . node }
46+ }
47+ } ,
48+
49+ tseslint . configs . recommended ,
50+ {
51+ plugins : {
52+ notice,
53+ tsdoc
54+ } ,
55+ rules : {
56+ "@typescript-eslint/no-unused-vars" : [
57+ "error" ,
58+ {
59+ "args" : "all" ,
60+ "argsIgnorePattern" : "^_" ,
61+ "caughtErrors" : "all" ,
62+ "caughtErrorsIgnorePattern" : "^_" ,
63+ "destructuredArrayIgnorePattern" : "^_" ,
64+ "varsIgnorePattern" : "^_" ,
65+ "ignoreRestSiblings" : true
66+ }
67+ ] ,
68+ // notice
69+ "notice/notice" : [
70+ "error" ,
71+ { templateFile : path . resolve ( __dirname , "./config/notice.js" ) }
72+ ] ,
73+
74+ // tsdoc
75+ "tsdoc/syntax" : "warn"
76+ }
77+ } ,
78+ {
79+ files : [ "**/*.spec.ts" ] ,
80+ rules : {
81+ "@typescript-eslint/no-unused-expressions" : "off" ,
82+ } ,
83+ }
84+ ] ) ;
0 commit comments