Fix many ESlint errors (#1265)

* Unvendor toml package

* Fix many ESlint errors

For mysterious reasons, these errors appear on my branch #1262 even
though they are not related to changes there. The eslint config seems
a bit unstable.

Anyways this fixes them.

* Put back Record

* Fix typescript compilation

* Fix lints

* Try @iarna/toml instead

* Fix import

* Use @ltd/j-toml

* Update test

* Use toml-j0.4

* Some changes

* Fix toml import

* Try adding eslint gha job

* Add forgotten checkout action

* Force CI to run

* Blah

* Fix

* Revert changes to github workflow

* Fix lints

* wget toml-j0.4 type definitions

* Add toml-j types workaround to eslint workflow

* Apply formatter

* Use @hoodmane/toml-j0.4

* Import from @hoodmane/toml-j0.4
This commit is contained in:
Hood Chatham
2023-03-13 15:51:28 +01:00
committed by GitHub
parent 653e2c9be4
commit 37c9db09c6
18 changed files with 196 additions and 122 deletions

View File

@@ -25,7 +25,8 @@ export class ImportmapPlugin extends Plugin {
const importmap: ImportMapType = (() => {
try {
return JSON.parse(node.textContent) as ImportMapType;
} catch (error) {
} catch (e) {
const error = e as Error;
showWarning('Failed to parse import map: ' + error.message);
}
})();

View File

@@ -16,7 +16,7 @@ export class PyTerminalPlugin extends Plugin {
this.app = app;
}
configure(config: AppConfig) {
configure(config: AppConfig & { terminal?: boolean | 'auto' }) {
// validate the terminal config and handle default values
const t = config.terminal;
if (t !== undefined && t !== true && t !== false && t !== 'auto') {
@@ -32,7 +32,7 @@ export class PyTerminalPlugin extends Plugin {
}
}
beforeLaunch(config: AppConfig) {
beforeLaunch(config: AppConfig & { terminal?: boolean | 'auto' }) {
// if config.terminal is "yes" or "auto", let's add a <py-terminal> to
// the document, unless it's already present.
const t = config.terminal;
@@ -46,7 +46,7 @@ export class PyTerminalPlugin extends Plugin {
}
}
afterSetup(interpreter: InterpreterClient) {
afterSetup(_interpreter: InterpreterClient) {
// the Python interpreter has been initialized and we are ready to
// execute user code:
//

View File

@@ -22,7 +22,9 @@ export class SplashscreenPlugin extends Plugin {
autoclose: boolean;
enabled: boolean;
configure(config: AppConfig) {
configure(
config: AppConfig & { splashscreen?: { autoclose?: boolean; enabled?: boolean }; autoclose_loader?: boolean },
) {
// the officially supported setting is config.splashscreen.autoclose,
// but we still also support the old config.autoclose_loader (with a
// deprecation warning)
@@ -40,7 +42,7 @@ export class SplashscreenPlugin extends Plugin {
}
}
beforeLaunch(config: AppConfig) {
beforeLaunch(_config: AppConfig) {
if (!this.enabled) {
return;
}
@@ -50,18 +52,18 @@ export class SplashscreenPlugin extends Plugin {
this.elem = <PySplashscreen>document.createElement('py-splashscreen');
document.body.append(this.elem);
document.addEventListener('py-status-message', (e: CustomEvent) => {
const msg = e.detail;
const msg = e.detail as string;
this.elem.log(msg);
});
}
afterStartup(interpreter: InterpreterClient) {
afterStartup(_interpreter: InterpreterClient) {
if (this.autoclose && this.enabled) {
this.elem.close();
}
}
onUserError(error: UserError) {
onUserError(_error: UserError) {
if (this.elem !== undefined && this.enabled) {
// Remove the splashscreen so users can see the banner better
this.elem.close();

View File

@@ -47,7 +47,7 @@ export class StdioDirector extends Plugin {
interpreter: InterpreterClient;
src: string;
pyScriptTag: PyScriptTag;
result: any;
result: any; // eslint-disable-line @typescript-eslint/no-explicit-any
}): void {
if (options.pyScriptTag.stdout_manager != null) {
this._stdioMultiplexer.removeListener(options.pyScriptTag.stdout_manager);