Skip to content

Commit 845e5ed

Browse files
committed
fix: eslint issues
1 parent a567604 commit 845e5ed

File tree

6 files changed

+14
-15
lines changed

6 files changed

+14
-15
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@
9898
"package-macos": "npm run setup && electron-builder --macos -p never",
9999
"build-app-image": "npm run setup && electron-builder --linux AppImage -p never",
100100
"electron": "npm run setup && wait-on tcp:3000 && electron build/",
101-
"lint": "eslint src/**/*.{ts,tsx}",
102-
"lint:fix": "eslint src/**/*.{ts,tsx} --fix",
101+
"lint": "eslint 'src/**/*.{ts,tsx}'",
102+
"lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix",
103103
"serve": "http-server ./build -p 3000",
104104
"prepare": "husky"
105105
},

src/components/ui/editor/JsonEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default forwardRef(function JsonEditor(props: Props, ref: ForwardedRef<Re
3535

3636
const basicSetup: BasicSetupOptions = {};
3737
if (editorOptions.options) {
38-
// @ts-ignore
38+
// @ts-expect-error dynamic key assignment into BasicSetupOptions
3939
editorOptions.options.forEach((item: Option) => basicSetup[item.title as keyof BasicSetupOptions] = item.active);
4040
}
4141

@@ -46,7 +46,7 @@ export default forwardRef(function JsonEditor(props: Props, ref: ForwardedRef<Re
4646
};
4747

4848
if (editorOptions.properties) {
49-
// @ts-ignore
49+
// @ts-expect-error dynamic key assignment into CSSProperties
5050
editorOptions.properties.forEach((item: Properties) => style[item.key] = item.value);
5151
}
5252

src/components/ui/io/Button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { DetailedHTMLProps, ReactNode } from 'react';
1+
import { ButtonHTMLAttributes, DetailedHTMLProps, ReactNode } from 'react';
22

33
type ButtonProps = {
4-
onClick?: DetailedHTMLProps<any, any>
4+
onClick?: DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>['onClick']
55
children?: ReactNode
66
className?: string
77
title?: string

src/components/ui/menu/JsonMenu.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { BaseSyntheticEvent, DetailedHTMLProps, useRef } from 'react';
1+
import { BaseSyntheticEvent, useRef } from 'react';
22
import { FaRegClipboard, FaRegFileArchive, FaRegTrashAlt, FaSearch } from 'react-icons/fa';
33
import Button from '../io/Button';
44
import { useToolbarContext } from '../../../ToolbarContext';
55
import { usePersistenceContext } from '../../../PersistenceContext';
66
import { useClipboardContext } from '../../../ClipboardContext';
77

88
interface Props {
9-
onLoadedFile: DetailedHTMLProps<any, any>;
10-
onSearch: DetailedHTMLProps<any, any>;
9+
onLoadedFile: (content: string | ArrayBuffer | null) => void;
10+
onSearch: () => void;
1111
}
1212

1313
export default function JsonMenu({ onLoadedFile, onSearch } : Props) {
@@ -56,7 +56,7 @@ export default function JsonMenu({ onLoadedFile, onSearch } : Props) {
5656
<Button
5757
onClick={() => {
5858
if (fileContent.current) {
59-
// @ts-ignore at the time of this code, there were no options to reset without accessing the ref
59+
// @ts-expect-error no typed API to reset a file input via ref
6060
fileContent.current.value = '';
6161
}
6262
deleteJson();

src/components/ui/menu/ResultMenu.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { FaBackspace, FaRegCopy, FaSearch, FaTerminal, FaUserFriends } from 'react-icons/fa';
2-
import { DetailedHTMLProps } from 'react';
32
import InputText from '../io/InputText';
43
import Button from '../io/Button';
54
import { useToolbarContext } from '../../../ToolbarContext';
65
import { usePersistenceContext } from '../../../PersistenceContext';
76
import { useClipboardContext } from '../../../ClipboardContext';
87

98
interface Props {
10-
onSearch: DetailedHTMLProps<any, any>;
9+
onSearch: () => void;
1110
}
1211

1312
export default function ResultMenu({ onSearch }: Props) {

src/setupTests.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import '@testing-library/jest-dom';
66
import toast from 'react-hot-toast';
77
import 'jsdom-worker';
88
import { TextEncoder, TextDecoder } from 'util';
9-
9+
// eslint-disable-next-line @typescript-eslint/no-require-imports
1010
const fmt2json = require('format-to-json');
1111

1212
Object.assign(global, { TextDecoder, TextEncoder });
1313

14-
// @ts-ignore
14+
// @ts-expect-error fmt2json is injected as a global for the worker simulation
1515
// eslint-disable-next-line no-undef
1616
globalThis.fmt2json = fmt2json;
1717

18-
// @ts-ignore
18+
// @ts-expect-error importScripts is a worker-only global, stubbed here for jsdom
1919
// eslint-disable-next-line no-undef
2020
globalThis.importScripts = (url: string) => {
2121
console.log(`returning null for url ${url}`);

0 commit comments

Comments
 (0)