Skip to content

Commit 748b960

Browse files
authored
Update ESLint config (#5813)
1 parent 308b444 commit 748b960

Some content is hidden

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

63 files changed

+123
-147
lines changed

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ export default [
165165
'extension/types/**',
166166
'extension/js/common/core/types/**',
167167
'test/source/core/types/**',
168+
'test/source/tests/**/*.js',
168169
],
169170
},
170171
pluginJs.configs.recommended,

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export class ComposeQuoteModule extends ViewModule<ComposeView> {
213213
const from = Str.parseEmail(this.messageToReplyOrForward.headers.from || '').email;
214214
const date = new Date(String(this.messageToReplyOrForward.headers.date));
215215
const dateStr = Str.fromDate(date).replace(' ', ' at ');
216-
const rtl = text.match(new RegExp('[' + Str.rtlChars + ']'));
216+
const rtl = new RegExp('[' + Str.rtlChars + ']').exec(text);
217217
const dirAttr = `dir="${rtl ? 'rtl' : 'ltr'}"`;
218218
const escapedText = this.convertLineBreakToBr(Xss.escape(text), method === 'reply');
219219
if (method === 'reply') {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ export class ComposeRenderModule extends ViewModule<ComposeView> {
425425
let normalizedPub: string;
426426
try {
427427
normalizedPub = await keyImportUi.checkPub(textData);
428-
} catch (e) {
428+
} catch {
429429
return; // key is invalid
430430
}
431431
const key = await KeyUtil.parse(normalizedPub);

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/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/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ View.run(
5151
const uncheckedUrlParams = Url.parse(['acctEmail', 'page', 'pageUrlParams', 'advanced', 'addNewAcct']);
5252
this.acctEmail = Assert.urlParamRequire.optionalString(uncheckedUrlParams, 'acctEmail');
5353
this.page = Assert.urlParamRequire.optionalString(uncheckedUrlParams, 'page');
54-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
5554
if (this.page && !/^(\/chrome|modules)/.test(this.page)) {
5655
Ui.modal.error('An unexpected value was found for the page parameter').catch((err: unknown) => {
5756
console.log(err);
@@ -244,7 +243,6 @@ View.run(
244243
$('#status-row #status_local_store').on(
245244
'click',
246245
this.setHandler(async () => {
247-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
248246
await Settings.renderSubPage(this.acctEmail, this.tabId, 'modules/debug_api.htm', { which: 'local_store' });
249247
})
250248
);
@@ -391,7 +389,6 @@ View.run(
391389
);
392390
statusContainer.empty().append(authNeededLink); // xss-direct
393391
$('#status-row #status_flowcrypt').text(`fc:auth`).addClass('bad');
394-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
395392
Settings.offerToLoginWithPopupShowModalOnErr(this.acctEmail, () => {
396393
window.location.reload();
397394
});

0 commit comments

Comments
 (0)