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

Update to Prettier 3 and add trailing commas #8244

Merged
merged 9 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"endOfLine": "auto",
"htmlWhitespaceSensitivity": "ignore"
"htmlWhitespaceSensitivity": "ignore",
"trailingComma": "all"
NotMyFault marked this conversation as resolved.
Show resolved Hide resolved
}
4 changes: 2 additions & 2 deletions core/src/main/resources/hudson/PluginManager/_installed.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
method: "post",
headers: crumb.wrap({}),
}
},
).then((rsp) => {
if (!rsp.ok) {
rsp.text().then((responseText) => {
Expand All @@ -38,7 +38,7 @@
let e = Array.from(
document
.getElementById("plugins")
.querySelectorAll("input[type='checkbox']")
.querySelectorAll("input[type='checkbox']"),
).find(function (e) {
return String(e.checked) !== e.getAttribute("original");
});
Expand Down
22 changes: 11 additions & 11 deletions core/src/main/resources/hudson/PluginManager/_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Behaviour.specify("#filter-box", "_table", 0, function (e) {
}
}
var instructions = document.getElementById(
"hidden-by-default-instructions"
"hidden-by-default-instructions",
);
if (instructions) {
instructions.style.display = anyVisible ? "none" : "";
Expand All @@ -53,7 +53,7 @@ Behaviour.specify("#filter-box", "_table", 0, function (e) {

(function () {
var instructionsTd = document.getElementById(
"hidden-by-default-instructions-td"
"hidden-by-default-instructions-td",
);
if (instructionsTd) {
// only on Available tab
Expand Down Expand Up @@ -372,19 +372,19 @@ Behaviour.specify("#filter-box", "_table", 0, function (e) {
if (dependenciesDiv) {
pluginTR.jenkinsPluginMetadata.dependencies = selectAll(
"span",
dependenciesDiv
dependenciesDiv,
);
pluginTR.jenkinsPluginMetadata.dependencyIds = processSpanSet(
pluginTR.jenkinsPluginMetadata.dependencies
pluginTR.jenkinsPluginMetadata.dependencies,
);
}
if (dependentsDiv) {
pluginTR.jenkinsPluginMetadata.dependents = selectAll(
"span",
dependentsDiv
dependentsDiv,
);
pluginTR.jenkinsPluginMetadata.dependentIds = processSpanSet(
pluginTR.jenkinsPluginMetadata.dependents
pluginTR.jenkinsPluginMetadata.dependents,
);
}

Expand Down Expand Up @@ -462,7 +462,7 @@ Behaviour.specify("#filter-box", "_table", 0, function (e) {

window.addEventListener("load", function () {
const compatibleCheckbox = document.querySelector(
"[data-select='compatible']"
"[data-select='compatible']",
);
if (compatibleCheckbox) {
compatibleCheckbox.addEventListener("click", () => {
Expand All @@ -478,7 +478,7 @@ window.addEventListener("load", function () {
}

const uninstallButtons = document.querySelectorAll(
"[data-action='uninstall']"
"[data-action='uninstall']",
);
uninstallButtons.forEach((uninstallButton) => {
uninstallButton.addEventListener("click", () => {
Expand All @@ -499,7 +499,7 @@ window.addEventListener("load", function () {
document.body.appendChild(form);
form.submit();
},
() => {}
() => {},
);
});
});
Expand All @@ -513,7 +513,7 @@ window.addEventListener("load", function () {
};
const updateButton = document.querySelector("#button-update");
const checkboxes = document.querySelectorAll(
"input[type='checkbox'], [data-select], .jenkins-table__checkbox"
"input[type='checkbox'], [data-select], .jenkins-table__checkbox",
);
checkboxes.forEach((checkbox) => {
checkbox.addEventListener("click", () => {
Expand All @@ -528,7 +528,7 @@ window.addEventListener("load", function () {
if (updateCenterError) {
notificationBar.show(
updateCenterError.content.textContent,
notificationBar.ERROR
notificationBar.ERROR,
);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
detail.style.display =
detail.style.display == "block" ? "none" : "block";
});
}
},
);
})();
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var redirectForm = document.getElementById("redirect-error");
if (!redirectForm) {
console.warn(
'This script expects to have an element with id="redirect-error" to be working.'
'This script expects to have an element with id="redirect-error" to be working.',
);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function getData(eventSource1, current, min, max) {
{
method: "POST",
headers: crumb.wrap({}),
}
},
).then((t) => {
if (t.ok) {
t.json()
Expand Down Expand Up @@ -129,6 +129,6 @@ if (window.addEventListener) {
tl.layout();
},
null,
true
true,
);
})();
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,20 @@ function generateSVGIcon(iconName, iconSizeClass) {
"href",
imagesURL +
"/build-status/build-status-sprite.svg#build-status-" +
(isInProgress ? "in-progress" : "static")
(isInProgress ? "in-progress" : "static"),
);
svg1.appendChild(use1);

const svg2 = document.createElementNS("http://www.w3.org/2000/svg", "svg");
svg2.setAttribute(
"class",
"svg-icon icon-" + iconName + " " + (iconSizeClass || "icon-sm")
"svg-icon icon-" + iconName + " " + (iconSizeClass || "icon-sm"),
);
svg2.setAttribute("viewBox", "0 0 24 24");
const use2 = document.createElementNS("http://www.w3.org/2000/svg", "use");
use2.setAttribute(
"href",
imagesURL + "/build-status/build-status-sprite.svg#" + buildStatus
imagesURL + "/build-status/build-status-sprite.svg#" + buildStatus,
);
svg2.appendChild(use2);

Expand Down Expand Up @@ -174,7 +174,7 @@ window.displayBuilds = function (data) {
"jenkins-table__link",
"jenkins-table__badge",
"model-link",
"inside"
"inside",
);
a2.href = rootUrl + "/" + e.url;
a2.textContent = e.displayName;
Expand All @@ -190,7 +190,7 @@ window.displayBuilds = function (data) {
"onclick",
'javascript:tl.getBand(0).scrollToCenter(Timeline.DateTime.parseGregorianDateTime("' +
e.timestampString3 +
'"))'
'"))',
);
button.textContent = e.timestampString;
td3.appendChild(button);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
if (graphLocation) {
const type = timespanSelect.value;
const parentSelector = graphLocation.getAttribute(
"data-graph-parent-selector"
"data-graph-parent-selector",
);
const baseUrl = graphLocation.getAttribute("data-graph-base-url");
const graphAlt = graphLocation.getAttribute("data-graph-alt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ Behaviour.specify(
n.style.display = "block";
this.style.display = "none";
};
}
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Behaviour.specify(
crumb.appendToForm(form);
form.submit();
});
}
},
);

function refresh() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ Behaviour.specify(
hoverNotification(message, this, -100);
return false;
};
}
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Behaviour.specify(
fetch(url + "?" + params).then((rsp) => {
rsp.text().then((responseText) => {
var message = document.getElementById(
"URICheckEncodingMonitor-message"
"URICheckEncodingMonitor-message",
);
message.innerHTML = responseText;
});
});
}
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rootUrlField.onkeydown = function (event) {
var iframeRelativeUrl = "setupWizard/setupWizardConfigureInstance";
var rootUrl = iframeUrl.substr(
0,
iframeUrl.length - iframeRelativeUrl.length
iframeUrl.length - iframeRelativeUrl.length,
);
// to keep only the root url
rootUrlField.value = rootUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@
document.getElementById("visible-am-container"),
{
closeAll: closeAll,
}
},
);
var securityMonitors = initializeAmMonitor(
document.getElementById("visible-sec-am-container"),
{
closeAll: closeAll,
}
},
);
monitorWidgets = [normalMonitors, securityMonitors].filter(
function (widget) {
return widget !== null;
},
);
monitorWidgets = [normalMonitors, securityMonitors].filter(function (
widget
) {
return widget !== null;
});

monitorWidgets.forEach(function (widget) {
widget.startListeners();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Behaviour.specify(
event.preventDefault();
revokeToken(element);
});
}
},
);

Behaviour.specify(
Expand All @@ -41,7 +41,7 @@ Behaviour.specify(
element.addEventListener("click", function () {
saveApiToken(element);
});
}
},
);

function revokeToken(anchorRevoke) {
Expand All @@ -67,7 +67,7 @@ function revokeToken(anchorRevoke) {
if (repeatedChunk.querySelectorAll(".legacy-token").length > 0) {
// we are revoking the legacy token
var messageIfLegacyRevoked = anchorRevoke.getAttribute(
"data-message-if-legacy-revoked"
"data-message-if-legacy-revoked",
);

var legacyInput = document.getElementById("apiToken");
Expand All @@ -78,7 +78,7 @@ function revokeToken(anchorRevoke) {
}
});
},
() => {}
() => {},
);
}

Expand Down Expand Up @@ -121,7 +121,7 @@ function saveApiToken(button) {

// show the copy button
var tokenCopyButton = repeatedChunk.querySelector(
".jenkins-copy-button"
".jenkins-copy-button",
);
tokenCopyButton.setAttribute("text", tokenValue);
tokenCopyButton.classList.remove("jenkins-hidden");
Expand All @@ -131,15 +131,15 @@ function saveApiToken(button) {
uuidInput.value = tokenUuid;

var warningMessage = repeatedChunk.querySelector(
".display-after-generation"
".display-after-generation",
);
warningMessage.classList.add("visible");

// we do not want to allow user to create twice a token using same name by mistake
button.remove();

var revokeButton = repeatedChunk.querySelector(
".api-token-property-token-revoke"
".api-token-property-token-revoke",
);
revokeButton.classList.remove("hidden-button");

Expand All @@ -160,7 +160,7 @@ function adjustTokenEmptyListMessage(tokenList) {

// number of token that are already existing or freshly created
var numOfToken = tokenList.querySelectorAll(
".token-list-existing-item, .token-list-fresh-item"
".token-list-existing-item, .token-list-fresh-item",
).length;
if (numOfToken >= 1) {
if (!emptyListMessage.classList.contains("hidden-message")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function selectFresh(anchor) {
var parent = anchor.closest(".legacy-token-usage");
var allCheckBoxes = parent.querySelectorAll(".token-to-revoke");
var concernedCheckBoxes = parent.querySelectorAll(
".token-to-revoke.fresh-token"
".token-to-revoke.fresh-token",
);

checkTheDesiredOne(allCheckBoxes, concernedCheckBoxes);
Expand All @@ -43,7 +43,7 @@ function selectRecent(anchor) {
var parent = anchor.closest(".legacy-token-usage");
var allCheckBoxes = parent.querySelectorAll(".token-to-revoke");
var concernedCheckBoxes = parent.querySelectorAll(
".token-to-revoke.recent-token"
".token-to-revoke.recent-token",
);

checkTheDesiredOne(allCheckBoxes, concernedCheckBoxes);
Expand Down Expand Up @@ -93,7 +93,7 @@ function confirmAndRevokeAllSelected(button) {
var confirmMessageTemplate = button.getAttribute("data-confirm-template");
var confirmMessage = confirmMessageTemplate.replace(
"%num%",
allCheckedCheckBoxes.length
allCheckedCheckBoxes.length,
);
dialog
.confirm(confirmTitle, { message: confirmMessage, type: "destructive" })
Expand All @@ -119,7 +119,7 @@ function confirmAndRevokeAllSelected(button) {
headers: crumb.wrap({ "Content-Type": "application/json" }),
}).then(() => window.location.reload());
},
() => {}
() => {},
);
}
}
Expand Down
Loading