Skip to content

Commit

Permalink
chore: remove deprecated globals (#16417)
Browse files Browse the repository at this point in the history
  • Loading branch information
atomrc authored Feb 12, 2024
1 parent 393c5df commit a8ef661
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 33 deletions.
10 changes: 3 additions & 7 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
"jasmine": true
},
"globals": {
"amplify": true,
"ko": true,
"sinon": true,
"wire": true,
"z": true,
"RTCAudioSource": true
"React": "readonly",
"JSX": "readonly",
"amplify": "readonly"
},
"ignorePatterns": [
".git/",
Expand Down Expand Up @@ -42,7 +39,6 @@
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/typedef": "off",
"no-dupe-class-members": "off",
"no-undef": "off",
"no-unsanitized/property": "off",
"prefer-promise-reject-errors": "off",
"valid-jsdoc": "off",
Expand Down
8 changes: 0 additions & 8 deletions src/script/auth/configureEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,8 @@
*
*/

import {amplify} from 'amplify';
import jQuery from 'jquery';

import '../event/Client';
import '../message/MessageCategorization';
import '../message/MessageCategory';
import '../service/BackendEnvironment';
import '../storage/StorageSchemata';

window.amplify = amplify;
window.jQuery = jQuery;
// eslint-disable-next-line id-length
window.$ = jQuery;
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import {useMemo, useState, useEffect} from 'react';

import {QualifiedId} from '@wireapp/api-client/lib/user';
import ko from 'knockout';

import {Conversation} from 'src/script/entity/Conversation';
import {CompositeMessage} from 'src/script/entity/message/CompositeMessage';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import {FC, useCallback, useRef, useState} from 'react';

import {amplify} from 'amplify';
import ko from 'knockout';

import {WebAppEvents} from '@wireapp/webapp-events';

Expand Down
3 changes: 2 additions & 1 deletion src/script/properties/PropertiesRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {RECEIPT_MODE} from '@wireapp/api-client/lib/conversation/data';
import {ConsentType} from '@wireapp/api-client/lib/self/';
import {AudioPreference, NotificationPreference, WebappProperties} from '@wireapp/api-client/lib/user/data/';
import {amplify} from 'amplify';
import jquery from 'jquery';
import ko from 'knockout';

import {WebAppEvents} from '@wireapp/webapp-events';
Expand Down Expand Up @@ -185,7 +186,7 @@ export class PropertiesRepository {
return this.propertiesService
.getPropertiesByKey(PropertiesRepository.CONFIG.WEBAPP_ACCOUNT_SETTINGS)
.then(properties => {
$.extend(true, this.properties, properties);
jquery.extend(true, this.properties, properties);
})
.catch(() => {
this.logger.warn(
Expand Down
2 changes: 1 addition & 1 deletion src/script/tracking/countly-skd-web.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ declare module 'countly-sdk-web' {
begin_session(): void;
change_id(newId: string, merge: boolean): void;
userData: UserData;
add_event: (eventData: EventData) => void;
add_event: (eventData: any) => void;
}

const Countly: Countly;
Expand Down
4 changes: 2 additions & 2 deletions src/script/util/DebugUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {FeatureStatus} from '@wireapp/api-client/lib/team/feature/';
import type {QualifiedId} from '@wireapp/api-client/lib/user';
import {DatabaseKeys} from '@wireapp/core/lib/notification/NotificationDatabaseRepository';
import Dexie from 'dexie';
import jquery from 'jquery';
import keyboardjs from 'keyboardjs';
import {$createTextNode, $getRoot, LexicalEditor} from 'lexical';
import {container} from 'tsyringe';
Expand Down Expand Up @@ -73,7 +74,7 @@ export class DebugUtil {
private readonly eventRepository: EventRepository;
private readonly storageRepository: StorageRepository;
private readonly messageRepository: MessageRepository;
public readonly $: JQueryStatic;
public readonly $ = jquery;
/** Used by QA test automation. */
public readonly userRepository: UserRepository;
/** Used by QA test automation. */
Expand All @@ -89,7 +90,6 @@ export class DebugUtil {
private readonly core = container.resolve(Core),
private readonly apiClient = container.resolve(APIClient),
) {
this.$ = $;
this.Dexie = Dexie;

const {calling, client, connection, conversation, event, user, storage, message} = repositories;
Expand Down
11 changes: 1 addition & 10 deletions src/types/window.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,13 @@
*/

import {amplify} from 'amplify';
import jQuery from 'jquery';
import ko from 'knockout';

import {t} from 'Util/LocalizerUtil';

import {WireModule} from './Wire.types';

declare global {
interface Window {
$: typeof jQuery;
amplify: amplify.Static;
jQuery: typeof jQuery;
ko: typeof ko;
t: typeof t;
wire: WireModule;
wSSOCapable: boolean;
amplify: amplify.Static;
z: any;
}
}
4 changes: 0 additions & 4 deletions webpack.config.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,7 @@ module.exports = {
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
Buffer: ['buffer', 'Buffer'],
_: 'underscore',
jQuery: 'jquery',
ko: 'knockout',
}),
new WorkboxPlugin.InjectManifest({
maximumFileSizeToCacheInBytes: process.env.NODE_ENV !== 'production' ? 10 * 1024 * 1024 : undefined,
Expand Down

0 comments on commit a8ef661

Please sign in to comment.