Eslint updates

This commit is contained in:
Bill 2022-04-02 01:37:27 -04:00
parent 855d9f2f0d
commit 3c0e3693e1
5 changed files with 36 additions and 14 deletions

View File

@ -2,7 +2,7 @@
"settings": { "settings": {
"react": { "react": {
"pragma": "React", "pragma": "React",
"version": "17.0.2" "version": "18.0.0"
} }
}, },
"env": { "env": {
@ -11,7 +11,8 @@
}, },
"extends": [ "extends": [
"plugin:react/recommended", "plugin:react/recommended",
"plugin:react/jsx-runtime" "plugin:react/jsx-runtime",
"plugin:react-hooks/recommended"
], ],
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"parserOptions": { "parserOptions": {
@ -26,9 +27,29 @@
"@typescript-eslint" "@typescript-eslint"
], ],
"rules": { "rules": {
"indent": ["error", 4, {"SwitchCase": 1}], "linebreak-style": [ "off" ],
"array-bracket-spacing": ["error", "always"], "quotes": [ "error", "single" ],
"brace-style": ["error", "allman"], "@typescript-eslint/indent": [ "error", 4, { "SwitchCase": 1 } ],
"react/prop-types": ["off"] "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" ]
} }
} }

View File

@ -206,7 +206,7 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
if(index >= 0) CURRENT_WINDOWS.splice(index, 1); if(index >= 0) CURRENT_WINDOWS.splice(index, 1);
} }
}, [ handleSelector, windowPosition, uniqueKey, disableDrag, bringToTop ]); }, [ handleSelector, windowPosition, uniqueKey, disableDrag, offsetLeft, offsetTop, bringToTop ]);
useEffect(() => useEffect(() =>
{ {

View File

@ -1,8 +1,8 @@
import { CancelMarketplaceOfferMessageComposer, GetMarketplaceOwnOffersMessageComposer, MarketplaceCancelOfferResultEvent, MarketplaceOwnOffersEvent, RedeemMarketplaceOfferCreditsMessageComposer } from '@nitrots/nitro-renderer'; 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 { LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer } from '../../../../../../api';
import { Button, Column, Text } from '../../../../../../common'; import { Button, Column, Text } from '../../../../../../common';
import { UseMessageEventHook, UseMountEffect } from '../../../../../../hooks'; import { UseMessageEventHook } from '../../../../../../hooks';
import { CatalogLayoutProps } from '../CatalogLayout.types'; import { CatalogLayoutProps } from '../CatalogLayout.types';
import { CatalogLayoutMarketplaceItemView, OWN_OFFER } from './CatalogLayoutMarketplaceItemView'; import { CatalogLayoutMarketplaceItemView, OWN_OFFER } from './CatalogLayoutMarketplaceItemView';
import { MarketplaceOfferData } from './common/MarketplaceOfferData'; import { MarketplaceOfferData } from './common/MarketplaceOfferData';
@ -74,10 +74,10 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC<CatalogLayoutProps> = prop
SendMessageComposer(new CancelMarketplaceOfferMessageComposer(offerData.offerId)); SendMessageComposer(new CancelMarketplaceOfferMessageComposer(offerData.offerId));
}; };
UseMountEffect(() => useEffect(() =>
{ {
SendMessageComposer(new GetMarketplaceOwnOffersMessageComposer()); SendMessageComposer(new GetMarketplaceOwnOffersMessageComposer());
}); }, []);
return ( return (
<Column overflow="hidden"> <Column overflow="hidden">

View File

@ -1,6 +1,7 @@
import { EffectCallback, useEffect } from 'react'; import { EffectCallback, useEffect } from 'react';
// eslint-disable-next-line react-hooks/exhaustive-deps
const useEffectOnce = (effect: EffectCallback) => useEffect(effect, []); const useEffectOnce = (effect: EffectCallback) => useEffect(effect, []);
export const UseMountEffect = (fn: Function) => useEffectOnce(() => fn()); export const UseMountEffect = (fn: Function) => useEffectOnce(() => fn());