Run typecheck and eslint on ./run lint (#6314)

This commit is contained in:
somebody1234 2023-05-04 14:00:42 +10:00 committed by GitHub
parent b93edb050b
commit 7885145b6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -104,7 +104,7 @@ export function isFileOpenable(path: string): boolean {
* we manually start a new instance of the application and pass the file path to it (using the
* Windows-style command).
*/
export function onFileOpened(event: Event, path: string): string | void {
export function onFileOpened(event: Event, path: string): string | null {
logger.log(`Received 'open-file' event for path '${path}'.`)
if (isFileOpenable(path)) {
logger.log(`The file '${path}' is openable.`)
@ -114,7 +114,6 @@ export function onFileOpened(event: Event, path: string): string | void {
if (!electron.app.isReady() && CLIENT_ARGUMENTS.length === 0) {
event.preventDefault()
logger.log(`Opening file '${path}'.`)
// eslint-disable-next-line no-restricted-syntax
return handleOpenFile(path)
} else {
// We need to start another copy of the application, as the first one is already running.
@ -128,9 +127,11 @@ export function onFileOpened(event: Event, path: string): string | void {
})
// Prevent parent (this) process from waiting for the child to exit.
child.unref()
return null
}
} else {
logger.log(`The file '${path}' is not openable, ignoring the 'open-file' event.`)
return null
}
}

View File

@ -86,6 +86,8 @@ use ide_ci::programs::git;
use ide_ci::programs::git::clean;
use ide_ci::programs::rustc;
use ide_ci::programs::Cargo;
use ide_ci::programs::Npm;
use ide_ci::programs::Npx;
use std::time::Duration;
use tempfile::tempdir;
use tokio::process::Child;
@ -835,6 +837,10 @@ pub async fn main_internal(config: Option<enso_build::config::Config>) -> Result
.await?;
prettier::check(&ctx.repo_root).await?;
let js_modules_root = ctx.repo_root.join("app/ide-desktop");
Npm.cmd()?.current_dir(&js_modules_root).args(["install"]).run_ok().await?;
Npm.cmd()?.current_dir(&js_modules_root).args(["run", "typecheck"]).run_ok().await?;
Npx.cmd()?.current_dir(&js_modules_root).args(["eslint", "."]).run_ok().await?;
}
Target::Fmt => {
let prettier = prettier::write(&ctx.repo_root);