lint: automated lint

This commit is contained in:
liushuyu 2019-09-05 11:19:56 -06:00 committed by James
parent ca6ac320c2
commit 713b85b59a
7 changed files with 24 additions and 22 deletions

View file

@ -87,8 +87,8 @@ fn main() {
// Copy for the main build
copy(&target_config, output_dir.join("bootstrap.toml")).expect("Unable to copy config file");
let yarn_binary = which::which("yarn")
.expect("Failed to find yarn - please go ahead and install it!");
let yarn_binary =
which::which("yarn").expect("Failed to find yarn - please go ahead and install it!");
// Build and deploy frontend files
Command::new(&yarn_binary)
@ -100,7 +100,8 @@ fn main() {
.arg(ui_dir.to_str().expect("Unable to covert path"))
.spawn()
.unwrap()
.wait().expect("Unable to install Node.JS dependencies using Yarn");
.wait()
.expect("Unable to install Node.JS dependencies using Yarn");
let return_code = Command::new(&yarn_binary)
.args(&[
"--cwd",

View file

@ -22,8 +22,8 @@ use futures::sink::Sink;
mod attributes;
mod config;
mod default_path;
mod dark_mode;
mod default_path;
mod exit;
mod install;
mod installation_status;

View file

@ -12,7 +12,7 @@ use log::Level;
enum CallbackType {
SelectInstallDir { callback_name: String },
Log { msg: String, kind: String },
Test {}
Test {},
}
/// Starts the main web UI. Will return when UI is closed.

View file

@ -38,9 +38,9 @@ extern crate chrono;
extern crate clap;
#[cfg(windows)]
extern crate winapi;
#[cfg(windows)]
extern crate widestring;
#[cfg(windows)]
extern crate winapi;
#[cfg(not(windows))]
extern crate slug;

View file

@ -300,7 +300,7 @@ mod natives {
Ok(file) => file,
Err(e) => return Err(format!("Unable to create desktop file: {}", e)),
};
let mut desktop_f = desktop_f.write_all(desktop_file.as_bytes());
let desktop_f = desktop_f.write_all(desktop_file.as_bytes());
match desktop_f {
Ok(_) => Ok("".to_string()),
Err(e) => Err(format!("Unable to write desktop file: {}", e)),

View file

@ -24,14 +24,14 @@ function intercept (method) {
}
// See if we have access to the JSON interface
var has_external_interface = false;
var has_external_interface = false
try {
window.external.invoke(JSON.stringify({
Test: {}
}))
has_external_interface = true;
has_external_interface = true
} catch (e) {
console.warn("Running without JSON interface - unexpected behaviour may occur!")
console.warn('Running without JSON interface - unexpected behaviour may occur!')
}
// Overwrite loggers with the logging backend
@ -101,13 +101,14 @@ var app = new Vue({
'/api/exit',
function () {},
function (msg) {
var search_location = app.metadata.install_path.length > 0 ? app.metadata.install_path :
"the location where this installer is";
var search_location = app.metadata.install_path.length > 0 ? app.metadata.install_path
: 'the location where this installer is'
app.$router.replace({ name: 'showerr', params: { msg: msg +
app.$router.replace({ name: 'showerr',
params: { msg: msg +
'\n\nPlease upload the log file (in ' + search_location + ') to ' +
'the ' + app.attrs.name + ' team'
}});
} })
}
)
},
@ -116,4 +117,4 @@ var app = new Vue({
}
}).$mount('#app')
console.log("Vue started")
console.log('Vue started')

View file

@ -38,12 +38,12 @@ export default {
return {
// https://stackoverflow.com/questions/6234773/can-i-escape-html-special-chars-in-javascript
msg: this.$route.params.msg
.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;")
.replace(/\n/g, "<br />"),
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;')
.replace(/\n/g, '<br />'),
remaining: window.history.length > 1
}
},