Explorar o código

configure biome for app client interfaces, models

Futa Arai hai 3 meses
pai
achega
7ff4894976

+ 2 - 0
apps/app/.eslintrc.js

@@ -85,6 +85,8 @@ module.exports = {
     'src/server/service/in-app-notification/**',
     'src/server/service/interfaces/**',
     'src/server/service/normalize-data/**',
+    'src/client/interfaces/**',
+    'src/client/models/**',
   ],
   settings: {
     // resolve path aliases by eslint-import-resolver-typescript

+ 1 - 1
apps/app/src/client/interfaces/clearable.ts

@@ -1,3 +1,3 @@
 export interface IClearable {
-  clear: () => void,
+  clear: () => void;
 }

+ 1 - 1
apps/app/src/client/interfaces/focusable.ts

@@ -1,3 +1,3 @@
 export interface IFocusable {
-  focus: () => void,
+  focus: () => void;
 }

+ 8 - 9
apps/app/src/client/interfaces/global-notification.ts

@@ -3,8 +3,7 @@ export const NotifyType = {
   SLACK: 'slack',
 } as const;
 
-export type NotifyType = typeof NotifyType[keyof typeof NotifyType]
-
+export type NotifyType = (typeof NotifyType)[keyof typeof NotifyType];
 
 export const TriggerEventType = {
   CREATE: 'pageCreate',
@@ -15,13 +14,13 @@ export const TriggerEventType = {
   POST: 'comment',
 } as const;
 
-type TriggerEventType = typeof TriggerEventType[keyof typeof TriggerEventType]
-
+type TriggerEventType =
+  (typeof TriggerEventType)[keyof typeof TriggerEventType];
 
 export type IGlobalNotification = {
-  triggerPath: string,
-  notifyType: NotifyType,
-  emailToSend: string,
-  slackChannelToSend: string,
-  triggerEvents: TriggerEventType[],
+  triggerPath: string;
+  notifyType: NotifyType;
+  emailToSend: string;
+  slackChannelToSend: string;
+  triggerEvents: TriggerEventType[];
 };

+ 3 - 3
apps/app/src/client/interfaces/handsontable-modal.ts

@@ -1,4 +1,4 @@
 export type LaunchHandsonTableModalEventDetail = {
-  bol: number,
-  eol: number,
-}
+  bol: number;
+  eol: number;
+};

+ 1 - 1
apps/app/src/client/interfaces/in-app-notification-openable.ts

@@ -1,3 +1,3 @@
 export interface IInAppNotificationOpenable {
-  open: () => void,
+  open: () => void;
 }

+ 4 - 4
apps/app/src/client/interfaces/notification.ts

@@ -1,8 +1,8 @@
 import type { NotifyType } from './global-notification';
 
 export type INotificationType = {
-  __t?: NotifyType
-  _id: string
+  __t?: NotifyType;
+  _id: string;
   // TOOD: Define the provider type
-  provider?: any
-}
+  provider?: any;
+};

+ 11 - 11
apps/app/src/client/interfaces/react-bootstrap-typeahead.ts

@@ -1,15 +1,15 @@
 // https://github.com/ericgio/react-bootstrap-typeahead/blob/5.x/docs/API.md
 export type TypeaheadProps = {
-  dropup?: boolean,
-  emptyLabel?: string,
-  placeholder?: string,
-  autoFocus?: boolean,
-  inputProps?: unknown,
+  dropup?: boolean;
+  emptyLabel?: string;
+  placeholder?: string;
+  autoFocus?: boolean;
+  inputProps?: unknown;
 
-  onChange?: (data: unknown[]) => void,
-  onBlur?: () => void,
-  onFocus?: () => void,
-  onSearch?: (text: string) => void,
-  onInputChange?: (text: string) => void,
-  onKeyDown?: (input: string) => void,
+  onChange?: (data: unknown[]) => void;
+  onBlur?: () => void;
+  onFocus?: () => void;
+  onSearch?: (text: string) => void;
+  onInputChange?: (text: string) => void;
+  onKeyDown?: (input: string) => void;
 };

