Switch to eslint.
This commit is contained in:
parent
aa6ed9a3e2
commit
3748a2ebbd
24
.eslintrc.yml
Normal file
24
.eslintrc.yml
Normal file
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
extends:
|
||||
- eslint:recommended
|
||||
- plugin:import/errors
|
||||
- plugin:import/warnings
|
||||
|
||||
parserOptions:
|
||||
ecmaVersion: 8
|
||||
sourceType: module
|
||||
|
||||
globals:
|
||||
pageState: writable
|
||||
pageContent: writable
|
||||
realPages: writable
|
||||
|
||||
|
||||
rules:
|
||||
no-unused-vars:
|
||||
- 2
|
||||
- argsIgnorePattern: ^_
|
||||
|
||||
env:
|
||||
browser: true
|
||||
es6: true
|
22
.jshintrc
22
.jshintrc
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"esversion": 8,
|
||||
"browser": true,
|
||||
"onevar": true,
|
||||
"passfail": false,
|
||||
"white": true,
|
||||
"maxerr": 100,
|
||||
"predef": [
|
||||
"define",
|
||||
"require",
|
||||
"console",
|
||||
"ClipboardJS",
|
||||
"UIkit",
|
||||
"Prism",
|
||||
"CodeJar",
|
||||
"moment"
|
||||
],
|
||||
"indent": 2,
|
||||
"globals": {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,9 +1,12 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.13.14",
|
||||
"clipboard": "^2.0.8",
|
||||
"codejar": "^3.4.0",
|
||||
"css-loader": "^5.2.1",
|
||||
"date-fns": "^2.21.1",
|
||||
"eslint": "^7.24.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"file-saver": "^2.0.5",
|
||||
"html-webpack-plugin": "^5.3.1",
|
||||
"mini-css-extract-plugin": "^1.4.1",
|
||||
|
|
3
runLinter.sh
Executable file
3
runLinter.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
npx eslint -c .eslintrc.yml src
|
|
@ -22,7 +22,7 @@ export class PageState extends Page {
|
|||
return localStorage.getItem('currentBaseMount') || "";
|
||||
}
|
||||
set currentBaseMount(value) {
|
||||
return localStorage.setItem('currentBaseMount', value);
|
||||
localStorage.setItem('currentBaseMount', value);
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,28 +43,28 @@ export class PageState extends Page {
|
|||
return JSON.parse(localStorage.getItem('currentSecretPath') || "[]");
|
||||
}
|
||||
set currentSecretPath(value) {
|
||||
return localStorage.setItem('currentSecretPath', JSON.stringify(value));
|
||||
localStorage.setItem('currentSecretPath', JSON.stringify(value));
|
||||
}
|
||||
|
||||
get currentSecretVersion() {
|
||||
return localStorage.getItem('currentSecretVersion') || "0";
|
||||
}
|
||||
set currentSecretVersion(value) {
|
||||
return localStorage.setItem('currentSecretVersion', value);
|
||||
localStorage.setItem('currentSecretVersion', value);
|
||||
}
|
||||
|
||||
get currentSecret() {
|
||||
return localStorage.getItem('currentSecret') || "";
|
||||
}
|
||||
set currentSecret(value) {
|
||||
return localStorage.setItem('currentSecret', value);
|
||||
localStorage.setItem('currentSecret', value);
|
||||
}
|
||||
|
||||
get currentMountType() {
|
||||
return localStorage.getItem('currentMountType') || "";
|
||||
}
|
||||
set currentMountType(value) {
|
||||
return localStorage.setItem('currentMountType', value);
|
||||
localStorage.setItem('currentMountType', value);
|
||||
}
|
||||
get currentPage() {
|
||||
let curPage = localStorage.getItem('currentPage') || "HOME";
|
||||
|
|
|
@ -108,7 +108,7 @@ export class KeyValueSecretsPage extends Page {
|
|||
pageState.currentSecretPath,
|
||||
pageState.currentSecret,
|
||||
pageState.currentSecretVersion
|
||||
).then(resp => {
|
||||
).then(_ => {
|
||||
changePage(pageState.currentPage);
|
||||
});
|
||||
},
|
||||
|
@ -118,7 +118,7 @@ export class KeyValueSecretsPage extends Page {
|
|||
|
||||
const secretsMap = new Map(Object.entries(secretInfo).sort());
|
||||
|
||||
for (let [key, value] of secretsMap) {
|
||||
for (let value of secretsMap.values()) {
|
||||
if (typeof value == 'object') isSecretNestedJson = true;
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ export class KeyValueSecretsPage extends Page {
|
|||
html: Prism.highlight(jsonText, Prism.languages.json, 'json')
|
||||
}));
|
||||
} else {
|
||||
secretsMap.forEach(function (value, key) {
|
||||
secretsMap.forEach((value, key) => {
|
||||
let kvListElement = this.makeKVListElement(key, value);
|
||||
kvList.appendChild(kvListElement);
|
||||
}, this);
|
||||
|
|
|
@ -54,7 +54,7 @@ export class KeyValueSecretsEditPage extends Page {
|
|||
pageState.currentSecretPath,
|
||||
pageState.currentSecret,
|
||||
JSON.parse(jar.toString())
|
||||
).then(resp => {
|
||||
).then(_ => {
|
||||
changePage("KEY_VALUE_SECRETS");
|
||||
return;
|
||||
}).catch(e => {
|
||||
|
|
|
@ -122,7 +122,7 @@ export class LoginPage extends Page {
|
|||
let formData = new FormData(tokenLoginForm);
|
||||
const token = formData.get("token");
|
||||
localStorage.setItem('token', token);
|
||||
lookupSelf().then(res => {
|
||||
lookupSelf().then(_ => {
|
||||
changePage("HOME");
|
||||
}).catch(e => {
|
||||
document.getElementById("tokenInput").classList.add("uk-form-danger");
|
||||
|
|
|
@ -20,7 +20,7 @@ function random() {
|
|||
|
||||
function genPw(len) {
|
||||
let pw = "";
|
||||
const pwArray = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"#$%&'()*+,-./:;<=>?@[\]^_{|}~".split('');
|
||||
const pwArray = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%&'()*+,-./:;<=>?@[]^_{|}~".split('');
|
||||
for (let i = 0; i < len; i++) {
|
||||
pw = pw.concat(pwArray[Math.floor(random() * pwArray.length)]);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ export class NewTOTPPage extends Page {
|
|||
name: formData.get("name"),
|
||||
generate: false
|
||||
};
|
||||
addNewTOTP(pageState.currentBaseMount, parms).then(res => {
|
||||
addNewTOTP(pageState.currentBaseMount, parms).then(_ => {
|
||||
changePage("TOTP");
|
||||
}).catch(e => {
|
||||
setErrorText(`API Error: ${e.message}`);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Page } from "../../types/Page.js";
|
||||
import { getTOTPKeys, getTOTPCode, DoesNotExistError } from "../../api.js";
|
||||
import { setTitleElement, setPageContent, changePage } from "../../pageUtils.js";
|
||||
import { setTitleElement, setPageContent, changePage, setErrorText } from "../../pageUtils.js";
|
||||
import { CopyableInputBox } from "../../elements/CopyableInputBox.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ export class UnsealPage extends Page {
|
|||
async handleKeySubmit() {
|
||||
let formData = new FormData(this.unsealKeyForm);
|
||||
|
||||
submitUnsealKey(formData.get("key")).then(resp => {
|
||||
submitUnsealKey(formData.get("key")).then(_ => {
|
||||
getSealStatus().then(data => {
|
||||
this.updateSealProgress(data);
|
||||
});
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
padding-bottom: 10px !important;
|
||||
padding-left: 10px !important;
|
||||
}
|
||||
|
||||
.wrap-pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue