diff --git a/build.ts b/build.ts index ae68b44..c78f9cb 100644 --- a/build.ts +++ b/build.ts @@ -2,9 +2,12 @@ import { readFile } from "node:fs/promises"; import { parseArgs } from "node:util"; import { sys } from "typescript"; +// @ts-ignore import txtScriptHeader from "./src/assets/header_script.txt" with { type: "text" }; +// @ts-ignore import txtMetaHeader from "./src/assets/header_meta.txt" with { type: "text" }; import { assert } from "node:console"; +import { ESLint } from "eslint"; enum BuildTarget { ALL = 'all', @@ -80,10 +83,20 @@ const build = async (target: BuildTarget, version: string, config: any={}) => { // Save to script await Bun.write(path, scriptHeader + result); - console.log(`---- [${target}] done in ${performance.now() - startTime} ms`); // Create meta file await Bun.write(outDir + '/' + outputMetaName, txtMetaHeader.replace('[[VERSION]]', version)); + + // Check with ESLint + const eslint = new ESLint(); + eslint.lintFiles([path]).then((results: any) => { + results[0].messages.forEach((msg: any) => { + console.error(`${path}#${msg.line}: ${msg.message}`); + }); + + console.log(`---- [${target}] done in ${performance.now() - startTime} ms`); + console.log(`---- [${target}] ${new Date()}`); + }); } const buildTargets = [ diff --git a/bun.lockb b/bun.lockb index db5d9bc..2866c67 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..ff54a57 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,3 @@ +import compat from "eslint-plugin-compat"; + +export default [compat.configs['flat/recommended']]; diff --git a/package.json b/package.json index 58bc63a..3def306 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,9 @@ "name": "better-xcloud", "module": "src/index.ts", "type": "module", + "browserslist": [ + "Chrome >= 80" + ], "bin": { "build": "build.ts" }, @@ -9,6 +12,8 @@ "@types/bun": "^1.1.6", "@types/node": "^20.14.12", "@types/stylus": "^0.48.42", + "eslint": "^9.8.0", + "eslint-plugin-compat": "^6.0.0", "stylus": "^0.63.0" }, "peerDependencies": {