diff --git a/.eslintrc.json b/.eslintrc.json index 6a841772d..dd2d9f7ed 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -48,6 +48,13 @@ "ts-check": false, "minimumDescriptionLength": 10 } + ], + "@typescript-eslint/consistent-type-imports": [ + "error", + { + "prefer": "type-imports", + "disallowTypeAnnotations": true + } ] } }, diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f3dbad68b..4060da6d0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,11 +31,11 @@ jobs: run: yarn install - name: Check formatting run: yarn nx format:check - - name: Check formatting - run: yarn eslint - - name: Check formatting + - name: Lint affected + run: yarn nx affected:lint + - name: Test affected run: yarn nx affected:test - - name: Check formatting + - name: Build affected run: yarn nx affected:build pr: name: Test and lint - PR @@ -59,9 +59,9 @@ jobs: run: yarn install - name: Check formatting run: yarn nx format:check - - name: Check formatting - run: yarn eslint - - name: Check formatting + - name: Lint affected + run: yarn nx affected:lint + - name: Test affected run: yarn nx affected:test - - name: Check formatting + - name: Build affected run: yarn nx affected:build diff --git a/apps/explorer/.env.local b/apps/explorer/.env.local deleted file mode 100644 index 95e4b1e16..000000000 --- a/apps/explorer/.env.local +++ /dev/null @@ -1,16 +0,0 @@ -# App configuration variables -NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-explorer-api" -NX_TENDERMINT_URL = "https://lb.testnet.vega.xyz/tm" -NX_TENDERMINT_WEBSOCKET_URL = "wss://lb.testnet.vega.xyz/tm/websocket" -NX_VEGA_URL = "https://lb.testnet.vega.xyz/query" -NX_VEGA_ENV = 'Testnet' -NX_VEGA_REST = 'https://lb.testnet.vega.xyz/datanode/rest' - -# App flags -NX_EXPLORER_ASSETS = 1 -NX_EXPLORER_GENESIS = 1 -NX_EXPLORER_GOVERNANCE = 1 -NX_EXPLORER_MARKETS = 1 -NX_EXPLORER_NETWORK_PARAMETERS = 1 -NX_EXPLORER_PARTIES = 1 -NX_EXPLORER_VALIDATORS = 1 diff --git a/apps/explorer/.eslintrc.json b/apps/explorer/.eslintrc.json index 734ddacee..db820c5d0 100644 --- a/apps/explorer/.eslintrc.json +++ b/apps/explorer/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], + "ignorePatterns": ["!**/*", "__generated__"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/apps/explorer/src/__generated__/globalTypes.ts b/apps/explorer/src/__generated__/globalTypes.ts deleted file mode 100644 index 74aa66291..000000000 --- a/apps/explorer/src/__generated__/globalTypes.ts +++ /dev/null @@ -1,126 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -//============================================================== -// START Enums and Input Objects -//============================================================== - -/** - * The various account types we have (used by collateral) - */ -export enum AccountType { - Bond = "Bond", - FeeInfrastructure = "FeeInfrastructure", - FeeLiquidity = "FeeLiquidity", - General = "General", - GlobalInsurance = "GlobalInsurance", - Insurance = "Insurance", - LockWithdraw = "LockWithdraw", - Margin = "Margin", - Settlement = "Settlement", -} - -export enum AuctionTrigger { - Batch = "Batch", - Liquidity = "Liquidity", - Opening = "Opening", - Price = "Price", - Unspecified = "Unspecified", -} - -/** - * The current state of a market - */ -export enum MarketState { - Active = "Active", - Cancelled = "Cancelled", - Closed = "Closed", - Pending = "Pending", - Proposed = "Proposed", - Rejected = "Rejected", - Settled = "Settled", - Suspended = "Suspended", - TradingTerminated = "TradingTerminated", -} - -/** - * What market trading mode are we in - */ -export enum MarketTradingMode { - BatchAuction = "BatchAuction", - Continuous = "Continuous", - MonitoringAuction = "MonitoringAuction", - OpeningAuction = "OpeningAuction", -} - -export enum NodeStatus { - NonValidator = "NonValidator", - Validator = "Validator", -} - -/** - * Reason for the proposal being rejected by the core node - */ -export enum ProposalRejectionReason { - CloseTimeTooLate = "CloseTimeTooLate", - CloseTimeTooSoon = "CloseTimeTooSoon", - CouldNotInstantiateMarket = "CouldNotInstantiateMarket", - EnactTimeTooLate = "EnactTimeTooLate", - EnactTimeTooSoon = "EnactTimeTooSoon", - IncompatibleTimestamps = "IncompatibleTimestamps", - InsufficientTokens = "InsufficientTokens", - InvalidAsset = "InvalidAsset", - InvalidAssetDetails = "InvalidAssetDetails", - InvalidFeeAmount = "InvalidFeeAmount", - InvalidFutureMaturityTimestamp = "InvalidFutureMaturityTimestamp", - InvalidFutureProduct = "InvalidFutureProduct", - InvalidInstrumentSecurity = "InvalidInstrumentSecurity", - InvalidRiskParameter = "InvalidRiskParameter", - InvalidShape = "InvalidShape", - MajorityThresholdNotReached = "MajorityThresholdNotReached", - MarketMissingLiquidityCommitment = "MarketMissingLiquidityCommitment", - MissingBuiltinAssetField = "MissingBuiltinAssetField", - MissingCommitmentAmount = "MissingCommitmentAmount", - MissingERC20ContractAddress = "MissingERC20ContractAddress", - NetworkParameterInvalidKey = "NetworkParameterInvalidKey", - NetworkParameterInvalidValue = "NetworkParameterInvalidValue", - NetworkParameterValidationFailed = "NetworkParameterValidationFailed", - NoProduct = "NoProduct", - NoRiskParameters = "NoRiskParameters", - NoTradingMode = "NoTradingMode", - NodeValidationFailed = "NodeValidationFailed", - OpeningAuctionDurationTooLarge = "OpeningAuctionDurationTooLarge", - OpeningAuctionDurationTooSmall = "OpeningAuctionDurationTooSmall", - ParticipationThresholdNotReached = "ParticipationThresholdNotReached", - ProductMaturityIsPassed = "ProductMaturityIsPassed", - UnsupportedProduct = "UnsupportedProduct", - UnsupportedTradingMode = "UnsupportedTradingMode", -} - -/** - * Various states a proposal can transition through: - * Open -> - * - Passed -> Enacted. - * - Rejected. - * Proposal can enter Failed state from any other state. - */ -export enum ProposalState { - Declined = "Declined", - Enacted = "Enacted", - Failed = "Failed", - Open = "Open", - Passed = "Passed", - Rejected = "Rejected", - WaitingForNodeVote = "WaitingForNodeVote", -} - -export enum VoteValue { - No = "No", - Yes = "Yes", -} - -//============================================================== -// END Enums and Input Objects -//============================================================== diff --git a/apps/explorer/src/app/components/blocks/block-data.tsx b/apps/explorer/src/app/components/blocks/block-data.tsx index 22d4c876c..5c41aae5d 100644 --- a/apps/explorer/src/app/components/blocks/block-data.tsx +++ b/apps/explorer/src/app/components/blocks/block-data.tsx @@ -1,9 +1,10 @@ import React from 'react'; -import { BlockMeta } from '../../routes/blocks/tendermint-blockchain-response'; +import type { BlockMeta } from '../../routes/blocks/tendermint-blockchain-response'; import { Routes } from '../../routes/router-config'; import { Link } from 'react-router-dom'; import { SecondsAgo } from '../seconds-ago'; import { TableWithTbody, TableRow, TableCell } from '../table'; +import { t } from '@vegaprotocol/react-helpers'; interface BlockProps { block: BlockMeta; @@ -20,7 +21,7 @@ export const BlockData = ({ block, className }: BlockProps) => { { {block.num_txs === '1' - ? '1 transaction' - : `${block.num_txs} transactions`} + ? t('1 transaction') + : t(`${block.num_txs} transactions`)} {block.header.proposer_address} @@ -50,7 +51,7 @@ export const BlockData = ({ block, className }: BlockProps) => { diff --git a/apps/explorer/src/app/components/blocks/blocks-data.tsx b/apps/explorer/src/app/components/blocks/blocks-data.tsx index 66d1301e1..708f16f75 100644 --- a/apps/explorer/src/app/components/blocks/blocks-data.tsx +++ b/apps/explorer/src/app/components/blocks/blocks-data.tsx @@ -1,5 +1,6 @@ +import { t } from '@vegaprotocol/react-helpers'; import React from 'react'; -import { TendermintBlockchainResponse } from '../../routes/blocks/tendermint-blockchain-response'; +import type { TendermintBlockchainResponse } from '../../routes/blocks/tendermint-blockchain-response'; import { BlockData } from './block-data'; interface BlocksProps { @@ -9,12 +10,14 @@ interface BlocksProps { export const BlocksData = ({ data, className }: BlocksProps) => { if (!data?.result) { - return
Awaiting block data
; + return
{t('Awaiting block data')}
; } return (