+ 5 - 5
apps/app/src/client/interfaces/selectable-all.ts

@@ -1,13 +1,13 @@
 export interface ISelectable {
-  select: () => void,
-  deselect: () => void,
+  select: () => void;
+  deselect: () => void;
 }
 
 export interface ISelectableAndIndeterminatable extends ISelectable {
-  setIndeterminate: () => void,
+  setIndeterminate: () => void;
 }
 
 export interface ISelectableAll {
-  selectAll: () => void,
-  deselectAll: () => void,
+  selectAll: () => void;
+  deselectAll: () => void;
 }

+ 11 - 8
apps/app/src/client/models/BootstrapGrid.js

@@ -1,20 +1,22 @@
 export default class BootstrapGrid {
-
   constructor(colsRatios, responsiveSize) {
     this.colsRatios = BootstrapGrid.validateColsRatios(colsRatios);
     this.responsiveSize = BootstrapGrid.validateResponsiveSize(responsiveSize);
   }
 
   static ResponsiveSize = {
-    XS_SIZE: 'xs', SM_SIZE: 'sm', MD_SIZE: 'md',
+    XS_SIZE: 'xs',
+    SM_SIZE: 'sm',
+    MD_SIZE: 'md',
   };
 
   static validateColsRatios(colsRatios) {
-
     if (colsRatios.length < 2 || colsRatios.length > 4) {
       throw new Error('Incorrect array length of cols ratios');
     }
-    const ratiosTotal = colsRatios.reduce((total, ratio) => { return total + ratio }, 0);
+    const ratiosTotal = colsRatios.reduce((total, ratio) => {
+      return total + ratio;
+    }, 0);
     if (ratiosTotal !== 12) {
       throw new Error('Incorrect cols ratios value');
     }
@@ -23,12 +25,13 @@ export default class BootstrapGrid {
   }
 
   static validateResponsiveSize(responsiveSize) {
-    if (responsiveSize === this.ResponsiveSize.XS_SIZE
-      || responsiveSize === this.ResponsiveSize.SM_SIZE
-      || responsiveSize === this.ResponsiveSize.MD_SIZE) {
+    if (
+      responsiveSize === BootstrapGrid.ResponsiveSize.XS_SIZE ||
+      responsiveSize === BootstrapGrid.ResponsiveSize.SM_SIZE ||
+      responsiveSize === BootstrapGrid.ResponsiveSize.MD_SIZE
+    ) {
       return responsiveSize;
     }
     throw new Error('Incorrect responsive size');
   }
-
 }

+ 8 - 4
apps/app/src/client/models/HotkeyStroke.js

@@ -3,7 +3,6 @@ import loggerFactory from '~/utils/logger';
 const logger = loggerFactory('growi:cli:HotkeyStroke');
 
 export default class HotkeyStroke {
-
   constructor(stroke) {
     this.stroke = stroke;
     this.activeIndices = [];
@@ -42,16 +41,21 @@ export default class HotkeyStroke {
         return nextIndex;
       })
       // exclude null
-      .filter(index => index != null);
+      .filter((index) => index != null);
 
     // reset if completed
     if (isCompleted) {
       this.activeIndices = [];
     }
 
-    logger.debug('activeIndices for [', this.stroke, '] => [', this.activeIndices, ']');
+    logger.debug(
+      'activeIndices for [',
+      this.stroke,
+      '] => [',
+      this.activeIndices,
+      ']',
+    );
 
     return isCompleted;
   }
-
 }

+ 3 - 1
biome.json

@@ -28,7 +28,9 @@
       "!apps/slackbot-proxy/src/public/bootstrap",
       "!packages/pdf-converter-client/src/index.ts",
       "!packages/pdf-converter-client/specs",
-      "!apps/app/src/client",
+      "!apps/app/src/client/components",
+      "!apps/app/src/client/services",
+      "!apps/app/src/client/util",
       "!apps/app/src/server/middlewares",
       "!apps/app/src/server/routes/apiv3/*.js",
       "!apps/app/src/server/service/page"