Add lint task

Fix various indentation issues
This commit is contained in:
Martin Kleinschrodt 2017-06-16 12:19:13 +02:00
parent 4ab0b61626
commit 7662ac7190
7 changed files with 46 additions and 40 deletions

5
.eslintignore Normal file
View File

@ -0,0 +1,5 @@
node_modules
app/bower_components
app/src/padlock.js
app/src/components
test

View File

@ -28,7 +28,7 @@
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-loop-func": "error",
"no-multi-spaces": "error",
"no-multiple-empty-lines": ["error", {"max": 1, "maxBOF": 0, "maxEOF": 0}],
"no-multiple-empty-lines": ["error", {"max": 1, "maxBOF": 1, "maxEOF": 0}],
"no-spaced-func": "error",
"no-trailing-spaces": "error",
"no-undef": "error",

View File

@ -330,7 +330,7 @@ class CloudView extends padlock.DialogMixin(padlock.NotificationMixin(padlock.Ba
this.prompt("It seems that your Padlock Cloud account uses a different master " +
"password than then one you are using on this device. Please provide the " +
"correct master password for your Padlock Cloud account!",
"Enter Master Password", "password", "Submit")
"Enter Master Password", "password", "Submit")
.then((pwd) => {
if (pwd === null) {
return;
@ -365,10 +365,10 @@ class CloudView extends padlock.DialogMixin(padlock.NotificationMixin(padlock.Ba
if (this.settings.syncCustomHost) {
this.confirm("Are you sure you want to use a custom server for synchronization? " +
"This option is only recommended for advanced users!", "Continue").then((confirmed) => {
if (!confirmed) {
this.set("settings.syncCustomHost", false);
}
});
if (!confirmed) {
this.set("settings.syncCustomHost", false);
}
});
}
}

View File

@ -256,7 +256,7 @@ class SettingsView extends padlock.DialogMixin(padlock.BaseElement) {
_getEncryptedData() {
return this.prompt("Please choose a password to protect your data. This may be the same as your master " +
" password or something else, but make sure it is sufficiently strong!",
"Enter Password", "password", "Confirm", "Cancel")
"Enter Password", "password", "Confirm", "Cancel")
.then((pwd) => {
if (!pwd) {
if (pwd === "") {
@ -269,12 +269,12 @@ class SettingsView extends padlock.DialogMixin(padlock.BaseElement) {
"attackers to break the encryption used to protect your data. Try to use a longer " +
"password or include a variation of uppercase, lowercase and special characters as " +
"well as numbers.", "Use Anyway", "Try Again").then((confirm) => {
if (!confirm) {
return Promise.reject();
}
if (!confirm) {
return Promise.reject();
}
return padlock.exp.toPadlock(this.collection.records, pwd);
});
return padlock.exp.toPadlock(this.collection.records, pwd);
});
} else {
return padlock.exp.toPadlock(this.collection.records, pwd);
}
@ -325,16 +325,16 @@ class SettingsView extends padlock.DialogMixin(padlock.BaseElement) {
_importFromClipboard() {
padlock.platform.getClipboard()
.then((str) => this._importString(str))
.catch((e) => {
switch (e.code) {
case "decryption_failed":
this.alert("Failed to decrypt data. Did you enter the correct password?");
break;
default:
this.alert("No supported data found in clipboard. Please make sure to copy " +
.catch((e) => {
switch (e.code) {
case "decryption_failed":
this.alert("Failed to decrypt data. Did you enter the correct password?");
break;
default:
this.alert("No supported data found in clipboard. Please make sure to copy " +
"you data to the clipboard first (e.g. via ctrl + C).");
}
});
}
});
}
_importString(rawStr) {
@ -364,7 +364,7 @@ class SettingsView extends padlock.DialogMixin(padlock.BaseElement) {
} else if (isCSV) {
return this.confirm("The data you want to import seems to be in CSV format. Before you continue, " +
"please make sure that the data is structured according to Padlocks specific requirements!",
"Continue", "Review Import Guidelines")
"Continue", "Review Import Guidelines")
.then((confirm) => {
if (confirm) {
return imp.fromCSV(rawStr);

View File

@ -222,13 +222,13 @@ class StartView extends padlock.DialogMixin(padlock.BaseElement) {
this.confirm("WARNING: The password you entered is weak which makes it easier for attackers to break " +
"the encryption used to protect your data. Try to use a longer password or include a " +
"variation of uppercase, lowercase and special characters as well as numbers.",
"Use Anyway", "Try Again").then((confirm) => {
if (confirm) {
this._confirmPassword();
} else {
this.$.newPasswordInput.focus();
}
});
"Use Anyway", "Try Again").then((confirm) => {
if (confirm) {
this._confirmPassword();
} else {
this.$.newPasswordInput.focus();
}
});
return;
}
@ -240,13 +240,13 @@ class StartView extends padlock.DialogMixin(padlock.BaseElement) {
"not even we! This is to ensure that your data is as safe as possible but it also means " +
"that if you lose your master password, we won't be able to assist you with recovering your " +
"data.", "password", "Repeat Master Password", "Confirm").then((pwd) => {
if (pwd === this.$.newPasswordInput.value) {
this._initializeData();
} else {
this.alert("You failed to repeat the password correctly. Try again!")
.then(() => this.$.newPasswordInput.focus());
}
});
if (pwd === this.$.newPasswordInput.value) {
this._initializeData();
} else {
this.alert("You failed to repeat the password correctly. Try again!")
.then(() => this.$.newPasswordInput.focus());
}
});
}
_initializeData() {

6
package-lock.json generated
View File

@ -1543,9 +1543,9 @@
}
},
"eslint-plugin-html": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-1.7.0.tgz",
"integrity": "sha1-KlsDiE2NVq35rZhk6cA2SA+2Kck=",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-3.0.0.tgz",
"integrity": "sha1-LJgqcbnZZWVPDzpSNYc1ghoaQjk=",
"dev": true
},
"eslint-scope": {

View File

@ -23,7 +23,7 @@
"electron": "^1.6.10",
"electron-builder": "^18.8.1",
"eslint": "^4.0.0",
"eslint-plugin-html": "^1.7.0",
"eslint-plugin-html": "^3.0.0",
"fs-extra": "^1.0.0",
"gulp": "^3.9.1",
"gulp-insert-lines": "0.0.4",
@ -46,6 +46,7 @@
"bower-install": "pushd app && bower install && popd app",
"compile": "gulp compile --silent",
"debug": "gulp --silent --watch",
"lint": "eslint app/**/*.{js,html}",
"test": "npm run compile && mocha --ui tdd",
"start": "gulp build --electron && electron dist/electron",
"postinstall": "npm run bower-install && npm run compile"