Skip to content

Commit

Permalink
chore: Merge develop branch
Browse files Browse the repository at this point in the history
  • Loading branch information
wsy19961129 committed Sep 18, 2024
1 parent b0ecc9c commit 9002606
Show file tree
Hide file tree
Showing 53 changed files with 2,391 additions and 1,863 deletions.
File renamed without changes.
21 changes: 18 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ const javascriptRules = {
'comma-dangle': ['error', 'never'],
'no-trailing-spaces': 'error',
'no-extra-semi': 'error',
'no-unused-vars': ['error', { args: 'after-used', varsIgnorePattern: '^__unused' }],
'no-unused-vars': ['error', {
args: 'after-used',
argsIgnorePattern: '^__unused',
caughtErrorsIgnorePattern: '^__unused',
destructuredArrayIgnorePattern: '^__unused',
varsIgnorePattern: '^__unused',
ignoreRestSiblings: true
}],
'semi': ['error', 'always']
};

Expand All @@ -41,7 +48,14 @@ const typescriptRules = {
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{ args: 'after-used', varsIgnorePattern: '^__unused' }
{
args: 'after-used',
argsIgnorePattern: '^__unused',
caughtErrorsIgnorePattern: '^__unused',
destructuredArrayIgnorePattern: '^__unused',
varsIgnorePattern: '^__unused',
ignoreRestSiblings: true
}
],
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/promise-function-async': 'error',
Expand All @@ -54,7 +68,8 @@ module.exports = {
parserOptions: {
ecmaVersion: 2022,
tsconfigRootDir: __dirname,
EXPERIMENTAL_useProjectService: true,
projectService: true,
allowDefaultProject: true,
warnOnUnsupportedTypeScriptVersion: false,
project: [
'./tsconfig.eslint.json',
Expand Down
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn run lint-commit $1
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn run lint-staged
File renamed without changes.
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"inputs": [
"default",
"^default",
"{workspaceRoot}/jest.preset.js"
"{workspaceRoot}/jest.preset.cjs"
],
"cache": true,
"options": {
Expand Down
113 changes: 57 additions & 56 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"license": "MIT",
"scripts": {
"prepare": "husky && husky install",
"postinstall": "husky install",
"prepare": "husky",
"postinstall": "husky",
"preinstall": "node ./scripts/hintYarn.js",
"dev": "yarn serve",
"serve": "nx run-many --parallel=5 --projects=itmat-job-executor,itmat-interface,itmat-ui-react --target=serve",
Expand All @@ -28,25 +28,25 @@
"format-fix": "nx format --all"
},
"devDependencies": {
"@babel/core": "^7.24.9",
"@babel/core": "^7.25.2",
"@babel/preset-react": "^7.24.7",
"@nx/esbuild": "19.4.3",
"@nx/eslint": "19.4.3",
"@nx/eslint-plugin": "19.4.3",
"@nx/express": "19.4.3",
"@nx/jest": "19.4.3",
"@nx/js": "19.4.3",
"@nx/node": "19.4.3",
"@nx/react": "19.4.3",
"@nx/web": "19.4.3",
"@nx/webpack": "19.4.3",
"@nx/workspace": "19.4.3",
"@nx/esbuild": "19.7.2",
"@nx/eslint": "19.7.2",
"@nx/eslint-plugin": "19.7.2",
"@nx/express": "19.7.2",
"@nx/jest": "19.7.2",
"@nx/js": "19.7.2",
"@nx/node": "19.7.2",
"@nx/react": "19.7.2",
"@nx/web": "19.7.2",
"@nx/webpack": "19.7.2",
"@nx/workspace": "19.7.2",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
"@svgr/webpack": "8.1.0",
"@swc/cli": "0.3.14",
"@swc/core": "1.5.7",
"@swc/cli": "0.4.0",
"@swc/core": "1.7.26",
"@swc/jest": "0.2.36",
"@testing-library/react": "15.0.6",
"@testing-library/react": "16.0.1",
"@types/bcrypt": "5.0.2",
"@types/connect-timeout": "0.0.39",
"@types/cors": "2.8.17",
Expand All @@ -56,50 +56,51 @@
"@types/jest": "29.5.12",
"@types/json2csv": "5.0.7",
"@types/jsonwebtoken": "9.0.6",
"@types/node": "^18.16.9",
"@types/node": "^22.5.4",
"@types/nodemailer": "6.4.15",
"@types/passport": "1.0.16",
"@types/qrcode": "1.5.5",
"@types/react": "18.3.1",
"@types/react": "18.3.5",
"@types/react-dom": "18.3.0",
"@types/react-highlight-words": "0.20.0",
"@types/supertest": "6.0.2",
"@types/tmp": "0.2.6",
"@types/uuid": "10.0.0",
"@types/webpack-env": "1.18.5",
"@typescript-eslint/eslint-plugin": "7.3.0",
"@typescript-eslint/parser": "7.3.0",
"@typescript-eslint/eslint-plugin": "8.5.0",
"@typescript-eslint/parser": "8.5.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-import": "2.30.0",
"eslint-plugin-jsonc": "2.16.0",
"eslint-plugin-jsx-a11y": "6.9.0",
"eslint-plugin-react": "7.34.4",
"eslint-plugin-jsx-a11y": "6.10.0",
"eslint-plugin-react": "7.35.2",
"eslint-plugin-react-hooks": "4.6.2",
"get-port": "7.1.0",
"git-rev-sync": "3.0.2",
"husky": "^9.0.11",
"husky": "^9.1.5",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"mongodb-memory-server": "9.4.1",
"nx": "19.4.3",
"mongodb-memory-server": "10.0.0",
"nx": "19.7.2",
"prettier": "^3.3.3",
"react-refresh": "^0.14.2",
"supertest": "6.3.4",
"supertest": "7.0.0",
"swc-loader": "0.2.6",
"ts-essentials": "10.0.1",
"ts-jest": "29.2.2",
"ts-essentials": "10.0.2",
"ts-jest": "29.2.5",
"ts-node": "10.9.2",
"typescript": "5.4.5",
"typescript": "5.6.2",
"url-loader": "^4.1.1",
"webpack": "^5.93.0",
"webpack-merge": "^5.10.0"
"webpack": "^5.94.0",
"webpack-dev-server": "5.1.0",
"webpack-merge": "^6.0.1"
},
"dependencies": {
"@ant-design/icons": "5.3.7",
"@apollo/client": "3.10.8",
"@apollo/server": "4.10.4",
"@commitlint/config-conventional": "^18.6.2",
"@ant-design/icons": "5.4.0",
"@apollo/client": "3.11.8",
"@apollo/server": "4.11.0",
"@commitlint/config-conventional": "^18.6.3",
"@commitlint/config-nx-scopes": "^18.6.1",
"@ideafast/idgen": "0.1.1",
"@simplewebauthn/browser": "^10.0.0",
Expand All @@ -110,30 +111,30 @@
"@nivo/line": "0.87.0",
"@nivo/pie": "0.87.0",
"@nivo/treemap": "0.87.0",
"@swc/helpers": "0.5.12",
"@swc/helpers": "0.5.13",
"@tanstack/react-query": "4.33.0",
"@trpc/client": "10.37.1",
"@trpc/react-query": "10.37.1",
"@trpc/server": "10.45.2",
"JSONStream": "1.3.5",
"antd": "5.19.2",
"antd": "5.20.6",
"antd-img-crop": "4.22.0",
"apollo-upload-client": "18.0.1",
"axios": "1.6.0",
"axios": "1.7.7",
"bcrypt": "5.1.1",
"commitlint": "^18.6.1",
"connect-mongo": "5.1.0",
"connect-timeout": "1.9.0",
"core-js": "^3.37.1",
"core-js": "^3.38.1",
"cors": "2.8.5",
"crypto-browserify": "3.12.0",
"csv-parse": "5.5.6",
"dayjs": "1.11.11",
"dayjs": "1.11.13",
"deepmerge": "4.3.1",
"esbuild": "^0.23.0",
"esbuild": "^0.23.1",
"export-from-json": "1.7.4",
"express": "^4.19.2",
"express-rate-limit": "7.3.1",
"express": "^4.20.0",
"express-rate-limit": "7.4.0",
"express-session": "1.18.0",
"fs-extra": "11.2.0",
"graphql": "16.9.0",
Expand All @@ -144,38 +145,38 @@
"graphql-upload-minimal": "1.6.1",
"graphql-ws": "5.16.0",
"hi-base32": "0.5.1",
"http-proxy-middleware": "3.0.0",
"http-proxy-middleware": "3.0.2",
"https-browserify": "1.0.0",
"jsonwebtoken": "9.0.2",
"jstat": "1.9.6",
"lint-staged": "15.2.7",
"lint-staged": "15.2.10",
"localforage": "^1.10.0",
"lodash-es": "4.17.21",
"minio": "7.1.3",
"mongodb": "6.8.0",
"multer": "1.4.3",
"nodemailer": "6.9.14",
"minio": "8.0.1",
"mongodb": "6.8.1",
"multer": "1.4.4",
"nodemailer": "6.9.15",
"passport": "0.7.0",
"path-browserify": "1.0.1",
"qrcode": "1.5.3",
"rc-picker": "4.6.9",
"qrcode": "1.5.4",
"rc-picker": "4.6.14",
"react": "18.3.1",
"react-csv": "2.2.2",
"react-dom": "18.3.1",
"react-dropzone": "14.2.3",
"react-helmet-async": "2.0.5",
"react-highlight-words": "0.20.0",
"react-quill": "2.0.0",
"react-router-dom": "6.24.1",
"react-router-dom": "6.26.2",
"react-spinners": "0.14.1",
"regenerator-runtime": "0.14.1",
"sanitize-filename": "1.6.3",
"stream-browserify": "3.0.0",
"stream-http": "3.2.0",
"tmp": "0.2.3",
"tslib": "^2.6.3",
"tslib": "^2.7.0",
"tsutils": "^3.21.0",
"url": "0.11.3",
"url": "0.11.4",
"uuid": "10.0.0",
"webdav-server": "2.6.2",
"zod": "3.23.8"
Expand Down
2 changes: 1 addition & 1 deletion packages/itmat-apis/express-user.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ declare global {

namespace Express {

// eslint-disable-next-line @typescript-eslint/no-empty-interface
// eslint-disable-next-line @typescript-eslint/no-empty-interface, @typescript-eslint/no-empty-object-type
interface User extends IUserWithoutToken { }

interface Request {
Expand Down
2 changes: 1 addition & 1 deletion packages/itmat-apis/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { exclude: _, ...swcJestConfig } = JSON.parse(
);
export default {
displayName: 'itmat-apis',
preset: '../../jest.preset.js',
preset: '../../jest.preset.cjs',
transform: {
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
},
Expand Down
4 changes: 2 additions & 2 deletions packages/itmat-apis/src/graphql/resolvers/studyResolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class StudyResolvers {
async studyRoles(study: IStudy, _args: never, context) {
try {
return await this.permissionCore.getRolesOfStudy(context.req.user, study.id);
} catch (e) {
} catch {
return [];
}
}
Expand All @@ -129,7 +129,7 @@ export class StudyResolvers {
}) : el.description
};
});
} catch (e) {
} catch (__unused__exception) {
return [];
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/itmat-commons/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { exclude: _, ...swcJestConfig } = JSON.parse(
);
export default {
displayName: 'itmat-commons',
preset: '../../jest.preset.js',
preset: '../../jest.preset.cjs',
transform: {
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
},
Expand Down
10 changes: 5 additions & 5 deletions packages/itmat-commons/src/utils/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ export class Database<configType extends IDatabaseBaseConfig, C = Record<keyof c
): Promise<MongoClient> {
this.config = config;
const shouldOutput = process.env['JEST_WORKER_ID'] !== undefined;
shouldOutput && Logger.log('Connecting to the database..');
if (shouldOutput) Logger.log('Connecting to the database..');
/* any error throw here will be caught by the server */
this.localClient = await (new mongoClient(config.mongo_url)).connect();
shouldOutput && Logger.log('Connected to database.');
if (shouldOutput) Logger.log('Connected to database.');

shouldOutput && Logger.log('Performing basic checks..');
if (shouldOutput) Logger.log('Performing basic checks..');
await this.checkAllCollectionsArePresent();
shouldOutput && Logger.log('Done basic checks.');
if (shouldOutput) Logger.log('Done basic checks.');

this.assignCollections();

shouldOutput && Logger.log('Finished with database initialisation.');
if (shouldOutput) Logger.log('Finished with database initialisation.');
return this.localClient;
}

Expand Down
12 changes: 8 additions & 4 deletions packages/itmat-commons/src/utils/objStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ export class ObjectStore {

public async isConnected(): Promise<boolean> {
try {
this.client && await this.client.listBuckets();
if (this.client)
await this.client.listBuckets();
return true;
} catch (e) {
} catch (__unused__exception) {
return false;
}
}
Expand Down Expand Up @@ -58,7 +59,7 @@ export class ObjectStore {
try {
await this.client.statObject(lowerCaseBucketId, uri);
fileExists = true;
} catch (e) {
} catch (__unused__exception) {
fileExists = false;
}

Expand All @@ -85,7 +86,10 @@ export class ObjectStore {
// Copy the object
const conds = new Minio.CopyConditions();
const result = await this.client.copyObject(lowerTargetBucket, targetUri, `/${lowerSourceBucket}/${sourceUri}`, conds);
return result.etag;
if (Object.hasOwn(result, 'Etag'))
return (result as Record<string, unknown>)?.['Etag'];
else
return (result as Record<string, unknown>)?.['etag'];
}

public async downloadFile(buckerId: string, uri: string): Promise<Readable> {
Expand Down
2 changes: 1 addition & 1 deletion packages/itmat-cores/express-user.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ declare global {

namespace Express {

// eslint-disable-next-line @typescript-eslint/no-empty-interface
// eslint-disable-next-line @typescript-eslint/no-empty-interface, @typescript-eslint/no-empty-object-type
interface User extends IUserWithoutToken { }

interface Request {
Expand Down
2 changes: 1 addition & 1 deletion packages/itmat-cores/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { exclude: _, ...swcJestConfig } = JSON.parse(
);
export default {
displayName: 'itmat-cores',
preset: '../../jest.preset.js',
preset: '../../jest.preset.cjs',
transform: {
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
},
Expand Down
Loading

0 comments on commit 9002606

Please sign in to comment.