Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JS linting error from pre-commit. #1670

Merged
merged 1 commit into from
Sep 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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