chore: bump oxlint & enable more supported rules (#14769)

This commit is contained in:
DarkSky
2026-04-03 03:36:52 +08:00
committed by GitHub
parent cdadf8588a
commit 233004f867
285 changed files with 937 additions and 1983 deletions

View File

@@ -20,6 +20,7 @@ export * from './popper-position';
export * from './print-to-pdf';
export * from './reference';
export * from './reordering';
export * from './safe-html';
export * from './signal';
export * from './string';
export * from './title';

View File

@@ -0,0 +1,22 @@
import DOMPurify from 'dompurify';
import { unsafeHTML as unsafeLitHtml } from 'lit/directives/unsafe-html.js';
type DOMPurifyOptions = NonNullable<Parameters<typeof DOMPurify.sanitize>[1]>;
type SanitizeOptions = Omit<
DOMPurifyOptions,
'IN_PLACE' | 'RETURN_DOM' | 'RETURN_DOM_FRAGMENT' | 'RETURN_TRUSTED_TYPE'
> & {
IN_PLACE?: false | undefined;
RETURN_DOM?: false | undefined;
RETURN_DOM_FRAGMENT?: false | undefined;
RETURN_TRUSTED_TYPE?: false | undefined;
};
export function sanitizeHTML(html: string, options?: SanitizeOptions): string {
return DOMPurify.sanitize(html, options);
}
export function unsafeHTML(html: string, options?: SanitizeOptions) {
return unsafeLitHtml(sanitizeHTML(html, options));
}