mirror of
https://github.com/go-gitea/gitea
synced 2024-11-16 17:29:25 +01:00
Add eslint-plugin-github
and fix issues (#29201)
This plugin has a few useful rules. The only thing I dislike about it is that it pulls in a rather big number of dependencies for react-related rules we don't use, but it can't really be avoided. Rule docs: https://github.com/github/eslint-plugin-github?tab=readme-ov-file#rules
This commit is contained in:
parent
d8d4b33b31
commit
26b17537e6
@ -12,6 +12,7 @@ plugins:
|
|||||||
- "@eslint-community/eslint-plugin-eslint-comments"
|
- "@eslint-community/eslint-plugin-eslint-comments"
|
||||||
- "@stylistic/eslint-plugin-js"
|
- "@stylistic/eslint-plugin-js"
|
||||||
- eslint-plugin-array-func
|
- eslint-plugin-array-func
|
||||||
|
- eslint-plugin-github
|
||||||
- eslint-plugin-i
|
- eslint-plugin-i
|
||||||
- eslint-plugin-jquery
|
- eslint-plugin-jquery
|
||||||
- eslint-plugin-no-jquery
|
- eslint-plugin-no-jquery
|
||||||
@ -209,6 +210,29 @@ rules:
|
|||||||
func-names: [0]
|
func-names: [0]
|
||||||
func-style: [0]
|
func-style: [0]
|
||||||
getter-return: [2]
|
getter-return: [2]
|
||||||
|
github/a11y-aria-label-is-well-formatted: [0]
|
||||||
|
github/a11y-no-title-attribute: [0]
|
||||||
|
github/a11y-no-visually-hidden-interactive-element: [0]
|
||||||
|
github/a11y-role-supports-aria-props: [0]
|
||||||
|
github/a11y-svg-has-accessible-name: [0]
|
||||||
|
github/array-foreach: [0]
|
||||||
|
github/async-currenttarget: [2]
|
||||||
|
github/async-preventdefault: [2]
|
||||||
|
github/authenticity-token: [0]
|
||||||
|
github/get-attribute: [0]
|
||||||
|
github/js-class-name: [0]
|
||||||
|
github/no-blur: [0]
|
||||||
|
github/no-d-none: [0]
|
||||||
|
github/no-dataset: [2]
|
||||||
|
github/no-dynamic-script-tag: [2]
|
||||||
|
github/no-implicit-buggy-globals: [2]
|
||||||
|
github/no-inner-html: [0]
|
||||||
|
github/no-innerText: [2]
|
||||||
|
github/no-then: [2]
|
||||||
|
github/no-useless-passive: [2]
|
||||||
|
github/prefer-observers: [2]
|
||||||
|
github/require-passive-events: [2]
|
||||||
|
github/unescaped-html-literal: [0]
|
||||||
grouped-accessor-pairs: [2]
|
grouped-accessor-pairs: [2]
|
||||||
guard-for-in: [0]
|
guard-for-in: [0]
|
||||||
id-blacklist: [0]
|
id-blacklist: [0]
|
||||||
|
@ -79,4 +79,8 @@ async function main() {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
main().then(exit).catch(exit);
|
try {
|
||||||
|
exit(await main());
|
||||||
|
} catch (err) {
|
||||||
|
exit(err);
|
||||||
|
}
|
||||||
|
@ -63,4 +63,8 @@ async function main() {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
main().then(exit).catch(exit);
|
try {
|
||||||
|
exit(await main());
|
||||||
|
} catch (err) {
|
||||||
|
exit(err);
|
||||||
|
}
|
||||||
|
954
package-lock.json
generated
954
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -67,6 +67,7 @@
|
|||||||
"@vitejs/plugin-vue": "5.0.4",
|
"@vitejs/plugin-vue": "5.0.4",
|
||||||
"eslint": "8.56.0",
|
"eslint": "8.56.0",
|
||||||
"eslint-plugin-array-func": "4.0.0",
|
"eslint-plugin-array-func": "4.0.0",
|
||||||
|
"eslint-plugin-github": "4.10.1",
|
||||||
"eslint-plugin-i": "2.29.1",
|
"eslint-plugin-i": "2.29.1",
|
||||||
"eslint-plugin-jquery": "1.5.1",
|
"eslint-plugin-jquery": "1.5.1",
|
||||||
"eslint-plugin-no-jquery": "2.7.0",
|
"eslint-plugin-no-jquery": "2.7.0",
|
||||||
|
@ -194,7 +194,7 @@ export function initRepoCodeView() {
|
|||||||
const blob = await $.get(`${url}?${query}&anchor=${anchor}`);
|
const blob = await $.get(`${url}?${query}&anchor=${anchor}`);
|
||||||
currentTarget.closest('tr').outerHTML = blob;
|
currentTarget.closest('tr').outerHTML = blob;
|
||||||
});
|
});
|
||||||
$(document).on('click', '.copy-line-permalink', async (e) => {
|
$(document).on('click', '.copy-line-permalink', async ({currentTarget}) => {
|
||||||
await clippie(toAbsoluteUrl(e.currentTarget.getAttribute('data-url')));
|
await clippie(toAbsoluteUrl(currentTarget.getAttribute('data-url')));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -69,16 +69,12 @@ function initRepoIssueListCheckboxes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateIssuesMeta(
|
try {
|
||||||
url,
|
await updateIssuesMeta(url, action, issueIDs, elementId);
|
||||||
action,
|
|
||||||
issueIDs,
|
|
||||||
elementId,
|
|
||||||
).then(() => {
|
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}).catch((reason) => {
|
} catch (err) {
|
||||||
showErrorToast(reason.responseJSON.error);
|
showErrorToast(err.responseJSON?.error ?? err.message);
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,19 +344,15 @@ export async function updateIssuesMeta(url, action, issueIds, elementId) {
|
|||||||
export function initRepoIssueComments() {
|
export function initRepoIssueComments() {
|
||||||
if ($('.repository.view.issue .timeline').length === 0) return;
|
if ($('.repository.view.issue .timeline').length === 0) return;
|
||||||
|
|
||||||
$('.re-request-review').on('click', function (e) {
|
$('.re-request-review').on('click', async function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const url = $(this).data('update-url');
|
const url = $(this).data('update-url');
|
||||||
const issueId = $(this).data('issue-id');
|
const issueId = $(this).data('issue-id');
|
||||||
const id = $(this).data('id');
|
const id = $(this).data('id');
|
||||||
const isChecked = $(this).hasClass('checked');
|
const isChecked = $(this).hasClass('checked');
|
||||||
|
|
||||||
updateIssuesMeta(
|
await updateIssuesMeta(url, isChecked ? 'detach' : 'attach', issueId, id);
|
||||||
url,
|
window.location.reload();
|
||||||
isChecked ? 'detach' : 'attach',
|
|
||||||
issueId,
|
|
||||||
id,
|
|
||||||
).then(() => window.location.reload());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', (event) => {
|
$(document).on('click', (event) => {
|
||||||
|
@ -205,12 +205,15 @@ export function initRepoCommentForm() {
|
|||||||
$listMenu.find('.no-select.item').on('click', function (e) {
|
$listMenu.find('.no-select.item').on('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (hasUpdateAction) {
|
if (hasUpdateAction) {
|
||||||
updateIssuesMeta(
|
(async () => {
|
||||||
|
await updateIssuesMeta(
|
||||||
$listMenu.data('update-url'),
|
$listMenu.data('update-url'),
|
||||||
'clear',
|
'clear',
|
||||||
$listMenu.data('issue-id'),
|
$listMenu.data('issue-id'),
|
||||||
'',
|
'',
|
||||||
).then(reloadConfirmDraftComment);
|
);
|
||||||
|
reloadConfirmDraftComment();
|
||||||
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this).parent().find('.item').each(function () {
|
$(this).parent().find('.item').each(function () {
|
||||||
@ -248,12 +251,15 @@ export function initRepoCommentForm() {
|
|||||||
|
|
||||||
$(this).addClass('selected active');
|
$(this).addClass('selected active');
|
||||||
if (hasUpdateAction) {
|
if (hasUpdateAction) {
|
||||||
updateIssuesMeta(
|
(async () => {
|
||||||
|
await updateIssuesMeta(
|
||||||
$menu.data('update-url'),
|
$menu.data('update-url'),
|
||||||
'',
|
'',
|
||||||
$menu.data('issue-id'),
|
$menu.data('issue-id'),
|
||||||
$(this).data('id'),
|
$(this).data('id'),
|
||||||
).then(reloadConfirmDraftComment);
|
);
|
||||||
|
reloadConfirmDraftComment();
|
||||||
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
let icon = '';
|
let icon = '';
|
||||||
@ -281,12 +287,15 @@ export function initRepoCommentForm() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (hasUpdateAction) {
|
if (hasUpdateAction) {
|
||||||
updateIssuesMeta(
|
(async () => {
|
||||||
|
await updateIssuesMeta(
|
||||||
$menu.data('update-url'),
|
$menu.data('update-url'),
|
||||||
'',
|
'',
|
||||||
$menu.data('issue-id'),
|
$menu.data('issue-id'),
|
||||||
$(this).data('id'),
|
$(this).data('id'),
|
||||||
).then(reloadConfirmDraftComment);
|
);
|
||||||
|
reloadConfirmDraftComment();
|
||||||
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
$list.find('.selected').html('');
|
$list.find('.selected').html('');
|
||||||
|
Loading…
Reference in New Issue
Block a user