Skip to content

Commit 265c5ec

Browse files
Mohammad Umer AlamBolajiOlajide
authored andcommitted
biome rule update
1 parent 4a9641c commit 265c5ec

File tree

3 files changed

+32
-33
lines changed

3 files changed

+32
-33
lines changed

biome.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
"noNonNullAssertion": "off",
2323
"noParameterAssign": "off",
2424
"useTemplate": "off"
25+
},
26+
"security": {
27+
"noDangerouslySetInnerHtml": "off"
2528
}
2629
},
2730
"ignore": ["client/browser/src/types/webextension-polyfill/index.d.ts"]

lib/ui-react/src/chip/Chip.tsx

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,34 @@
1-
import type { Annotation } from "@openctx/schema";
2-
import { renderHoverToHTML } from "@openctx/ui-common";
3-
import DOMPurify from "dompurify";
4-
import type { FunctionComponent } from "react";
5-
import { BaseChip } from "./BaseChip.js";
1+
import type { Annotation } from '@openctx/schema'
2+
import { renderHoverToHTML } from '@openctx/ui-common'
3+
import DOMPurify from 'dompurify'
4+
import type { FunctionComponent } from 'react'
5+
import { BaseChip } from './BaseChip.js'
66
/**
77
* A single OpenCtx annotation, displayed as a "chip".
88
*/
99
export const Chip: FunctionComponent<{
10-
annotation: Annotation;
11-
className?: string;
12-
popoverClassName?: string;
10+
annotation: Annotation
11+
className?: string
12+
popoverClassName?: string
1313
}> = ({ annotation: { item }, className, popoverClassName }) => {
14-
const renderedHover = renderHoverToHTML(item.ui?.hover);
15-
return (
16-
<BaseChip
17-
title={item.title}
18-
url={item.url}
19-
className={className}
20-
popover={
21-
renderedHover ? (
22-
renderedHover.format === "text" ? (
23-
<div>{renderedHover.value}</div>
24-
) : (
25-
/* biome-ignore lint/security/noDangerouslySetInnerHtml: input is sanitized by renderHoverToHTML */
26-
<div
27-
dangerouslySetInnerHTML={{
28-
__html: DOMPurify.sanitize(renderedHover.value),
29-
}}
30-
/>
31-
)
32-
) : null
33-
}
34-
popoverClassName={popoverClassName}
35-
/>
36-
);
37-
};
14+
const renderedHover = renderHoverToHTML(item.ui?.hover)
15+
return (
16+
<BaseChip
17+
title={item.title}
18+
url={item.url}
19+
className={className}
20+
popover={
21+
renderedHover ? (
22+
renderedHover.format === 'text' ? (
23+
<div>{renderedHover.value}</div>
24+
) : (
25+
<div
26+
dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(renderedHover.value) }}
27+
/>
28+
)
29+
) : null
30+
}
31+
popoverClassName={popoverClassName}
32+
/>
33+
)
34+
}

web/src/content/ContentPage.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export const ContentPage: FunctionComponent<{ content: ContentPages }> = ({ cont
2020
<ContentPageComponent />
2121
</div>
2222
) : pageContext.contentPageHtml ? (
23-
// biome-ignore lint/security/noDangerouslySetInnerHtml: The input value does not come from the user.
2423
<div
2524
dangerouslySetInnerHTML={{
2625
__html: DOMPurify.sanitize(pageContext.contentPageHtml.toString()),

0 commit comments

Comments
 (0)