Skip to content

Commit 21b61d9

Browse files
authored
refactor: React Migration + Accessibility improvements
2 parents 4c5043c + 2be0c84 commit 21b61d9

File tree

765 files changed

+16820
-12608
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

765 files changed

+16820
-12608
lines changed

.cspell.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"allowfullscreen",
77
"animationend",
88
"animationstart",
9-
"antiscroll",
109
"applock",
1110
"arraybuffer",
1211
"arrayify",

.eslintrc.json

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
"jasmine": true,
44
"jest/globals": true
55
},
6-
"extends": ["@wireapp/eslint-config", "plugin:jest/recommended", "plugin:jsx-a11y/recommended"],
6+
"extends": [
7+
"@wireapp/eslint-config",
8+
"plugin:jest/recommended",
9+
"plugin:jsx-a11y/recommended",
10+
"plugin:@typescript-eslint/eslint-recommended",
11+
"prettier",
12+
"plugin:import/recommended",
13+
"plugin:import/typescript"
14+
],
715
"globals": {
816
"$": true,
917
"amplify": true,
@@ -14,8 +22,21 @@
1422
"z": true,
1523
"RTCAudioSource": true
1624
},
17-
"plugins": ["sort-keys-fix", "react-hooks"],
18-
"ignorePatterns": [".git/", "docs/", "bin/", "node_modules/", "resource/", "server/bin/", "server/dist/", "server/node_modules/", "src/ext/", "src/script/localization/**/webapp*.js", "src/worker/"],
25+
"plugins": ["sort-keys-fix", "import", "react-hooks", "eslint-plugin-testing-library", "@typescript-eslint"],
26+
"ignorePatterns": [
27+
".git/",
28+
"docs/",
29+
"bin/",
30+
"node_modules/",
31+
"resource/",
32+
"server/bin/",
33+
"server/dist/",
34+
"server/node_modules/",
35+
"src/ext/",
36+
"src/script/localization/**/webapp*.js",
37+
"src/worker/",
38+
"*.js"
39+
],
1940
"overrides": [
2041
{
2142
"files": ["*.ts", "*.tsx"],
@@ -37,22 +58,63 @@
3758
],
3859
"rules": {
3960
"id-length": "off",
40-
"no-magic-numbers": "off",
61+
"no-magic-numbers": ["warn", {"ignoreArrayIndexes": true}],
4162
"jest/no-jasmine-globals": "off",
4263
"jest/no-identical-title": "warn",
4364
"jest/no-done-callback": "warn",
4465
"jest/no-disabled-tests": "warn",
4566
"jest/no-conditional-expect": "warn",
4667
"sort-keys-fix/sort-keys-fix": "warn",
4768
"jsx-a11y/media-has-caption": "warn",
69+
"jsx-a11y/no-noninteractive-tabindex": "warn",
70+
"react/no-unknown-property": ["error", {"ignore": ["css"]}],
4871
"react/react-in-jsx-scope": "off",
49-
"react/no-unknown-property": ["error", {"ignore": ["css", "transform-origin"]}],
5072
"react-hooks/rules-of-hooks": "error",
51-
"react-hooks/exhaustive-deps": "warn"
73+
"react-hooks/exhaustive-deps": "warn",
74+
"import/no-unresolved": "error",
75+
"import/no-default-export": "error",
76+
"@typescript-eslint/explicit-module-boundary-types": "off",
77+
"@typescript-eslint/no-empty-interface": "warn",
78+
"@typescript-eslint/ban-ts-comment": "off",
79+
"@typescript-eslint/no-var-requires": "warn",
80+
"@typescript-eslint/no-non-null-assertion": "warn",
81+
"import/order": [
82+
"error",
83+
{
84+
"groups": ["external", "builtin", "internal", "sibling", "parent", "index"],
85+
"pathGroups": [
86+
{
87+
"pattern": "react",
88+
"group": "external",
89+
"position": "before"
90+
}
91+
],
92+
"pathGroupsExcludedImportTypes": ["react"],
93+
"newlines-between": "always",
94+
"alphabetize": {
95+
"order": "asc",
96+
"caseInsensitive": true
97+
},
98+
"warnOnUnassignedImports": false
99+
}
100+
]
52101
},
53102
"settings": {
54103
"react": {
55104
"version": "detect"
105+
},
106+
"import/resolver": {
107+
"alias": {
108+
"map": [
109+
["Util", "./src/script/util/"],
110+
["Components", "./src/script/components/"],
111+
["I18n", "./src/i18n/"],
112+
["Resource", "./resource/"],
113+
["src", "./src/"],
114+
["test", "./test/"]
115+
],
116+
"extensions": [".ts", ".js", ".jsx", ".tsx", ".json"]
117+
}
56118
}
57119
}
58120
}

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npx --no-install lint-staged
4+
npx --no-install lint-staged && yarn check:circular-dependencies

Gruntfile.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
*
1818
*/
1919

