fixing linting for etherscan

linter rules for solhint
pull/4771/head
lianahus 7 months ago
parent 313cec883e
commit 1d08797503
  1. 8
      apps/etherscan/src/app/EtherscanPluginClient.ts
  2. 6
      apps/etherscan/src/app/utils/utilities.ts
  3. 14
      apps/etherscan/src/app/utils/verify.ts
  4. 15
      apps/solhint/.eslintrc
  5. 1
      apps/solhint/src/app/SolhintPluginClient.ts

@ -1,7 +1,7 @@
import {PluginClient} from '@remixproject/plugin'
import { PluginClient } from '@remixproject/plugin'
import { createClient } from '@remixproject/plugin-webview'
import {verify, EtherScanReturn} from './utils/verify'
import {getReceiptStatus, getEtherScanApi, getNetworkName, getProxyContractReceiptStatus} from './utils'
import { verify, EtherScanReturn } from './utils/verify'
import { getReceiptStatus, getEtherScanApi, getNetworkName, getProxyContractReceiptStatus } from './utils'
import EventManager from 'events'
export class EtherscanPluginClient extends PluginClient {
@ -46,7 +46,7 @@ export class EtherscanPluginClient extends PluginClient {
async receiptStatus(receiptGuid: string, apiKey: string, isProxyContract: boolean) {
try {
const {network, networkId} = await getNetworkName(this)
const { network, networkId } = await getNetworkName(this)
if (network === 'vm') {
throw new Error('Cannot check the receipt status in the selected network')
}

@ -4,7 +4,7 @@ import { scanAPIurls } from "./networks"
type RemixClient = PluginClient
/*
status: 0=Error, 1=Pass
status: 0=Error, 1=Pass
message: OK, NOTOK
result: explanation
*/
@ -14,7 +14,7 @@ export type receiptStatus = {
status: string
}
export const getEtherScanApi = (networkId: any) => {
export const getEtherScanApi = (networkId: any) => {
if (!(networkId in scanAPIurls)) {
throw new Error("no known network to verify against")
}
@ -26,7 +26,7 @@ export const getNetworkName = async (client: RemixClient) => {
const network = await client.call("network", "detectNetwork")
if (!network) {
throw new Error("no known network to verify against")
}
}
return { network: network.name!.toLowerCase(), networkId: network.id }
}

@ -23,7 +23,7 @@ export const verify = async (
compilationResultParam: CompilerAbstract,
chainRef: number | string,
isProxyContract: boolean,
expectedImplAddress: string,
expectedImplAddress: string,
client: PluginClient,
onVerifiedContract: (value: EtherScanReturn) => void,
setResults: (value: string) => void
@ -47,7 +47,7 @@ export const verify = async (
etherscanApi = getEtherScanApi(networkChainId)
}
}
try {
const contractMetadata = getContractMetadata(
// cast from the remix-plugin interface to the solidity one. Should be fixed when remix-plugin move to the remix-project repository
@ -61,7 +61,7 @@ export const verify = async (
message: "Please recompile contract"
}
}
const contractMetadataParsed = JSON.parse(contractMetadata)
const fileName = getContractFileName(
@ -146,9 +146,9 @@ export const verify = async (
title: result,
})
const returnValue = {
message: result,
succeed: false,
isProxyContract
message: result,
succeed: false,
isProxyContract
}
resetAfter10Seconds(client, setResults)
return returnValue
@ -184,7 +184,7 @@ export const getContractFileName = (
}
return fileName
}
export const getContractMetadata = (
compilationResult: CompilationResult,
contractName: string

@ -1,3 +1,18 @@
{
"extends": "../../.eslintrc.json",
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"warn"
]
}
}
]
}

@ -1,6 +1,7 @@
import { PluginClient } from '@remixproject/plugin'
import { createClient } from '@remixproject/plugin-webview'
import EventEmitter from 'events'
// eslint-disable @nrwl/nx/enforce-module-boundaries
import { processStr } from 'solhint'
import { applyExtends } from 'solhint/lib/config/config-file'
import bestPractises from 'solhint/lib/rules/best-practises'

Loading…
Cancel
Save