Browse Source

fix non-autofixable biome lint errors

Futa Arai 9 months ago
parent
commit
492db2751e

+ 1 - 1
packages/presentation/src/client/components/MarpSlides.tsx

@@ -20,7 +20,7 @@ export const MarpSlides = (props: Props): JSX.Element => {
         <style>{css}</style>
       </Head>
       <div
-        // eslint-disable-next-line react/no-danger
+        // biome-ignore lint/security/noDangerouslySetInnerHtml: ignore
         dangerouslySetInnerHTML={{
           // DOMpurify.sanitize delete elements in <svg> so sanitize is not used here.
           __html: html,

+ 3 - 1
packages/presentation/src/client/components/Presentation.tsx

@@ -26,7 +26,9 @@ const baseRevealOptions: Reveal.Options = {
  */
 const removeAllHiddenElements = () => {
   const sections = document.querySelectorAll(`${moduleClass} section`);
-  sections.forEach((section) => section.removeAttribute('hidden'));
+  for (const section of sections) {
+    section.removeAttribute('hidden');
+  }
 };
 
 export type PresentationProps = {

+ 2 - 1
packages/presentation/src/client/components/RichSlideSection.tsx

@@ -13,8 +13,9 @@ const OriginalRichSlideSection = React.memo(
     return (
       <section className={presentation ? 'm-2' : 'shadow rounded m-2'}>
         <svg data-marpit-svg="" viewBox="0 0 1280 720">
+          <title>Rich Slide Section</title>
           <foreignObject width="1280" height="720">
-            <section>{children ?? <></>}</section>
+            <section>{children}</section>
           </foreignObject>
         </svg>
       </section>

+ 5 - 4
packages/presentation/src/services/use-slides-by-frontmatter.ts

@@ -9,11 +9,12 @@ type ParseResult = {
 };
 
 const parseSlideFrontmatter = (frontmatter: string): ParseResult => {
-  let marp;
-  let slide;
+  let marp: boolean | undefined;
+  let slide: boolean | undefined;
 
   const lines = frontmatter.split('\n');
-  lines.forEach((line) => {
+
+  for (const line of lines) {
     const [key, value] = line.split(':').map((part) => part.trim());
     if (key === 'marp' && value === 'true') {
       marp = true;
@@ -21,7 +22,7 @@ const parseSlideFrontmatter = (frontmatter: string): ParseResult => {
     if (key === 'slide' && value === 'true') {
       slide = true;
     }
-  });
+  }
 
   return { marp, slide };
 };

+ 1 - 1
packages/presentation/vite.config.ts

@@ -1,4 +1,4 @@
-import path from 'path';
+import path from 'node:path';
 
 import react from '@vitejs/plugin-react';
 import glob from 'glob';