Skip to content

Commit 4c00a6f

Browse files
committed
fix: remove eslint for preact in package.json
1 parent edcba36 commit 4c00a6f

File tree

17 files changed

+5329
-183
lines changed

17 files changed

+5329
-183
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"node": ">=16.20.2"
88
},
99
"workspaces": [
10-
"packages/*"
10+
"packages/*",
11+
"packages/e2e/test/web-extension/dapp-connector-preact"
1112
],
1213
"scripts": {
1314
"build": "yarn workspaces foreach -v run build",

packages/e2e/test/web-extension/dapp-connector-preact/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
"scripts": {
44
"dev": "webpack serve --mode development --open",
55
"build": "webpack --mode production",
6-
"preview": "vite preview"
6+
"lint": "eslint --ignore-path ../../../../../.eslintignore \"**/*.ts\" \"**/*.tsx\""
77
},
88
"dependencies": {
9+
"@cardano-sdk/cardano-services-client": "workspace:~",
10+
"@cardano-sdk/core": "workspace:~",
911
"@cardano-sdk/crypto": "workspace:~",
1012
"@cardano-sdk/dapp-connector-client": "workspace:~",
13+
"@cardano-sdk/tx-construction": "workspace:~",
14+
"@cardano-sdk/util-dev": "workspace:~",
15+
"@cardano-sdk/wallet": "workspace:~",
1116
"buffer": "^6.0.3",
1217
"crypto-browserify": "^3.12.0",
1318
"libsodium-wrappers-sumo": "^0.7.5",
@@ -39,8 +44,5 @@
3944
"webpack": "^5.91.0",
4045
"webpack-cli": "^5.1.4",
4146
"webpack-dev-server": "^5.0.4"
42-
},
43-
"eslintConfig": {
44-
"extends": "preact"
4547
}
4648
}

packages/e2e/test/web-extension/dapp-connector-preact/src/components/connect/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { ConnectWalletDependencies, listWallets, connectWallet } from '@cardano-sdk/dapp-connector-client';
2-
import { logger } from '@cardano-sdk/util-dev';
1+
import { ConnectWalletDependencies, connectWallet, listWallets } from '@cardano-sdk/dapp-connector-client';
32
import { ObservableWallet } from '@cardano-sdk/wallet';
4-
import { tap, switchMap, combineLatest } from 'rxjs';
3+
import { combineLatest, switchMap, tap } from 'rxjs';
4+
import { logger } from '@cardano-sdk/util-dev';
55

66
import { connectWalletDependencies } from '../../constants';
77
import { connectorStore } from '../../state/store';
@@ -12,7 +12,7 @@ const connectLace = (dependencies: ConnectWalletDependencies) => {
1212
const wallets = listWallets({ logger });
1313
const lace = wallets.find(({ id }) => id === 'lace');
1414
if (!lace) {
15-
return undefined;
15+
return;
1616
}
1717

1818
return connectWallet(lace, dependencies)
@@ -30,6 +30,4 @@ const connectLace = (dependencies: ConnectWalletDependencies) => {
3030
});
3131
};
3232

33-
export const Connect = () => {
34-
return <button onClick={() => connectLace(connectWalletDependencies)}>Connect wallet</button>;
35-
};
33+
export const Connect = () => <button onClick={() => connectLace(connectWalletDependencies)}>Connect wallet</button>;
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import { Logs, WalletActions } from '..';
21
import './dashboard.css';
2+
import { Logs, WalletActions } from '..';
33

4-
export const Dashboard = () => {
5-
// TODO: show a message if it's empty or not connected
6-
return (
7-
<div class="dashboard-container">
8-
<WalletActions />
9-
<Logs />
10-
</div>
11-
);
12-
};
4+
export const Dashboard = () => (
5+
<div class="dashboard-container">
6+
<WalletActions />
7+
<Logs />
8+
</div>
9+
);
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { useLocation } from 'preact-iso';
22

3-
export function Header() {
3+
export const Header = () => {
44
const { url } = useLocation();
55

66
return (
77
<header>
88
<nav>
9-
<a href="/" className={url == '/' ? 'active' : undefined}>
9+
<a href="/" className={url === '/' ? 'active' : undefined}>
1010
Home
1111
</a>
12-
<a href="/404" className={url == '/404' ? 'active' : undefined}>
12+
<a href="/404" className={url === '/404' ? 'active' : undefined}>
1313
404
1414
</a>
1515
</nav>
1616
</header>
1717
);
18-
}
18+
};

packages/e2e/test/web-extension/dapp-connector-preact/src/components/wallet-actions/index.tsx

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { useEffect, useState } from 'preact/hooks';
21
import { Store, connectorStore } from '../../state/store';
32
import { sendCoins, sendSeveralAssets, singleDelegation, singleUndelegation } from '../../features';
3+
import { useEffect, useState } from 'preact/hooks';
44

