Skip to content

Commit 2f46419

Browse files
tlebonmythsunwind
andauthored
chore: keep packages below esm versions, fix some package issues, lint pipeline (#6069)
* chore: keep packages below esm versions * fix: use correct directory to link binaries on deb install (#6070) * fix: use correct directory to link binaries on deb install * use sanitizedProductName * feat: update linter * chore: add uuidjs * feat: add lint action * chore: remove duplicate windowUtil * chore: fix failing lib check * chore: switch package versions to latest --------- Co-authored-by: Sven Jost <[email protected]>
1 parent a16bc4b commit 2f46419

Some content is hidden

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

62 files changed

+1876
-2396
lines changed

.eslintrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"jasmine": true
44
},
55
"extends": "@wireapp/eslint-config",
6+
"ignorePatterns": ["**/*.js", "**/*.jsx"], // Ignore JS files until we migrate to TS
67
"overrides": [
78
{
89
"files": ["*.ts", "*.tsx"],

.github/dependabot.yml

+10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ updates:
1919
- dependency-name: husky
2020
versions:
2121
- '> 4.x'
22+
# these are being updated to esm modules after these versions and electron doesn't currently natively support it
23+
- dependency-name: image-type
24+
versions:
25+
- '> 4.x'
26+
- dependency-name: globby
27+
versions:
28+
- '> 11.x'
29+
- dependency-name: uuidjs
30+
versions:
31+
- '> 4.x'
2232
# when building, we receive this error with winstaller 5.0:
2333
# Error: no such file or directory, copyfile 'vendor/7z-ia32.exe' -> 'vendor/7z.exe'
2434
- dependency-name: electron-winstaller

.github/workflows/lint.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main, dev, staging]
6+
pull_request:
7+
branches: [main, dev, staging]
8+
9+
concurrency:
10+
group: lint-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 16.x
25+
cache: 'yarn'
26+
27+
- name: Install JS dependencies
28+
run: yarn --immutable
29+
30+
- name: Lint
31+
run: yarn lint

babel.config.js

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1-
// @ts-check
2-
/* eslint-disable valid-jsdoc */
1+
/*
2+
* Wire
3+
* Copyright (C) 2023 Wire Swiss GmbH
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see http://www.gnu.org/licenses/.
17+
*
18+
*/
319

420
const plugins = ['@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-optional-chaining'];
521

electron/renderer/src/actions/AccountAction.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
*
1818
*/
1919

20-
import {ActionType, initiateSSO} from './';
21-
import {config} from '../../../dist/settings/config';
2220
import {EVENT_TYPE} from '../../../dist/lib/eventType';
21+
import {config} from '../../../dist/settings/config';
2322
import {AccountSelector} from '../selector/AccountSelector';
2423

24+
import {ActionType, initiateSSO} from './';
25+
2526
/**
2627
* Don't use this method directly, use `switchWebview` instead.
2728
*

electron/renderer/src/actions/__tests__/actions.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
*
1818
*/
1919

20-
import {generateUUID} from '../../lib/util';
2120
import {ActionType, addAccount, deleteAccount, updateAccount, updateAccountBadge} from '../';
21+
import {generateUUID} from '../../lib/util';
2222
import {switchAccount} from '../AccountAction';
2323

2424
describe('action creators', () => {

electron/renderer/src/actions/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
*/
1919

2020
import * as Joi from '@hapi/joi';
21+
2122
import {Availability} from '@wireapp/protocol-messaging';
2223

2324
import {accountAction} from './AccountAction';
24-
import {AccountSelector} from '../selector/AccountSelector';
25+
2526
import {generateUUID} from '../lib/util';
27+
import {AccountSelector} from '../selector/AccountSelector';
2628

2729
export const ActionType = {
2830
ADD_ACCOUNT: 'ADD_ACCOUNT',

electron/renderer/src/components/AccountIcon.jsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
*
1818
*/
1919

20-
import './AccountIcon.css';
20+
import React from 'react';
2121

2222
import PropTypes from 'prop-types';
23-
import React from 'react';
23+
24+
import './AccountIcon.css';
2425

2526
import {colorFromId} from '../lib/accentColor';
2627

@@ -49,7 +50,11 @@ const AccountIcon = ({account, ...props}) => {
4950
/>
5051
)}
5152
<div className="AccountIcon-inner">
52-
{account.picture ? <img src={account.picture} /> : <div>{account.name && [...account.name][0]}</div>}
53+
{account.picture ? (
54+
<img src={account.picture} alt="Account Icon" />
55+
) : (
56+
<div>{account.name && [...account.name][0]}</div>
57+
)}
5358
</div>
5459
</div>
5560
);

electron/renderer/src/components/App.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@
1818
*/
1919

2020
import React from 'react';
21+
2122
import {connect} from 'react-redux';
23+
2224
import {StyledApp} from '@wireapp/react-ui-kit';
2325

24-
import actionRoot from '../actions';
2526
import IsOnline from './IsOnline';
2627
import Sidebar from './Sidebar';
2728
import WebviewList from './WebviewList';
29+
30+
import actionRoot from '../actions';
2831
import {AccountSelector} from '../selector/AccountSelector';
2932

3033
const App = () => {

electron/renderer/src/components/IsOnline.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
*/
1919

2020
import React, {useEffect, useState} from 'react';
21+
2122
import {Text, ContainerSM} from '@wireapp/react-ui-kit';
23+
2224
import {getText} from '../lib/locale';
2325

2426
const IsOnline = ({children}) => {

electron/renderer/src/components/LoadingSpinner.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919

2020
import React, {useEffect, useState} from 'react';
21+
2122
import {FlexBox, Loading, COLOR} from '@wireapp/react-ui-kit';
2223

2324
import './LoadingSpinner.css';

electron/renderer/src/components/Sidebar.jsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,22 @@
1818
*/
1919

2020
import React from 'react';
21+
2122
import {connect} from 'react-redux';
2223

24+
import AccountIcon from './AccountIcon';
25+
import AddAccountTrigger from './context/AddAccountTrigger';
26+
import EditAccountMenu from './context/EditAccountMenu';
27+
import './Sidebar.css';
28+
2329
import {EVENT_TYPE} from '../../../dist/lib/eventType';
2430
import {addAccountWithSession, setAccountContextHidden, toggleEditAccountMenuVisibility} from '../actions';
2531
import {colorFromId} from '../lib/accentColor';
2632
import {isEnterKey} from '../lib/keyboardUtil';
2733
import {preventFocus} from '../lib/util';
28-
import AccountIcon from './AccountIcon';
29-
import AddAccountTrigger from './context/AddAccountTrigger';
30-
import EditAccountMenu from './context/EditAccountMenu';
3134
import {AccountSelector} from '../selector/AccountSelector';
3235
import {ContextMenuSelector} from '../selector/ContextMenuSelector';
3336

34-
import './Sidebar.css';
35-
3637
const centerOfEventTarget = event => {
3738
const clientRectangle = event.currentTarget.getBoundingClientRect();
3839
const centerX = clientRectangle.left + clientRectangle.width / 2;

electron/renderer/src/components/Webview.jsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@
1818
*/
1919

2020
import React, {useEffect, useRef, useState} from 'react';
21-
import {ContainerSM, COLOR, H1, Logo, Text, TextLink} from '@wireapp/react-ui-kit';
21+
2222
import {SVGIcon} from '@wireapp/react-ui-kit/src/Icon/SVGIcon';
2323
import {connect} from 'react-redux';
2424

25+
import {ContainerSM, COLOR, H1, Logo, Text, TextLink} from '@wireapp/react-ui-kit';
26+
2527
import LoadingSpinner from './LoadingSpinner';
28+
import './Webview.css';
29+
2630
import {EVENT_TYPE} from '../../../src/lib/eventType';
27-
import {WindowUrl} from '../lib/WindowUrl';
2831
import {
2932
abortAccountCreation,
3033
resetIdentity,
@@ -34,10 +37,10 @@ import {
3437
updateAccountLifecycle,
3538
updateAccountDarkMode,
3639
} from '../actions';
40+
import {accountAction} from '../actions/AccountAction';
3741
import {getText, wrapperLocale} from '../lib/locale';
42+
import {WindowUrl} from '../lib/WindowUrl';
3843
import {AccountSelector} from '../selector/AccountSelector';
39-
import './Webview.css';
40-
import {accountAction} from '../actions/AccountAction';
4144
/* eslint-disable react/no-unknown-property */
4245

4346
const getEnvironmentUrl = account => {

electron/renderer/src/components/WebviewList.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
*/
1919

2020
import React from 'react';
21+
2122
import {connect} from 'react-redux';
2223

2324
import Webview from './Webview';
25+
2426
import {updateAccountBadgeCount} from '../actions';
2527
import {AccountSelector} from '../selector/AccountSelector';
2628

electron/renderer/src/components/context/ContextMenu.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919

2020
import React, {useEffect, useRef} from 'react';
21+
2122
import {connect} from 'react-redux';
2223

2324
import {setAccountContextHidden} from '../../actions';

electron/renderer/src/components/context/ContextMenuItem.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
*
1818
*/
1919

20-
import PropTypes from 'prop-types';
2120
import React from 'react';
2221

22+
import PropTypes from 'prop-types';
23+
2324
const ContextMenuItem = ({onClick, children}) => (
2425
<div data-uie-name="item-context-menu" className="ContextMenu-item" onClick={onClick}>
2526
{children}

electron/renderer/src/components/context/EditAccountMenu.jsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@
1818
*/
1919

2020
import React from 'react';
21+
2122
import {connect} from 'react-redux';
2223

23-
import {abortAccountCreation} from '../../actions';
24-
import {EVENT_TYPE} from '../../../../dist/lib/eventType';
25-
import {getText} from '../../lib/locale';
2624
import ContextMenu from './ContextMenu';
2725
import ContextMenuItem from './ContextMenuItem';
28-
import {ContextMenuSelector} from '../../selector/ContextMenuSelector';
26+
27+
import {EVENT_TYPE} from '../../../../dist/lib/eventType';
28+
import {abortAccountCreation} from '../../actions';
2929
import {accountAction} from '../../actions/AccountAction';
30+
import {getText} from '../../lib/locale';
3031
import {AccountSelector} from '../../selector/AccountSelector';
32+
import {ContextMenuSelector} from '../../selector/ContextMenuSelector';
3133

3234
const EditAccountMenu = ({accountId, accountIndex, isAtLeastAdmin, lifecycle, sessionId, ...connected}) => {
3335
return (

electron/renderer/src/configureStore.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
*
1818
*/
1919

20+
import throttle from 'lodash/throttle';
2021
import {applyMiddleware, createStore} from 'redux';
2122
import {createLogger} from 'redux-logger';
2223
import thunk from 'redux-thunk';
23-
import throttle from 'lodash/throttle';
2424

2525
import {loadState, saveState} from './lib/localStorage';
2626
import reducers from './reducers';

electron/renderer/src/index.jsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
*/
1919

2020
import React from 'react';
21-
import {Provider} from 'react-redux';
21+
2222
import {createRoot} from 'react-dom/client';
23+
import {Provider} from 'react-redux';
24+
2325
import {EVENT_TYPE} from '../../dist/lib/eventType';
26+
27+
import actionRoot, {addAccountWithSession} from './actions';
2428
import App from './components/App';
2529
import configureStore from './configureStore';
26-
import actionRoot from './actions';
27-
import {addAccountWithSession} from './actions/index';
28-
2930
import './Index.css';
3031

3132
const store = configureStore({actions: actionRoot});

electron/renderer/src/reducers/__tests__/accountReducer.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
/* eslint-disable no-magic-numbers */
2121

2222
import {addAccount, deleteAccount, updateAccount, updateAccountBadge} from '../../actions';
23-
import accountReducer from '../accountReducer';
2423
import {switchAccount} from '../../actions/AccountAction';
24+
import accountReducer from '../accountReducer';
2525

2626
describe('accounts reducer', () => {
2727
it('should return the initial state with one account', () => {

electron/renderer/src/reducers/accountReducer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
*
1818
*/
1919

20-
import {generateUUID} from '../lib/util';
2120
import {ActionType} from '../actions';
21+
import {generateUUID} from '../lib/util';
2222

2323
const createAccount = (sessionID, ssoCode = undefined) => ({
2424
accentID: undefined,

electron/src/after.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919

2020
import * as fs from 'fs-extra';
21+
2122
import * as path from 'path';
2223

2324
declare global {

electron/src/auth/ProxyAuth.test.main.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
*
1818
*/
1919

20-
import * as assert from 'assert';
2120
import {Protocol} from 'get-proxy-settings';
2221

22+
import * as assert from 'assert';
23+
2324
import * as ProxyAuth from './ProxyAuth';
2425

2526
describe('ProxyAuth', () => {

electron/src/global.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
*
1818
*/
1919

20-
import type {DesktopCapturer} from 'electron';
21-
import type {WebAppEvents} from '@wireapp/webapp-events';
22-
import type {Data as OpenGraphResult} from 'open-graph';
2320
import type {Static as amplify} from 'amplify';
21+
import type {Data as OpenGraphResult} from 'open-graph';
22+
23+
import type {WebAppEvents} from '@wireapp/webapp-events';
2424

25-
import type * as EnvironmentUtil from './runtime/EnvironmentUtil';
2625
import type {i18nStrings, SupportedI18nLanguage} from './locale';
26+
import type * as EnvironmentUtil from './runtime/EnvironmentUtil';
2727

2828
declare global {
2929
interface Window {

0 commit comments

Comments
 (0)