-
Notifications
You must be signed in to change notification settings - Fork 6
/
eslint.config.mjs
99 lines (66 loc) · 1.83 KB
/
eslint.config.mjs
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
/* Copyright(C) 2017-2024, HJD (https://github.com/hjdhjd). All rights reserved.
*
* eslint.config.mjs: Linting defaults for Homebridge plugins.
*/
import eslintJs from "@eslint/js";
import hbPluginUtils from "homebridge-plugin-utils/build/eslint-rules.mjs";
import ts from "typescript-eslint";
import tsParser from "@typescript-eslint/parser";
export default ts.config(
eslintJs.configs.recommended,
{
files: [ "src/**.ts" ],
rules: {
...hbPluginUtils.rules.ts
}
},
{
files: [ "homebridge-ui/public/**/*.@(js|mjs)", "homebridge-ui/server.js", "eslint.config.mjs" ],
rules: {
...hbPluginUtils.rules.js
}
},
{
files: [ "src/**.ts", "homebridge-ui/*.@(js|mjs)", "homebridge-ui/public/**/*.@(js|mjs)", "eslint.config.mjs" ],
ignores: [ "dist" ],
languageOptions: {
ecmaVersion: "latest",
parser: tsParser,
parserOptions: {
ecmaVersion: "latest",
project: "./tsconfig.json",
projectService: {
allowDefaultProject: [ "eslint.config.mjs", "homebridge-ui/*.@(js|mjs)", "homebridge-ui/public/*.@(js|mjs)", "homebridge-ui/public/lib/*.@(js|mjs)" ],
defaultProject: "./tsconfig.json"
}
},
sourceType: "module"
},
linterOptions: {
reportUnusedDisableDirectives: "error"
},
plugins: {
...hbPluginUtils.plugins
},
rules: {
...hbPluginUtils.rules.common
}
},
{
files: [ "homebridge-ui/public/lib/webUi.mjs", "homebridge-ui/public/lib/webUi-featureoptions.mjs", "homebridge-ui/public/ui.mjs" ],
languageOptions: {
globals: {
...hbPluginUtils.globals.ui
}
}
},
{
files: [ "homebridge-ui/server.js" ],
languageOptions: {
globals: {
console: "readonly",
fetch: "readonly"
}
}
}
);