Skip to content

Commit

Permalink
Add node and react ESlint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
paullinator committed Feb 10, 2024
1 parent 1aea927 commit 529ed33
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 29 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"extends": [
"standard-kit/prettier",
"standard-kit/prettier/node",
"standard-kit/prettier/jsx",
"standard-kit/prettier/node",
"standard-kit/prettier/react",
"standard-kit/prettier/typescript"
],
"globals": {
Expand Down
5 changes: 2 additions & 3 deletions src/bin/bogReporter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import fetch from 'node-fetch'

import CONFIG from '../../config.json'
import { config } from '../config'

// @ts-expect-error
const BITS_OF_GOLD_API_KEY = CONFIG.bog.apiKey
const BITS_OF_GOLD_API_KEY = config.bog.apiKey

const dateRegex = /([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))/

Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const asConfig = asObject({
'http://username:password@localhost:5984'
),
httpPort: asOptional(asNumber, 8008),
bog: asOptional(asObject({ apiKey: asString }), { apiKey: '' }),
soloAppIds: asOptional(asArray(asString), undefined),
soloPartnerIds: asOptional(asArray(asString), undefined),
timeoutOverrideMins: asOptional(asNumber, 1200),
Expand Down
16 changes: 1 addition & 15 deletions src/demo/clientUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,15 @@ import sub from 'date-fns/sub'
import { getTimezoneOffset } from 'date-fns-tz'
import fetch from 'node-fetch'

import { clientConfig } from './clientConfig'
import { AnalyticsResult, asAnalyticsResult, Bucket } from '../types'
import { clientConfig } from './clientConfig'
import { Data, DataPlusSevenDayAve } from './components/Graphs'
import Partners from './partners'

export const SIX_DAYS = 6

export const apiHost = clientConfig.apiHost ?? ''

const CURRENCY_CONVERSION = {
USDT20: 'USDT',
USDTERC20: 'USDT',
USDTPOLYGON: 'USDT',
USDCPOLYGON: 'USDC',
ZADDR: 'ZEC',
BCHABC: 'BCH',
BCHSV: 'BSV',
FTMMAINNET: 'FTM',
BNBMAINNET: 'BNB',
AVAXC: 'AVAX',
POLYGON: 'MATIC'
}

const asGetPartnerIds = asArray(asString)

export const addObject = (origin: any, destination: any): void => {
Expand Down
5 changes: 4 additions & 1 deletion src/demo/components/Buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ interface buttonProps {
onClick: () => void
}

export class MainButton extends PureComponent<buttonProps, {}> {
export class MainButton extends PureComponent<
{ label: string; onClick: () => void },
{}
> {
render(): JSX.Element {
return (
<button style={mainButton} onClick={() => this.props.onClick()}>
Expand Down
1 change: 0 additions & 1 deletion src/demo/components/Custom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export interface CustomRouteProps {
end: string
}
interface CustomProps extends RouteComponentProps<CustomRouteProps> {
key: string
apiKey: string
exchangeType: string
changeTimePeriod: (timePeriod: string) => void
Expand Down
6 changes: 5 additions & 1 deletion src/demo/components/MainScene.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import React from 'react'

export function MainScene({ children }): JSX.Element {
export function MainScene({
children
}: {
children: React.ReactNode
}): JSX.Element {
return (
<>
<div>
Expand Down
8 changes: 4 additions & 4 deletions src/demo/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ class Sidebar extends Component<SidebarProps, SidebarState> {
this.setState({ end })
}

renderExchangeButtons = (props: SidebarProps): JSX.Element => (
renderExchangeButtons = (): JSX.Element => (
<>
{Object.entries(allowExchangeTypes).map(([exchangeType, label]) => (
<SecondaryButton
key={exchangeType}
underline={props.exchangeType === exchangeType}
underline={this.props.exchangeType === exchangeType}
label={label}
onClick={() => props.changeExchangeType(exchangeType)}
onClick={() => this.props.changeExchangeType(exchangeType)}
/>
))}
</>
Expand Down Expand Up @@ -224,7 +224,7 @@ class Sidebar extends Component<SidebarProps, SidebarState> {
<Sidetab serverName="Reports" appId={this.props.appId}>
{this.renderCustomView(this.props)}
<hr style={divider} />
{this.renderExchangeButtons(this.props)}
{this.renderExchangeButtons()}
<hr style={divider} />
<NavLink to="/">
<MainButton label="Logout" onClick={() => this.props.logout()} />
Expand Down
1 change: 1 addition & 0 deletions src/demo/components/Sidetab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const logo = new URL('../images/logo.png', import.meta.url).toString()
interface SidetabProps {
appId?: string
serverName: string
children: React.ReactNode
}

const logoStyle = {
Expand Down
6 changes: 3 additions & 3 deletions src/partners/moonpay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ export async function queryMoonpay(
pluginParams: PluginParams
): Promise<PluginResult> {
const ssFormatTxs: StandardTx[] = []
let apiKey

let headers
let latestTimestamp = 0
if (typeof pluginParams.settings.latestTimestamp === 'number') {
latestTimestamp = pluginParams.settings.latestTimestamp
}

if (typeof pluginParams.apiKeys.apiKey === 'string') {
apiKey = pluginParams.apiKeys.apiKey
const apiKey = pluginParams.apiKeys.apiKey
if (typeof apiKey === 'string') {
headers = {
Authorization: `Api-Key ${apiKey}`
}
Expand Down

0 comments on commit 529ed33

Please sign in to comment.