Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: upgrade to typescript 5 #4240

Draft
wants to merge 2 commits into
base: next
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ module.exports = {
"ts-expect-error": false
}
],
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/no-empty-object-type": "error",
"@typescript-eslint/no-unsafe-function-type": "error",
"@typescript-eslint/no-wrapper-object-types": "error",
"@typescript-eslint/no-duplicate-enum-values": 0,
"@typescript-eslint/no-unused-expressions": 0,
"@typescript-eslint/no-require-imports": 0,
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/no-unused-vars": getNoUnusedVars(),
"@typescript-eslint/no-var-requires": 0,
Expand Down
2 changes: 1 addition & 1 deletion cypress-tests/cypress/support/pageBuilder/reloadUntil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Cypress.Commands.add("reloadUntil", (callback, options = {}) => {
}
}
return cy.log("Condition met, moving on...");
} catch (err) {
} catch {
if (retries > MAX_RETRIES) {
throw new Error(`retried too many times (${--retries})`);
}
Expand Down
2 changes: 1 addition & 1 deletion cypress-tests/cypress/support/reloadUntil/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Cypress.Commands.add("reloadUntil", (callback, options = {}) => {
}
}
return cy.log("Condition met, moving on...");
} catch (err) {
} catch {
if (retries > MAX_RETRIES) {
throw new Error(`retried too many times (${--retries})`);
}
Expand Down
2 changes: 1 addition & 1 deletion cypress-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"lodash": "^4.17.21",
"nanoid": "^3.3.7",
"node-fetch": "^2.6.1",
"typescript": "4.9.5",
"typescript": "5.1.6",
"uniqid": "^5.2.0"
},
"scripts": {
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"@types/prettier": "^2.7.3",
"@types/react": "18.2.79",
"@types/react-dom": "18.2.25",
"@typescript-eslint/eslint-plugin": "^5.5.0",
"@typescript-eslint/parser": "^5.5.0",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.3.0",
"adio": "^1.0.1",
"babel-jest": "29.7.0",
"babel-plugin-dynamic-import-node": "2.3.3",
Expand Down Expand Up @@ -93,9 +93,10 @@
"rimraf": "^5.0.5",
"semver": "^7.5.4",
"ts-expect": "^1.3.0",
"ts-jest": "^29.1.2",
"typescript": "4.9.5",
"typescript-transform-paths": "^3.4.6",
"ts-jest": "^29.2.5",
"ts-patch": "^3.2.1",
"typescript": "5.1.6",
"typescript-transform-paths": "^3.5.0",
"verdaccio": "^5.29.1",
"write-json-file": "^4.2.0",
"yargs": "^17.0.1"
Expand Down Expand Up @@ -134,7 +135,7 @@
"trigger-release": "node ./scripts/release/triggerRelease.js",
"dispatch-github-event": "node ./scripts/dispatchGitHubEvent.js",
"lint-staged": "lint-staged",
"postinstall": "yarn node ./scripts/linkWorkspaces.js",
"postinstall": "ts-patch install -s && yarn node ./scripts/linkWorkspaces.js",
"prepublishOnly": "node scripts/prepublishOnly",
"prettier": "prettier \"**/**/*.{js,jsx,ts,tsx,json,scss}\" --config .prettierrc.js",
"prettier:check": "yarn prettier --check",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-aco/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"graphql": "^15.8.0",
"prettier": "^2.8.3",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.13",
"typescript": "4.9.5"
"ts-patch": "3.2.1",
"typescript": "5.1.6"
}
}
4 changes: 2 additions & 2 deletions packages/api-admin-settings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"prettier": "^2.8.3",
"rimraf": "^5.0.5",
"sinon": "^9.0.2",
"ttypescript": "^1.5.12",
"typescript": "4.9.5"
"ts-patch": "3.2.1",
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-admin-users-so-ddb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"jest": "^29.7.0",
"jest-dynalite": "^3.2.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.9.5"
"ts-patch": "3.2.1",
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-admin-users/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"rimraf": "^5.0.5",
"typescript": "4.9.5"
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-apw-scheduler-so-ddb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"jest": "^29.7.0",
"jest-dynalite": "^3.2.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.9.5"
"ts-patch": "3.2.1",
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-apw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"prettier": "^2.8.3",
"rimraf": "^5.0.5",
"sinon": "^9.0.2",
"ttypescript": "^1.5.12",
"typescript": "4.9.5"
"ts-patch": "3.2.1",
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-apw/src/plugins/hooks/validateComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const validateComment = ({ apw }: Pick<LifeCycleHookCallbackParams, "apw"
}
);
}
} catch (ex) {
} catch {
throw new WebinyError(
`The"changeRequest" property in input is not properly formatted.`,
"MALFORMED_CHANGE_REQUEST_ID",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-audit-logs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"@webiny/plugins": "0.0.0",
"@webiny/project-utils": "0.0.0",
"graphql": "^15.8.0",
"ttypescript": "^1.5.13",
"typescript": "4.9.5"
"ts-patch": "3.2.1",
"typescript": "5.1.6"
},
"dependencies": {
"@webiny/api": "0.0.0",
Expand Down
5 changes: 4 additions & 1 deletion packages/api-audit-logs/src/subscriptions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ export const createSubscriptionHooks = (context: AuditLogsContext) => {
createI18NHooks(context);
createMailerHooks(context);
createAcoHooks(context);
context.wcp.canUseFeature("advancedPublishingWorkflow") && createApwHooks(context);
if (!context.wcp.canUseFeature("advancedPublishingWorkflow")) {
return;
}
createApwHooks(context);
};
2 changes: 1 addition & 1 deletion packages/api-authentication-cognito/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"rimraf": "^5.0.5",
"typescript": "4.9.5"
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-authentication/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@webiny/project-utils": "0.0.0",
"jest-dynalite": "^3.2.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.9.5"
"ts-patch": "3.2.1",
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-background-tasks-ddb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.9.5"
"ts-patch": "3.2.1",
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-background-tasks-es/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.9.5"
"ts-patch": "3.2.1",
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-background-tasks-os/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.9.5"
"ts-patch": "3.2.1",
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-cognito-authenticator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"rimraf": "^5.0.5",
"typescript": "4.9.5"
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-dynamodb-to-elasticsearch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@webiny/cli": "0.0.0",
"@webiny/plugins": "0.0.0",
"@webiny/project-utils": "0.0.0",
"typescript": "4.9.5"
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-elasticsearch-tasks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
"@webiny/plugins": "0.0.0",
"@webiny/project-utils": "0.0.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.13",
"ts-patch": "3.2.1",
"type-fest": "^2.19.0",
"typescript": "4.9.5"
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-elasticsearch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.9.5"
"ts-patch": "3.2.1",
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-elasticsearch/src/plugins/GzipCompression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class GzipCompression extends CompressionPlugin {
const buf = await ungzip(convertToBuffer(data.value));
const value = buf.toString(FROM_STORAGE_ENCODING);
return JSON.parse(value);
} catch (ex) {
} catch {
return null;
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/api-elasticsearch/src/utils/createIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const indexExists = async (params: ExistsIndexParams): Promise<boolean> => {
return true;
} catch (ex) {
console.error(`Could not determine if the index "${index}" exists.`);
console.log(ex);
}
return false;
};
Expand Down
4 changes: 2 additions & 2 deletions packages/api-file-manager-ddb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"jest-dynalite": "^3.2.0",
"jsonpack": "^1.1.5",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.9.5"
"ts-patch": "3.2.1",
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export class SystemStorageOperations implements FileManagerSystemStorageOperatio
"Could not insert new system data into DynamoDB",
"CREATE_SYSTEM_ERROR",
{
...ex.data,
data
}
);
Expand All @@ -98,6 +99,7 @@ export class SystemStorageOperations implements FileManagerSystemStorageOperatio
"Could not update system data in the DynamoDB.",
"UPDATE_SYSTEM_ERROR",
{
...ex.data,
data
}
);
Expand Down
2 changes: 1 addition & 1 deletion packages/api-file-manager-s3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@webiny/cli": "0.0.0",
"@webiny/project-utils": "0.0.0",
"rimraf": "^5.0.5",
"typescript": "4.9.5"
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class SharpTransform implements AssetTransformationStrategy {
const buffer = Buffer.from(await Body.transformToByteArray());

asset.setContentsReader(new CallableContentsReader(() => buffer));
} catch (e) {
} catch {
const optimizedImage = await this.optimizeAsset(asset);

const widths = new WidthCollection(this.params.imageResizeWidths);
Expand Down Expand Up @@ -115,7 +115,7 @@ export class SharpTransform implements AssetTransformationStrategy {
const buffer = Buffer.from(await Body.transformToByteArray());

asset.setContentsReader(new CallableContentsReader(() => buffer));
} catch (e) {
} catch {
// If not found, create an optimized version of the original asset.
const buffer = await asset.getContents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const sanitizeFileSizeValue = (value: number, defaultValue: number): number => {
try {
validation.validateSync(value, "required,numeric,gte:0");
return value;
} catch (e) {
} catch {
// TODO @ts-refactor No need to log the error?
return defaultValue;
}
Expand Down
5 changes: 2 additions & 3 deletions packages/api-file-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@
"@babel/plugin-transform-runtime": "^7.24.0",
"@babel/preset-env": "^7.24.0",
"@babel/preset-typescript": "^7.23.3",
"@types/sharp": "^0.32.0",
"@webiny/api-i18n": "0.0.0",
"@webiny/cli": "0.0.0",
"@webiny/utils": "0.0.0",
"jest": "^29.7.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.9.5"
"ts-patch": "3.2.1",
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const createSystemCrud = ({
"Could not update the system data.",
"SYSTEM_UPDATE_ERROR",
{
...ex.data,
data
}
);
Expand All @@ -60,6 +61,7 @@ export const createSystemCrud = ({
return;
} catch (ex) {
throw new WebinyError("Could not create the system data.", "SYSTEM_CREATE_ERROR", {
...ex.data,
data
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class PrivateFilesAssetProcessor implements AssetProcessor {

try {
await this.assetAuthorizer.authorize(file);
} catch (error) {
} catch {
asset.setOutputStrategy(new NotAuthorizedOutputStrategy());

return asset;
Expand Down
4 changes: 2 additions & 2 deletions packages/api-form-builder-so-ddb-es/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"jest": "^29.7.0",
"jest-dynalite": "^3.2.0",
"rimraf": "^5.0.5",
"ttypescript": "^1.5.12",
"typescript": "4.9.5"
"ts-patch": "3.2.1",
"typescript": "5.1.6"
},
"publishConfig": {
"access": "public",
Expand Down
Loading
Loading