diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 54dc2baa6..07de1cd35 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,6 +42,8 @@ repos: hooks: - id: prettier types_or: [javascript, css] + args: + - --trailing-comma=es5 - repo: https://github.com/pre-commit/mirrors-eslint rev: v8.23.0 hooks: diff --git a/debug_toolbar/static/debug_toolbar/js/history.js b/debug_toolbar/static/debug_toolbar/js/history.js index 5611fde1d..b30fcabae 100644 --- a/debug_toolbar/static/debug_toolbar/js/history.js +++ b/debug_toolbar/static/debug_toolbar/js/history.js @@ -25,7 +25,7 @@ function refreshHistory() { const formTarget = djDebug.querySelector(".refreshHistory"); const container = document.getElementById("djdtHistoryRequests"); const oldIds = new Set( - pluckData(container.querySelectorAll("tr[data-store-id]"), "storeId"), + pluckData(container.querySelectorAll("tr[data-store-id]"), "storeId") ); ajaxForm(formTarget) @@ -44,8 +44,8 @@ function refreshHistory() { const allIds = new Set( pluckData( container.querySelectorAll("tr[data-store-id]"), - "storeId", - ), + "storeId" + ) ); const newIds = difference(allIds, oldIds); const lastRequestId = newIds.values().next().value; @@ -58,7 +58,7 @@ function refreshHistory() { .then(function (refreshInfo) { refreshInfo.newIds.forEach(function (newId) { const row = container.querySelector( - `tr[data-store-id="${newId}"]`, + `tr[data-store-id="${newId}"]` ); row.classList.add("flash-new"); }); @@ -74,7 +74,7 @@ function refreshHistory() { function switchHistory(newStoreId) { const formTarget = djDebug.querySelector( - ".switchHistory[data-store-id='" + newStoreId + "']", + ".switchHistory[data-store-id='" + newStoreId + "']" ); const tbody = formTarget.closest("tbody"); @@ -88,7 +88,7 @@ function switchHistory(newStoreId) { if (Object.keys(data).length === 0) { const container = document.getElementById("djdtHistoryRequests"); container.querySelector( - 'button[data-store-id="' + newStoreId + '"]', + 'button[data-store-id="' + newStoreId + '"]' ).innerHTML = "Switch [EXPIRED]"; } replaceToolbarState(newStoreId, data); diff --git a/debug_toolbar/static/debug_toolbar/js/timer.js b/debug_toolbar/static/debug_toolbar/js/timer.js index 9f26bf83c..70d3fe5a2 100644 --- a/debug_toolbar/static/debug_toolbar/js/timer.js +++ b/debug_toolbar/static/debug_toolbar/js/timer.js @@ -33,7 +33,7 @@ function insertBrowserTiming() { ")"; row.querySelector("rect").setAttribute( "width", - getCSSWidth(stat, endStat), + getCSSWidth(stat, endStat) ); } else { // Render a point in time diff --git a/debug_toolbar/static/debug_toolbar/js/toolbar.js b/debug_toolbar/static/debug_toolbar/js/toolbar.js index 3d45ffd74..1c06be7fa 100644 --- a/debug_toolbar/static/debug_toolbar/js/toolbar.js +++ b/debug_toolbar/static/debug_toolbar/js/toolbar.js @@ -31,13 +31,13 @@ const djdt = { this.parentElement.classList.add("djdt-active"); const inner = current.querySelector( - ".djDebugPanelContent .djdt-scroll", + ".djDebugPanelContent .djdt-scroll" ), store_id = djDebug.dataset.storeId; if (store_id && inner.children.length === 0) { const url = new URL( djDebug.dataset.renderPanelUrl, - window.location, + window.location ); url.searchParams.append("store_id", store_id); url.searchParams.append("panel_id", panelId); @@ -49,18 +49,18 @@ const djdt = { djDebug.dispatchEvent( new CustomEvent("djdt.panel.render", { detail: { panelId: panelId }, - }), + }) ); }); } else { djDebug.dispatchEvent( new CustomEvent("djdt.panel.render", { detail: { panelId: panelId }, - }), + }) ); } } - }, + } ); $$.on(djDebug, "click", ".djDebugClose", function () { djdt.hide_one_level(); @@ -76,9 +76,9 @@ const djdt = { { path: "/", expires: 10, - }, + } ); - }, + } ); // Used by the SQL and template panels @@ -219,7 +219,7 @@ const djdt = { // set handle position const handleTop = Math.min( localStorage.getItem("djdt.top") || 0, - window.innerHeight - handle.offsetWidth, + window.innerHeight - handle.offsetWidth ); handle.style.top = handleTop + "px"; }, diff --git a/debug_toolbar/static/debug_toolbar/js/utils.js b/debug_toolbar/static/debug_toolbar/js/utils.js index 065c1d42e..72c767fb6 100644 --- a/debug_toolbar/static/debug_toolbar/js/utils.js +++ b/debug_toolbar/static/debug_toolbar/js/utils.js @@ -77,7 +77,7 @@ function ajax(url, init) { return response.json(); } return Promise.reject( - new Error(response.status + ": " + response.statusText), + new Error(response.status + ": " + response.statusText) ); }) .catch(function (error) {