fixing linting for remixd

pull/4771/head
lianahus 7 months ago
parent d0dd8a27a2
commit 726132f9a0
  1. 6
      libs/remixd/src/bin/remixd.ts
  2. 7
      libs/remixd/src/services/foundryClient.ts
  3. 5
      libs/remixd/src/services/hardhatClient.ts
  4. 4
      libs/remixd/src/services/remixdClient.ts
  5. 1
      libs/remixd/src/services/truffleClient.ts

@ -77,7 +77,7 @@ function errorHandler (error: any, service: string) {
const options = program.opts(); const options = program.opts();
await warnLatestVersion() await warnLatestVersion()
if(options.install && !options.readOnly) { if (options.install && !options.readOnly) {
if (options.install.toLowerCase() === 'slither') require('./../scripts/installSlither') if (options.install.toLowerCase() === 'slither') require('./../scripts/installSlither')
process.exit(0) process.exit(0)
} }
@ -128,7 +128,7 @@ function errorHandler (error: any, service: string) {
} }
// Run hardhat service if a hardhat project is shared as folder // Run hardhat service if a hardhat project is shared as folder
const hardhatConfigFilePath = absolutePath('./', options.sharedFolder) const hardhatConfigFilePath = absolutePath('./', options.sharedFolder)
const isHardhatProject = existsSync(hardhatConfigFilePath + '/hardhat.config.js') || existsSync(hardhatConfigFilePath + '/hardhat.config.ts') const isHardhatProject = existsSync(hardhatConfigFilePath + '/hardhat.config.js') || existsSync(hardhatConfigFilePath + '/hardhat.config.ts')
if (isHardhatProject) { if (isHardhatProject) {
startService('hardhat', (ws: WS, sharedFolderClient: servicesList.Sharedfolder, error: Error) => { startService('hardhat', (ws: WS, sharedFolderClient: servicesList.Sharedfolder, error: Error) => {
if (error) { if (error) {
@ -141,7 +141,7 @@ function errorHandler (error: any, service: string) {
} }
// Run foundry service if a founndry project is shared as folder // Run foundry service if a founndry project is shared as folder
const foundryConfigFilePath = absolutePath('./', options.sharedFolder) const foundryConfigFilePath = absolutePath('./', options.sharedFolder)
const isFoundryProject = existsSync(foundryConfigFilePath + '/foundry.toml') const isFoundryProject = existsSync(foundryConfigFilePath + '/foundry.toml')
if (isFoundryProject) { if (isFoundryProject) {
startService('foundry', (ws: WS, sharedFolderClient: servicesList.Sharedfolder, error: Error) => { startService('foundry', (ws: WS, sharedFolderClient: servicesList.Sharedfolder, error: Error) => {
if (error) { if (error) {

@ -52,7 +52,7 @@ export class FoundryClient extends PluginClient {
listenOnFoundryFolder() { listenOnFoundryFolder() {
console.log('Foundry out folder doesn\'t exist... waiting for the compilation.') console.log('Foundry out folder doesn\'t exist... waiting for the compilation.')
try { try {
if(this.watcher) this.watcher.close() if (this.watcher) this.watcher.close()
this.watcher = chokidar.watch(this.currentSharedFolder, { depth: 1, ignorePermissionErrors: true, ignoreInitial: true }) this.watcher = chokidar.watch(this.currentSharedFolder, { depth: 1, ignorePermissionErrors: true, ignoreInitial: true })
// watch for new folders // watch for new folders
this.watcher.on('addDir', () => { this.watcher.on('addDir', () => {
@ -126,7 +126,7 @@ export class FoundryClient extends PluginClient {
this.logTimeout = setTimeout(() => { this.logTimeout = setTimeout(() => {
// @ts-ignore // @ts-ignore
this.call('terminal', 'log', { type: 'log', value: `receiving compilation result from Foundry` }) this.call('terminal', 'log', { type: 'log', value: `receiving compilation result from Foundry` })
console.log('Syncing compilation result from Foundry') console.log('Syncing compilation result from Foundry')
}, 1000) }, 1000)
} catch (e) { } catch (e) {
@ -142,7 +142,7 @@ export class FoundryClient extends PluginClient {
listenOnFoundryCompilation() { listenOnFoundryCompilation() {
try { try {
if(this.watcher) this.watcher.close() if (this.watcher) this.watcher.close()
this.watcher = chokidar.watch(this.cachePath, { depth: 0, ignorePermissionErrors: true, ignoreInitial: true }) this.watcher = chokidar.watch(this.cachePath, { depth: 0, ignorePermissionErrors: true, ignoreInitial: true })
this.watcher.on('change', async () => await this.triggerProcessArtifact()) this.watcher.on('change', async () => await this.triggerProcessArtifact())
this.watcher.on('add', async () => await this.triggerProcessArtifact()) this.watcher.on('add', async () => await this.triggerProcessArtifact())
@ -193,7 +193,6 @@ export class FoundryClient extends PluginClient {
console.log('\x1b[32m%s\x1b[0m', 'sources input not found, please update Foundry to the latest version.') console.log('\x1b[32m%s\x1b[0m', 'sources input not found, please update Foundry to the latest version.')
} }
compilationResultPart.compilationTarget = contentJSON.ast.absolutePath compilationResultPart.compilationTarget = contentJSON.ast.absolutePath
// extract data // extract data
if (!compilationResultPart.output['sources'][contentJSON.ast.absolutePath]) compilationResultPart.output['sources'][contentJSON.ast.absolutePath] = {} if (!compilationResultPart.output['sources'][contentJSON.ast.absolutePath]) compilationResultPart.output['sources'][contentJSON.ast.absolutePath] = {}

@ -143,13 +143,12 @@ export class HardhatClient extends PluginClient {
} }
}, 1000) }, 1000)
} }
listenOnHardHatFolder() { listenOnHardHatFolder() {
console.log('Hardhat artifacts folder doesn\'t exist... waiting for the compilation.') console.log('Hardhat artifacts folder doesn\'t exist... waiting for the compilation.')
try { try {
if(this.watcher) this.watcher.close() if (this.watcher) this.watcher.close()
this.watcher = chokidar.watch(this.currentSharedFolder, { depth: 2, ignorePermissionErrors: true, ignoreInitial: true }) this.watcher = chokidar.watch(this.currentSharedFolder, { depth: 2, ignorePermissionErrors: true, ignoreInitial: true })
// watch for new folders // watch for new folders
this.watcher.on('addDir', () => { this.watcher.on('addDir', () => {
@ -171,7 +170,7 @@ export class HardhatClient extends PluginClient {
listenOnHardhatCompilation() { listenOnHardhatCompilation() {
try { try {
console.log('listening on Hardhat compilation...') console.log('listening on Hardhat compilation...')
if(this.watcher) this.watcher.close() if (this.watcher) this.watcher.close()
this.watcher = chokidar.watch(this.buildPath, { depth: 1, ignorePermissionErrors: true, ignoreInitial: true }) this.watcher = chokidar.watch(this.buildPath, { depth: 1, ignorePermissionErrors: true, ignoreInitial: true })
this.watcher.on('change', async () => await this.triggerProcessArtifact()) this.watcher.on('change', async () => await this.triggerProcessArtifact())
this.watcher.on('add', async () => await this.triggerProcessArtifact()) this.watcher.on('add', async () => await this.triggerProcessArtifact())

@ -275,12 +275,12 @@ export class RemixdClient extends PluginClient {
}) })
this.watcher.on('unlink', async (f: string) => { this.watcher.on('unlink', async (f: string) => {
if (this.isLoaded) { if (this.isLoaded) {
this.emit('removed', utils.relativePath(f, this.currentSharedFolder), false) this.emit('removed', utils.relativePath(f, this.currentSharedFolder), false)
} }
}) })
this.watcher.on('unlinkDir', async (f: string) => { this.watcher.on('unlinkDir', async (f: string) => {
if (this.isLoaded) { if (this.isLoaded) {
this.emit('removed', utils.relativePath(f, this.currentSharedFolder), true) this.emit('removed', utils.relativePath(f, this.currentSharedFolder), true)
} }
}) })
} }

@ -100,7 +100,6 @@ export class TruffleClient extends PluginClient {
return true return true
} }
private async processArtifact() { private async processArtifact() {
if (!this.checkPath()) return if (!this.checkPath()) return
const folderFiles = await fs.readdir(this.buildPath) const folderFiles = await fs.readdir(this.buildPath)

Loading…
Cancel
Save