Skip to content

Commit 45bc42e

Browse files
committed
update eslint to v9 and required migration steps
1 parent 8c93be6 commit 45bc42e

File tree

7 files changed

+500
-444
lines changed

7 files changed

+500
-444
lines changed

.eslintrc

Lines changed: 0 additions & 40 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ All notable changes to `hap-nodejs` will be documented in this file. This projec
1212
- Added support for NodeJS 24
1313
- Update @homebridge/ciao to 1.3.3
1414
- update `jest` to `v30` and required migration steps
15+
- update `eslint` to `v9` and required migration steps
1516

1617
### Homebridge Dependencies
1718

eslint.config.mjs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { defineConfig, globalIgnores } from "eslint/config";
2+
import tsParser from "@typescript-eslint/parser";
3+
import path from "node:path";
4+
import { fileURLToPath } from "node:url";
5+
import js from "@eslint/js";
6+
import { FlatCompat } from "@eslint/eslintrc";
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = path.dirname(__filename);
10+
const compat = new FlatCompat({
11+
baseDirectory: __dirname,
12+
recommendedConfig: js.configs.recommended,
13+
allConfig: js.configs.all,
14+
});
15+
16+
export default defineConfig([globalIgnores(["**/dist/"]), {
17+
extends: compat.extends(
18+
"eslint:recommended",
19+
"plugin:@typescript-eslint/eslint-recommended",
20+
"plugin:@typescript-eslint/recommended",
21+
),
22+
23+
languageOptions: {
24+
parser: tsParser,
25+
ecmaVersion: 2018,
26+
sourceType: "module",
27+
},
28+
29+
rules: {
30+
quotes: ["error", "double"],
31+
indent: ["error", 2, {
32+
SwitchCase: 0,
33+
}],
34+
"linebreak-style": ["error", "unix"],
35+
semi: ["error", "always"],
36+
"comma-dangle": ["error", "always-multiline"],
37+
"dot-notation": "error",
38+
eqeqeq: ["error", "smart"],
39+
curly: ["error", "all"],
40+
"brace-style": ["error"],
41+
"prefer-arrow-callback": "warn",
42+
"max-len": ["warn", 160],
43+
"object-curly-spacing": ["error", "always"],
44+
"@typescript-eslint/no-unused-vars": ["error", {
45+
caughtErrors: "none",
46+
}],
47+
"@typescript-eslint/no-use-before-define": ["error", {
48+
classes: false,
49+
enums: false,
50+
}],
51+
"@typescript-eslint/no-non-null-assertion": "off",
52+
"@typescript-eslint/explicit-module-boundary-types": "error",
53+
},
54+
}]);

0 commit comments

Comments
 (0)