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

Enforce trailing comma in JS on multiline #30002

Merged
merged 3 commits into from
Mar 22, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ rules:
"@stylistic/js/arrow-spacing": [2, {before: true, after: true}]
"@stylistic/js/block-spacing": [0]
"@stylistic/js/brace-style": [2, 1tbs, {allowSingleLine: true}]
"@stylistic/js/comma-dangle": [2, only-multiline]
"@stylistic/js/comma-dangle": [2, always-multiline]
"@stylistic/js/comma-spacing": [2, {before: false, after: true}]
"@stylistic/js/comma-style": [2, last]
"@stylistic/js/computed-property-spacing": [2, never]
Expand Down
2 changes: 1 addition & 1 deletion playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 2000
timeout: 2000,
},

/* Fail the build on CI if you accidentally left test.only in the source code. */
Expand Down
2 changes: 1 addition & 1 deletion tools/generate-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function generate(svg, path, {size, bg}) {
'removeDimensions',
{
name: 'addAttributesToSVGElement',
params: {attributes: [{width: size}, {height: size}]}
params: {attributes: [{width: size}, {height: size}]},
},
],
});
Expand Down
4 changes: 2 additions & 2 deletions tools/generate-svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ async function processFile(file, {prefix, fullName} = {}) {
attributes: [
{'xmlns': 'http://www.w3.org/2000/svg'},
{'width': '16'}, {'height': '16'}, {'aria-hidden': 'true'},
]
}
],
},
},
],
});
Expand Down
10 changes: 5 additions & 5 deletions web_src/js/components/ActionRunStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ export default {
props: {
status: {
type: String,
required: true
required: true,
},
size: {
type: Number,
default: 16
default: 16,
},
className: {
type: String,
default: ''
default: '',
},
localeStatus: {
type: String,
default: ''
}
default: '',
},
},
};
</script>
Expand Down
4 changes: 2 additions & 2 deletions web_src/js/components/ActivityHeatmap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
locale: {
type: Object,
default: () => {},
}
},
},
data: () => ({
colorRange: [
Expand Down Expand Up @@ -49,7 +49,7 @@ export default {
const newSearch = params.toString();
window.location.search = newSearch.length ? `?${newSearch}` : '';
}
},
},
};
</script>
Expand Down
6 changes: 3 additions & 3 deletions web_src/js/components/ContextPopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default {
}
return {name: label.name, color: `#${label.color}`, textColor};
});
}
},
},
mounted() {
this.$refs.root.addEventListener('ce-load-context-popup', (e) => {
Expand Down Expand Up @@ -97,8 +97,8 @@ export default {
} finally {
this.loading = false;
}
}
}
},
},
};
</script>
<template>
Expand Down
4 changes: 2 additions & 2 deletions web_src/js/components/DashboardRepoList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ const sfc = {
...webSearchRepo.repository,
latest_commit_status_state: webSearchRepo.latest_commit_status.State,
locale_latest_commit_status_state: webSearchRepo.locale_latest_commit_status,
latest_commit_status_state_link: webSearchRepo.latest_commit_status.TargetURL
latest_commit_status_state_link: webSearchRepo.latest_commit_status.TargetURL,
};
});
const count = response.headers.get('X-Total-Count');
Expand Down Expand Up @@ -325,7 +325,7 @@ const sfc = {
if (this.activeIndex === -1 || this.activeIndex > this.repos.length - 1) {
this.activeIndex = 0;
}
}
},
},
};
Expand Down
6 changes: 3 additions & 3 deletions web_src/js/components/DiffCommitSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
},
commits: [],
hoverActivated: false,
lastReviewCommitSha: null
lastReviewCommitSha: null,
};
},
computed: {
Expand All @@ -29,7 +29,7 @@ export default {
},
issueLink() {
return this.$el.parentNode.getAttribute('data-issuelink');
}
},
},
mounted() {
document.body.addEventListener('click', this.onBodyClick);
Expand Down Expand Up @@ -185,7 +185,7 @@ export default {
}
}
},
}
},
};
</script>
<template>
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/components/DiffFileList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
},
loadMoreData() {
loadMoreFiles(this.store.linkLoadMore);
}
},
},
};
</script>
Expand Down
6 changes: 3 additions & 3 deletions web_src/js/components/DiffFileTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default {
let newParent = {
name: split,
children: [],
isFile
isFile,
};
if (isFile === true) {
Expand All @@ -40,7 +40,7 @@ export default {
if (parent) {
// check if the folder already exists
const existingFolder = parent.children.find(
(x) => x.name === split
(x) => x.name === split,
);
if (existingFolder) {
newParent = existingFolder;
Expand Down Expand Up @@ -74,7 +74,7 @@ export default {
// reduce the depth of our tree.
mergeChildIfOnlyOneDir(result);
return result;
}
},
},
mounted() {
// Default to true if unset
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/components/DiffFileTreeItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
props: {
item: {
type: Object,
required: true
required: true,
},
},
data: () => ({
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/components/PullRequestMergeForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default {
for (const elem of document.querySelectorAll('[data-pull-merge-style]')) {
toggleElem(elem, elem.getAttribute('data-pull-merge-style') === val);
}
}
},
},
created() {
this.mergeStyleAllowedCount = this.mergeForm.mergeStyles.reduce((v, msd) => v + (msd.allowed ? 1 : 0), 0);
Expand Down
6 changes: 3 additions & 3 deletions web_src/js/components/RepoActionView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const sfc = {
name: '',
link: '',
},
}
},
},
currentJob: {
title: '',
Expand Down Expand Up @@ -311,7 +311,7 @@ const sfc = {
const logLine = this.$refs.steps.querySelector(selectedLogStep);
if (!logLine) return;
logLine.querySelector('.line-num').click();
}
},
},
};
Expand Down Expand Up @@ -352,7 +352,7 @@ export function initRepositoryActionView() {
skipped: el.getAttribute('data-locale-status-skipped'),
blocked: el.getAttribute('data-locale-status-blocked'),
},
}
},
});
view.mount(el);
}
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/components/RepoActivityTopAuthors.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const sfc = {
this.colors.barColor = refStyle.backgroundColor;
this.colors.textColor = refStyle.color;
this.colors.textAltColor = refAltStyle.color;
}
},
};
export function initRepoActivityTopAuthorsChart() {
Expand Down
6 changes: 3 additions & 3 deletions web_src/js/components/RepoBranchTagSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const sfc = {
},
shouldCreateTag() {
return this.mode === 'tags';
}
},
},
watch: {
Expand All @@ -45,7 +45,7 @@ const sfc = {
this.focusSearchField();
this.fetchBranchesOrTags();
}
}
},
},
beforeMount() {
Expand Down Expand Up @@ -209,7 +209,7 @@ const sfc = {
this.isLoading = false;
}
},
}
},
};
export function initRepoBranchTagSelector(selector) {
Expand Down
6 changes: 3 additions & 3 deletions web_src/js/components/RepoCodeFrequency.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default {
props: {
locale: {
type: Object,
required: true
required: true,
},
},
data: () => ({
Expand Down Expand Up @@ -128,12 +128,12 @@ export default {
},
ticks: {
maxRotation: 0,
maxTicksLimit: 12
maxTicksLimit: 12,
},
},
y: {
ticks: {
maxTicksLimit: 6
maxTicksLimit: 6,
},
},
},
Expand Down
8 changes: 4 additions & 4 deletions web_src/js/components/RepoContributors.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const customEventListener = {
chart.resetZoom();
opts.instance.updateOtherCharts(args.event, true);
}
}
},
};
Chart.defaults.color = chartJsColors.text;
Expand Down Expand Up @@ -82,7 +82,7 @@ export default {
this.xAxisMax = this.xAxisEnd;
this.type = val;
this.sortContributors();
}
},
});
},
methods: {
Expand Down Expand Up @@ -175,7 +175,7 @@ export default {
// Normally, chartjs handles this automatically, but it will resize the graph when you
// zoom, pan etc. I think resizing the graph makes it harder to compare things visually.
const maxValue = Math.max(
...this.totalStats.weeks.map((o) => o[this.type])
...this.totalStats.weeks.map((o) => o[this.type]),
);
const [coefficient, exp] = maxValue.toExponential().split('e').map(Number);
if (coefficient % 1 === 0) return maxValue;
Expand All @@ -187,7 +187,7 @@ export default {
// for contributors' graph. If I let chartjs do this for me, it will choose different
// maxY value for each contributors' graph which again makes it harder to compare.
const maxValue = Math.max(
...this.sortedContributors.map((c) => c.max_contribution_type)
...this.sortedContributors.map((c) => c.max_contribution_type),
);
const [coefficient, exp] = maxValue.toExponential().split('e').map(Number);
if (coefficient % 1 === 0) return maxValue;
Expand Down
6 changes: 3 additions & 3 deletions web_src/js/components/RepoRecentCommits.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default {
props: {
locale: {
type: Object,
required: true
required: true,
},
},
data: () => ({
Expand Down Expand Up @@ -105,12 +105,12 @@ export default {
},
ticks: {
maxRotation: 0,
maxTicksLimit: 52
maxTicksLimit: 52,
},
},
y: {
ticks: {
maxTicksLimit: 6
maxTicksLimit: 6,
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions web_src/js/components/ScopedAccessTokenSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const sfc = {
'repository',
'user');
return categories;
}
},
},
mounted() {
Expand Down Expand Up @@ -68,7 +68,7 @@ const sfc = {
}
// no scopes selected, show validation error
showElem(warningEl);
}
},
},
};
Expand Down
4 changes: 2 additions & 2 deletions web_src/js/features/captcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function initCaptcha() {

const params = {
sitekey: siteKey,
theme: isDark ? 'dark' : 'light'
theme: isDark ? 'dark' : 'light',
};

switch (captchaEl.getAttribute('data-captcha-type')) {
Expand Down Expand Up @@ -42,7 +42,7 @@ export async function initCaptcha() {
siteKey: {
instanceUrl: new URL(instanceURL),
key: siteKey,
}
},
});
break;
}
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/features/code-frequency.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function initRepoCodeFrequency() {
loadingTitle: el.getAttribute('data-locale-loading-title'),
loadingTitleFailed: el.getAttribute('data-locale-loading-title-failed'),
loadingInfo: el.getAttribute('data-locale-loading-info'),
}
},
});
View.mount(el);
} catch (err) {
Expand Down
Loading