From 63f63612fab40c3def72d9ed50d0ac042a078677 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Wed, 4 May 2022 12:50:58 +0200 Subject: [PATCH] refactor!: target es2020 (#848) --- scripts/copyMimeTypes.ts | 10 ++++------ tsconfig.json | 3 ++- tsconfig.lint.json | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/scripts/copyMimeTypes.ts b/scripts/copyMimeTypes.ts index 9691070ce58..f56acff973a 100644 --- a/scripts/copyMimeTypes.ts +++ b/scripts/copyMimeTypes.ts @@ -6,7 +6,7 @@ import options from '../.prettierrc.cjs'; const rootPath = path.resolve(__dirname, '..'); const mimeDbPath = path.resolve(rootPath, 'node_modules/mime-db/db.json'); -const mimeDbLicencePath = path.resolve( +const mimeDbLicensePath = path.resolve( rootPath, 'node_modules/mime-db/LICENSE' ); @@ -20,10 +20,8 @@ fs.readFile(mimeDbPath, 'utf8', (err, data) => { throw err; } - const licence = fs.readFileSync(mimeDbLicencePath, { encoding: 'utf8' }); - const mimeTypeFileContent = `// This file is generated by scripts/copyMimeTypes.ts\n// Do not edit this file directly. Instead, update mime-db and run \`pnpm run copy:mime-types\`\n\n/*\n${ - licence as string - }*/\n\nexport default ${data as string};\n`; + const license = fs.readFileSync(mimeDbLicensePath, { encoding: 'utf8' }); + const mimeTypeFileContent = `// This file is generated by scripts/copyMimeTypes.ts\n// Do not edit this file directly. Instead, update mime-db and run \`pnpm run copy:mime-types\`\n\n/*\n${license}*/\n\nexport default ${data};\n`; fs.writeFile( mimeTypesTsPath, @@ -33,7 +31,7 @@ fs.readFile(mimeDbPath, 'utf8', (err, data) => { throw err; } - console.log(`Mime types copied to ${mimeTypesTsPath as string}`); + console.log(`Mime types copied to ${mimeTypesTsPath}`); } ); }); diff --git a/tsconfig.json b/tsconfig.json index 2e040b1b501..99a90a33f91 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { - "target": "ES5", + "target": "ES2020", + "moduleResolution": "Node", "rootDir": "src", "outDir": "dist", "declaration": true, diff --git a/tsconfig.lint.json b/tsconfig.lint.json index d2bed87be05..362d4c3e057 100644 --- a/tsconfig.lint.json +++ b/tsconfig.lint.json @@ -1,5 +1,19 @@ { "compilerOptions": { + "target": "ES2020", + "moduleResolution": "Node", + "esModuleInterop": true, + "allowJs": true, + "alwaysStrict": true, + // "strictNullChecks": true, + // "strictBindCallApply": true, + "strictFunctionTypes": true, + // "strictPropertyInitialization": true, + // "noImplicitAny": true, + // "noImplicitThis": true, + "useUnknownInCatchVariables": true, + "stripInternal": true, + "rootDir": ".", "noEmit": true },