Skip to content

Commit

Permalink
Fixing lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed May 18, 2017
1 parent c734f27 commit 4b4c2b4
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 51 deletions.
5 changes: 3 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"env": {
"browser": false,
"browser": true,
"node": true,
"es6": true,
"amd": false
Expand All @@ -13,7 +13,8 @@
},
"globals": {
"describe": true,
"it": true
"it": true,
"router": true
},
"rules": {
"arrow-parens": [2, "as-needed"],
Expand Down
3 changes: 2 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module.exports = function (grunt) {
eslint: {
target: [
"lib/*.js",
"test/*.js"
"test/*.js",
"www/assets/js/*.es6"
]
},
mochaTest : {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tenso",
"description": "Tensō is an elastic REST API gateway for node.js",
"version": "4.5.1",
"version": "4.5.2",
"homepage": "http://avoidwork.github.io/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down
44 changes: 20 additions & 24 deletions www/assets/js/app.es6
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
"use strict";

(function () {
(function (document, window, location, fetch, router) {
// Wiring up the request tab
const button = document.querySelector("button"),
close = document.querySelector("#close"),
form = document.querySelector("form"),
formats = document.querySelector("#formats"),
methods = document.querySelector("#methods"),
modal = document.querySelector(".modal"),
loading = modal.querySelector(".loading"),
textarea = document.querySelector("textarea"),
resBody = modal.querySelector(".body"),
json = /^[\[\{"]/;

if (methods.childElementCount > 0) {
form.setAttribute("method", methods.options[methods.selectedIndex].value);
}

function escape (arg) {
return arg.replace(/[\-\[\]{}()*+?.,\\\/\^\$|#\s]/g, "\\$&");
}
Expand Down Expand Up @@ -32,7 +48,7 @@
let html = i.innerHTML,
val = html.replace(/(^\"|\"$)/g, "");

if (val.indexOf( "/" ) === 0 || val.indexOf("//") > -1) {
if (val.indexOf("/") === 0 || val.indexOf("//") > -1) {
html = html.replace(val, "<a href='" + val + "' title='View " + val + "'>" + val + "</a>");
}

Expand All @@ -55,28 +71,10 @@
return output;
}

// Wiring up the request tab
const button = document.querySelector("button"),
close = document.querySelector("#close"),
form = document.querySelector("form"),
methods = document.querySelector("#methods"),
modal = document.querySelector(".modal"),
loading = modal.querySelector(".loading"),
textarea = document.querySelector("textarea"),
resBody = modal.querySelector(".body"),
json = /^[\[\{"]/;

let flight = false;

if (methods.childElementCount > 0) {
form.setAttribute("method", methods.options[methods.selectedIndex].value);
}

// Intercepting the submission
form.onsubmit = ev => {
ev.preventDefault();
ev.stopPropagation();
flight = true;

window.requestAnimationFrame(() => {
resBody.innerText = "";
Expand All @@ -103,7 +101,7 @@
}).catch(res => {
window.requestAnimationFrame(() => {
resBody.innerHTML = "<h1 class=\"title\">" + res.status + " - " + res.statusText + "</h1>";
resBody.parentNode.classList.add("has-text-centered")
resBody.parentNode.classList.add("has-text-centered");
resBody.classList.remove("dr-hidden");
loading.classList.add("dr-hidden");
button.classList.remove("is-loading");
Expand All @@ -117,7 +115,6 @@

// Creating a DOM router
router({css: {current: "is-active", hidden: "dr-hidden"}, callback: ev => {
flight = false;
window.requestAnimationFrame(() => {
Array.from(document.querySelectorAll("li.is-active")).forEach(i => i.classList.remove("is-active"));
ev.trigger.parentNode.classList.add("is-active");
Expand All @@ -128,7 +125,6 @@
close.onclick = ev => {
ev.preventDefault();
ev.stopPropagation();
flight = false;
button.classList.remove("is-loading");
modal.classList.remove("is-active");
};
Expand Down Expand Up @@ -180,4 +176,4 @@
" \\ \\ /'---' `--'---'",
" `----'"
].join("\n"));
})();
}(document, window, location, fetch, router));
40 changes: 18 additions & 22 deletions www/assets/js/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion www/assets/js/app.js.map

Large diffs are not rendered by default.

0 comments on commit 4b4c2b4

Please sign in to comment.