Enforce trailing comma in JS on multiline (#30002)

To keep blame info accurate and to avoid [changes like
this](https://github.com/go-gitea/gitea/pull/29977/files#diff-c3422631a14edbe1e508c4b22f0c718db318be08a6e889427802f9b6165d88d6R359),
it's good to always have a trailing comma, so let's enforce it in JS.

This rule is completely automatically fixable with `make lint-js-fix`
and that's what I did here.

(cherry picked from commit 3d751b6ec18e57698ce86b79866031d2c80c2071)

Conflicts:
	web_src/js/components/DashboardRepoList.vue
	trivial context conflict because of '3b7b899afa fix commit_status'
This commit is contained in:
silverwind 2024-03-22 15:06:53 +01:00 committed by Earl Warren
parent 9c9f40f6d3
commit b96845ae01
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
48 changed files with 117 additions and 117 deletions

View file

@ -20,19 +20,19 @@ function getDefaultSvgBoundsIfUndefined(text, src) {
if (img.width > 1 && img.width < MaxSize && img.height > 1 && img.height < MaxSize) {
return {
width: img.width,
height: img.height
height: img.height,
};
}
if (svg.hasAttribute('viewBox')) {
const viewBox = svg.viewBox.baseVal;
return {
width: DefaultSize,
height: DefaultSize * viewBox.width / viewBox.height
height: DefaultSize * viewBox.width / viewBox.height,
};
}
return {
width: DefaultSize,
height: DefaultSize
height: DefaultSize,
};
}
return null;
@ -42,15 +42,15 @@ export function initImageDiff() {
function createContext(image1, image2) {
const size1 = {
width: image1 && image1.width || 0,
height: image1 && image1.height || 0
height: image1 && image1.height || 0,
};
const size2 = {
width: image2 && image2.width || 0,
height: image2 && image2.height || 0
height: image2 && image2.height || 0,
};
const max = {
width: Math.max(size2.width, size1.width),
height: Math.max(size2.height, size1.height)
height: Math.max(size2.height, size1.height),
};
return {
@ -63,8 +63,8 @@ export function initImageDiff() {
Math.floor(max.width - size1.width) / 2,
Math.floor(max.height - size1.height) / 2,
Math.floor(max.width - size2.width) / 2,
Math.floor(max.height - size2.height) / 2
]
Math.floor(max.height - size2.height) / 2,
],
};
}
@ -79,12 +79,12 @@ export function initImageDiff() {
path: this.getAttribute('data-path-after'),
mime: this.getAttribute('data-mime-after'),
$images: $container.find('img.image-after'), // matches 3 <img>
$boundsInfo: $container.find('.bounds-info-after')
$boundsInfo: $container.find('.bounds-info-after'),
}, {
path: this.getAttribute('data-path-before'),
mime: this.getAttribute('data-mime-before'),
$images: $container.find('img.image-before'), // matches 3 <img>
$boundsInfo: $container.find('.bounds-info-before')
$boundsInfo: $container.find('.bounds-info-before'),
}];
await Promise.all(imageInfos.map(async (info) => {
@ -222,21 +222,21 @@ export function initImageDiff() {
sizes.image1.css({
width: sizes.size1.width * factor,
height: sizes.size1.height * factor
height: sizes.size1.height * factor,
});
sizes.image2.css({
width: sizes.size2.width * factor,
height: sizes.size2.height * factor
height: sizes.size2.height * factor,
});
sizes.image1.parent().css({
margin: `${sizes.ratio[1] * factor}px ${sizes.ratio[0] * factor}px`,
width: sizes.size1.width * factor + 2,
height: sizes.size1.height * factor + 2
height: sizes.size1.height * factor + 2,
});
sizes.image2.parent().css({
margin: `${sizes.ratio[3] * factor}px ${sizes.ratio[2] * factor}px`,
width: sizes.size2.width * factor + 2,
height: sizes.size2.height * factor + 2
height: sizes.size2.height * factor + 2,
});
// some inner elements are `position: absolute`, so the container's height must be large enough
@ -248,7 +248,7 @@ export function initImageDiff() {
const $range = $container.find("input[type='range']");
const onInput = () => sizes.image1.parent().css({
opacity: $range.val() / 100
opacity: $range.val() / 100,
});
$range.on('input', onInput);
onInput();