Skip to content

Commit

Permalink
Update to Prettier 3 and add trailing commas (jenkinsci#8244)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Basil Crow <me@basilcrow.com>
  • Loading branch information
4 people authored Jul 27, 2023
1 parent b3342f8 commit 74610e0
Show file tree
Hide file tree
Showing 77 changed files with 407 additions and 334 deletions.
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 @@ -128,6 +128,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 Down Expand Up @@ -69,7 +69,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 @@ -80,7 +80,7 @@ function revokeToken(anchorRevoke) {
}
});
},
() => {}
() => {},
);
}

Expand Down Expand Up @@ -125,7 +125,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 @@ -135,15 +135,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 @@ -164,7 +164,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
8 changes: 4 additions & 4 deletions core/src/main/resources/lib/form/advanced/advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Behaviour.specify(
}

const oneOrMoreFieldsEditedNotice = parentContainer.querySelector(
".jenkins-edited-section-label"
".jenkins-edited-section-label",
);

if (oneOrMoreFieldsEditedNotice.classList.contains("jenkins-hidden")) {
Expand All @@ -63,7 +63,7 @@ Behaviour.specify(
JSON.stringify(Object.fromEntries(formData));
oneOrMoreFieldsEditedNotice.classList.toggle(
"jenkins-hidden",
result
result,
);
});
});
Expand All @@ -83,7 +83,7 @@ Behaviour.specify(
layoutUpdateCallback.call();
});
e = null; // avoid memory leak
}
},
);

Behaviour.specify(
Expand All @@ -99,5 +99,5 @@ Behaviour.specify(
const customizedFields = element.getAttribute("data-customized-fields");
console.log("no element " + id + " for " + customizedFields);
}
}
},
);
Loading

0 comments on commit 74610e0

Please sign in to comment.