Skip to content

Commit

Permalink
Lint/typecheck/prettier local speed up chore (#3726)
Browse files Browse the repository at this point in the history
* Update lint script to use eslint cache

* Update prettier + prettier cache + format all dem files

* Update lint and typecheck scripts in package.json

* Update typescript, eslint and minimum node version (needed by new typescript), removed socket.io

* Add lint, prettier, and typescript cache creation to dev and prod workflows

* Update Node.js version to 18.19.1
  • Loading branch information
marcinciarka authored Mar 26, 2024
1 parent c21717a commit 52821c2
Show file tree
Hide file tree
Showing 88 changed files with 791 additions and 870 deletions.
2 changes: 1 addition & 1 deletion .codesandbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM node:18.12
FROM node:18.19.1
2 changes: 1 addition & 1 deletion .github/workflows/aws-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18.12
node-version: 18.19.1

- name: Check required secrets
env:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.12
node-version: 18.19.1
- uses: actions/cache@v3
id: yarn-cache
with:
Expand All @@ -36,7 +36,7 @@ jobs:
if (( 10#${numbers[1]} != 10#${numbers[0]}+1 )); then
echo "The last two migration files do not have consecutive numbers: ${numbers[0]} and ${numbers[1]}"
exit 1
fi
fi
- name: Install packages
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --no-progress --non-interactive --frozen-lockfile
Expand All @@ -54,7 +54,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.12
node-version: 18.19.1
- uses: actions/cache@v3
id: yarn-cache
with:
Expand All @@ -77,7 +77,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.12
node-version: 18.19.1
- uses: actions/cache@v3
id: yarn-cache
with:
Expand All @@ -103,7 +103,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.12
node-version: 18.19.1
- uses: actions/cache@v3
id: yarn-cache
with:
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/dev-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- name: Check Out Repo
uses: actions/checkout@v3

- name: Use Node.js 18.12
- name: Use Node.js 18.19.1
uses: actions/setup-node@v3
with:
node-version: 18.12
node-version: 18.19.1

- name: Generate Cache Key
id: key
Expand All @@ -40,10 +40,10 @@ jobs:
if: ${{ !needs.search.outputs.cache-hit }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.12
- name: Use Node.js 18.19.1
uses: actions/setup-node@v3
with:
node-version: 18.12
node-version: 18.19.1
- name: Check cache
uses: actions/cache@v3
id: yarn-cache
Expand All @@ -53,6 +53,15 @@ jobs:
- name: Install packages
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --no-progress --non-interactive --frozen-lockfile
- name: Create lint cache
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn lint --quiet
- name: Create prettier cache
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn format
- name: Create typescript cache
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn typecheck
cleanup:
name: Cleanup old caches
needs: [search]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nextjs-bundle-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.12
node-version: 18.19.1
- name: Use modules cache
uses: actions/cache@v3
id: yarn-cache
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/prod-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- name: Check Out Repo
uses: actions/checkout@v3

- name: Use Node.js 18.12
- name: Use Node.js 18.19.1
uses: actions/setup-node@v3
with:
node-version: 18.12
node-version: 18.19.1

- name: Generate Cache Key
id: key
Expand All @@ -40,10 +40,10 @@ jobs:
if: ${{ !needs.search.outputs.cache-hit }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.12
- name: Use Node.js 18.19.1
uses: actions/setup-node@v3
with:
node-version: 18.12
node-version: 18.19.1
- name: Check cache
uses: actions/cache@v3
id: yarn-cache
Expand All @@ -53,6 +53,15 @@ jobs:
- name: Install packages
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --no-progress --non-interactive --frozen-lockfile
- name: Create lint cache
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn lint --quiet
- name: Create prettier cache
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn format
- name: Create typescript cache
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn typecheck
cleanup:
name: Cleanup old caches
needs: [search]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18.12
node-version: 18.19.1
- name: 'Determine Release Type'
run: |
if ${{ contains(github.event.inputs.release_type, 'major') }}; then
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.12
18.19.1
2 changes: 1 addition & 1 deletion Dockerfile.production
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.12
FROM node:18.19.1

EXPOSE 3000

Expand Down
4 changes: 2 additions & 2 deletions blockchain/better-calls/send-generic-transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export const sendGenericTransaction$ = ({
receipt.status === 1
? TxStatus.Success
: receipt.status === 0
? TxStatus.Error
: TxStatus.WaitingForConfirmation
? TxStatus.Error
: TxStatus.WaitingForConfirmation

return {
status,
Expand Down
5 changes: 2 additions & 3 deletions blockchain/calls/observe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ export function observe<A, R>(
)
}

export type CallObservable<C extends CallDef<any, any>> = C extends CallDef<infer A, infer R>
? (a: A) => Observable<R>
: never
export type CallObservable<C extends CallDef<any, any>> =
C extends CallDef<infer A, infer R> ? (a: A) => Observable<R> : never
4 changes: 2 additions & 2 deletions blockchain/vault.maths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export function buildPosition({
const daiYieldFromLockedCollateralWithoutOriginationFee = availableDebt.lt(ilkDebtAvailable)
? availableDebt
: ilkDebtAvailable.gt(zero)
? ilkDebtAvailable
: zero
? ilkDebtAvailable
: zero

const daiYieldFromLockedCollateral = daiYieldFromLockedCollateralWithoutOriginationFee.div(
originationFee.plus(1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export function AssetsTableDataCellProtection({
{level > 0
? t('discover.table.protection-value', { protection: level })
: isOwner
? t('discover.table.activate')
: t('discover.table.inactive')}
? t('discover.table.activate')
: t('discover.table.inactive')}
</Button>
</AppLink>
</>
Expand Down
4 changes: 2 additions & 2 deletions components/navigation/NavigationMenuDropdownContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ export function NavigationMenuDropdownContent({
(selected[0] === i && selected[1] < j) || selected[0] < i
? 50
: (selected[0] === i && selected[1] > j) || selected[0] > i
? -50
: 0
? -50
: 0
}px)`,
}}
{...(selected[0] === i && selected[1] === j && { ref })}
Expand Down
8 changes: 4 additions & 4 deletions components/vault/VaultActionInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ export function VaultActionInput({
{auxiliaryFlag && BigNumber.isBigNumber(minAuxiliaryAmount)
? formatCryptoBalance(minAuxiliaryAmount)
: !auxiliaryFlag && BigNumber.isBigNumber(minAmount)
? formatCryptoBalance(minAmount)
: null}
? formatCryptoBalance(minAmount)
: null}
</Text>
</>
)}
Expand All @@ -217,8 +217,8 @@ export function VaultActionInput({
{auxiliaryFlag && BigNumber.isBigNumber(maxAuxiliaryAmount)
? formatCryptoBalance(maxAuxiliaryAmount)
: !auxiliaryFlag && BigNumber.isBigNumber(maxAmount)
? formatCryptoBalance(maxAmount)
: null}
? formatCryptoBalance(maxAmount)
: null}
</Text>
</>
)}{' '}
Expand Down
12 changes: 6 additions & 6 deletions components/vault/VaultDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ export function getCollRatioColor(
return collateralizationRatio.isZero()
? 'primary100'
: vaultWillBeAtRiskLevelDanger || vaultWillBeUnderCollateralized
? 'critical100'
: vaultWillBeAtRiskLevelWarning
? 'warning100'
: 'success100'
? 'critical100'
: vaultWillBeAtRiskLevelWarning
? 'warning100'
: 'success100'
}

export function getPriceChangeColor({
Expand All @@ -51,8 +51,8 @@ export function getPriceChangeColor({
return collateralPricePercentageChange.isZero()
? 'neutral80'
: collateralPricePercentageChange.gt(zero)
? 'success100'
: 'critical100'
? 'success100'
: 'critical100'
}

export function getAfterPillColors(collRatioColor: CollRatioColor) {
Expand Down
8 changes: 4 additions & 4 deletions components/vault/VaultWarnings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ export function VaultWarnings({
isAutoSellEnabled && isAutoBuyEnabled
? `Auto-Sell ${t('and')} Auto-Buy`
: isAutoSellEnabled
? 'Auto-Sell'
: isAutoBuyEnabled
? 'Auto-Buy'
: t('active-triggers'),
? 'Auto-Sell'
: isAutoBuyEnabled
? 'Auto-Buy'
: t('active-triggers'),
}}
components={[ConstantMultipleKBLink]}
/>
Expand Down
20 changes: 10 additions & 10 deletions components/vault/commonMultiply/ManageMultiplyVaultButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ export function manageMultiplyVaultButtonText(state: ManageMultiplyVaultState):
? t('adjust-your-position')
: t('enter-an-amount')
: !state.proxyAddress
? t('setup-proxy')
: state.insufficientCollateralAllowance
? t('set-token-allowance', { token: state.vault.token })
: state.insufficientDaiAllowance
? t('set-token-allowance', { token: 'DAI' })
: state.originalEditingStage === 'otherActions' && state.otherAction === 'closeVault'
? t('close-vault')
: t('confirm')
? t('setup-proxy')
: state.insufficientCollateralAllowance
? t('set-token-allowance', { token: state.vault.token })
: state.insufficientDaiAllowance
? t('set-token-allowance', { token: 'DAI' })
: state.originalEditingStage === 'otherActions' && state.otherAction === 'closeVault'
? t('close-vault')
: t('confirm')

case 'proxySuccess':
return state.insufficientCollateralAllowance
? t('set-token-allowance', { token: state.vault.token })
: state.insufficientDaiAllowance
? t('set-token-allowance', { token: 'DAI' })
: t('continue')
? t('set-token-allowance', { token: 'DAI' })
: t('continue')

case 'collateralAllowanceSuccess':
return state.insufficientDaiAllowance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export function ManageMultiplyVaultConfirmationStatus({
originalEditingStage === 'adjustPosition'
? 'adjusting-vault-multiply'
: otherAction === 'closeVault'
? 'closing-vault-multiply'
: 'changing-vault-multiply'
? 'closing-vault-multiply'
: 'changing-vault-multiply'

return (
<TxStatusCardProgress text={t(messageKey)} etherscan={etherscan!} txHash={manageTxHash!} />
Expand Down
12 changes: 6 additions & 6 deletions components/vault/commonMultiply/ManageVaultHeaderAllowance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export function ManageVaultHeaderAllowance({
? t('vault-form.header.proxy-success')
: t('vault-form.header.proxy')
: isCollateralAllowanceStage
? t('vault-form.header.allowance', { token: token.toUpperCase() })
: isDaiAllowanceStage
? t('vault-form.header.daiAllowance')
: stage === 'manageInProgress'
? t('vault-form.header.modified')
: t('vault-form.header.review-manage')}
? t('vault-form.header.allowance', { token: token.toUpperCase() })
: isDaiAllowanceStage
? t('vault-form.header.daiAllowance')
: stage === 'manageInProgress'
? t('vault-form.header.modified')
: t('vault-form.header.review-manage')}
</Text>
</WithVaultFormStepIndicator>
<Text variant="paragraph3" sx={{ color: 'neutral80', lineHeight: '22px' }}>
Expand Down
16 changes: 8 additions & 8 deletions components/vault/commonMultiply/OpenMultiplyVaultTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export function OpenMultiplyVaultTitle({
{isEditingStage
? title
: isProxyStage
? stage === 'proxySuccess'
? t('vault-form.header.proxy-success')
: t('vault-form.header.proxy')
: isAllowanceStage
? t('vault-form.header.allowance', { token: token.toUpperCase() })
: stage === 'txInProgress'
? t('vault-form.header.confirm-in-progress')
: t('vault-form.header.confirm')}
? stage === 'proxySuccess'
? t('vault-form.header.proxy-success')
: t('vault-form.header.proxy')
: isAllowanceStage
? t('vault-form.header.allowance', { token: token.toUpperCase() })
: stage === 'txInProgress'
? t('vault-form.header.confirm-in-progress')
: t('vault-form.header.confirm')}
</Text>
</WithVaultFormStepIndicator>
<Text variant="paragraph3" sx={{ color: 'neutral80', lineHeight: '22px' }}>
Expand Down
12 changes: 6 additions & 6 deletions components/vault/detailsCards/VaultDetailsCardNetValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ export function VaultDetailsNetValueModal({
const lockedCollateralUSD = isCollateralLpToken
? vault?.lockedCollateralUSD || zero
: vault && marketPrice
? vault.lockedCollateral.times(marketPrice)
: zero
? vault.lockedCollateral.times(marketPrice)
: zero

const daiDebtUndercollateralizedToken = vault
? isCollateralLpToken
? vault.debt.dividedBy(oraclePrice)
: marketPrice
? vault.debt.dividedBy(marketPrice)
: zero
? vault.debt.dividedBy(marketPrice)
: zero
: zero

const netValueUndercollateralizedToken = vault
? isCollateralLpToken
? netValueUSD.dividedBy(oraclePrice)
: marketPrice
? netValueUSD.dividedBy(marketPrice)
: zero
? netValueUSD.dividedBy(marketPrice)
: zero
: zero

return (
Expand Down
Loading

0 comments on commit 52821c2

Please sign in to comment.