Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): eslint prettier #54

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ module.exports = {
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:prettier/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
plugins: ['react-refresh', 'prettier'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'prettier/prettier': 'error',
},
}
};
13 changes: 11 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,31 @@
"build": "tsc && vite build",
"test": "exit 0",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "yarn lint --fix",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@agoric/rpc": "^0.6.0",
"@agoric/web-components": "0.12.0",
"@agoric/eventual-send": "^0.14.1",
"@agoric/notifier": "^0.6.2",
"@agoric/rpc": "^0.6.0",
"@agoric/store": "^0.9.2",
"@agoric/ui-components": "^0.9.0",
"@agoric/web-components": "0.12.0",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/plugin-react": "^4.0.3",
"eslint": "^8.45.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"prettier": "^3.2.4",
"ses": "^0.18.8",
"typescript": "^5.0.2",
"vite": "^4.4.5",
Expand All @@ -37,5 +41,10 @@
"resolutions": {
"**/ses": "^0.18.8",
"**/@agoric/xsnap": "0.14.3-dev-9f085d3.0"
},
"prettier": {
"trailingComma": "all",
"arrowParens": "avoid",
"singleQuote": true
}
}
16 changes: 8 additions & 8 deletions ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Wallet = Awaited<ReturnType<typeof makeAgoricWalletConnection>>;

const watcher = makeAgoricChainStorageWatcher(
'http://localhost:26657',
'agoriclocal'
'agoriclocal',
);

interface CopyBag<T = string> {
Expand Down Expand Up @@ -68,7 +68,7 @@ const setup = async () => {
useAppStore.setState({
offerUpInstance: instances.find(([name]) => name === 'offerUp')!.at(1),
});
}
},
);

watcher.watchLatest<Array<[string, unknown]>>(
Expand All @@ -78,7 +78,7 @@ const setup = async () => {
useAppStore.setState({
brands: fromEntries(brands),
});
}
},
);
};

Expand Down Expand Up @@ -121,7 +121,7 @@ const makeOffer = (giveValue: bigint, wantChoices: Record<string, bigint>) => {
if (update.status === 'refunded') {
alert('Offer rejected');
}
}
},
);
};

Expand Down Expand Up @@ -156,7 +156,7 @@ function App() {
switch (err.message) {
case 'KEPLR_CONNECTION_ERROR_NO_SMART_WALLET':
alert(
'no smart wallet at that address; try: yarn docker:make print-key'
'no smart wallet at that address; try: yarn docker:make print-key',
);
break;
default:
Expand Down Expand Up @@ -199,7 +199,7 @@ function App() {
{stringifyAmountValue(
istPurse.currentAmount,
istPurse.displayInfo.assetKind,
istPurse.displayInfo.decimalPlaces
istPurse.displayInfo.decimalPlaces,
)}
</div>
<div>
Expand All @@ -211,7 +211,7 @@ function App() {
<li key={name}>
{String(number)} {name}
</li>
)
),
)}
</ul>
) : (
Expand All @@ -232,7 +232,7 @@ function App() {
value={stringifyAmountValue(
{ ...purse.currentAmount, value: giveValue },
purse.displayInfo.assetKind,
purse.displayInfo.decimalPlaces
purse.displayInfo.decimalPlaces,
)}
onChange={ev => setGiveValue(parseValue(ev?.target?.value, purse))}
className={giveValue >= terms.price ? 'ok' : 'error'}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import './index.css';
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>
</React.StrictMode>,
);
6 changes: 3 additions & 3 deletions ui/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
});
Loading
Loading