From 265c5eccd04d7a921be14c788941a16c83fb4630 Mon Sep 17 00:00:00 2001 From: Mohammad Umer Alam Date: Wed, 24 Jul 2024 12:37:37 -0400 Subject: [PATCH] biome rule update --- biome.json | 3 ++ lib/ui-react/src/chip/Chip.tsx | 61 ++++++++++++++++----------------- web/src/content/ContentPage.tsx | 1 - 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/biome.json b/biome.json index 31016231..2d8ece07 100644 --- a/biome.json +++ b/biome.json @@ -22,6 +22,9 @@ "noNonNullAssertion": "off", "noParameterAssign": "off", "useTemplate": "off" + }, + "security": { + "noDangerouslySetInnerHtml": "off" } }, "ignore": ["client/browser/src/types/webextension-polyfill/index.d.ts"] diff --git a/lib/ui-react/src/chip/Chip.tsx b/lib/ui-react/src/chip/Chip.tsx index e5c3bbce..50b883a7 100644 --- a/lib/ui-react/src/chip/Chip.tsx +++ b/lib/ui-react/src/chip/Chip.tsx @@ -1,37 +1,34 @@ -import type { Annotation } from "@openctx/schema"; -import { renderHoverToHTML } from "@openctx/ui-common"; -import DOMPurify from "dompurify"; -import type { FunctionComponent } from "react"; -import { BaseChip } from "./BaseChip.js"; +import type { Annotation } from '@openctx/schema' +import { renderHoverToHTML } from '@openctx/ui-common' +import DOMPurify from 'dompurify' +import type { FunctionComponent } from 'react' +import { BaseChip } from './BaseChip.js' /** * A single OpenCtx annotation, displayed as a "chip". */ export const Chip: FunctionComponent<{ - annotation: Annotation; - className?: string; - popoverClassName?: string; + annotation: Annotation + className?: string + popoverClassName?: string }> = ({ annotation: { item }, className, popoverClassName }) => { - const renderedHover = renderHoverToHTML(item.ui?.hover); - return ( - {renderedHover.value} - ) : ( - /* biome-ignore lint/security/noDangerouslySetInnerHtml: input is sanitized by renderHoverToHTML */ -
- ) - ) : null - } - popoverClassName={popoverClassName} - /> - ); -}; + const renderedHover = renderHoverToHTML(item.ui?.hover) + return ( + {renderedHover.value}
+ ) : ( +
+ ) + ) : null + } + popoverClassName={popoverClassName} + /> + ) +} diff --git a/web/src/content/ContentPage.tsx b/web/src/content/ContentPage.tsx index 084de99a..4a970d2a 100644 --- a/web/src/content/ContentPage.tsx +++ b/web/src/content/ContentPage.tsx @@ -20,7 +20,6 @@ export const ContentPage: FunctionComponent<{ content: ContentPages }> = ({ cont
) : pageContext.contentPageHtml ? ( - // biome-ignore lint/security/noDangerouslySetInnerHtml: The input value does not come from the user.