Skip to content

Commit f2b7af9

Browse files
committed
lint fix
1 parent a5a0d53 commit f2b7af9

File tree

9 files changed

+44
-7
lines changed

9 files changed

+44
-7
lines changed

src/webview/activitybar/eslint.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ export default tseslint.config(
2323
'warn',
2424
{ allowConstantExport: true },
2525
],
26+
'@typescript-eslint/no-unused-expressions': [
27+
'error',
28+
{
29+
allowShortCircuit: true,
30+
allowTernary: true,
31+
allowTaggedTemplates: true,
32+
},
33+
],
2634
},
2735
},
2836
);

src/webview/activitybar/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "tsc -b && vite build",
9-
"lint": "eslint .",
9+
"lint": "eslint --fix .",
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {

src/webview/activitybar/src/App.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ExplorerObject } from './components/ExplorerObject';
1111
import { ExplorerPackage } from './components/ExplorerPackage';
1212
import { Workspace } from './components/Workspace';
1313
import { COMMENDS } from './utilities/commends';
14-
import { STATE } from './recoil';
14+
import { IAccount, STATE } from './recoil';
1515

1616
function App() {
1717
const initialized = useRef<boolean>(false);
@@ -20,7 +20,15 @@ function App() {
2020
const [state, setState] = useRecoilState(STATE);
2121

2222
useEffect(() => {
23-
const handleMessage = async (event: any) => {
23+
const handleMessage = async (
24+
event: MessageEvent<{
25+
command: COMMENDS;
26+
data: {
27+
hasTerminal: boolean;
28+
account?: IAccount;
29+
};
30+
}>,
31+
) => {
2432
const message = event.data;
2533
switch (message.command) {
2634
case COMMENDS.Env:

src/webview/activitybar/src/components/Account.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ export const Account = ({ client }: { client: SuiClient | undefined }) => {
8585
setState((oldState) => ({ ...oldState, balance }));
8686
};
8787

88-
const handleMessage = async (event: any) => {
88+
const handleMessage = async (
89+
event: MessageEvent<{
90+
command: COMMENDS;
91+
data: string;
92+
}>,
93+
) => {
8994
const message = event.data;
9095
switch (message.command) {
9196
case COMMENDS.LoginJwt:

src/webview/activitybar/src/components/ExplorerOwnerObjects.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export const ExplorerOwnerObjects = ({
119119
const handleNext = async () => {
120120
if (currentPage < objectsInfo.length - 1) {
121121
setCurrentPage(currentPage + 1);
122-
} else if (!!next) {
122+
} else if (next) {
123123
await loadOwnerObjecs(next);
124124
setCurrentPage(currentPage + 1);
125125
}

src/webview/activitybar/src/components/Function.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export const Function = ({
130130
) => {
131131
try {
132132
setIsLoading(true);
133-
let errors: boolean[] = [...new Array(inputValues.length).fill(false)];
133+
const errors: boolean[] = [...new Array(inputValues.length).fill(false)];
134134
for (let i = 0; i < inputValues.length; i++) {
135135
if (state.account) {
136136
const filtered = deleteTxContext(func);

src/webview/activitybar/src/utilities/signAndExcute.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const signAndExcute = async (
4646
digest,
4747
options: { showObjectChanges: true },
4848
});
49-
if (!!res.errors) {
49+
if (res.errors) {
5050
vscode.postMessage({
5151
command: COMMENDS.MsgError,
5252
data: `error: ${res.errors.toString()}`,

src/webview/panel/eslint.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ export default tseslint.config(
2323
'warn',
2424
{ allowConstantExport: true },
2525
],
26+
'@typescript-eslint/no-unused-expressions': [
27+
'error',
28+
{
29+
allowShortCircuit: true,
30+
allowTernary: true,
31+
allowTaggedTemplates: true,
32+
},
33+
],
2634
},
2735
},
2836
);

src/webview/ptb-builder/eslint.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ export default tseslint.config(
2323
'warn',
2424
{ allowConstantExport: true },
2525
],
26+
'@typescript-eslint/no-unused-expressions': [
27+
'error',
28+
{
29+
allowShortCircuit: true,
30+
allowTernary: true,
31+
allowTaggedTemplates: true,
32+
},
33+
],
2634
},
2735
},
2836
);

0 commit comments

Comments
 (0)