Skip to content

Commit a9f6bde

Browse files
committed
eslint
1 parent e070c3b commit a9f6bde

26 files changed

+222
-201
lines changed

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ node_modules
22
dist
33
firefox
44
chrome
5+
scripts
6+
webpack.config.js
7+
webpack.prod.js
8+
src/test
9+
src/models/credentials.ts

.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@ module.exports = {
1515
env: {
1616
"amd": true,
1717
"node": true
18+
},
19+
rules: {
20+
"@typescript-eslint/no-use-before-define": "off",
21+
"@typescript-eslint/explicit-function-return-type": "off"
1822
}
1923
};

src/argon.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ window.addEventListener("message", event => {
1010

1111
switch (message.action) {
1212
case "hash":
13-
argon.hash(message.value).then(hash => {
13+
Argon.hash(message.value).then(hash => {
1414
source.postMessage({ response: hash }, event.origin);
1515
});
1616
break;
1717

1818
case "verify":
19-
argon.compareHash(message.hash, message.value).then(result => {
19+
Argon.compareHash(message.hash, message.value).then(result => {
2020
source.postMessage({ response: result }, event.origin);
2121
});
2222
break;
@@ -27,7 +27,7 @@ window.addEventListener("message", event => {
2727
return;
2828
});
2929

30-
class argon {
30+
class Argon {
3131
static async hash(value: string) {
3232
const salt = window.crypto.getRandomValues(new Uint8Array(16));
3333
const hash = await argon2.hash({

src/background.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
12
// @ts-ignore
23
import QRCode from "qrcode-reader";
34

@@ -157,8 +158,8 @@ async function getTotp(text: string) {
157158
}
158159
issuer = issuer.replace(/\+/g, " ");
159160
} else if (parameter[0].toLowerCase() === "counter") {
160-
let counter = Number(parameter[1]);
161-
counter = isNaN(counter) || counter < 0 ? 0 : counter;
161+
// let counter = Number(parameter[1]);
162+
// counter = isNaN(counter) || counter < 0 ? 0 : counter;
162163
} else if (parameter[0].toLowerCase() === "period") {
163164
period = Number(parameter[1]);
164165
period =
@@ -426,18 +427,15 @@ async function uploadBackup(service: string) {
426427

427428
switch (service) {
428429
case "dropbox":
429-
const dbox = new Dropbox();
430-
await dbox.upload(encryption);
430+
await new Dropbox().upload(encryption);
431431
break;
432432

433433
case "drive":
434-
const drive = new Drive();
435-
await drive.upload(encryption);
434+
await new Drive().upload(encryption);
436435
break;
437436

438437
case "onedrive":
439-
const onedrive = new OneDrive();
440-
await onedrive.upload(encryption);
438+
await new OneDrive().upload(encryption);
441439
break;
442440

443441
default:

src/components/Import.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default Vue.extend({
5959
}
6060
});
6161
62-
function shouldShowPassphrase(entries: IOTPEntry[]) {
62+
function shouldShowPassphrase(entries: OTPEntryInterface[]) {
6363
for (const entry of entries) {
6464
if (!entry.secret) {
6565
return true;

src/components/Popup/PrefrencesPage.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default Vue.extend({
6868
this.$store.commit("menu/setHighContrast", useHighContrast);
6969
}
7070
},
71-
encryption(): IEncryption {
71+
encryption(): EncryptionInterface {
7272
return this.$store.state.accounts.encryption;
7373
},
7474
enforceAutolock() {

src/content.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
12
// @ts-ignore
23
import scanGIF from "../images/scan.gif";
34

@@ -26,7 +27,7 @@ if (!document.getElementById("__ga_grayLayout__")) {
2627
case "pastecode":
2728
pasteCode(message.code);
2829
break;
29-
case "stopCapture":
30+
case "stopCapture": {
3031
const captureBox = document.getElementById("__ga_captureBox__");
3132
if (captureBox) {
3233
captureBox.style.display = "none";
@@ -37,6 +38,7 @@ if (!document.getElementById("__ga_grayLayout__")) {
3738
grayLayout.style.display = "none";
3839
}
3940
break;
41+
}
4042
default:
4143
// invalid command, ignore it
4244
break;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
interface BackupProvider {
2-
upload(encryption: IEncryption): Promise<boolean>;
2+
upload(encryption: EncryptionInterface): Promise<boolean>;
33
getUser(): Promise<string>;
44
}
Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
interface IModule {
1+
interface Module {
22
getModule(): Promise<VuexConstructor> | VuexConstructor;
33
}
44

55
interface VuexConstructor {
66
state?: {
7+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
78
[key: string]: any;
89
};
910
mutations?: {
@@ -13,76 +14,77 @@ interface VuexConstructor {
1314
[key: string]:
1415
| Function
1516
| {
16-
root: Boolean;
17+
root: boolean;
1718
handler: Function;
1819
};
1920
};
2021
getters?: {
2122
[key: string]: Function;
2223
};
23-
modules?: Object;
24+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
25+
modules?: Record<string, any>;
2426
plugins?: Array<Function>;
25-
strict?: Boolean;
26-
devtools?: Boolean;
27+
strict?: boolean;
28+
devtools?: boolean;
2729
}
2830

2931
interface MenuState {
30-
version: String;
31-
zoom: Number;
32-
autolock: Number;
33-
useAutofill: Boolean;
34-
useHighContrast: Boolean;
35-
backupDisabled: Boolean;
36-
storageArea: String;
32+
version: string;
33+
zoom: number;
34+
autolock: number;
35+
useAutofill: boolean;
36+
useHighContrast: boolean;
37+
backupDisabled: boolean;
38+
storageArea: string;
3739
}
3840

3941
interface StyleState {
4042
style: {
41-
timeout: Boolean;
42-
isEditing: Boolean;
43-
slidein: Boolean;
44-
slideout: Boolean;
45-
fadein: Boolean;
46-
fadeout: Boolean;
47-
show: Boolean;
48-
qrfadein: Boolean;
49-
qrfadeout: Boolean;
50-
notificationFadein: Boolean;
51-
notificationFadeout: Boolean;
52-
hotpDisabled: Boolean;
43+
timeout: boolean;
44+
isEditing: boolean;
45+
slidein: boolean;
46+
slideout: boolean;
47+
fadein: boolean;
48+
fadeout: boolean;
49+
show: boolean;
50+
qrfadein: boolean;
51+
qrfadeout: boolean;
52+
notificationFadein: boolean;
53+
notificationFadeout: boolean;
54+
hotpDisabled: boolean;
5355
};
5456
}
5557

5658
interface AccountsState {
57-
entries: IOTPEntry[];
58-
encryption: IEncryption;
59-
OTPType: Number;
60-
shouldShowPassphrase: Boolean;
61-
sectorStart: Boolean;
62-
sectorOffset: Number;
63-
second: Number;
64-
notification: String;
65-
filter: Boolean;
59+
entries: OTPEntryInterface[];
60+
encryption: EncryptionInterface;
61+
OTPType: number;
62+
shouldShowPassphrase: boolean;
63+
sectorStart: boolean;
64+
sectorOffset: number;
65+
second: number;
66+
notification: string;
67+
filter: boolean;
6668
siteName: (string | null)[];
67-
showSearch: Boolean;
68-
exportData: { [k: string]: IOTPEntry };
69-
exportEncData: { [k: string]: IOTPEntry };
69+
showSearch: boolean;
70+
exportData: { [k: string]: OTPEntryInterface };
71+
exportEncData: { [k: string]: OTPEntryInterface };
7072
key: { enc: string; hash: string } | null;
71-
wrongPassword: Boolean;
73+
wrongPassword: boolean;
7274
}
7375

7476
interface NotificationState {
7577
message: Array<string>;
76-
confirmMessage: String;
77-
messageIdle: Boolean;
78-
notification: String;
78+
confirmMessage: string;
79+
messageIdle: boolean;
80+
notification: string;
7981
}
8082

8183
interface BackupState {
82-
dropboxEncrypted: Boolean;
83-
driveEncrypted: Boolean;
84-
oneDriveEncrypted: Boolean;
85-
dropboxToken: Boolean;
86-
driveToken: Boolean;
87-
oneDriveToken: Boolean;
84+
dropboxEncrypted: boolean;
85+
driveEncrypted: boolean;
86+
oneDriveEncrypted: boolean;
87+
dropboxToken: boolean;
88+
driveToken: boolean;
89+
oneDriveToken: boolean;
8890
}

src/definitions/otp.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
interface IOTPEntry {
1+
interface OTPEntryInterface {
22
type: number; // OTPType
33
index: number;
44
issuer: string;
@@ -14,14 +14,14 @@ interface IOTPEntry {
1414
create(): Promise<void>;
1515
update(): Promise<void>;
1616
next(): Promise<void>;
17-
applyEncryption(encryption: IEncryption): void;
18-
changeEncryption(encryption: IEncryption): void;
17+
applyEncryption(encryption: EncryptionInterface): void;
18+
changeEncryption(encryption: EncryptionInterface): void;
1919
delete(): Promise<void>;
2020
generate(): void;
2121
genUUID(): void;
2222
}
2323

24-
interface IEncryption {
24+
interface EncryptionInterface {
2525
getEncryptedString(data: string): string;
2626
getDecryptedSecret(entry: OTPStorage): string | null;
2727
getEncryptionStatus(): boolean;

0 commit comments

Comments
 (0)