mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-11 05:36:25 +00:00
chore: upgrade eslint plugins, remove eslint-plugin-github (#38046)
- Bump `eslint`, `typescript-eslint` and `eslint-plugin-unicorn` (to v68), and configure the rules added in unicorn v66/v67/v68. - Remove `eslint-plugin-github` and its workarounds (rules, type stub, pnpm peer override, in-code `eslint-disable` comments); the rules worth keeping are covered by `unicorn` equivalents. - Apply the resulting fixes and autofixes across the JS codebase. _Prepared with Claude (Opus 4.8)._ --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
+1
-1
@@ -83,7 +83,7 @@ async function setPrLabels(): Promise<void> {
|
||||
Accept: 'application/vnd.github+json',
|
||||
Authorization: `Bearer ${env.GITHUB_TOKEN}`,
|
||||
'X-GitHub-Api-Version': '2022-11-28',
|
||||
...(body ? {'Content-Type': 'application/json'} : {}),
|
||||
...(Boolean(body) && {'Content-Type': 'application/json'}),
|
||||
},
|
||||
body: body ? JSON.stringify(body) : undefined,
|
||||
});
|
||||
|
||||
@@ -12,30 +12,28 @@ const rule: JSRuleDefinition<JSRuleDefinitionTypeOptions> = {
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
Literal(node) {
|
||||
if (typeof node.value !== 'string' || !htmlOpenTag.test(node.value)) return;
|
||||
create: (context) => ({
|
||||
Literal(node) {
|
||||
if (typeof node.value !== 'string' || !htmlOpenTag.test(node.value)) return;
|
||||
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'unescapedHtmlLiteral',
|
||||
});
|
||||
},
|
||||
TemplateLiteral(node) {
|
||||
const templateStart = node.quasis[0]?.value.raw;
|
||||
if (!templateStart || !htmlOpenTag.test(templateStart)) return;
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'unescapedHtmlLiteral',
|
||||
});
|
||||
},
|
||||
TemplateLiteral(node) {
|
||||
const templateStart = node.quasis[0]?.value.raw;
|
||||
if (!templateStart || !htmlOpenTag.test(templateStart)) return;
|
||||
|
||||
const parent = node.parent;
|
||||
if (parent?.type === 'TaggedTemplateExpression' && parent.tag.type === 'Identifier' && parent.tag.name === 'html') return;
|
||||
const parent = node.parent;
|
||||
if (parent?.type === 'TaggedTemplateExpression' && parent.tag.type === 'Identifier' && parent.tag.name === 'html') return;
|
||||
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'unescapedHtmlLiteral',
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'unescapedHtmlLiteral',
|
||||
});
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
export default rule;
|
||||
|
||||
@@ -7,7 +7,7 @@ import {argv, exit} from 'node:process';
|
||||
async function generate(svg: string, path: string, {size, bg}: {size: number, bg?: boolean}) {
|
||||
const outputFile = new URL(path, import.meta.url);
|
||||
|
||||
if (String(outputFile).endsWith('.svg')) {
|
||||
if (outputFile.href.endsWith('.svg')) {
|
||||
const {data} = optimize(svg, {
|
||||
plugins: [
|
||||
'preset-default',
|
||||
|
||||
@@ -92,7 +92,7 @@ async function processMaterialFileIcons() {
|
||||
}
|
||||
|
||||
// Use VSCode's "Language ID" mapping from its extensions
|
||||
for (const [_, langIdExtMap] of Object.entries(vscodeExtensions)) {
|
||||
for (const langIdExtMap of Object.values(vscodeExtensions)) {
|
||||
for (const [langId, names] of Object.entries(langIdExtMap)) {
|
||||
for (const name of names) {
|
||||
const nameLower = name.toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user