chore(prettier): full repo linting and code reformatting once and for all (#3627)

This commit is contained in:
Alireza authored and GitHub committed 2023-09-01 16:19:39 -04:00
1 parent 01500a2d4c
commit 9045ddaedc
656 files changed
+21737 -20628

No files matched your search

@@ -1,11 +1,4 @@
import React, {
useState,
createContext,
useContext,
useCallback,
useEffect,
useRef,
} from 'react';
import React, { useState, createContext, useContext, useCallback, useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import Draggable from 'react-draggable';
@@ -97,8 +90,7 @@ const DialogProvider = ({ children, service }) => {
* @returns void
*/
const dismiss = useCallback(
({ id }) =>
setDialogs(dialogs => dialogs.filter(dialog => dialog.id !== id)),
({ id }) => setDialogs(dialogs => dialogs.filter(dialog => dialog.id !== id)),
[]
);
@@ -127,9 +119,7 @@ const DialogProvider = ({ children, service }) => {
const _bringToFront = useCallback(id => {
setDialogs(dialogs => {
const topDialog = dialogs.find(dialog => dialog.id === id);
return topDialog
? [...dialogs.filter(dialog => dialog.id !== id), topDialog]
: dialogs;
return topDialog ? [...dialogs.filter(dialog => dialog.id !== id), topDialog] : dialogs;
});
}, []);
@@ -163,8 +153,7 @@ const DialogProvider = ({ children, service }) => {
showOverlay,
} = dialog;
let position =
(preservePosition && lastDialogPosition) || defaultPosition;
let position = (preservePosition && lastDialogPosition) || defaultPosition;
if (centralize) {
position = centerPositions.find(position => position.id === id);
}
@@ -179,14 +168,7 @@ const DialogProvider = ({ children, service }) => {
onStart={event => {
const e = event || (typeof window !== 'undefined' && window.event);
const target = e.target || e.srcElement;
const BLACKLIST = [
'SVG',
'BUTTON',
'PATH',
'INPUT',
'SPAN',
'LABEL',
];
const BLACKLIST = ['SVG', 'BUTTON', 'PATH', 'INPUT', 'SPAN', 'LABEL'];
if (BLACKLIST.includes(target.tagName.toUpperCase())) {
return false;
}
@@ -222,7 +204,10 @@ const DialogProvider = ({ children, service }) => {
style={{ zIndex: '999', position: 'absolute', width: '350px' }}
onClick={() => _bringToFront(id)}
>
<DialogContent {...dialog} {...contentProps} />
<DialogContent
{...dialog}
{...contentProps}
/>
</div>
</Draggable>
);
@@ -231,7 +216,10 @@ const DialogProvider = ({ children, service }) => {
const background = 'bg-black bg-opacity-50';
const overlay = 'fixed z-50 left-0 top-0 w-full h-full overflow-auto';
return (
<div className={classNames(overlay, background)} key={id}>
<div
className={classNames(overlay, background)}
key={id}
>
{component}
</div>
);
@@ -245,7 +233,10 @@ const DialogProvider = ({ children, service }) => {
if (typeof onClickOutside === 'function') {
result = (
<OutsideAlerter key={id} onClickOutside={onClickOutside}>
<OutsideAlerter
key={id}
onClickOutside={onClickOutside}
>
{result}
</OutsideAlerter>
);
@@ -280,7 +271,10 @@ const DialogProvider = ({ children, service }) => {
return (
<DialogContext.Provider value={{ create, dismiss, dismissAll, isEmpty }}>
{!isEmpty() && (
<div className="w-full h-full absolute" onKeyDown={onKeyDownHandler}>
<div
className="absolute h-full w-full"
onKeyDown={onKeyDownHandler}
>
{renderDialogs()}
</div>
)}
@@ -298,7 +292,10 @@ export const withDialog = Component => {
return function WrappedComponent(props) {
const { create, dismiss, dismissAll, isEmpty } = useDialog();
return (
<Component {...props} dialog={{ create, dismiss, dismissAll, isEmpty }} />
<Component
{...props}
dialog={{ create, dismiss, dismissAll, isEmpty }}
/>
);
};
};
@@ -308,11 +305,8 @@ DialogProvider.defaultProps = {
};
DialogProvider.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
PropTypes.func,
]).isRequired,
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node, PropTypes.func])
.isRequired,
service: PropTypes.shape({
setServiceImplementation: PropTypes.func,
}),