diff --git a/.eslintrc.json b/.eslintrc.json index 2891f80f..e3bb1ed8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,7 +2,7 @@ "settings": { "react": { "pragma": "React", - "version": "17.0.2" + "version": "18.0.0" } }, "env": { @@ -11,7 +11,8 @@ }, "extends": [ "plugin:react/recommended", - "plugin:react/jsx-runtime" + "plugin:react/jsx-runtime", + "plugin:react-hooks/recommended" ], "parser": "@typescript-eslint/parser", "parserOptions": { @@ -26,9 +27,29 @@ "@typescript-eslint" ], "rules": { - "indent": ["error", 4, {"SwitchCase": 1}], - "array-bracket-spacing": ["error", "always"], - "brace-style": ["error", "allman"], - "react/prop-types": ["off"] + "linebreak-style": [ "off" ], + "quotes": [ "error", "single" ], + "@typescript-eslint/indent": [ "error", 4, { "SwitchCase": 1 } ], + "array-bracket-spacing": [ "error", "always" ], + "brace-style": [ "error", "allman" ], + "react/prop-types": [ "off" ], + "object-curly-spacing": [ "error", "always" ], + "@typescript-eslint/ban-types": [ + "error", + { + "types": { + "String": true, + "Boolean": true, + "Number": true, + "Symbol": true, + "{}": false, + "Object": false, + "object": false, + "Function": false + }, + "extendDefaults": true + } + ], + "no-switch-case-fall-through": [ "off" ] } } diff --git a/src/common/draggable-window/DraggableWindow.tsx b/src/common/draggable-window/DraggableWindow.tsx index 397ac436..d167c3d1 100644 --- a/src/common/draggable-window/DraggableWindow.tsx +++ b/src/common/draggable-window/DraggableWindow.tsx @@ -206,7 +206,7 @@ export const DraggableWindow: FC = props => if(index >= 0) CURRENT_WINDOWS.splice(index, 1); } - }, [ handleSelector, windowPosition, uniqueKey, disableDrag, bringToTop ]); + }, [ handleSelector, windowPosition, uniqueKey, disableDrag, offsetLeft, offsetTop, bringToTop ]); useEffect(() => { diff --git a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx index e7b8e3bf..67860591 100644 --- a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx @@ -1,8 +1,8 @@ import { CancelMarketplaceOfferMessageComposer, GetMarketplaceOwnOffersMessageComposer, MarketplaceCancelOfferResultEvent, MarketplaceOwnOffersEvent, RedeemMarketplaceOfferCreditsMessageComposer } from '@nitrots/nitro-renderer'; -import { FC, useCallback, useMemo, useState } from 'react'; +import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer } from '../../../../../../api'; import { Button, Column, Text } from '../../../../../../common'; -import { UseMessageEventHook, UseMountEffect } from '../../../../../../hooks'; +import { UseMessageEventHook } from '../../../../../../hooks'; import { CatalogLayoutProps } from '../CatalogLayout.types'; import { CatalogLayoutMarketplaceItemView, OWN_OFFER } from './CatalogLayoutMarketplaceItemView'; import { MarketplaceOfferData } from './common/MarketplaceOfferData'; @@ -74,10 +74,10 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC = prop SendMessageComposer(new CancelMarketplaceOfferMessageComposer(offerData.offerId)); }; - UseMountEffect(() => + useEffect(() => { SendMessageComposer(new GetMarketplaceOwnOffersMessageComposer()); - }); + }, []); return ( diff --git a/src/components/hotel-view/views/widgets/GetWidgetLayout.tsx b/src/components/hotel-view/views/widgets/GetWidgetLayout.tsx index 37b30b93..f5fafe61 100644 --- a/src/components/hotel-view/views/widgets/GetWidgetLayout.tsx +++ b/src/components/hotel-view/views/widgets/GetWidgetLayout.tsx @@ -6,9 +6,9 @@ import { WidgetContainerView } from './widget-container/WidgetContainerView'; export interface GetWidgetLayoutProps { - widgetType: string; - slot: number; - widgetConf: any; + widgetType: string; + slot: number; + widgetConf: any; } export const GetWidgetLayout: FC = props => diff --git a/src/hooks/UseMountEffect.tsx b/src/hooks/UseMountEffect.tsx index 7b33ea72..0ead14b1 100644 --- a/src/hooks/UseMountEffect.tsx +++ b/src/hooks/UseMountEffect.tsx @@ -1,6 +1,7 @@ import { EffectCallback, useEffect } from 'react'; +// eslint-disable-next-line react-hooks/exhaustive-deps const useEffectOnce = (effect: EffectCallback) => useEffect(effect, []); export const UseMountEffect = (fn: Function) => useEffectOnce(() => fn());