Skip to content

Commit

Permalink
chore(deps): Upgrade dependencies (#2773)
Browse files Browse the repository at this point in the history
* Prefer ECMAScript's `URL`

* Upgrade some deps

* Remove unused `tslib`

* Adjust ESlint configuration

* Change Jest runner

* Fix linting

* Use upgraded `@rocket.chat/eslint-config`

* remove some console logs

---------

Co-authored-by: Jean Brito <[email protected]>
  • Loading branch information
tassoevan and jeanfbrito authored Nov 21, 2023
1 parent 45d6ada commit e703dde
Show file tree
Hide file tree
Showing 49 changed files with 2,800 additions and 6,117 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/node_modules
/app
/workspaces/desktop-release-action/dist
/workspaces/*
10 changes: 0 additions & 10 deletions .eslintrc.js

This file was deleted.

37 changes: 37 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"extends": ["@rocket.chat/eslint-config"],
"plugins": ["react", "react-hooks"],
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true,
"jest": true
},
"rules": {
"react-hooks/exhaustive-deps": "error",
"react-hooks/rules-of-hooks": "error",
"react/display-name": "error",
"react/jsx-curly-brace-presence": "error",
"react/jsx-fragments": ["error", "syntax"],
"react/jsx-key": ["error", { "checkFragmentShorthand": true, "checkKeyMustBeforeSpread": true, "warnOnDuplicates": true }],
"react/jsx-no-undef": "error",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react/no-multi-comp": "error"
},
"settings": {
"react": {
"version": "detect"
}
},
"overrides": [
{
"files": ["**/*.stories.js", "**/*.stories.jsx", "**/*.stories.ts", "**/*.stories.tsx", "**/*.spec.tsx"],
"rules": {
"react/display-name": "off",
"react/no-multi-comp": "off"
}
}
]
}
1 change: 0 additions & 1 deletion .prettierrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@rocket.chat/prettier-config/fuselage"
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"eslint.workingDirectories": [
{
"pattern": "workspaces/*",
"changeProcessCWD": true
},
{
"pattern": ".",
"changeProcessCWD": true
}
],
"typescript.tsdk": "./node_modules/typescript/lib"
}
22 changes: 3 additions & 19 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,24 @@ module.exports = {
{
preset: 'ts-jest',
errorOnDeprecated: true,
runner: '@jest-runner/electron',
testEnvironment: '@jest-runner/electron/environment',
runner: '@kayahr/jest-electron-runner',
testEnvironment: '@kayahr/jest-electron-runner/environment',
testMatch: [
'<rootDir>/src/*/!(main)/**/*.(spec|test).{js,ts,tsx}',
'<rootDir>/src/**/renderer.(spec|test).{js,ts,tsx}',
],
setupFilesAfterEnv: ['./src/.jest/setup.ts'],
globals: {
'ts-jest': {
tsconfig: {
noUnusedLocals: false,
noUnusedParameters: false,
},
},
},
},
{
preset: 'ts-jest',
errorOnDeprecated: true,
runner: '@jest-runner/electron/main',
runner: '@kayahr/jest-electron-runner/main',
testEnvironment: 'node',
testMatch: [
'<rootDir>/src/*/main/**/*.(spec|test).{js,ts,tsx}',
'<rootDir>/src/**/main.(spec|test).{js,ts,tsx}',
],
setupFilesAfterEnv: ['./src/.jest/setup.ts'],
globals: {
'ts-jest': {
tsconfig: {
noUnusedLocals: false,
noUnusedParameters: false,
},
},
},
},
],
};
71 changes: 38 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"lint": "run-s .:lint:eslint .:lint:tsc",
".:lint:eslint": "eslint .",
".:lint:tsc": "tsc --noEmit --skipLibCheck",
".:lint:tsc": "tsc --noEmit",
"lint-fix": "run-s .:lint-fix:eslint .:lint:tsc",
".:lint-fix:eslint": "eslint --fix .",
"workspaces:build": "yarn workspaces foreach -t run build",
Expand All @@ -53,7 +53,7 @@
"@emotion/css": "^11.7.1",
"@emotion/react": "^11.7.1",
"@emotion/styled": "^11.6.0",
"@ewsjs/xhr": "^1.5.0",
"@ewsjs/xhr": "^2.0.1",
"@rocket.chat/css-in-js": "~0.31.25",
"@rocket.chat/fuselage": "~0.36.0",
"@rocket.chat/fuselage-hooks": "~0.32.1",
Expand All @@ -62,25 +62,24 @@
"abort-controller": "^3.0.0",
"axios": "^1.4.0",
"dotenv": "~16.3.1",
"electron-dl": "^3.5.0",
"electron-dl": "~3.5.1",
"electron-store": "^8.1.0",
"electron-updater": "^5.3.0",
"ews-javascript-api": "^0.12.0",
"ews-javascript-api": "~0.13.0",
"i18next": "^21.6.10",
"jsonwebtoken": "^9.0.1",
"jsonwebtoken": "~9.0.2",
"moment": "^2.29.4",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "~17.0.2",
"react-dom": "~17.0.2",
"react-hook-form": "^7.43.9",
"react-i18next": "^11.15.3",
"react-keyed-flatten-children": "^1.3.0",
"react-redux": "^7.2.6",
"react-redux": "~7.1.3",
"react-virtuoso": "1.2.4",
"redux": "^4.1.2",
"reselect": "4.1.6",
"redux": "^4.2.1",
"reselect": "~4.1.8",
"rimraf": "^3.0.2",
"semver": "^7.5.4",
"tslib": "^2.3.1"
"semver": "^7.5.4"
},
"devDependencies": {
"@babel/core": "^7.16.12",
Expand All @@ -89,28 +88,28 @@
"@babel/plugin-proposal-function-bind": "^7.16.7",
"@babel/preset-env": "^7.16.11",
"@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "~7.23.3",
"@fiahfy/icns-convert": "^0.0.12",
"@fiahfy/ico-convert": "^0.0.12",
"@jest-runner/electron": "^3.0.1",
"@rocket.chat/eslint-config": "^0.4.0",
"@rocket.chat/eslint-config-alt": "^0.32.0-dev.143",
"@rocket.chat/prettier-config": "^0.31.23-dev.165",
"@kayahr/jest-electron-runner": "~29.10.0",
"@rocket.chat/eslint-config": "~0.6.0",
"@rocket.chat/prettier-config": "~0.31.25",
"@rollup/plugin-babel": "~5.3.1",
"@rollup/plugin-commonjs": "~21.1.0",
"@rollup/plugin-json": "~4.1.0",
"@rollup/plugin-node-resolve": "~13.3.0",
"@rollup/plugin-replace": "~3.1.0",
"@types/electron-devtools-installer": "^2.2.1",
"@types/bluebird": "~3.5.42",
"@types/electron-devtools-installer": "~2.2.5",
"@types/jest": "^27.4.0",
"@types/jsonwebtoken": "^9.0.2",
"@types/meteor": "^2.0.4",
"@types/node": "^17.0.13",
"@types/node-fetch": "^3.0.3",
"@types/react": "^17.0.38",
"@types/react-dom": "^17.0.11",
"@types/react-redux": "^7.1.22",
"@types/resize-observer-browser": "^0.1.6",
"@types/jsonwebtoken": "~9.0.5",
"@types/node": "~16.0.3",
"@types/react": "~17.0.70",
"@types/react-dom": "~17.0.23",
"@types/react-redux": "~7.1.30",
"@types/resize-observer-browser": "~0.1.10",
"@types/rimraf": "^3.0.2",
"@types/stylis": "~4.2.3",
"@typescript-eslint/eslint-plugin": "~5.60.1",
"@typescript-eslint/parser": "~5.60.1",
"builtin-modules": "^3.2.0",
Expand All @@ -121,22 +120,28 @@
"electron-builder": "^23.6.0",
"electron-devtools-installer": "^3.2.0",
"electron-notarize": "^1.2.2",
"eslint": "~8.45.0",
"eslint": "~8.53.0",
"eslint-config-prettier": "~9.0.0",
"eslint-import-resolver-typescript": "~3.6.1",
"eslint-plugin-import": "~2.26.0",
"jest": "^26.6.3",
"jimp": "^0.16.1",
"eslint-plugin-prettier": "~4.2.1",
"eslint-plugin-react": "~7.33.2",
"eslint-plugin-react-hooks": "~4.6.0",
"jest": "~29.7.0",
"jest-environment-jsdom": "~29.7.0",
"jimp": "~0.16.13",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"prettier": "~2.8.8",
"puppeteer": "^13.1.2",
"rollup": "~2.79.1",
"rollup-plugin-copy": "~3.4.0",
"ts-jest": "^26.5.6",
"ts-node": "^10.4.0",
"typescript": "^4.5.5",
"ts-jest": "~29.1.1",
"ts-node": "^10.9.1",
"typescript": "~5.2.2",
"xvfb-maybe": "^0.2.1"
},
"optionalDependencies": {
"fsevents": "2.3.2"
"fsevents": "2.3.3"
},
"engines": {
"node": ">=12.8.x"
Expand Down
2 changes: 0 additions & 2 deletions src/deepLinks/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { URL } from 'url';

import type { WebContents } from 'electron';
import { app } from 'electron';

Expand Down
2 changes: 1 addition & 1 deletion src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const listenToBugsnagEnabledToggle = async (appType: AppType) => {
bugsnagInstance || initBugsnag(apiKey, appVersion, appType);
bugsnagInstance.startSession();
} else {
bugsnagInstance && bugsnagInstance.pauseSession();
bugsnagInstance?.pauseSession();
}
});
};
Expand Down
11 changes: 1 addition & 10 deletions src/injected.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { RocketChatDesktopAPI } from './servers/preload/api';

