mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 19:38:23 +00:00 
			
		
		
		
	Add typescript guideline and typescript-specific eslint plugins and fix issues (#31521)
1. Add some general guidelines how to write our typescript code 2. Add `@typescript-eslint/eslint-plugin`, general typescript rules 3. Add `eslint-plugin-deprecation` to detect deprecated code 4. Fix all new lint issues that came up
This commit is contained in:
		| @@ -153,7 +153,7 @@ export function initRepoCodeView() { | ||||
|     }); | ||||
|  | ||||
|     $(window).on('hashchange', () => { | ||||
|       let m = rangeAnchorRegex.exec(window.location.hash.match); | ||||
|       let m = rangeAnchorRegex.exec(window.location.hash); | ||||
|       const $linesEls = $(getLineEls()); | ||||
|       let $first; | ||||
|       if (m) { | ||||
| @@ -170,7 +170,7 @@ export function initRepoCodeView() { | ||||
|           return; | ||||
|         } | ||||
|       } | ||||
|       m = singleAnchorRegex.exec(window.location.hash.match); | ||||
|       m = singleAnchorRegex.exec(window.location.hash); | ||||
|       if (m) { | ||||
|         $first = $linesEls.filter(`[rel=L${m[2]}]`); | ||||
|         if ($first.length) { | ||||
|   | ||||
| @@ -55,8 +55,8 @@ export function filterRepoFilesWeighted(files, filter) { | ||||
|     const filterLower = filter.toLowerCase(); | ||||
|     // TODO: for large repo, this loop could be slow, maybe there could be one more limit: | ||||
|     // ... && filterResult.length < threshold * 20,  wait for more feedbacks | ||||
|     for (let i = 0; i < files.length; i++) { | ||||
|       const res = strSubMatch(files[i], filterLower); | ||||
|     for (const file of files) { | ||||
|       const res = strSubMatch(file, filterLower); | ||||
|       if (res.length > 1) { // length==1 means unmatched, >1 means having matched sub strings | ||||
|         filterResult.push({matchResult: res, matchWeight: calcMatchedWeight(res)}); | ||||
|       } | ||||
|   | ||||
| @@ -102,16 +102,16 @@ export function initRepoTopicBar() { | ||||
|  | ||||
|         if (res.topics) { | ||||
|           let found = false; | ||||
|           for (let i = 0; i < res.topics.length; i++) { | ||||
|           for (const {topic_name} of res.topics) { | ||||
|             // skip currently added tags | ||||
|             if (current_topics.includes(res.topics[i].topic_name)) { | ||||
|             if (current_topics.includes(topic_name)) { | ||||
|               continue; | ||||
|             } | ||||
|  | ||||
|             if (res.topics[i].topic_name.toLowerCase() === query.toLowerCase()) { | ||||
|             if (topic_name.toLowerCase() === query.toLowerCase()) { | ||||
|               found_query = true; | ||||
|             } | ||||
|             formattedResponse.results.push({description: res.topics[i].topic_name, 'data-value': res.topics[i].topic_name}); | ||||
|             formattedResponse.results.push({description: topic_name, 'data-value': topic_name}); | ||||
|             found = true; | ||||
|           } | ||||
|           formattedResponse.success = found; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user