Skip to content

Commit 4d01e4f

Browse files
authored
Fix found ESLint issues (#5771)
* autofix found ESLint issues * remove unused references
1 parent 2b2c259 commit 4d01e4f

26 files changed

+653
-760
lines changed

eslint.config.mjs

+8-17
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
// Importing necessary ESLint plugins
2-
import typescriptEslint from 'typescript-eslint';
2+
import tseslint from 'typescript-eslint';
33
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';
77
import importPlugin from 'eslint-plugin-import';
88
import noNullPlugin from 'eslint-plugin-no-null';
99
import localRulesPlugin from 'eslint-plugin-local-rules';
10-
import globals from 'globals';
1110
import eslintConfigPrettier from 'eslint-config-prettier';
1211
import pluginJs from '@eslint/js';
1312

1413
const commonConfig = {
1514
plugins: {
16-
'@typescript-eslint': typescriptEslint.plugin,
15+
'@typescript-eslint': tseslint.plugin,
1716
'no-only-tests': noOnlyTestsPlugin,
1817
header: headerPlugin,
1918
jsdoc: jsdocPlugin,
@@ -23,17 +22,9 @@ const commonConfig = {
2322
'local-rules': localRulesPlugin,
2423
},
2524
languageOptions: {
26-
parser: typescriptEslint.parser,
27-
sourceType: 'module',
28-
ecmaVersion: 'latest',
29-
globals: {
30-
...globals.browser,
31-
...globals.node,
32-
...globals.commonjs,
33-
...globals.es6,
34-
$: false,
35-
chrome: false,
36-
OpenPGP: false,
25+
parser: tseslint.parser,
26+
parserOptions: {
27+
project: true,
3728
},
3829
},
3930
rules: {
@@ -179,8 +170,8 @@ export default [
179170
ignores: ['extension/types/**', 'extension/js/common/core/types/**', 'test/source/core/types/**', 'build/**', 'extension/lib/**', 'eslint.config.js'],
180171
},
181172
pluginJs.configs.recommended,
182-
...typescriptEslint.configs.strictTypeChecked,
183-
...typescriptEslint.configs.stylisticTypeChecked,
173+
...tseslint.configs.strictTypeChecked,
174+
...tseslint.configs.stylisticTypeChecked,
184175
eslintConfigPrettier,
185176
{
186177
...commonConfig,
@@ -220,7 +211,7 @@ export default [
220211
'@typescript-eslint/no-unsafe-member-access': 'off',
221212
},
222213
},
223-
...typescriptEslint.config({
214+
...tseslint.config({
224215
files: ['extension/js/content_scripts/webmail/**/*.ts'],
225216
languageOptions: {
226217
parserOptions: {

extension/js/common/api/key-server/attester.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ export class Attester extends Api {
2828
]);
2929
const validResults = results.filter(result => result.status === 'fulfilled');
3030
for (const result of validResults) {
31-
const fulfilResult = result as PromiseFulfilledResult<PubkeysSearchResult>;
32-
if (fulfilResult.value.pubkeys.length) {
33-
return fulfilResult.value;
31+
if (result.value.pubkeys.length) {
32+
return result.value;
3433
}
3534
}
3635
if (results[1].status === 'rejected') {

extension/js/common/browser/browser.ts

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
/* ©️ 2016 - present FlowCrypt a.s. Limitations apply. Contact [email protected] */
22

3-
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
4-
/// <reference path="../../../../node_modules/@types/chrome/index.d.ts" />
5-
63
'use strict';
74

85
import { Attachment } from '../core/attachment.js';

extension/js/common/browser/env.ts

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
/* ©️ 2016 - present FlowCrypt a.s. Limitations apply. Contact [email protected] */
22

3-
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
4-
/// <reference path="../../../../node_modules/@types/chrome/index.d.ts" />
5-
63
'use strict';
74

85
import { Url } from '../core/common.js';

extension/js/common/core/crypto/pgp/openpgp-key.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export class OpenPGPKey {
125125
public static async decryptMessage(message: OpenPGP.Message<OpenPGP.Data>, privateKeys: Key[], passwords?: string[]) {
126126
const opgpKeys = await Promise.all(privateKeys.map(key => OpenPGPKey.extractExternalLibraryObjFromKey(key)));
127127
return await message.decrypt(
128-
opgpKeys.filter(key => key.isPrivate()).map(key => key as OpenPGP.PrivateKey),
128+
opgpKeys.filter(key => key.isPrivate()),
129129
passwords
130130
);
131131
}

flowcrypt-browser.code-workspace

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
"**/node_modules/**": true
1919
},
2020
"errorLens.enabledDiagnosticLevels": ["error"],
21-
"errorLens.errorColor": "#FF00000A",
22-
"errorLens.errorTextColor": "#FF000066",
2321
"editor.tabSize": 2,
2422
"editor.codeActionsOnSave": {
2523
"source.fixAll.eslint": "explicit",

0 commit comments

Comments
 (0)