Skip to content

Commit

Permalink
Fix JS linting error from pre-commit.
Browse files Browse the repository at this point in the history
prettier v3 changed the default of trailing comma to all which seems to be
problematic for ESLint.
  • Loading branch information
tim-schilling committed Sep 11, 2022
1 parent 6f548ae commit b20ddd3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions debug_toolbar/static/debug_toolbar/js/history.js
Expand Up @@ -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)
Expand All @@ -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;
Expand All @@ -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");
});
Expand All @@ -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");

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion debug_toolbar/static/debug_toolbar/js/timer.js
Expand Up @@ -33,7 +33,7 @@ function insertBrowserTiming() {
")</td>";
row.querySelector("rect").setAttribute(
"width",
getCSSWidth(stat, endStat),
getCSSWidth(stat, endStat)
);
} else {
// Render a point in time
Expand Down
16 changes: 8 additions & 8 deletions debug_toolbar/static/debug_toolbar/js/toolbar.js
Expand Up @@ -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);
Expand All @@ -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();
Expand All @@ -76,9 +76,9 @@ const djdt = {
{
path: "/",
expires: 10,
},
}
);
},
}
);

// Used by the SQL and template panels
Expand Down Expand Up @@ -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";
},
Expand Down
2 changes: 1 addition & 1 deletion debug_toolbar/static/debug_toolbar/js/utils.js
Expand Up @@ -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) {
Expand Down

0 comments on commit b20ddd3

Please sign in to comment.