add husky pre-commit for linting and formatting

This commit is contained in:
Tyler Shipe 2021-04-14 14:49:01 -04:00
parent 96ee9ce664
commit 0da8d34a7d
5 changed files with 13 additions and 5 deletions

View File

@ -3,3 +3,4 @@ node_modules
yarn.lock
package-lock.json
public
components/charting_library

View File

@ -9,6 +9,7 @@ Uses:
- Testing with [Jest](https://jestjs.io/) and [`react-testing-library`](https://testing-library.com/docs/react-testing-library/intro)
ToDo:
- Create popup notification messages and wire up to `notify()`
- Add logo and mark price to browser tab
- Finish migrating TradeForm from Ant to Tailwind

View File

@ -19,7 +19,9 @@ const DepositSrmModal = ({ isOpen, onClose }) => {
const walletAccounts = useMangoStore((s) => s.wallet.balances)
const actions = useMangoStore((s) => s.actions)
const srmMintAddress = useMangoStore((s) => s.connection.srmMint)
const mangoSrmAccountsForOwner = useMangoStore((s) => s.wallet.srmAccountsForOwner)
const mangoSrmAccountsForOwner = useMangoStore(
(s) => s.wallet.srmAccountsForOwner
)
const depositAccounts = useMemo(
() =>
walletAccounts.filter(

View File

@ -18,9 +18,13 @@ const WithdrawModal = ({ isOpen, onClose }) => {
const { connection, programId } = useConnection()
const walletAccounts = useMangoStore((s) => s.wallet.balances)
const actions = useMangoStore((s) => s.actions)
const withdrawAccounts = useMemo(() => walletAccounts.filter((acc) =>
const withdrawAccounts = useMemo(
() =>
walletAccounts.filter((acc) =>
Object.values(symbols).includes(acc.account.mint.toString())
),[symbols, walletAccounts])
),
[symbols, walletAccounts]
)
const [selectedAccount, setSelectedAccount] = useState(withdrawAccounts[0])
const mintAddress = useMemo(() => selectedAccount?.account.mint.toString(), [
selectedAccount,

View File

@ -8,14 +8,14 @@
"build": "next build",
"start": "next start",
"type-check": "tsc --pretty --noEmit",
"format": "prettier --write .",
"format": "prettier --check .",
"lint": "eslint . --ext ts --ext tsx --ext js --quiet",
"test": "jest",
"test-all": "yarn lint && yarn type-check && yarn test"
},
"husky": {
"hooks": {
"pre-commit": "yarn format",
"pre-commit": "lint-staged",
"pre-push": ""
}
},