mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 03:18:24 +00:00 
			
		
		
		
	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.
This commit is contained in:
		| @@ -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> | ||||
|   | ||||
| @@ -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}` : ''; | ||||
|     } | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
|   | ||||
| @@ -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; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
| <template> | ||||
|   | ||||
| @@ -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'); | ||||
| @@ -325,7 +325,7 @@ const sfc = { | ||||
|       if (this.activeIndex === -1 || this.activeIndex > this.repos.length - 1) { | ||||
|         this.activeIndex = 0; | ||||
|       } | ||||
|     } | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -14,7 +14,7 @@ export default { | ||||
|       }, | ||||
|       commits: [], | ||||
|       hoverActivated: false, | ||||
|       lastReviewCommitSha: null | ||||
|       lastReviewCommitSha: null, | ||||
|     }; | ||||
|   }, | ||||
|   computed: { | ||||
| @@ -29,7 +29,7 @@ export default { | ||||
|     }, | ||||
|     issueLink() { | ||||
|       return this.$el.parentNode.getAttribute('data-issuelink'); | ||||
|     } | ||||
|     }, | ||||
|   }, | ||||
|   mounted() { | ||||
|     document.body.addEventListener('click', this.onBodyClick); | ||||
| @@ -185,7 +185,7 @@ export default { | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|   } | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
| <template> | ||||
|   | ||||
| @@ -31,7 +31,7 @@ export default { | ||||
|     }, | ||||
|     loadMoreData() { | ||||
|       loadMoreFiles(this.store.linkLoadMore); | ||||
|     } | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
|   | ||||
| @@ -30,7 +30,7 @@ export default { | ||||
|           let newParent = { | ||||
|             name: split, | ||||
|             children: [], | ||||
|             isFile | ||||
|             isFile, | ||||
|           }; | ||||
|  | ||||
|           if (isFile === true) { | ||||
| @@ -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; | ||||
| @@ -74,7 +74,7 @@ export default { | ||||
|       // reduce the depth of our tree. | ||||
|       mergeChildIfOnlyOneDir(result); | ||||
|       return result; | ||||
|     } | ||||
|     }, | ||||
|   }, | ||||
|   mounted() { | ||||
|     // Default to true if unset | ||||
|   | ||||
| @@ -7,7 +7,7 @@ export default { | ||||
|   props: { | ||||
|     item: { | ||||
|       type: Object, | ||||
|       required: true | ||||
|       required: true, | ||||
|     }, | ||||
|   }, | ||||
|   data: () => ({ | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -66,7 +66,7 @@ const sfc = { | ||||
|             name: '', | ||||
|             link: '', | ||||
|           }, | ||||
|         } | ||||
|         }, | ||||
|       }, | ||||
|       currentJob: { | ||||
|         title: '', | ||||
| @@ -311,7 +311,7 @@ const sfc = { | ||||
|       const logLine = this.$refs.steps.querySelector(selectedLogStep); | ||||
|       if (!logLine) return; | ||||
|       logLine.querySelector('.line-num').click(); | ||||
|     } | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
|  | ||||
| @@ -352,7 +352,7 @@ export function initRepositoryActionView() { | ||||
|         skipped: el.getAttribute('data-locale-status-skipped'), | ||||
|         blocked: el.getAttribute('data-locale-status-blocked'), | ||||
|       }, | ||||
|     } | ||||
|     }, | ||||
|   }); | ||||
|   view.mount(el); | ||||
| } | ||||
|   | ||||
| @@ -47,7 +47,7 @@ const sfc = { | ||||
|     this.colors.barColor = refStyle.backgroundColor; | ||||
|     this.colors.textColor = refStyle.color; | ||||
|     this.colors.textAltColor = refAltStyle.color; | ||||
|   } | ||||
|   }, | ||||
| }; | ||||
|  | ||||
| export function initRepoActivityTopAuthorsChart() { | ||||
|   | ||||
| @@ -36,7 +36,7 @@ const sfc = { | ||||
|     }, | ||||
|     shouldCreateTag() { | ||||
|       return this.mode === 'tags'; | ||||
|     } | ||||
|     }, | ||||
|   }, | ||||
|  | ||||
|   watch: { | ||||
| @@ -45,7 +45,7 @@ const sfc = { | ||||
|         this.focusSearchField(); | ||||
|         this.fetchBranchesOrTags(); | ||||
|       } | ||||
|     } | ||||
|     }, | ||||
|   }, | ||||
|  | ||||
|   beforeMount() { | ||||
| @@ -209,7 +209,7 @@ const sfc = { | ||||
|         this.isLoading = false; | ||||
|       } | ||||
|     }, | ||||
|   } | ||||
|   }, | ||||
| }; | ||||
|  | ||||
| export function initRepoBranchTagSelector(selector) { | ||||
|   | ||||
| @@ -39,7 +39,7 @@ export default { | ||||
|   props: { | ||||
|     locale: { | ||||
|       type: Object, | ||||
|       required: true | ||||
|       required: true, | ||||
|     }, | ||||
|   }, | ||||
|   data: () => ({ | ||||
| @@ -128,12 +128,12 @@ export default { | ||||
|             }, | ||||
|             ticks: { | ||||
|               maxRotation: 0, | ||||
|               maxTicksLimit: 12 | ||||
|               maxTicksLimit: 12, | ||||
|             }, | ||||
|           }, | ||||
|           y: { | ||||
|             ticks: { | ||||
|               maxTicksLimit: 6 | ||||
|               maxTicksLimit: 6, | ||||
|             }, | ||||
|           }, | ||||
|         }, | ||||
|   | ||||
| @@ -34,7 +34,7 @@ const customEventListener = { | ||||
|       chart.resetZoom(); | ||||
|       opts.instance.updateOtherCharts(args.event, true); | ||||
|     } | ||||
|   } | ||||
|   }, | ||||
| }; | ||||
|  | ||||
| Chart.defaults.color = chartJsColors.text; | ||||
| @@ -82,7 +82,7 @@ export default { | ||||
|         this.xAxisMax = this.xAxisEnd; | ||||
|         this.type = val; | ||||
|         this.sortContributors(); | ||||
|       } | ||||
|       }, | ||||
|     }); | ||||
|   }, | ||||
|   methods: { | ||||
| @@ -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; | ||||
| @@ -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; | ||||
|   | ||||
| @@ -35,7 +35,7 @@ export default { | ||||
|   props: { | ||||
|     locale: { | ||||
|       type: Object, | ||||
|       required: true | ||||
|       required: true, | ||||
|     }, | ||||
|   }, | ||||
|   data: () => ({ | ||||
| @@ -105,12 +105,12 @@ export default { | ||||
|             }, | ||||
|             ticks: { | ||||
|               maxRotation: 0, | ||||
|               maxTicksLimit: 52 | ||||
|               maxTicksLimit: 52, | ||||
|             }, | ||||
|           }, | ||||
|           y: { | ||||
|             ticks: { | ||||
|               maxTicksLimit: 6 | ||||
|               maxTicksLimit: 6, | ||||
|             }, | ||||
|           }, | ||||
|         }, | ||||
|   | ||||
| @@ -39,7 +39,7 @@ const sfc = { | ||||
|         'repository', | ||||
|         'user'); | ||||
|       return categories; | ||||
|     } | ||||
|     }, | ||||
|   }, | ||||
|  | ||||
|   mounted() { | ||||
| @@ -68,7 +68,7 @@ const sfc = { | ||||
|       } | ||||
|       // no scopes selected, show validation error | ||||
|       showElem(warningEl); | ||||
|     } | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user