Skip to content

Commit 3d751b6

Browse files
authored
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.
1 parent f88ad54 commit 3d751b6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+117
-117
lines changed

.eslintrc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ rules:
119119
"@stylistic/js/arrow-spacing": [2, {before: true, after: true}]
120120
"@stylistic/js/block-spacing": [0]
121121
"@stylistic/js/brace-style": [2, 1tbs, {allowSingleLine: true}]
122-
"@stylistic/js/comma-dangle": [2, only-multiline]
122+
"@stylistic/js/comma-dangle": [2, always-multiline]
123123
"@stylistic/js/comma-spacing": [2, {before: false, after: true}]
124124
"@stylistic/js/comma-style": [2, last]
125125
"@stylistic/js/computed-property-spacing": [2, never]

playwright.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default {
2020
* Maximum time expect() should wait for the condition to be met.
2121
* For example in `await expect(locator).toHaveText();`
2222
*/
23-
timeout: 2000
23+
timeout: 2000,
2424
},
2525

2626
/* Fail the build on CI if you accidentally left test.only in the source code. */

tools/generate-images.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async function generate(svg, path, {size, bg}) {
2020
'removeDimensions',
2121
{
2222
name: 'addAttributesToSVGElement',
23-
params: {attributes: [{width: size}, {height: size}]}
23+
params: {attributes: [{width: size}, {height: size}]},
2424
},
2525
],
2626
});

tools/generate-svg.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ async function processFile(file, {prefix, fullName} = {}) {
3939
attributes: [
4040
{'xmlns': 'http://www.w3.org/2000/svg'},
4141
{'width': '16'}, {'height': '16'}, {'aria-hidden': 'true'},
42-
]
43-
}
42+
],
43+
},
4444
},
4545
],
4646
});

web_src/js/components/ActionRunStatus.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ export default {
1010
props: {
1111
status: {
1212
type: String,
13-
required: true
13+
required: true,
1414
},
1515
size: {
1616
type: Number,
17-
default: 16
17+
default: 16,
1818
},
1919
className: {
2020
type: String,
21-
default: ''
21+
default: '',
2222
},
2323
localeStatus: {
2424
type: String,
25-
default: ''
26-
}
25+
default: '',
26+
},
2727
},
2828
};
2929
</script>

web_src/js/components/ActivityHeatmap.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default {
1111
locale: {
1212
type: Object,
1313
default: () => {},
14-
}
14+
},
1515
},
1616
data: () => ({
1717
colorRange: [
@@ -49,7 +49,7 @@ export default {
4949
5050
const newSearch = params.toString();
5151
window.location.search = newSearch.length ? `?${newSearch}` : '';
52-
}
52+
},
5353
},
5454
};
5555
</script>

web_src/js/components/ContextPopup.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default {
6969
}
7070
return {name: label.name, color: `#${label.color}`, textColor};
7171
});
72-
}
72+
},
7373
},
7474
mounted() {
7575
this.$refs.root.addEventListener('ce-load-context-popup', (e) => {
@@ -97,8 +97,8 @@ export default {
9797
} finally {
9898
this.loading = false;
9999
}
100-
}
101-
}
100+
},
101+
},
102102
};
103103
</script>
104104
<template>

web_src/js/components/DashboardRepoList.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ const sfc = {
253253
...webSearchRepo.repository,
254254
latest_commit_status_state: webSearchRepo.latest_commit_status.State,
255255
locale_latest_commit_status_state: webSearchRepo.locale_latest_commit_status,
256-
latest_commit_status_state_link: webSearchRepo.latest_commit_status.TargetURL
256+
latest_commit_status_state_link: webSearchRepo.latest_commit_status.TargetURL,
257257
};
258258
});
259259
const count = response.headers.get('X-Total-Count');
@@ -325,7 +325,7 @@ const sfc = {
325325
if (this.activeIndex === -1 || this.activeIndex > this.repos.length - 1) {
326326
this.activeIndex = 0;
327327
}
328-
}
328+
},
329329
},
330330
};
331331

web_src/js/components/DiffCommitSelector.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
},
1515
commits: [],
1616
hoverActivated: false,
17-
lastReviewCommitSha: null
17+
lastReviewCommitSha: null,
1818
};
1919
},
2020
computed: {
@@ -29,7 +29,7 @@ export default {
2929
},
3030
issueLink() {
3131
return this.$el.parentNode.getAttribute('data-issuelink');
32-
}
32+
},
3333
},
3434
mounted() {
3535
document.body.addEventListener('click', this.onBodyClick);
@@ -185,7 +185,7 @@ export default {
185185
}
186186
}
187187
},
188-
}
188+
},
189189
};
190190
</script>
191191
<template>

web_src/js/components/DiffFileList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default {
3131
},
3232
loadMoreData() {
3333
loadMoreFiles(this.store.linkLoadMore);
34-
}
34+
},
3535
},
3636
};
3737
</script>

0 commit comments

Comments
 (0)