Просмотр исходного кода

fix non-autofixable biome errors

Futa Arai 6 месяцев назад
Родитель
Сommit
038c999b0d

+ 3 - 0
apps/app/src/pages/_document.page.tsx

@@ -94,6 +94,7 @@ class GrowiDocument extends Document<GrowiDocumentInitialProps> {
     return (
       <script
         id="customScript"
+        // biome-ignore lint/security/noDangerouslySetInnerHtml: ignore
         dangerouslySetInnerHTML={{ __html: customScript }}
       />
     );
@@ -103,6 +104,7 @@ class GrowiDocument extends Document<GrowiDocumentInitialProps> {
     if (customCss == null || customCss.length === 0) {
       return <></>;
     }
+    // biome-ignore lint/security/noDangerouslySetInnerHtml: ignore
     return <style dangerouslySetInnerHTML={{ __html: customCss }} />;
   }
 
@@ -110,6 +112,7 @@ class GrowiDocument extends Document<GrowiDocumentInitialProps> {
     if (customNoscript == null || customNoscript.length === 0) {
       return <></>;
     }
+    // biome-ignore lint/security/noDangerouslySetInnerHtml: ignore
     return <noscript dangerouslySetInnerHTML={{ __html: customNoscript }} />;
   }
 

+ 2 - 2
apps/app/src/pages/_error.page.tsx

@@ -1,10 +1,10 @@
 import type { JSX } from 'react';
 import type { NextPageContext } from 'next';
 import type { ErrorProps } from 'next/error';
-import Error from 'next/error';
+import NextError from 'next/error';
 
 export default function ErrorPage(props: ErrorProps): JSX.Element {
-  return <Error {...props} />;
+  return <NextError {...props} />;
 }
 
 // add getInitialProps to disable "https://nextjs.org/docs/messages/prerender-error"

+ 17 - 10
apps/app/src/pages/installer.page.tsx

@@ -58,31 +58,38 @@ type Props = CommonProps & {
   pageWithMetaStr: string;
 };
 
+const UserInfoIcon = () => (
+  <span className="material-symbols-outlined me-2">person</span>
+);
+
+const ExternalAccountsIcon = () => (
+  <span className="growi-custom-icons me-2">external_link</span>
+);
+
 const InstallerPage: NextPage<Props> = (props: Props) => {
   const { t } = useTranslation();
   const { t: tCommons } = useTranslation('commons');
 
+  const BoundInstallerForm = useMemo(
+    () => () => <InstallerForm minPasswordLength={props.minPasswordLength} />,
+    [props.minPasswordLength],
+  );
+
   const navTabMapping = useMemo(() => {
     return {
       user_infomation: {
-        Icon: () => (
-          <span className="material-symbols-outlined me-2">person</span>
-        ),
-        Content: () => (
-          <InstallerForm minPasswordLength={props.minPasswordLength} />
-        ),
+        Icon: UserInfoIcon,
+        Content: BoundInstallerForm,
         i18n: t('installer.tab'),
       },
       external_accounts: {
         // TODO: chack and fix font-size. see: https://redmine.weseek.co.jp/issues/143015
-        Icon: () => (
-          <span className="growi-custom-icons me-2">external_link</span>
-        ),
+        Icon: ExternalAccountsIcon,
         Content: DataTransferForm,
         i18n: tCommons('g2g_data_transfer.tab'),
       },
     };
-  }, [props.minPasswordLength, t, tCommons]);
+  }, [BoundInstallerForm, t, tCommons]);
 
   // commons
   useAppTitle(props.appTitle);

+ 48 - 44
apps/app/src/pages/login/error/[message].page.tsx

@@ -18,56 +18,60 @@ import {
 type Props = CommonProps;
 const classNames: string[] = ['login-page'];
 
-const LoginPage: NextPage<CommonProps> = () => {
+const ApprovalPendingUserError = () => {
   const { t } = useTranslation();
-  const router = useRouter();
-  const { message } = router.query;
+  return (
+    <>
+      <div className="alert alert-warning">
+        <h2>{t('login.sign_in_error')}</h2>
+      </div>
+      <p>Wait for approved by administrators.</p>
+    </>
+  );
+};
 
-  let loginErrorElm;
+const SuspendedUserError = () => {
+  const { t } = useTranslation();
+  return (
+    <>
+      <div className="alert alert-warning">
+        <h2>{t('login.sign_in_error')}</h2>
+      </div>
+      <p>This account is suspended.</p>
+    </>
+  );
+};
 
-  const ApprovalPendingUserError = () => {
-    return (
-      <>
-        <div className="alert alert-warning">
-          <h2>{t('login.sign_in_error')}</h2>
-        </div>
-        <p>Wait for approved by administrators.</p>
-      </>
-    );
-  };
+const PasswordResetOrderError = () => {
+  const { t } = useTranslation();
+  return (
+    <>
+      <div className="alert alert-warning mb-3">
+        <h2>{t('forgot_password.incorrect_token_or_expired_url')}</h2>
+      </div>
+      <a href="/forgot-password" className="link-switch">
+        <span className="material-symbols-outlined">key</span>{' '}
+        {t('forgot_password.forgot_password')}
+      </a>
+    </>
+  );
+};
 
-  const SuspendedUserError = () => {
-    return (
-      <>
-        <div className="alert alert-warning">
-          <h2>{t('login.sign_in_error')}</h2>
-        </div>
-        <p>This account is suspended.</p>
-      </>
-    );
-  };
+const DefaultLoginError = () => {
+  const { t } = useTranslation();
+  return (
+    <div className="alert alert-warning">
+      <h2>{t('login.sign_in_error')}</h2>
+    </div>
+  );
+};
 
-  const PasswordResetOrderError = () => {
-    return (
-      <>
-        <div className="alert alert-warning mb-3">
-          <h2>{t('forgot_password.incorrect_token_or_expired_url')}</h2>
-        </div>
-        <a href="/forgot-password" className="link-switch">
-          <span className="material-symbols-outlined">key</span>{' '}
-          {t('forgot_password.forgot_password')}
-        </a>
-      </>
-    );
-  };
+const LoginPage: NextPage<CommonProps> = () => {
+  const { t } = useTranslation();
+  const router = useRouter();
+  const { message } = router.query;
 
-  const DefaultLoginError = () => {
-    return (
-      <div className="alert alert-warning">
-        <h2>{t('login.sign_in_error')}</h2>
-      </div>
-    );
-  };
+  let loginErrorElm: JSX.Element;
 
   switch (message) {
     case 'registered':

+ 1 - 0
apps/app/src/pages/utils/commons.ts

@@ -59,6 +59,7 @@ export const getServerSideCommonProps: GetServerSideProps<CommonProps> = async (
 
   const isMaintenanceMode = appService.isMaintenanceMode();
 
+  // biome-ignore lint/suspicious/noImplicitAnyLet: ignore
   let currentUser;
   if (user != null) {
     currentUser = user.toObject();