fix linting

pull/5370/head
filip mertens 3 years ago
parent 16b77e1f82
commit aa6e5aa924
  1. 9
      apps/solidity-compiler/src/app/app.tsx
  2. 37
      apps/solidity-compiler/src/app/compiler-api.ts
  3. 20
      apps/solidity-compiler/src/app/compiler.ts
  4. 2
      apps/solidity-compiler/src/environments/environment.prod.ts
  5. 2
      apps/solidity-compiler/src/environments/environment.ts
  6. 2
      apps/solidity-compiler/src/index.ts
  7. 9
      apps/solidity-compiler/src/main.tsx
  8. 4
      apps/solidity-compiler/src/polyfills.ts

@ -1,4 +1,5 @@
import React, { useState, useEffect } from 'react';
/* eslint-disable no-use-before-define */
import React from 'react'
import { SolidityCompiler } from '@remix-ui/solidity-compiler' // eslint-disable-line
@ -11,7 +12,7 @@ export const App = () => {
<div>
<SolidityCompiler api={remix} />
</div>
);
};
)
}
export default App;
export default App

@ -7,6 +7,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
contractMap: {
file: string
} | Record<string, any>
compileErrors: any
compileTabLogic: CompileTabLogic
contractsDetails: Record<string, any>
@ -29,7 +30,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
errorContainer: null,
contractEl: null
}
this.contractsDetails = {}
this.data = {
eventHandlers: {},
@ -54,7 +55,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
if (this.data.eventHandlers.onLoadingCompiler) {
this.compiler.event.unregister('loadingCompiler', this.data.eventHandlers.onLoadingCompiler)
}
if (this.data.eventHandlers.onCompilerLoaded) {
this.compiler.event.unregister('compilerLoaded', this.data.eventHandlers.onCompilerLoaded)
}
@ -62,7 +63,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
if (this.data.eventHandlers.onCompilationFinished) {
this.compiler.event.unregister('compilationFinished', this.data.eventHandlers.onCompilationFinished)
}
this.off('filePanel', 'setWorkspace')
this.off('remixd', 'rootFolderChanged')
@ -72,19 +73,19 @@ export const CompilerApiMixin = (Base) => class extends Base {
if (this.data.eventHandlers.onStartingCompilation) {
this.compileTabLogic.event.off('startingCompilation', this.data.eventHandlers.onStartingCompilation)
}
if (this.data.eventHandlers.onRemoveAnnotations) {
this.compileTabLogic.event.off('removeAnnotations', this.data.eventHandlers.onRemoveAnnotations)
}
}
this.off('fileManager', 'currentFileChanged')
this.off('fileManager', 'noFileSelected')
this.off('fileManager', 'noFileSelected')
this.off('themeModule', 'themeChanged')
if (this.data.eventHandlers.onKeyDown) {
window.document.removeEventListener('keydown', this.data.eventHandlers.onKeyDown)
window.document.removeEventListener('keydown', this.data.eventHandlers.onKeyDown)
}
}
@ -99,7 +100,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
logToTerminal (content) {
return this.call('terminal', 'log', content)
}
getCompilationResult () {
return this.compileTabLogic.compiler.state.lastCompilationResult
}
@ -143,7 +144,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
// This function is used for passing the compiler configuration to 'remix-tests'
getCurrentCompilerConfig () {
const compilerState = this.getCompilerState()
let compilerDetails: any = {
const compilerDetails: any = {
currentVersion: compilerState.currentVersion,
evmVersion: compilerState.evmVersion,
optimize: compilerState.optimize,
@ -162,8 +163,8 @@ export const CompilerApiMixin = (Base) => class extends Base {
* @param {object} settings {evmVersion, optimize, runs, version, language}
*/
setCompilerConfig (settings) {
this.configurationSettings = settings
}
this.configurationSettings = settings
}
fileExists (fileName) {
return this.call('fileManager', 'exists', fileName)
@ -231,7 +232,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
this.on('editor', 'sessionSwitched', () => {
if (this.onSessionSwitched) this.onSessionSwitched()
})
})
this.compileTabLogic.event.on('startingCompilation', this.data.eventHandlers.onStartingCompilation)
this.compileTabLogic.event.on('removeAnnotations', this.data.eventHandlers.onRemoveAnnotations)
@ -241,13 +242,13 @@ export const CompilerApiMixin = (Base) => class extends Base {
if (this.onCurrentFileChanged) this.onCurrentFileChanged(name)
}
this.on('fileManager', 'currentFileChanged', this.data.eventHandlers.onCurrentFileChanged)
this.data.eventHandlers.onNoFileSelected = () => {
this.currentFile = ''
if (this.onNoFileSelected) this.onNoFileSelected()
}
this.on('fileManager', 'noFileSelected', this.data.eventHandlers.onNoFileSelected)
this.data.eventHandlers.onCompilationFinished = (success, data, source) => {
this.compileErrors = data
if (success) {
@ -288,7 +289,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
}
}
this.on('themeModule', 'themeChanged', this.data.eventHandlers.onThemeChanged)
// Run the compiler instead of trying to save the website
this.data.eventHandlers.onKeyDown = (e) => {
// ctrl+s or command+s

@ -1,5 +1,7 @@
import { PluginClient } from "@remixproject/plugin";
import { createClient } from "@remixproject/plugin-webview";
/* eslint-disable no-undef */
/* eslint-disable no-unused-vars */
import { PluginClient } from '@remixproject/plugin'
import { createClient } from '@remixproject/plugin-webview'
import { CompilerApiMixin } from './compiler-api'
import { ICompilerApi } from '@remix-project/remix-lib-ts'
import { CompileTabLogic } from '@remix-ui/solidity-compiler'
@ -14,7 +16,7 @@ const profile = {
location: 'sidePanel',
documentation: 'https://remix-ide.readthedocs.io/en/latest/solidity_editor.html',
version: '0.0.1',
methods: ['getCompilationResult', 'compile', 'compileWithParameters', 'setCompilerConfig', 'compileFile' ,'getCompilerState']
methods: ['getCompilationResult', 'compile', 'compileWithParameters', 'setCompilerConfig', 'compileFile', 'getCompilerState']
}
const defaultAppParameters = {
@ -30,7 +32,7 @@ const defaultCompilerParameters = {
evmVersion: null, // compiler default
language: 'Solidity'
}
export class CompilerClientApi extends CompilerApiMixin(PluginClient) implements ICompilerApi {
export class CompilerClientApi extends CompilerApiMixin(PluginClient) implements ICompilerApi {
constructor () {
super()
createClient(this as any)
@ -42,11 +44,11 @@ export class CompilerClientApi extends CompilerApiMixin(PluginClient) implements
getCompilerParameters () {
const params = {
runs: localStorage.getItem('runs') || defaultCompilerParameters['runs'],
optimize: localStorage.getItem('optimize') === 'true' ? true : false,
version: localStorage.getItem('version') || defaultCompilerParameters['version'],
evmVersion: localStorage.getItem('evmVersion') || defaultCompilerParameters['evmVersion'], // default
language: localStorage.getItem('language') || defaultCompilerParameters['language']
runs: localStorage.getItem('runs') || defaultCompilerParameters.runs,
optimize: localStorage.getItem('optimize') === 'true',
version: localStorage.getItem('version') || defaultCompilerParameters.version,
evmVersion: localStorage.getItem('evmVersion') || defaultCompilerParameters.evmVersion, // default
language: localStorage.getItem('language') || defaultCompilerParameters.language
}
return params
}

@ -1,3 +1,3 @@
export const environment = {
production: true
};
}

@ -3,4 +3,4 @@
export const environment = {
production: false
};
}

@ -1 +1 @@
export * from './app/compiler-api';
export * from './app/compiler-api'

@ -1,11 +1,12 @@
import React from 'react';
import ReactDOM from 'react-dom';
// eslint-disable-next-line no-use-before-define
import React from 'react'
import ReactDOM from 'react-dom'
import App from './app/app';
import App from './app/app'
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
)

@ -3,5 +3,5 @@
*
* See: https://github.com/zloirock/core-js#babel
*/
import 'core-js/stable';
import 'regenerator-runtime/runtime';
import 'core-js/stable'
import 'regenerator-runtime/runtime'

Loading…
Cancel
Save