Skip to content

Commit

Permalink
chore: upgrade to typescript 5
Browse files Browse the repository at this point in the history
  • Loading branch information
sandor-trombitas committed Sep 9, 2024
1 parent 2dabad7 commit c0a08d7
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 29 deletions.
106 changes: 79 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"build-cli:prod": "node --max-old-space-size=8192 node_modules/webpack/bin/webpack.js --config webpack.prod.ts",
"watch": "npm run build-cli:dev -- --watch",
"test": "npm run test:unit && npm run test:acceptance && npm run test:tap",
"test:tsc": "tsc --noEmit",
"test:unit": "jest --runInBand --testPathPattern '/test(/jest)?/unit/' --reporters=jest-junit",
"test:acceptance": "jest --maxWorkers=1 --testPathPattern \"/test(/jest)?/acceptance/\" --reporters=jest-junit",
"test:tap": "tap -Rspec --timeout=300 test/tap/*.test.* ",
Expand Down Expand Up @@ -136,7 +137,9 @@
"wrap-ansi": "^5.1.0"
},
"devDependencies": {
"@types/abbrev": "^1.1.5",
"@types/body-parser": "^1.19.1",
"@types/chalk": "^2.2.0",
"@types/cross-spawn": "^6.0.2",
"@types/express": "^4.17.13",
"@types/fs-extra": "^9.0.11",
Expand Down Expand Up @@ -177,7 +180,7 @@
"ts-jest": "29.1.2",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"typescript": "^4.9.5",
"typescript": "^5.5.0",
"vscode-jsonrpc": "8.1.0",
"webpack": "^5.54.0",
"webpack-cli": "^4.6.0",
Expand Down
12 changes: 12 additions & 0 deletions src/cli/commands/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ export default async function test(
// Note: this is done based on the logic done below
// for non-json/sarif outputs, where we take the code of
// the first error.
// TODO: refactor this to be more consistent
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: broken type definitions
err.code = errorResults[0].code;
}
err.json = stringifiedData;
Expand Down Expand Up @@ -292,13 +295,22 @@ export default async function test(
if (notSuccess) {
response += chalk.bold.red(summaryMessage);
const error = new Error(response) as any;
// TODO: refactor this to be more consistent
// take the code of the first problem to go through error
// translation
// HACK as there can be different errors, and we pass only the
// first one
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: broken type definitions
error.code = errorResults[0].code;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: broken type definitions
error.userMessage = errorResults[0].userMessage;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: broken type definitions
error.strCode = errorResults[0].strCode;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: broken type definitions
error.innerError = errorResults[0].innerError;
throw error;
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export async function main(): Promise<void> {

if (
typeof globalArgs.options.detectionDepth !== 'undefined' &&
(globalArgs.options.detectionDepth <= 0 ||
(globalArgs.options.detectionDepth as number <= 0 ||
Number.isNaN(globalArgs.options.detectionDepth))
) {
throw new InvalidDetectionDepthValue();
Expand Down

0 comments on commit c0a08d7

Please sign in to comment.