Skip to content

Commit 4e94496

Browse files
committed
fixing linting for remix-lib
1 parent 4716cfa commit 4e94496

File tree

15 files changed

+48
-50
lines changed

15 files changed

+48
-50
lines changed

libs/remix-lib/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"outputs": ["{options.outputFile}"],
2323
"options": {
2424
"lintFilePatterns": ["libs/remix-lib/**/*.ts"],
25-
"eslintConfig": "libs/remix-lib/.eslinrc"
25+
"eslintConfig": "libs/remix-lib/.eslintrc"
2626
}
2727
}
2828
},

libs/remix-lib/src/execution/eventsDecoder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class EventsDecoder {
2121
* @param {Function} cb - callback
2222
*/
2323
parseLogs (tx, contractName, compiledContracts, cb) {
24-
if (tx.isCall) return cb(null, { decoded: [], raw: [] })
24+
if (tx.isCall) return cb(null, { decoded: [], raw: []})
2525
this.resolveReceipt(tx, (error, receipt) => {
2626
if (error) return cb(error)
2727
this._decodeLogs(tx, receipt, contractName, compiledContracts, cb)
@@ -33,7 +33,7 @@ export class EventsDecoder {
3333
return cb('cannot decode logs - contract or receipt not resolved ')
3434
}
3535
if (!receipt.logs) {
36-
return cb(null, { decoded: [], raw: [] })
36+
return cb(null, { decoded: [], raw: []})
3737
}
3838
this._decodeEvents(tx, receipt.logs, contract, contracts, cb)
3939
}

libs/remix-lib/src/execution/logsManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class LogsManager {
2424
if (!receipt) return next()
2525
for (const log of receipt.logs) {
2626
this.oldLogs.push({ type: 'block', blockNumber, block, tx, log, txNumber: i, receipt })
27-
const subscriptions = this.getSubscriptionsFor({ type: 'block', blockNumber, block, tx, log, receipt})
27+
const subscriptions = this.getSubscriptionsFor({ type: 'block', blockNumber, block, tx, log, receipt })
2828
for (const subscriptionId of subscriptions) {
2929
const result = {
3030
logIndex: '0x1', // 1
@@ -76,7 +76,7 @@ export class LogsManager {
7676
const subscriptionParams = this.subscriptions[subscriptionId]
7777
const [queryType, queryFilter] = subscriptionParams
7878

79-
if (this.eventMatchesFilter(changeEvent, queryType, queryFilter || { topics: [] })) {
79+
if (this.eventMatchesFilter(changeEvent, queryType, queryFilter || { topics: []})) {
8080
matchedSubscriptions.push(subscriptionId)
8181
}
8282
}
@@ -135,7 +135,7 @@ export class LogsManager {
135135
const tracking = this.filterTracking[filterId]
136136

137137
if (logsOnly || filterType === 'filter') {
138-
return this.getLogsFor(params || { topics: [] })
138+
return this.getLogsFor(params || { topics: []})
139139
}
140140
if (filterType === 'block') {
141141
const blocks = this.oldLogs.filter(x => x.type === 'block').filter(x => tracking.block === undefined || x.blockNumber >= tracking.block)

libs/remix-lib/src/execution/txFormat.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function encodeParams (params, funAbi, callback?) {
8888
const result = { data: data, dataHex: dataHex, funArgs: funArgs }
8989
callback && callback(null, result)
9090
resolve(result)
91-
})
91+
})
9292
}
9393

9494
/**
@@ -409,7 +409,7 @@ export function decodeResponse (response, fnabi) {
409409
const name = fnabi.outputs[i].name
410410
json[i] = outputTypes[i] + ': ' + (name ? name + ' ' + decodedObj[i] : decodedObj[i])
411411
}
412-
412+
413413
return json
414414
} catch (e) {
415415
return { error: 'Failed to decode output: ' + e }
@@ -485,16 +485,16 @@ export const normalizeParam = (param) => {
485485
try {
486486
let paramTrimmed = param.replace(/^'/g, '').replace(/'$/g, '')
487487
paramTrimmed = paramTrimmed.replace(/^"/g, '').replace(/"$/g, '')
488-
param = fromExponential(paramTrimmed)
488+
param = fromExponential(paramTrimmed)
489489
} catch (e) {
490490
console.log(e)
491491
}
492492
}
493-
}
493+
}
494494

495-
if (typeof param === 'string') {
495+
if (typeof param === 'string') {
496496
if (param === 'true') param = true
497-
if (param === 'false') param = false
497+
if (param === 'false') param = false
498498
}
499499
return param
500500
}

libs/remix-lib/src/execution/txHelper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export function encodeParams (funABI, args) {
1616
const type = funABI.inputs[i].type
1717
if (type === 'bool') {
1818
if (args[i] === false || args[i] === 'false' || args[i] === '0' || args[i] === 0) args[i] = false
19-
else if (args[i] === true || args[i] === 'true' || args[i] === '1' || args[i] === 1) args[i] = true
20-
else throw new Error(`provided value for boolean is invalid: ${args[i]}`)
19+
else if (args[i] === true || args[i] === 'true' || args[i] === '1' || args[i] === 1) args[i] = true
20+
else throw new Error(`provided value for boolean is invalid: ${args[i]}`)
2121
}
2222
types.push(type.indexOf('tuple') === 0 ? makeFullTypeDefinition(funABI.inputs[i]) : type)
2323
if (args.length < types.length) {
@@ -66,7 +66,7 @@ export function sortAbiFunction (contractabi) {
6666
}
6767

6868
export function getConstructorInterface (abi) {
69-
const funABI = { name: '', inputs: [], type: 'constructor', payable: false, outputs: [] }
69+
const funABI = { name: '', inputs: [], type: 'constructor', payable: false, outputs: []}
7070
if (typeof abi === 'string') {
7171
try {
7272
abi = JSON.parse(abi)

libs/remix-lib/src/execution/txRunnerVM.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class TxRunnerVM {
3838
this.logsManager = new LogsManager()
3939
// has a default for now for backwards compatibility
4040
this.getVMObject = getVMObject
41-
this.commonContext = this.getVMObject().common
41+
this.commonContext = this.getVMObject().common
4242
this.pendingTxs = {}
4343
this.vmaccounts = vmaccounts
4444
this.queusTxs = []
@@ -137,7 +137,7 @@ export class TxRunnerVM {
137137
})
138138
} else {
139139
this.blockParentHash = block.hash()
140-
this.runBlockInVm(tx, block, async (err, result) => {
140+
this.runBlockInVm(tx, block, async (err, result) => {
141141
if (!err) {
142142
if (!useCall) {
143143
this.getVMObject().vm.blockchain.putBlock(block)

libs/remix-lib/src/execution/txRunnerWeb3.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { EventManager } from '../eventManager'
33
import type { Transaction as InternalTransaction } from './txRunner'
44
import Web3 from 'web3'
5-
import {toBigInt, toHex} from 'web3-utils'
5+
import { toBigInt, toHex } from 'web3-utils'
66

77
export class TxRunnerWeb3 {
88
event
@@ -65,9 +65,9 @@ export class TxRunnerWeb3 {
6565
promptCb(
6666
async (value) => {
6767
try {
68-
const res = await (this.getWeb3() as any).eth.personal.sendTransaction({...tx, value}, { checkRevertBeforeSending: false, ignoreGasPricing: true })
68+
const res = await (this.getWeb3() as any).eth.personal.sendTransaction({ ...tx, value }, { checkRevertBeforeSending: false, ignoreGasPricing: true })
6969
cb(null, res.transactionHash)
70-
} catch (e) {
70+
} catch (e) {
7171
console.log(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `)
7272
// in case the receipt is available, we consider that only the execution failed but the transaction went through.
7373
// So we don't consider this to be an error.
@@ -81,9 +81,9 @@ export class TxRunnerWeb3 {
8181
)
8282
} else {
8383
try {
84-
const res = await this.getWeb3().eth.sendTransaction(tx, null, { checkRevertBeforeSending: false, ignoreGasPricing: true})
84+
const res = await this.getWeb3().eth.sendTransaction(tx, null, { checkRevertBeforeSending: false, ignoreGasPricing: true })
8585
cb(null, res.transactionHash)
86-
} catch (e) {
86+
} catch (e) {
8787
console.log(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `)
8888
// in case the receipt is available, we consider that only the execution failed but the transaction went through.
8989
// So we don't consider this to be an error.
@@ -121,7 +121,7 @@ export class TxRunnerWeb3 {
121121
console.log(errNetWork)
122122
return
123123
}
124-
const txCopy = { ...tx, type: undefined, maxFeePerGas: undefined, gasPrice: undefined }
124+
const txCopy = { ...tx, type: undefined, maxFeePerGas: undefined, gasPrice: undefined }
125125
if (network && network.lastBlock) {
126126
if (network.lastBlock.baseFeePerGas) {
127127
// the sending stack (web3.js / metamask need to have the type defined)
@@ -138,17 +138,17 @@ export class TxRunnerWeb3 {
138138
gasEstimationForceSend(null, () => {
139139
/*
140140
* gasLimit is a value that can be set in the UI to hardcap value that can be put in a tx.
141-
* e.g if the gasestimate
141+
* e.g if the gasestimate
142142
*/
143143
if (gasLimit !== '0x0' && gasEstimation > gasLimit) {
144144
return callback(`estimated gas for this transaction (${gasEstimation}) is higher than gasLimit set in the configuration (${gasLimit}). Please raise the gas limit.`)
145-
}
146-
145+
}
146+
147147
if (gasLimit === '0x0') {
148148
tx['gas'] = gasEstimation
149149
} else {
150150
tx['gas'] = gasLimit
151-
}
151+
}
152152

153153
if (this._api.config.getUnpersistedProperty('doNotShowTransactionConfirmationAgain')) {
154154
return this._executeTx(tx, network, null, this._api, promptCb, callback)

libs/remix-lib/src/helpers/txResultHelper.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ function convertToPrefixedHex (input) {
88
if (input === undefined || input === null || isHexString(input)) {
99
return input
1010
}
11-
if ((input.constructor && input.constructor.name === 'BigNumber')
12-
|| BN.isBN(input)
11+
if ((input.constructor && input.constructor.name === 'BigNumber')
12+
|| BN.isBN(input)
1313
|| isBigInt(input)
1414
|| typeof input === 'number') {
1515
return '0x' + input.toString(16)
1616
}
17-
17+
1818
try {
1919
return bytesToHex(input)
2020
} catch (e) {
@@ -26,7 +26,7 @@ function convertToPrefixedHex (input) {
2626
return '0x' + input.toString(16)
2727
} catch (e) {
2828
console.log(e)
29-
}
29+
}
3030

3131
return input
3232
}

libs/remix-lib/src/init.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
'use strict'
22
import Web3, { Web3PluginBase } from 'web3'
3-
import {toNumber} from 'web3-utils'
3+
import { toNumber } from 'web3-utils'
44

55
export function extendWeb3 (web3) {
6-
if(!web3.debug){
6+
if (!web3.debug){
77
web3.registerPlugin(new Web3DebugPlugin())
88
}
99
}

libs/remix-lib/src/query-params.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
export class QueryParams {
3+
export class QueryParams {
44

55
update (params) {
66
const currentParams = this.get()

0 commit comments

Comments
 (0)