From bec9662ac97300290fd7cd89099e4808c7ef0b78 Mon Sep 17 00:00:00 2001 From: Jozef Izso Date: Tue, 25 Jun 2024 15:52:26 +0200 Subject: [PATCH] Upgrade typescript config to target NodeJS 20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the error: ``` src/parsers/dart-json/dart-json-parser.ts:209:123 - error TS1501: This regular expression flag is only available when targeting 'es2018' or later. 209 /^══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═+\s+(.*)\s+When the exception was thrown, this was the stack:/ms ``` --- package.json | 3 +++ tsconfig.json | 18 +++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index d755f84..dbe60ad 100644 --- a/package.json +++ b/package.json @@ -77,5 +77,8 @@ "suiteNameTemplate": "{filepath}", "classNameTemplate": "{classname}", "titleTemplate": "{title}" + }, + "engines": { + "node": ">=20" } } diff --git a/tsconfig.json b/tsconfig.json index f6e7cb5..1408a09 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,12 +1,16 @@ { "compilerOptions": { - "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "outDir": "./lib", /* Redirect output structure to the directory. */ - "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - "strict": true, /* Enable all strict type-checking options. */ - "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + "lib": ["es2023"], + "module": "node16", + "target": "es2022", + + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "moduleResolution": "node16", + + "outDir": "./lib", + "rootDir": "./src", }, "exclude": ["node_modules", "**/*.test.ts"] }