20-
const path = require('path');
2120
const {format} = require('date-fns');
21+
22+
const path = require('path');
23+
2224
const {SRC_PATH, DIST_PATH} = require('./locations');
2325

2426
module.exports = grunt => {

jest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ const config: Config = {
4242
testRunner: 'jest-jasmine2',
4343
};
4444

45+
// eslint-disable-next-line import/no-default-export
4546
export default config;

package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,10 @@
103103
"cssnano": "4.1.11",
104104
"dexie": "^3.2.2",
105105
"dotenv": "16.0.3",
106+
"dpdm": "3.10.0",
106107
"eslint": "8.26.0",
107108
"eslint-config-prettier": "8.5.0",
109+
"eslint-import-resolver-alias": "1.1.2",
108110
"eslint-plugin-babel": "5.3.1",
109111
"eslint-plugin-import": "2.26.0",
110112
"eslint-plugin-jest": "27.1.3",
@@ -115,6 +117,7 @@
115117
"eslint-plugin-react": "7.31.10",
116118
"eslint-plugin-react-hooks": "4.6.0",
117119
"eslint-plugin-sort-keys-fix": "1.1.2",
120+
"eslint-plugin-testing-library": "5.7.2",
118121
"eslint-plugin-typescript-sort-keys": "2.1.0",
119122
"eslint-plugin-unused-imports": "2.0.0",
120123
"fake-indexeddb": "4.0.0",
@@ -176,15 +179,12 @@
176179
},
177180
"license": "GPL-3.0",
178181
"lint-staged": {
182+
"*": "prettier --ignore-unknown --write",
179183
"*.less": [
180-
"prettier --write",
181184
"stylelint --fix"
182185
],
183-
"*.{js,ts,tsx}": [
186+
"*.{js,jsx,ts,tsx}": [
184187
"eslint --fix"
185-
],
186-
"*.{json,md,yml}": [
187-
"prettier --write"
188188
]
189189
},
190190
"name": "wire-webapp",
@@ -218,7 +218,10 @@
218218
"lint:other": "yarn prettier --list-different && yarn stylelint",
219219
"lint:code": "eslint -c .eslintrc.json --ext .js,.ts,.tsx .",
220220
"lint:spelling": "cspell -c .cspell.json 'src/script/**/*.{js,ts,tsx,md}' src/i18n/en-US.json",
221-
"postinstall": "yarn configure && cd server && yarn && cd .. && husky install",
221+
"check:circular-dependencies": "yarn check:circular-dependencies:app && yarn check:circular-dependencies:auth",
222+
"check:circular-dependencies:app": "dpdm -T ./src/script/main/app.ts",
223+
"check:circular-dependencies:auth": "dpdm -T ./src/script/auth/main.tsx",
224+
"postinstall": "yarn configure && cd server && yarn && cd .. && husky install",
222225
"prettier": "prettier --ignore-path .prettierignore \"**/*.{json,md,yml}\"",
223226
"release:staging": "git checkout dev && git pull && ts-node ./bin/release_tag.ts staging",
224227
"release:production": "git checkout master && git pull && ts-node ./bin/release_tag.ts production",

server/Server.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@
1919

2020
import express from 'express';
2121
import expressSitemapXml from 'express-sitemap-xml';
22-
import fs from 'fs';
2322
import hbs from 'hbs';
2423
import helmet from 'helmet';
24+
import {StatusCodes as HTTP_STATUS} from 'http-status-codes';
25+
import nocache from 'nocache';
26+
27+
import fs from 'fs';
2528
import http from 'http';
2629
import https from 'https';
27-
import nocache from 'nocache';
2830
import path from 'path';
29-
import {StatusCodes as HTTP_STATUS} from 'http-status-codes';
3031

3132
import {HealthCheckRoute} from './routes/_health/HealthRoute';
3233
import {AppleAssociationRoute} from './routes/appleassociation/AppleAssociationRoute';

server/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import dotenv from 'dotenv-extended';
2121
import fs from 'fs-extra';
2222
import logdown from 'logdown';
23+
2324
import path from 'path';
2425

2526
import type {ServerConfig} from './ServerConfig';

server/routes/error/ErrorRoutes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
*/
1919

2020
import express from 'express';
21-
import logdown from 'logdown';
2221
import {StatusCodes as HTTP_STATUS} from 'http-status-codes';
22+
import logdown from 'logdown';
2323

2424
import {formatDate} from '../../util/TimeUtil';
2525

setupTests.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*
1818
*/
1919

20+
/* eslint-disable import/order */
21+
2022
// Polyfill for "tsyringe" dependency injection
2123
require('core-js/full/reflect');
2224
require('intersection-observer');
@@ -31,6 +33,7 @@ require('src/script/util/test/mock/navigatorPermissionsMock');
3133
require('src/script/util/test/mock/ResponseMock');
3234
require('src/script/util/test/mock/SVGProviderMock');
3335
require('src/script/util/test/mock/WebRTCMock');
36+
require('src/script/util/test/mock/resizeObserver.mock');
3437

3538
jest.mock('axios', () => {
3639
return {
@@ -73,5 +76,7 @@ window.wire = {
7376

7477
window.z = {userPermission: {}};
7578

79+
window.URL.createObjectURL = jest.fn();
80+
7681
const testLib = require('@testing-library/react');
7782
testLib.configure({testIdAttribute: 'data-uie-name'});

src/i18n/ar-SA.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"accessibility.conversationStatusUnreadPing": "Missed ping",
9090
"accessibility.conversationStatusUnreadReply": "Unread reply",
9191
"accessibility.giphyModal.close": "Close 'GIF' window",
92-
"accessibility.giphyModal.loading": "Loading gif",
92+
"accessibility.giphyModal.loading": "Loading giphy",
9393
"accessibility.giphyModal.selectGif": "Select gif",
9494
"accessibility.giphyModal.sendGif": "Send gif",
9595
"accessibility.giphyModal.showGifs": "Open all gifs",
@@ -840,9 +840,8 @@
840840
"modalCreateFolderPlaceholder": "Folder name",
841841
"modalCreateGroupProtocolHeading": "Protocol",
842842
"modalCreateGroupProtocolInfo": "Select MLS to create a group conversation using the Messaging Layer Security protocol. Please be aware that this is a beta version.",
843-
"modalCreateGroupProtocolSelect.default": " (default)",
844843
"modalCreateGroupProtocolSelect.mls": "MLS",
845-
"modalCreateGroupProtocolSelect.proteus": "Proteus",
844+
"modalCreateGroupProtocolSelect.proteus": "Proteus (default)",
846845
"modalGifTooLargeHeadline": "الصورة المتحركة المختارة كبيرة جدا",
847846
"modalGifTooLargeMessage": "الحجم الأقصى هو {{number}} ميغابايت.",
848847
"modalImproveWireAction": "قبول",

src/i18n/en-US.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"accessibility.conversationStatusUnreadPing": "Missed ping",
9090
"accessibility.conversationStatusUnreadReply": "Unread reply",
9191
"accessibility.giphyModal.close": "Close 'GIF' window",
92-
"accessibility.giphyModal.loading": "Loading gif",
92+
"accessibility.giphyModal.loading": "Loading giphy",
9393
"accessibility.giphyModal.selectGif": "Select gif",
9494
"accessibility.giphyModal.sendGif": "Send gif",
9595
"accessibility.giphyModal.showGifs": "Open all gifs",
@@ -542,6 +542,7 @@
542542
"groupCreationPreferencesErrorNameShort": "At least 1 character",
543543
"groupCreationPreferencesHeader": "Create group",
544544
"groupCreationPreferencesPlaceholder": "Group name",
545+
"groupCreationDeleteEntry": "Delete entry",
545546
"groupParticipantActionBlock": "Block…",
546547
"groupParticipantActionCancelRequest": "Cancel request…",
547548
"groupParticipantActionDevices": "Devices",
@@ -1007,9 +1008,7 @@
10071008
"preferencesAccountUsernameErrorTaken": "Already taken",
10081009
"preferencesAccountUsernameHint": "At least 2 characters. a—z, 0—9 and _ only.",
10091010
"preferencesAccountUsernamePlaceholder": "Your full name",
1010-
"preferencesDevice": "Device",
10111011
"preferencesDeviceDetails": "Device Details",
1012-
"preferencesDeviceNotVerified": "not verified",
10131012
"preferencesDevices": "Devices",
10141013
"preferencesDevicesActivatedOn": "Activated [bold]{{date}}[/bold]",
10151014
"preferencesDevicesActive": "Active",
@@ -1026,6 +1025,8 @@
10261025
"preferencesDevicesSessionOngoing": "Resetting session…",
10271026
"preferencesDevicesSessionReset": "Reset Session",
10281027
"preferencesDevicesVerification": "Verified",
1028+
"preferencesDeviceNotVerified": "not verified",
1029+
"preferencesDevice": "Device",
10291030
"preferencesHeadline": "Preferences",
10301031
"preferencesOptions": "Options",
10311032
"preferencesOptionsAudio": "Sound alerts",

src/page/index.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,23 @@
33
<!-- {{@config.VERSION}} -->
44
<html id="wire-main-app">
55
<head>
6-
#include('meta.htm')
7-
#include('graph.htm')
6+
#include('meta.htm') #include('graph.htm')
87
<title>{{@config.BRAND_NAME}}</title>
98
<style type="text/css">
109
#include('../../../server/dist/static/style/default.css');
1110
</style>
1211
</head>
1312

1413
<body>
15-
#include('wire-main.htm')
14+
<app-container
15+
id="wire-main"
16+
class="off"
17+
data-bind="css: mainClasses()"
18+
params="root: $root"
19+
data-uie-name="status-webapp"
20+
data-uie-value="is-loading"
21+
></app-container>
22+
1623
#include('loading.htm')
1724

1825
<script src="./config.js?{{@config.VERSION}}"></script>

src/page/template/content/connect-requests.htm

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)