From 7a67bc7220ea3d970ad80204a7ef1bbfd0727ee6 Mon Sep 17 00:00:00 2001 From: Jonas Holst Damtoft Date: Tue, 11 Oct 2022 16:50:31 +0200 Subject: [PATCH 1/4] upgrade and fix tsconfig.lib --- .eslintrc.js | 7 +++---- .nvmrc | 1 + package.json | 18 ++++++++---------- src/main.ts | 10 ++++------ src/utils/ErrorMapper.ts | 1 + tsconfig.json | 4 ++-- 6 files changed, 19 insertions(+), 22 deletions(-) create mode 100644 .nvmrc diff --git a/.eslintrc.js b/.eslintrc.js index ce415a15a..37fd04492 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -8,16 +8,15 @@ module.exports = { "eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended-requiring-type-checking", - "plugin:prettier/recommended", - "prettier/@typescript-eslint", "plugin:import/errors", "plugin:import/warnings", - "plugin:import/typescript" + "plugin:import/typescript", + "prettier", ], parser: "@typescript-eslint/parser", parserOptions: { project: "tsconfig.json", - sourceType: "module" + // sourceType: "module" }, plugins: ["@typescript-eslint", "import"], settings: { diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 000000000..37e391feb --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v16.17.0 diff --git a/package.json b/package.json index 7e281b932..0aec9223d 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ }, "homepage": "https://github.com/screepers/screeps-typescript-starter#readme", "engines": { - "node": "10.x || 12.x" + "node": ">=16.x" }, "devDependencies": { "@rollup/plugin-commonjs": "^20.0.0", @@ -42,18 +42,16 @@ "@types/screeps": "^3.2.3", "@types/sinon": "^5.0.5", "@types/sinon-chai": "^3.2.0", - "@typescript-eslint/eslint-plugin": "^4.29.1", - "@typescript-eslint/parser": "^4.29.1", - "@typescript-eslint/typescript-estree": "^4.29.1", + "@typescript-eslint/eslint-plugin": "^5.38.1", + "@typescript-eslint/parser": "^5.38.1", "chai": "^4.2.0", - "eslint": "^7.32.0", - "eslint-config-prettier": "^8.3.0", - "eslint-import-resolver-typescript": "^2.4.0", + "eslint": "^8.24.0", + "eslint-config-prettier": "^8.5.0", + "eslint-import-resolver-typescript": "^3.5.1", "eslint-plugin-import": "^2.24.0", - "eslint-plugin-prettier": "^3.4.0", "lodash": "^3.10.1", "mocha": "^5.2.0", - "prettier": "^2.3.2", + "prettier": "^2.7.1", "rollup": "^2.56.2", "rollup-plugin-clear": "^2.0.7", "rollup-plugin-screeps": "^1.0.1", @@ -62,7 +60,7 @@ "sinon-chai": "^3.2.0", "ts-node": "^10.2.0", "tsconfig-paths": "^3.10.1", - "typescript": "^4.3.5" + "typescript": "^4.8.4" }, "dependencies": { "source-map": "~0.6.1" diff --git a/src/main.ts b/src/main.ts index 3b29f3e72..326c76525 100644 --- a/src/main.ts +++ b/src/main.ts @@ -21,12 +21,10 @@ declare global { working: boolean; } - // Syntax for adding proprties to `global` (ex "global.log") - namespace NodeJS { - interface Global { - log: any; - } - } +} +// Syntax for adding proprties to `global` (ex "global.log") +declare const global: { + log: any; } // When compiling TS to JS and bundling with rollup, the line numbers and file names in error messages change diff --git a/src/utils/ErrorMapper.ts b/src/utils/ErrorMapper.ts index 119a3954e..75222a394 100644 --- a/src/utils/ErrorMapper.ts +++ b/src/utils/ErrorMapper.ts @@ -1,3 +1,4 @@ +/* eslint-disable */ import { SourceMapConsumer } from "source-map"; export class ErrorMapper { diff --git a/tsconfig.json b/tsconfig.json index 9b1ca355a..631807d25 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { "module": "esnext", - "lib": ["es2018"], - "target": "es2018", + "lib": ["es2017"], + "target": "es2017", "moduleResolution": "Node", "outDir": "dist", "baseUrl": "src/", From 08d96d4fbac40037e2688cefa7018e0948059aa2 Mon Sep 17 00:00:00 2001 From: Jonas Holst Damtoft Date: Tue, 11 Oct 2022 17:48:28 +0200 Subject: [PATCH 2/4] correct eslint sourceType --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 37fd04492..fc938afd9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -16,7 +16,7 @@ module.exports = { parser: "@typescript-eslint/parser", parserOptions: { project: "tsconfig.json", - // sourceType: "module" + sourceType: "module" }, plugins: ["@typescript-eslint", "import"], settings: { From 7bbfd926f3deecdb952de6ce86445ece82ad57aa Mon Sep 17 00:00:00 2001 From: Jonas Holst Damtoft Date: Wed, 26 Oct 2022 20:46:58 +0200 Subject: [PATCH 3/4] revert tsconfig changes --- tsconfig.json | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 631807d25..ff922dc09 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { "module": "esnext", - "lib": ["es2017"], - "target": "es2017", + "lib": ["es2018"], + "target": "es2018", "moduleResolution": "Node", "outDir": "dist", "baseUrl": "src/", @@ -13,7 +13,5 @@ "allowSyntheticDefaultImports": true, "allowUnreachableCode": false }, - "exclude": [ - "node_modules" - ] + "exclude": ["node_modules"] } From f2f5224311d3beeedeccad46c594d25997c5dbb0 Mon Sep 17 00:00:00 2001 From: Jonas Holst Damtoft Date: Wed, 26 Oct 2022 20:47:07 +0200 Subject: [PATCH 4/4] remove engine field --- package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/package.json b/package.json index 0aec9223d..9bccd8e35 100644 --- a/package.json +++ b/package.json @@ -29,9 +29,6 @@ "url": "https://github.com/screepers/screeps-typescript-starter/issues" }, "homepage": "https://github.com/screepers/screeps-typescript-starter#readme", - "engines": { - "node": ">=16.x" - }, "devDependencies": { "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4",