declare global {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface Window {
RocketChatDesktop: RocketChatDesktopAPI;
}
Expand Down Expand Up @@ -178,18 +179,8 @@ const start = async () => {
const userId = Meteor.userId();
const outlookCalendarEnabled = settings.get('Outlook_Calendar_Enabled');
const outlookExchangeUrl = settings.get('Outlook_Calendar_Exchange_Url');
console.log(
'[Rocket.Chat Desktop] outlookCalendarEnabled',
outlookCalendarEnabled
);
console.log('[Rocket.Chat Desktop] userToken', userToken);
console.log('[Rocket.Chat Desktop] userId', userId);
console.log('[Rocket.Chat Desktop] outlookExchangeUrl', outlookExchangeUrl);
if (!userToken || !userId || !outlookCalendarEnabled || !outlookExchangeUrl)
return;
console.log(
'[Rocket.Chat Desktop] window.RocketChatDesktop.setUserToken fired'
);
window.RocketChatDesktop.setUserToken(userToken, userId);

window.RocketChatDesktop.setOutlookExchangeUrl(outlookExchangeUrl, userId);
Expand Down
2 changes: 1 addition & 1 deletion src/notifications/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const createNotification = async (
subtitle,
body: body ?? '',
icon: await resolveIcon(icon),
silent,
silent: silent ?? undefined,
hasReply: canReply,
actions: actions?.map((action) => ({
type: 'button',
Expand Down
16 changes: 8 additions & 8 deletions src/outlookCalendar/getOutlookEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const getOutlookEvents = async (
try {
const { login, password, serverUrl } = credentials;

const xhrApi = new XhrApi({ gzip: true });
const xhrApi = new XhrApi({ decompress: true });
xhrApi.useNtlmAuthentication(login, password);

ConfigurationApi.ConfigureXHR(xhrApi);
Expand All @@ -34,18 +34,18 @@ export const getOutlookEvents = async (
exchange.Credentials = new WebCredentials(login, password);
exchange.Url = new Uri(`${serverUrl}/ews/exchange.asmx`);

const validated_date = new Date(date);
const validatedDate = new Date(date);

const folderId = new FolderId(WellKnownFolderName.Calendar);
const minTime = new DateTime(
validated_date.getFullYear(),
validated_date.getMonth() + 1,
validated_date.getDate()
validatedDate.getFullYear(),
validatedDate.getMonth() + 1,
validatedDate.getDate()
);
const maxTime = new DateTime(
validated_date.getFullYear(),
validated_date.getMonth() + 1,
validated_date.getDate(),
validatedDate.getFullYear(),
validatedDate.getMonth() + 1,
validatedDate.getDate(),
23,
59,
59
Expand Down
1 change: 1 addition & 0 deletions src/outlookCalendar/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ export const startOutlookCalendarUrlHandler = (): void => {
const server = getServerInformationByWebContentsId(event.id);
const { outlookCredentials } = server;
if (
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
!outlookCredentials ||
!outlookCredentials.userId ||
!outlookCredentials.serverUrl
Expand Down
1 change: 1 addition & 0 deletions src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { handleTrafficLightsSpacing } from './ui/preload/sidebar';
import { whenReady } from './whenReady';

declare global {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface Window {
JitsiMeetElectron: JitsiMeetElectronAPI;
RocketChatDesktop: RocketChatDesktopAPI;
Expand Down
6 changes: 3 additions & 3 deletions src/servers/supportedVersions/downloadFromCloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const apiUrl =
'https://releases.rocket.chat/v2/server/supportedVersions?source=desktop';
const outputFilePath = path.join('.', 'app', 'supportedVersions.jwt');

interface SupportedVersionsResponse {
type SupportedVersionsResponse = {
signed?: string;
}
};

export async function downloadAndSaveSupportedVersionsFromCloud(): Promise<void> {
console.log('Getting Supported Versions from Cloud...');
Expand All @@ -22,7 +22,7 @@ export async function downloadAndSaveSupportedVersionsFromCloud(): Promise<void>
if (response.status === 200) {
const jsonData: SupportedVersionsResponse = response.data;

if (jsonData && jsonData.signed) {
if (jsonData?.signed) {
const signedContent: string = jsonData.signed;
const directory = path.dirname(outputFilePath);
if (!fs.existsSync(directory)) {
Expand Down
2 changes: 1 addition & 1 deletion src/servers/supportedVersions/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const getSupportedVersionsData = async (
serverDomain,
serverUniqueID
);
if (cloudSupportedVersions && cloudSupportedVersions.signed) {
if (cloudSupportedVersions?.signed) {
const decodedCloudSupportedVersions = decode(
cloudSupportedVersions.signed
) as SupportedVersions;
Expand Down
Loading

0 comments on commit e703dde

Please sign in to comment.