chore: enable eslint rule react/no-danger (#17983)

* enable react/no-danger and disable rule all places

* remove wild rule
This commit is contained in:
Christoffer Bjelke authored and GitHub committed 2024-12-04 15:07:30 +00:00
1 parent 509fc4b289
commit a75a5b72b2
22 files changed
+43 -4

No files matched your search

@@ -139,6 +139,7 @@ export const EventMeta = ({
{(event.description || translatedDescription) && (
<EventMetaBlock contentClassName="mb-8 break-words max-w-full max-h-[180px] scroll-bar pr-4">
<div
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: markdownToSafeHTML(translatedDescription ?? event.description),
}}
@@ -286,7 +286,8 @@ const OtherTeamProfileView = () => {
<Label className="text-emphasis mt-5">{t("about")}</Label>
<div
className=" text-subtle break-words text-sm [&_a]:text-blue-500 [&_a]:underline [&_a]:hover:text-blue-600"
dangerouslySetInnerHTML={{ __html: md.render(markdownToSafeHTML(team.bio)) }}
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: markdownToSafeHTML(team.bio) }}
/>
</>
)}
@@ -145,6 +145,7 @@ const OrgProfileView = () => {
<Label className="text-emphasis mt-5">{t("about")}</Label>
<div
className=" text-subtle break-words text-sm [&_a]:text-blue-500 [&_a]:underline [&_a]:hover:text-blue-600"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: markdownToSafeHTML(currentOrganisation.bio || ""),
}}
@@ -190,7 +190,8 @@ const ProfileView = ({ isAppDir }: { isAppDir?: boolean }) => {
<Label className="text-emphasis mt-5">{t("about")}</Label>
<div
className=" text-subtle break-words text-sm [&_a]:text-blue-500 [&_a]:underline [&_a]:hover:text-blue-600"
dangerouslySetInnerHTML={{ __html: md.render(markdownToSafeHTML(team.bio ?? null)) }}
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: markdownToSafeHTML(team.bio ?? null) }}
/>
</>
)}
@@ -50,6 +50,7 @@ export const EventTypeDescription = ({
"text-subtle line-clamp-3 break-words py-1 text-sm sm:max-w-[650px] [&_a]:text-blue-500 [&_a]:underline [&_a]:hover:text-blue-600",
shortenDescription ? "line-clamp-4 [&>*:not(:first-child)]:hidden" : ""
)}
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: markdownToSafeHTML(eventType.descriptionAsSafeHTML || ""),
}}
@@ -712,6 +712,7 @@ function FieldLabel({ field }: { field: RhfFormField }) {
if (fieldsThatSupportLabelAsSafeHtml.includes(field.type)) {
return (
<span
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
// Derive from field.label because label might change in b/w and field.labelAsSafeHtml will not be updated.
__html: markdownToSafeHTMLClient(field.label || t(field.defaultLabel || "") || ""),