From 3d751b6ec18e57698ce86b79866031d2c80c2071 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 22 Mar 2024 15:06:53 +0100 Subject: [PATCH] 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. --- .eslintrc.yaml | 2 +- playwright.config.js | 2 +- tools/generate-images.js | 2 +- tools/generate-svg.js | 4 +-- web_src/js/components/ActionRunStatus.vue | 10 +++---- web_src/js/components/ActivityHeatmap.vue | 4 +-- web_src/js/components/ContextPopup.vue | 6 ++-- web_src/js/components/DashboardRepoList.vue | 4 +-- web_src/js/components/DiffCommitSelector.vue | 6 ++-- web_src/js/components/DiffFileList.vue | 2 +- web_src/js/components/DiffFileTree.vue | 6 ++-- web_src/js/components/DiffFileTreeItem.vue | 2 +- .../js/components/PullRequestMergeForm.vue | 2 +- web_src/js/components/RepoActionView.vue | 6 ++-- .../js/components/RepoActivityTopAuthors.vue | 2 +- .../js/components/RepoBranchTagSelector.vue | 6 ++-- web_src/js/components/RepoCodeFrequency.vue | 6 ++-- web_src/js/components/RepoContributors.vue | 8 ++--- web_src/js/components/RepoRecentCommits.vue | 6 ++-- .../components/ScopedAccessTokenSelector.vue | 4 +-- web_src/js/features/captcha.js | 4 +-- web_src/js/features/code-frequency.js | 2 +- web_src/js/features/codeeditor.js | 4 +-- web_src/js/features/common-global.js | 2 +- .../js/features/comp/EasyMDEToolbarActions.js | 2 +- web_src/js/features/comp/SearchUserBox.js | 8 ++--- web_src/js/features/contextpopup.js | 2 +- web_src/js/features/contributors.js | 2 +- .../js/features/eventsource.sharedworker.js | 2 +- web_src/js/features/imagediff.js | 30 +++++++++---------- web_src/js/features/install.js | 2 +- web_src/js/features/org-team.js | 6 ++-- web_src/js/features/recent-commits.js | 2 +- web_src/js/features/repo-code.js | 2 +- web_src/js/features/repo-home.js | 12 ++++---- web_src/js/features/repo-issue-content.js | 2 +- web_src/js/features/repo-issue.js | 14 ++++----- web_src/js/features/repo-settings.js | 8 ++--- web_src/js/features/repo-template.js | 6 ++-- web_src/js/features/repo-wiki.js | 2 +- web_src/js/features/tribute.js | 4 +-- web_src/js/features/user-auth-webauthn.js | 6 ++-- web_src/js/modules/tippy.js | 2 +- web_src/js/standalone/swagger.js | 6 ++-- web_src/js/svg.js | 2 +- web_src/js/utils/dom.js | 2 +- web_src/js/webcomponents/polyfills.js | 2 +- webpack.config.js | 6 ++-- 48 files changed, 117 insertions(+), 117 deletions(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 72039a6013..eeb3e20cb8 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -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] diff --git a/playwright.config.js b/playwright.config.js index b7badf1cc0..bdd303ae25 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -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. */ diff --git a/tools/generate-images.js b/tools/generate-images.js index cc2855c18e..0bd3af29e4 100755 --- a/tools/generate-images.js +++ b/tools/generate-images.js @@ -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}]}, }, ], }); diff --git a/tools/generate-svg.js b/tools/generate-svg.js index f26b60d960..f744162099 100755 --- a/tools/generate-svg.js +++ b/tools/generate-svg.js @@ -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'}, - ] - } + ], + }, }, ], }); diff --git a/web_src/js/components/ActionRunStatus.vue b/web_src/js/components/ActionRunStatus.vue index 08a47eded7..4eccddffdf 100644 --- a/web_src/js/components/ActionRunStatus.vue +++ b/web_src/js/components/ActionRunStatus.vue @@ -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: '', + }, }, }; diff --git a/web_src/js/components/ActivityHeatmap.vue b/web_src/js/components/ActivityHeatmap.vue index 96a6e68012..9592a0df3c 100644 --- a/web_src/js/components/ActivityHeatmap.vue +++ b/web_src/js/components/ActivityHeatmap.vue @@ -11,7 +11,7 @@ export default { locale: { type: Object, default: () => {}, - } + }, }, data: () => ({ colorRange: [ @@ -49,7 +49,7 @@ export default { const newSearch = params.toString(); window.location.search = newSearch.length ? `?${newSearch}` : ''; - } + }, }, }; diff --git a/web_src/js/components/ContextPopup.vue b/web_src/js/components/ContextPopup.vue index 3a1b828cca..149cabd41e 100644 --- a/web_src/js/components/ContextPopup.vue +++ b/web_src/js/components/ContextPopup.vue @@ -69,7 +69,7 @@ export default { } return {name: label.name, color: `#${label.color}`, textColor}; }); - } + }, }, mounted() { this.$refs.root.addEventListener('ce-load-context-popup', (e) => { @@ -97,8 +97,8 @@ export default { } finally { this.loading = false; } - } - } + }, + }, };