55
import './wallet-actions.css';
66

@@ -11,7 +11,9 @@ export const WalletActions = () => {
1111
const subscription = connectorStore.subscribe(setStoreState);
1212
connectorStore.init();
1313

14-
() => subscription.unsubscribe();
14+
return () => {
15+
subscription.unsubscribe();
16+
};
1517
}, []);
1618

1719
if (!storeState.wallet) {
@@ -24,12 +26,10 @@ export const WalletActions = () => {
2426
}
2527

2628
const { hash, txId } = await sendCoins({ connectedWallet: storeState.wallet });
27-
console.log('hash and txId', hash, txId);
28-
2929
connectorStore.log({
30+
hash,
3031
title: 'Send coins',
31-
hash: hash,
32-
txId: txId
32+
txId
3333
});
3434
};
3535

@@ -39,11 +39,10 @@ export const WalletActions = () => {
3939
}
4040

4141
const { hash, txId } = await sendSeveralAssets({ connectedWallet: storeState.wallet });
42-
console.log('hash and txId', hash, txId);
4342
connectorStore.log({
43+
hash,
4444
title: 'Send several assets',
45-
hash: hash,
46-
txId: txId
45+
txId
4746
});
4847
};
4948

@@ -53,12 +52,10 @@ export const WalletActions = () => {
5352
}
5453

5554
const { hash, txId } = await singleDelegation({ connectedWallet: storeState.wallet });
56-
console.log('hash and txId', hash, txId);
57-
5855
connectorStore.log({
56+
hash,
5957
title: 'Single delegation',
60-
hash: hash,
61-
txId: txId
58+
txId
6259
});
6360
};
6461

@@ -68,12 +65,10 @@ export const WalletActions = () => {
6865
}
6966

7067
const { hash, txId } = await singleUndelegation({ connectedWallet: storeState.wallet });
71-
console.log('hash and txId', hash, txId);
72-
7368
connectorStore.log({
69+
hash,
7470
title: 'Single undelegation',
75-
hash: hash,
76-
txId: txId
71+
txId
7772
});
7873
};
7974

packages/e2e/test/web-extension/dapp-connector-preact/src/components/wallet-logs/index.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { useState, useEffect } from 'preact/hooks';
21
import { Store, connectorStore } from '../../state/store';
2+
import { useEffect, useState } from 'preact/hooks';
33

44
import './logs.css';
55

@@ -10,7 +10,9 @@ export const Logs = () => {
1010
const subscription = connectorStore.subscribe(setStoreState);
1111
connectorStore.init();
1212

13-
() => subscription.unsubscribe();
13+
return () => {
14+
subscription.unsubscribe();
15+
};
1416
}, []);
1517

