mirror of https://github.com/espruino/BangleApps
Now linting library too
parent
e1c6123063
commit
aa193454db
|
@ -1 +1,5 @@
|
|||
js/espruinotools.js
|
||||
lib/imageconverter.js
|
||||
lib/qrcode.min.js
|
||||
lib/heatshrink.js
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ function toJS(txt) {
|
|||
if ("undefined"!=typeof module)
|
||||
Espruino = require("./espruinotools.js");
|
||||
|
||||
let AppInfo = {
|
||||
const AppInfo = {
|
||||
/* Get files needed for app.
|
||||
options = {
|
||||
fileGetter : callback for getting URL,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Puck.debug=3;
|
||||
|
||||
// FIXME: use UART lib so that we handle errors properly
|
||||
let Comms = {
|
||||
const Comms = {
|
||||
reset : (opt) => new Promise((resolve,reject) => {
|
||||
Puck.write(`\x03\x10reset(${opt=="wipe"?"1":""});\n`, (result) => {
|
||||
if (result===null) return reject("Connection failed");
|
||||
|
|
2
js/ui.js
2
js/ui.js
|
@ -1,7 +1,7 @@
|
|||
// General UI tools (progress bar, toast, prompt)
|
||||
|
||||
/// Handle progress bars
|
||||
let Progress = {
|
||||
const Progress = {
|
||||
domElement : null, // the DOM element
|
||||
sticky : false, // Progress.show({..., sticky:true}) don't remove until Progress.hide({sticky:true})
|
||||
interval : undefined, // the interval used if Progress.show({progress:"animate"})
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
"sourceType": "script"
|
||||
},
|
||||
"rules": {
|
||||
"indent": [
|
||||
"warn",
|
||||
2,
|
||||
{
|
||||
"SwitchCase": 1
|
||||
}
|
||||
],
|
||||
"no-undef": "warn",
|
||||
"no-redeclare": "warn",
|
||||
"no-var": "warn",
|
||||
"no-unused-vars":"off" // we define stuff to use in other scripts
|
||||
},
|
||||
"env": {
|
||||
"browser": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"globals": {
|
||||
"onInit" : "readonly"
|
||||
}
|
||||
}
|
|
@ -19,8 +19,8 @@ Util.eraseStorageFile(filename,callback)
|
|||
Util.showModal(title)
|
||||
Util.hideModal()
|
||||
*/
|
||||
var __id = 0, __idlookup = [];
|
||||
var Puck = {
|
||||
let __id = 0, __idlookup = [];
|
||||
const Puck = {
|
||||
eval : function(data,callback) {
|
||||
__id++;
|
||||
__idlookup[__id] = callback;
|
||||
|
@ -32,7 +32,7 @@ var Puck = {
|
|||
}
|
||||
};
|
||||
|
||||
var Util = {
|
||||
const Util = {
|
||||
readStorageFile : function(filename,callback) {
|
||||
__id++;
|
||||
__idlookup[__id] = callback;
|
||||
|
@ -71,9 +71,9 @@ var Util = {
|
|||
Util.domModal.classList.remove("active");
|
||||
},
|
||||
saveCSV : function(filename, csvData) {
|
||||
var a = document.createElement("a"),
|
||||
let a = document.createElement("a"),
|
||||
file = new Blob([csvData], {type: "Comma-separated value file"});
|
||||
var url = URL.createObjectURL(file);
|
||||
let url = URL.createObjectURL(file);
|
||||
a.href = url;
|
||||
a.download = filename+".csv";
|
||||
document.body.appendChild(a);
|
||||
|
@ -85,11 +85,11 @@ var Util = {
|
|||
}
|
||||
};
|
||||
window.addEventListener("message", function(event) {
|
||||
var msg = event.data;
|
||||
let msg = event.data;
|
||||
if (msg.type=="init") {
|
||||
onInit();
|
||||
} else if (msg.type=="evalrsp" || msg.type=="writersp"|| msg.type=="readstoragefilersp") {
|
||||
var cb = __idlookup[msg.id];
|
||||
let cb = __idlookup[msg.id];
|
||||
delete __idlookup[msg.id];
|
||||
cb(msg.data);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"lint-apps": "eslint ./apps --ext .js",
|
||||
"test": "node bin/sanitycheck.js && eslint ./apps --ext .js && eslint ./js",
|
||||
"test": "node bin/sanitycheck.js && eslint ./apps --ext .js && eslint ./lib ./js",
|
||||
"start": "npx http-server"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
Loading…
Reference in New Issue