fix remaining eslint error

This commit is contained in:
DaneEveritt 2022-06-26 15:30:05 -04:00
parent dc84af9937
commit 922d75f471
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
15 changed files with 30 additions and 28 deletions

View file

@ -169,8 +169,7 @@ export default ({ style, initialContent, filename, mode, fetchContent, onContent
autocorrect: false,
autocapitalize: false,
lint: false,
// This property is actually used, the d.ts file for CodeMirror is incorrect.
// @ts-ignore
// @ts-expect-error this property is actually used, the d.ts file for CodeMirror is incorrect.
autoCloseBrackets: true,
matchBrackets: true,
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'],

View file

@ -9,9 +9,7 @@ interface Props {
}
const Icon = ({ icon, className, style }: Props) => {
let [width, height, , , paths] = icon.icon;
paths = Array.isArray(paths) ? paths : [paths];
const [width, height, , , paths] = icon.icon;
return (
<svg
@ -21,7 +19,7 @@ const Icon = ({ icon, className, style }: Props) => {
className={className}
style={style}
>
{paths.map((path, index) => (
{(Array.isArray(paths) ? paths : [paths]).map((path, index) => (
<path key={`svg_path_${index}`} d={path} />
))}
</svg>

View file

@ -11,9 +11,11 @@ const BarFill = styled.div`
box-shadow: 0 -2px 10px 2px hsl(178, 78%, 57%);
`;
type Timer = ReturnType<typeof setTimeout>;
export default () => {
const interval = useRef<number>(null);
const timeout = useRef<number>(null);
const interval = useRef<Timer>(null) as React.MutableRefObject<Timer>;
const timeout = useRef<Timer>(null) as React.MutableRefObject<Timer>;
const [visible, setVisible] = useState(false);
const progress = useStoreState((state) => state.progress.progress);
const continuous = useStoreState((state) => state.progress.continuous);
@ -30,7 +32,6 @@ export default () => {
setVisible((progress || 0) > 0);
if (progress === 100) {
// @ts-ignore
timeout.current = setTimeout(() => setProgress(undefined), 500);
}
}, [progress]);
@ -52,8 +53,7 @@ export default () => {
if ((progress || 0) >= 90) {
setProgress(90);
} else {
// @ts-ignore
interval.current = setTimeout(() => setProgress(progress + randomInt(1, 5)), 500);
interval.current = setTimeout(() => setProgress((progress || 0) + randomInt(1, 5)), 500);
}
}
}, [progress, continuous]);

View file

@ -28,12 +28,12 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
);
const TextButton = forwardRef<HTMLButtonElement, ButtonProps>(({ className, ...props }, ref) => (
// @ts-expect-error
// @ts-expect-error not sure how to get this correct
<Button ref={ref} className={classNames(styles.text, className)} {...props} />
));
const DangerButton = forwardRef<HTMLButtonElement, ButtonProps>(({ className, ...props }, ref) => (
// @ts-expect-error
// @ts-expect-error not sure how to get this correct
<Button ref={ref} className={classNames(styles.danger, className)} {...props} />
));

View file

@ -21,11 +21,11 @@ const DialogButtons = ({ children }: { children: React.ReactNode }) => <>{childr
const Dialog = ({ open, title, description, onClose, hideCloseIcon, children }: DialogProps) => {
const items = React.Children.toArray(children || []);
const [buttons, icon, content] = [
// @ts-expect-error
// @ts-expect-error not sure how to get this correct
items.find((child) => child.type === DialogButtons),
// @ts-expect-error
// @ts-expect-error not sure how to get this correct
items.find((child) => child.type === DialogIcon),
// @ts-expect-error
// @ts-expect-error not sure how to get this correct
items.filter((child) => ![DialogIcon, DialogButtons].includes(child.type)),
];