1618
if (!storeState.wallet || !storeState.addresses || !storeState.balance) {
@@ -27,20 +29,18 @@ export const Logs = () => {
2729
<h4>Addresses: </h4> {getAddresses()}
2830
</div>
2931
<div>
30-
{storeState.log.map((entry) => {
31-
return (
32-
<>
33-
<h4>{entry.title}</h4>
34-
<p>
35-
<h5>hash:</h5>
36-
{entry.hash}
37-
</p>
38-
<p>
39-
<h5>tx ID:</h5> {entry.txId}
40-
</p>
41-
</>
42-
);
43-
})}
32+
{storeState.log.map((entry) => (
33+
<>
34+
<h4>{entry.title}</h4>
35+
<p>
36+
<h5>hash:</h5>
37+
{entry.hash}
38+
</p>
39+
<p>
40+
<h5>tx ID:</h5> {entry.txId}
41+
</p>
42+
</>
43+
))}
4444
</div>
4545
</div>
4646
);

packages/e2e/test/web-extension/dapp-connector-preact/src/features/sendCoins.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { inspectAndSignTx } from '../utils';
21
import { ObservableWallet } from '@cardano-sdk/wallet';
2+
import { inspectAndSignTx } from '../utils';
33

44
export const sendCoins = async ({
55
connectedWallet
@@ -11,7 +11,7 @@ export const sendCoins = async ({
1111
const builtTx = builder.addOutput(output).build();
1212

1313
return new Promise(async (resolve) => {
14-
const { hash, txId } = await inspectAndSignTx({ builtTx, connectedWallet: connectedWallet });
14+
const { hash, txId } = await inspectAndSignTx({ builtTx, connectedWallet });
1515
resolve({ hash, txId });
1616
});
1717
};

packages/e2e/test/web-extension/dapp-connector-preact/src/features/sendSeveralAssets.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { ObservableWallet } from '@cardano-sdk/wallet';
21
import { EMPTY, catchError, take, tap } from 'rxjs';
2+
import { ObservableWallet } from '@cardano-sdk/wallet';
33
import { inspectAndSignTx } from '../utils';
44
import { logger } from '@cardano-sdk/util-dev';
55

66
export const sendSeveralAssets = ({
77
connectedWallet
88
}: {
99
connectedWallet: ObservableWallet;
10-
}): Promise<{ hash: string; txId: string }> => {
11-
return new Promise((resolve, reject) => {
10+
}): Promise<{ hash: string; txId: string }> =>
11+
new Promise((resolve, reject) => {
1212
connectedWallet.balance.utxo.available$
1313
.pipe(
1414
take(1),
@@ -52,4 +52,3 @@ export const sendSeveralAssets = ({
5252
)
5353
.subscribe();
5454
});
55-
};

packages/e2e/test/web-extension/dapp-connector-preact/src/features/singleDelegation.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { ObservableWallet } from '@cardano-sdk/wallet';
1+
import { Cardano } from '@cardano-sdk/core';
22
import { EMPTY, catchError, take, tap } from 'rxjs';
3+
import { ObservableWallet } from '@cardano-sdk/wallet';
34
import { inspectAndSignTx } from '../utils';
4-
import { Cardano } from '@cardano-sdk/core';
55
import { logger } from '@cardano-sdk/util-dev';
66

77
export const singleDelegation = ({
88
connectedWallet
99
}: {
1010
connectedWallet: ObservableWallet;
11-
}): Promise<{ hash: string; txId: string }> => {
12-
return new Promise((resolve, reject) => {
11+
}): Promise<{ hash: string; txId: string }> =>
12+
new Promise((resolve, reject) => {
1313
connectedWallet.balance.utxo.available$
1414
.pipe(
1515
take(1),
@@ -52,4 +52,3 @@ export const singleDelegation = ({
5252
)
5353
.subscribe();
5454
});
55-
};

packages/e2e/test/web-extension/dapp-connector-preact/src/features/singleUndelegation.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { ObservableWallet } from '@cardano-sdk/wallet';
21
import { EMPTY, catchError, take, tap } from 'rxjs';
2+
import { ObservableWallet } from '@cardano-sdk/wallet';
33
import { inspectAndSignTx } from '../utils';
44
import { logger } from '@cardano-sdk/util-dev';
55

66
export const singleUndelegation = ({
77
connectedWallet
88
}: {
99
connectedWallet: ObservableWallet;
10-
}): Promise<{ hash: string; txId: string }> => {
11-
return new Promise((resolve, reject) => {
10+
}): Promise<{ hash: string; txId: string }> =>
11+
new Promise((resolve, reject) => {
1212
connectedWallet.balance.utxo.available$
1313
.pipe(
1414
take(1),
@@ -34,4 +34,3 @@ export const singleUndelegation = ({
3434
)
3535
.subscribe();
3636
});
37-
};
Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
1-
import { hydrate, prerender as ssr } from 'preact-iso';
2-
import { Router, Route } from 'preact-router';
1+
import './style.css';
32
import { Header } from './components/header';
43
import { Home } from './pages/Home';
54
import { NotFound } from './pages/_404';
6-
import './style.css';
5+
import { Route, Router } from 'preact-router';
6+
import { hydrate, prerender as ssr } from 'preact-iso';
77

8-
export function App() {
9-
return (
10-
<>
11-
<Header />
12-
<main>
13-
<Router>
14-
<Route path="/" component={Home} />
15-
<Route path="/404" component={NotFound} />
16-
</Router>
17-
</main>
18-
</>
19-
);
20-
}
8+
export const App = () => (
9+
<>
10+
<Header />
11+
<main>
12+
<Router>
13+
<Route path="/" component={Home} />
14+
<Route path="/404" component={NotFound} />
15+
</Router>
16+
</main>
17+
</>
18+
);
2119

2220
if (typeof window !== 'undefined') {
23-
hydrate(<App />, document.getElementById('app')!);
21+
hydrate(<App />, document.querySelector('#app')!);
2422
}
2523

26-
export async function prerender(data: any) {
27-
return await ssr(<App {...data} />);
28-
}
24+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
25+
export const prerender = async (data: any) => await ssr(<App {...data} />);

packages/e2e/test/web-extension/dapp-connector-preact/src/pages/Home/index.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import { Connect, Dashboard } from '../../components';
22

33
import './style.css';
44

5-
export function Home() {
6-
return (
7-
<div class="home">
8-
<h1>Dapp Connector </h1>
9-
<Connect />
10-
<Dashboard />
11-
</div>
12-
);
13-
}
5+
export const Home = () => (
6+
<div class="home">
7+
<h1>Dapp Connector </h1>
8+
<Connect />
9+
<Dashboard />
10+
</div>
11+
);

0 commit comments

Comments
 (0)