diff --git a/eslint.config.mjs b/eslint.config.mjs index 1b130cd2e6..c7d01c79da 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -320,7 +320,7 @@ export default tseslint.config( 'no-jquery/no-delegate': [2], 'no-jquery/no-done-fail': [2], 'no-jquery/no-each-collection': [0], - 'no-jquery/no-each-util': [0], + 'no-jquery/no-each-util': [2], 'no-jquery/no-each': [0], 'no-jquery/no-error-shorthand': [2], 'no-jquery/no-error': [2], diff --git a/web_src/js/features/org-team.js b/web_src/js/features/org-team.js index 9b059b3a46..fe816da865 100644 --- a/web_src/js/features/org-team.js +++ b/web_src/js/features/org-team.js @@ -10,13 +10,12 @@ export function initOrgTeamSearchRepoBox() { url: `${appSubUrl}/repo/search?q={query}&uid=${$searchRepoBox.data('uid')}`, onResponse(response) { const items = []; - $.each(response.data, (_i, item) => { + for (const item of response.data) { items.push({ title: item.repository.full_name.split('/')[1], description: item.repository.full_name, }); - }); - + } return {results: items}; }, }, diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js index c28bf08442..77ceb0401c 100644 --- a/web_src/js/features/repo-issue.js +++ b/web_src/js/features/repo-issue.js @@ -139,7 +139,7 @@ export function initRepoIssueSidebarList() { const filteredResponse = {success: true, results: []}; const currIssueId = $('#new-dependency-drop-list').data('issue-id'); // Parse the response from the api to work with our dropdown - $.each(response, (_i, issue) => { + for (const [_, issue] of Object.entries(response)) { // Don't list current issue in the dependency list. if (issue.id === currIssueId) { return; @@ -149,7 +149,7 @@ export function initRepoIssueSidebarList() { }
${htmlEscape(issue.repository.full_name)}
`, value: issue.id, }); - }); + } return filteredResponse; }, cache: false, @@ -345,12 +345,12 @@ export function initRepoIssueReferenceRepositorySearch() { url: `${appSubUrl}/repo/search?q={query}&limit=20`, onResponse(response) { const filteredResponse = {success: true, results: []}; - $.each(response.data, (_r, repo) => { + for (const repo of response.data) { filteredResponse.results.push({ name: htmlEscape(repo.repository.full_name), value: repo.repository.full_name, }); - }); + } return filteredResponse; }, cache: false, diff --git a/web_src/js/features/repo-settings.js b/web_src/js/features/repo-settings.js index 52c5de2bfa..47ada545de 100644 --- a/web_src/js/features/repo-settings.js +++ b/web_src/js/features/repo-settings.js @@ -55,13 +55,12 @@ export function initRepoSettingSearchTeamBox() { headers: {'X-Csrf-Token': csrfToken}, onResponse(response) { const items = []; - $.each(response.data, (_i, item) => { + for (const item of response.data) { items.push({ title: item.name, description: `${item.permission} access`, // TODO: translate this string }); - }); - + } return {results: items}; }, }, diff --git a/web_src/js/features/repo-template.js b/web_src/js/features/repo-template.js index 5f63e8b3ba..5f01be5ad3 100644 --- a/web_src/js/features/repo-template.js +++ b/web_src/js/features/repo-template.js @@ -32,12 +32,12 @@ export function initRepoTemplateSearch() { value: '', }); // Parse the response from the api to work with our dropdown - $.each(response.data, (_r, repo) => { + for (const repo of response.data) { filteredResponse.results.push({ name: htmlEscape(repo.repository.full_name), value: repo.repository.id, }); - }); + } return filteredResponse; }, cache: false,