Skip to content

Commit 2acca94

Browse files
committed
Merge branch 'master' into dependabot/npm_and_yarn/ava-6.1.1
# Conflicts: # extension/js/common/browser/ui.ts # extension/js/common/platform/catch.ts # package-lock.json
2 parents 878f3f1 + 5acce64 commit 2acca94

File tree

85 files changed

+1503
-2335
lines changed

Some content is hidden

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

85 files changed

+1503
-2335
lines changed

eslint-local-rules.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ module.exports = {
4040
if (propertyName === 'forEach' || propertyName === 'each') {
4141
context.report({ node, message: DO_NOT_USE_EACH });
4242
} else if (propertyName === 'map') {
43-
const ancestors = context.getAncestors();
43+
const sourceCode = context.sourceCode ?? context.getSourceCode();
44+
const ancestors = sourceCode.getAncestors ? sourceCode.getAncestors(node) : context.getAncestors();
4445
const parent = ancestors[ancestors.length - 1];
4546
if (parent && parent.type === 'ExpressionStatement') {
4647
context.report({ node, message: DO_NOT_USE_MAP_EXPR_STMT });

eslint.config.mjs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests';
44
import headerPlugin from 'eslint-plugin-header';
55
import jsdocPlugin from 'eslint-plugin-jsdoc';
66
import preferArrowPlugin from 'eslint-plugin-prefer-arrow';
7-
import importPlugin from 'eslint-plugin-import';
87
import noNullPlugin from 'eslint-plugin-no-null';
98
import localRulesPlugin from 'eslint-plugin-local-rules';
109
import eslintConfigPrettier from 'eslint-config-prettier';
@@ -17,7 +16,6 @@ const commonConfig = {
1716
header: headerPlugin,
1817
jsdoc: jsdocPlugin,
1918
'prefer-arrow': preferArrowPlugin,
20-
import: importPlugin,
2119
'no-null': noNullPlugin,
2220
'local-rules': localRulesPlugin,
2321
},
@@ -94,7 +92,6 @@ const commonConfig = {
9492
'@typescript-eslint/no-unused-vars': ['error'],
9593
'@typescript-eslint/no-unused-expressions': 'error',
9694
'@typescript-eslint/no-use-before-define': 'off',
97-
'@typescript-eslint/no-var-requires': 'error',
9895
'@typescript-eslint/prefer-for-of': 'error',
9996
'@typescript-eslint/prefer-function-type': 'error',
10097
'@typescript-eslint/prefer-namespace-keyword': 'error',
@@ -110,7 +107,6 @@ const commonConfig = {
110107
'header/header': ['error', 'block', ' ©️ 2016 - present FlowCrypt a.s. Limitations apply. Contact [email protected] '],
111108
'id-denylist': 'error',
112109
'id-match': 'error',
113-
'import/order': 'off',
114110
'jsdoc/check-alignment': 'off',
115111
'jsdoc/check-indentation': 'off',
116112
'jsdoc/newline-after-description': 'off',
@@ -154,20 +150,23 @@ const commonConfig = {
154150
radix: 'off',
155151
'require-atomic-updates': 0,
156152
'sort-imports': 'off',
157-
'spaced-comment': [
158-
'error',
159-
'always',
160-
{
161-
markers: ['/'],
162-
},
163-
],
164153
'local-rules/standard-loops': 'error',
165154
},
166155
};
167156

168157
export default [
169158
{
170-
ignores: ['extension/types/**', 'extension/js/common/core/types/**', 'test/source/core/types/**', 'build/**', 'extension/lib/**', 'eslint.config.js'],
159+
ignores: [
160+
'build/**',
161+
'conf/**',
162+
'eslint.config.mjs',
163+
'eslint-local-rules.js',
164+
'extension/lib/**',
165+
'extension/types/**',
166+
'extension/js/common/core/types/**',
167+
'test/source/core/types/**',
168+
'test/source/tests/**/*.js',
169+
],
171170
},
172171
pluginJs.configs.recommended,
173172
...tseslint.configs.strictTypeChecked,

extension/chrome/elements/attachment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export class AttachmentDownloadView extends View {
221221
try {
222222
const googleDriveFileId = url.split('/').pop()?.split('?').shift(); // try and catch any errors below if structure is not as expected
223223
url = googleDriveFileId ? `https://drive.google.com/uc?export=download&id=${googleDriveFileId}` : url; // attempt to get length headers from Google Drive file if available
224-
} catch (e) {
224+
} catch {
225225
// leave url as is
226226
}
227227
}

extension/chrome/elements/compose-modules/compose-err-module.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Browser } from '../../../js/common/browser/browser.js';
66
import { BrowserEventErrHandler, Ui } from '../../../js/common/browser/ui.js';
77
import { Catch } from '../../../js/common/platform/catch.js';
88
import { NewMsgData, SendBtnTexts, SendMsgsResult } from './compose-types.js';
9-
import { ApiErr } from '../../../js/common/api/shared/api-error.js';
9+
import { ApiErr, EnterpriseServerAuthErr } from '../../../js/common/api/shared/api-error.js';
1010
import { BrowserExtension } from '../../../js/common/browser/browser-extension.js';
1111
import { BrowserMsg } from '../../../js/common/browser/browser-msg.js';
1212
import { Settings } from '../../../js/common/settings.js';
@@ -44,7 +44,7 @@ export class ComposeErrModule extends ViewModule<ComposeView> {
4444
} else if (typeof e === 'object' && e && typeof (e as { stack: string }).stack === 'undefined') {
4545
try {
4646
(e as { stack: string }).stack = `[compose action: ${couldNotDoWhat}]`;
47-
} catch (e) {
47+
} catch {
4848
// no need
4949
}
5050
}
@@ -82,6 +82,9 @@ export class ComposeErrModule extends ViewModule<ComposeView> {
8282
'(This may also be caused by <a href="https://flowcrypt.com/docs/help/network-error.html" target="_blank">missing extension permissions</a>).';
8383
}
8484
await Ui.modal.error(netErrMsg, true);
85+
} else if (e instanceof EnterpriseServerAuthErr) {
86+
BrowserMsg.send.notificationShowCustomIDPAuthPopupNeeded(this.view.parentTabId, { acctEmail: this.view.acctEmail });
87+
Settings.offerToLoginWithPopupShowModalOnErr(this.view.acctEmail, () => this.view.sendBtnModule.extractProcessSendMsg());
8588
} else if (ApiErr.isAuthErr(e)) {
8689
BrowserMsg.send.notificationShowAuthPopupNeeded(this.view.parentTabId, { acctEmail: this.view.acctEmail });
8790
Settings.offerToLoginWithPopupShowModalOnErr(this.view.acctEmail, () => this.view.sendBtnModule.extractProcessSendMsg());

extension/chrome/elements/compose-modules/compose-send-btn-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export class ComposeSendBtnModule extends ViewModule<ComposeView> {
212212
let mimeType;
213213
let data = '';
214214
const parts = src.split(/[:;,]/);
215-
if (parts.length === 4 && parts[0] === 'data' && parts[1].match(/^image\/\w+/) && parts[2] === 'base64') {
215+
if (parts.length === 4 && parts[0] === 'data' && /^image\/\w+/.exec(parts[1]) && parts[2] === 'base64') {
216216
mimeType = parts[1];
217217
data = parts[3];
218218
}

extension/chrome/elements/compose-modules/compose-storage-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export class ComposeStorageModule extends ViewModule<ComposeView> {
140140
try {
141141
// no valid keys found, query synchronously, then return result
142142
await this.updateLocalPubkeysFromRemote(storedContact?.sortedPubkeys || [], email);
143-
} catch (e) {
143+
} catch {
144144
return PUBKEY_LOOKUP_RESULT_FAIL;
145145
}
146146
// re-query the storage, which is now updated

extension/chrome/elements/compose-modules/formatters/encrypted-mail-msg-formatter.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import { UploadedMessageData } from '../../../../js/common/api/account-server.js';
66
import { SendableMsg } from '../../../../js/common/api/email-provider/sendable-msg.js';
7-
import { ApiErr } from '../../../../js/common/api/shared/api-error.js';
7+
import { ApiErr, EnterpriseServerAuthErr } from '../../../../js/common/api/shared/api-error.js';
88
import { Api, RecipientType } from '../../../../js/common/api/shared/api.js';
99
import { Ui } from '../../../../js/common/browser/ui.js';
1010
import { Attachment } from '../../../../js/common/core/attachment.js';
@@ -275,6 +275,10 @@ export class EncryptedMsgMailFormatter extends BaseMailFormatter {
275275
replyToken: response.replyToken,
276276
};
277277
} catch (msgTokenErr) {
278+
if (msgTokenErr instanceof EnterpriseServerAuthErr) {
279+
Settings.offerToLoginCustomIDPWithPopupShowModalOnErr(this.acctEmail, () => this.view.sendBtnModule.extractProcessSendMsg());
280+
throw new ComposerResetBtnTrigger();
281+
}
278282
if (ApiErr.isAuthErr(msgTokenErr)) {
279283
Settings.offerToLoginWithPopupShowModalOnErr(this.acctEmail, () => this.view.sendBtnModule.extractProcessSendMsg());
280284
throw new ComposerResetBtnTrigger();

extension/chrome/elements/compose-modules/formatters/general-mail-formatter.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,9 @@ export class GeneralMailFormatter {
4747
`Could not sign this encrypted message. The sender email ${view.senderModule.getSender()} isn't present in the signing key's user ids`
4848
);
4949
}
50-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
5150
const msg = await new SignedMsgMailFormatter(view).sendableMsg(newMsgData, signingKey.key);
5251

5352
return {
54-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
5553
senderKi: signingKey.keyInfo,
5654
msgs: [msg],
5755
renderSentMessage: { recipients: msg.recipients, attachments: msg.attachments },

extension/chrome/settings/inbox/inbox-modules/inbox-menu-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export class InboxMenuModule extends ViewModule<InboxView> {
149149

150150
private renderFolder = (labelEl: HTMLSpanElement) => {
151151
for (const cls of labelEl.classList) {
152-
const labelId = (cls.match(/^label_([a-zA-Z0-9_]+)$/) || [])[1];
152+
const labelId = (/^label_([a-zA-Z0-9_]+)$/.exec(cls) || [])[1];
153153
if (labelId) {
154154
this.view.redirectToUrl({ acctEmail: this.view.acctEmail, labelId });
155155
return;

extension/chrome/settings/inbox/inbox-modules/inbox-notification-module.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ export class InboxNotificationModule extends ViewModule<InboxView> {
4949
BrowserMsg.addListener('notification_show_auth_popup_needed', async ({ acctEmail }: Bm.NotificationShowAuthPopupNeeded) => {
5050
this.notifications.showAuthPopupNeeded(acctEmail);
5151
});
52+
BrowserMsg.addListener('notification_show_custom_idp_auth_popup_needed', async ({ acctEmail }: Bm.NotificationShowAuthPopupNeeded) => {
53+
this.notifications.showCustomIDPAuthPopupNeeded(acctEmail);
54+
});
5255
};
5356

5457
private notificationShowHandler: Bm.AsyncResponselessHandler = async ({ notification, callbacks, group }: Bm.NotificationShow) => {

0 commit comments

Comments
 (0)