XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

chore: migrate to eslint 9 (#3690)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3690 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

ce819438
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

5 个文件 +307 -431
Deleted .eslintrc +0 -37
@@ -1,37 +0,0 @@
1 {
2 "plugins": ["@typescript-eslint", "prettier"],
3 "extends": [
4 "eslint:recommended",
5 "plugin:@typescript-eslint/recommended",
6 "plugin:@typescript-eslint/recommended-requiring-type-checking"
7 ],
8 "env": {
9 "browser": true,
10 "es6": true,
11 "node": true
12 },
13 "rules": {
14 "@typescript-eslint/consistent-type-imports": "error",
15 "@typescript-eslint/explicit-function-return-type": "error",
16 "@typescript-eslint/restrict-template-expressions": "error",
17 "@typescript-eslint/restrict-plus-operands": "error",
18 "@typescript-eslint/no-unsafe-member-access": "error",
19 "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "caughtErrors": "none" }],
20 "@typescript-eslint/no-unsafe-argument": "error",
21 "@typescript-eslint/no-unsafe-call": "error",
22 "@typescript-eslint/no-unsafe-assignment": "error",
23 "@typescript-eslint/no-explicit-any": "off",
24 "no-loss-of-precision": "error",
25 "@typescript-eslint/no-unnecessary-condition": "error",
26 "@typescript-eslint/no-base-to-string": "off",
27 "no-case-declarations": "error",
28 "prettier/prettier": "error",
29 "no-mixed-spaces-and-tabs": "error",
30 "@typescript-eslint/require-await": "error",
31 "@typescript-eslint/no-deprecated": "warn"
32 },
33 "parser": "@typescript-eslint/parser",
34 "parserOptions": {
35 "project": "./tsconfig.json"
36 }
37 }
Added eslint.config.js +46 -0
@@ -0,0 +1,46 @@
1 import js from "@eslint/js";
2 import tsPlugin from "@typescript-eslint/eslint-plugin";
3 import prettierPlugin from "eslint-plugin-prettier";
4
5 export default [
6 {
7 ignores: ["build/**", "node_modules/**"]
8 },
9 {
10 files: ["**/*.ts"],
11 languageOptions: {
12 parserOptions: {
13 project: "./tsconfig.json"
14 }
15 }
16 },
17 js.configs.recommended,
18 ...tsPlugin.configs["flat/recommended"],
19 ...tsPlugin.configs["flat/recommended-type-checked"],
20 {
21 files: ["**/*.ts"],
22 plugins: {
23 prettier: prettierPlugin
24 },
25 rules: {
26 "@typescript-eslint/consistent-type-imports": "error",
27 "@typescript-eslint/explicit-function-return-type": "error",
28 "@typescript-eslint/restrict-template-expressions": "error",
29 "@typescript-eslint/restrict-plus-operands": "error",
30 "@typescript-eslint/no-unsafe-member-access": "error",
31 "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_", caughtErrors: "none" }],
32 "@typescript-eslint/no-unsafe-argument": "error",
33 "@typescript-eslint/no-unsafe-call": "error",
34 "@typescript-eslint/no-unsafe-assignment": "error",
35 "@typescript-eslint/no-explicit-any": "off",
36 "no-loss-of-precision": "error",
37 "@typescript-eslint/no-unnecessary-condition": "error",
38 "@typescript-eslint/no-base-to-string": "off",
39 "no-case-declarations": "error",
40 "prettier/prettier": "error",
41 "no-mixed-spaces-and-tabs": "error",
42 "@typescript-eslint/require-await": "error",
43 "@typescript-eslint/no-deprecated": "warn"
44 }
45 }
46 ];
Modified package.json +7 -7
@@ -16,9 +16,9 @@
16 16 "verify:tsc": "tsc --noEmit",
17 17 "raw": "node scripts/raw-precheck.js && node --experimental-transform-types src/index.ts",
18 18 "raw:bun": "bun src/index.ts",
19 "lint": "eslint --ext .ts .",
20 "lint:ci": "eslint --ext .ts --rule \"prettier/prettier: off\" .",
21 "lint:fix": "eslint --fix --ext .ts .",
19 "lint": "eslint \"**/*.ts\"",
20 "lint:ci": "eslint \"**/*.ts\" --rule \"prettier/prettier: off\"",
21 "lint:fix": "eslint --fix \"**/*.ts\"",
22 22 "prettier": "prettier --write .",
23 23 "update-translations": "cd scripts && node update-translations.cjs",
24 24 "fix": "npm run update-translations && npm run prettier"
@@ -46,16 +46,16 @@
46 46 "@types/morgan": "^1.9.9",
47 47 "@types/websocket": "^1.0.10",
48 48 "@types/ws": "^8.18.1",
49 "@typescript/native-preview": "^7.0.0-dev.20260308.1",
50 "typescript": "^5.7"
49 "@typescript/native-preview": "^7.0.0-dev.20260308.1"
51 50 },
52 51 "devDependencies": {
53 52 "@typescript-eslint/eslint-plugin": "^8.28.0",
54 53 "@typescript-eslint/parser": "^8.28.0",
55 "eslint": "^8",
54 "eslint": "^9.39.4",
56 55 "eslint-plugin-prettier": "^5.2.5",
57 56 "prettier": "^3.5.3",
58 "tree-kill": "^1.2.2"
57 "tree-kill": "^1.2.2",
58 "typescript": "^5.7"
59 59 },
60 60 "engines": {
61 61 "node": ">=20.18.1"
Modified src/services/purchaseService.ts +0 -1
@@ -610,7 +610,6 @@ const handleBoosterPackPurchase = async (
610 610 buildLabel?: string
611 611 ): Promise<IPurchaseResponse> => {
612 612 const pack = getBoosterPack(typeName, buildLabel);
613 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
614 613 if (!pack) {
615 614 throw new Error(`unknown booster pack: ${typeName}`);
616 615 }