Switch linting to ESLint and Prettier (#191)

* Switch linting to ESLint and Prettier
* Clean up config
* Prettier fixes
This commit was merged in pull request #191.
This commit is contained in:
BehindTheMath
2019-02-13 22:26:57 -05:00
committed by GitHub
parent 2c6506af65
commit 3c1a4b2e18
23 changed files with 4674 additions and 2222 deletions

View File

@@ -1,51 +1,49 @@
/* global Pjax */
var pjax;
var initButtons = function() {
var buttons = document.querySelectorAll("button[data-manual-trigger]")
var buttons = document.querySelectorAll("button[data-manual-trigger]");
if (!buttons) {
return
return;
}
// jshint -W083
for (var i = 0; i < buttons.length; i++) {
buttons[i].addEventListener("click", function(e) {
var el = e.currentTarget
var el = e.currentTarget;
if (el.getAttribute("data-manual-trigger-override") === "true") {
// Manually load URL with overridden Pjax instance options
pjax.loadUrl("/example/page2.html", {cacheBust: false})
}
else
{
pjax.loadUrl("/example/page2.html", { cacheBust: false });
} else {
// Manually load URL with current Pjax instance options
pjax.loadUrl("/example/page2.html")
pjax.loadUrl("/example/page2.html");
}
})
});
}
// jshint +W083
}
};
console.log("Document initialized:", window.location.href)
console.log("Document initialized:", window.location.href);
document.addEventListener("pjax:send", function() {
console.log("Event: pjax:send", arguments)
})
console.log("Event: pjax:send", arguments);
});
document.addEventListener("pjax:complete", function() {
console.log("Event: pjax:complete", arguments)
})
console.log("Event: pjax:complete", arguments);
});
document.addEventListener("pjax:error", function() {
console.log("Event: pjax:error", arguments)
})
console.log("Event: pjax:error", arguments);
});
document.addEventListener("pjax:success", function() {
console.log("Event: pjax:success", arguments)
console.log("Event: pjax:success", arguments);
// Init page content
initButtons()
})
initButtons();
});
document.addEventListener("DOMContentLoaded", function() {
// Init Pjax instance
@@ -53,9 +51,9 @@ document.addEventListener("DOMContentLoaded", function() {
elements: [".js-Pjax"],
selectors: [".body", "title"],
cacheBust: true
})
console.log("Pjax initialized.", pjax)
});
console.log("Pjax initialized.", pjax);
// Init page content
initButtons()
})
initButtons();
});