Skip to content

Commit

Permalink
Lint (#654)
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan authored Oct 30, 2023
1 parent dc633d5 commit 25f9136
Show file tree
Hide file tree
Showing 102 changed files with 1,942 additions and 2,328 deletions.
38 changes: 21 additions & 17 deletions cli/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,18 +501,20 @@ export async function saveLibFiles(
const customServices =
buildConfig.services.filter(srv => srv.catalog !== undefined) || []
// generate source files
await Promise.all(["ts", "c"].map(async(lang) => {
const converter = converters()[lang]
let constants = ""
for (const srv of customServices) {
constants += converter(srv) + "\n"
}
const dir = join(pref, GENDIR, lang)
await mkdirp(dir)
return writeFile(join(dir, `constants.${lang}`), constants, {
encoding: "utf-8",
await Promise.all(
["ts", "c"].map(async lang => {
const converter = converters()[lang]
let constants = ""
for (const srv of customServices) {
constants += converter(srv) + "\n"
}
const dir = join(pref, GENDIR, lang)
await mkdirp(dir)
return writeFile(join(dir, `constants.${lang}`), constants, {
encoding: "utf-8",
})
})
}))
)
// json specs
{
const dir = join(pref, GENDIR)
Expand All @@ -528,13 +530,15 @@ export async function saveLibFiles(
}

export async function buildAll(options: BuildOptions) {
await Promise.all((await glob("src/main*.ts")).map((file) => {
log(`build ${file}`)
return build(file, {
...options,
outDir: BINDIR + "/" + file.slice(8, -3),
await Promise.all(
(await glob("src/main*.ts")).map(file => {
log(`build ${file}`)
return build(file, {
...options,
outDir: BINDIR + "/" + file.slice(8, -3),
})
})
}))
)
}

export async function build(file: string, options: BuildOptions) {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/exitcodes.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const EXIT_CODE_EADDRINUSE = 100
export const EXIT_CODE_COMPILATION_ERROR = 101
export const EXIT_CODE_COMPILATION_ERROR = 101
11 changes: 5 additions & 6 deletions cli/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,7 @@ export async function init(dir: string | undefined, options: InitOptions) {
const pkg = readJSON5Sync("package.json") as PackageManifest

// name needed in worspace for install to work
if (!pkg.name)
pkg.name = dir || basename(process.cwd())
if (!pkg.name) pkg.name = dir || basename(process.cwd())

// ensure cli is added
addCliDependency(pkg)
Expand Down Expand Up @@ -505,12 +504,12 @@ export async function init(dir: string | undefined, options: InitOptions) {

return finishAdd(
`Your DeviceScript project is initialized.\n` +
`To get more help, https://microsoft.github.io/devicescript/getting-started/`,
`To get more help, https://microsoft.github.io/devicescript/getting-started/`,
["package.json", MAIN]
)
}

export interface AddSimOptions extends InitOptions { }
export interface AddSimOptions extends InitOptions {}

export async function addSim(options: AddSimOptions) {
log(`Adding simulator support`)
Expand Down Expand Up @@ -569,7 +568,7 @@ export interface AddNpmOptions extends InitOptions {
name?: string
}

export interface AddSettingsOptions extends InitOptions { }
export interface AddSettingsOptions extends InitOptions {}

export function execCmd(cmd: string) {
try {
Expand Down Expand Up @@ -729,7 +728,7 @@ export async function addTest(options: AddTestOptions) {
)
}

export interface AddTestOptions extends InitOptions { }
export interface AddTestOptions extends InitOptions {}

export function initAddCmds() {
addReqHandler<SideAddBoardReq, SideAddBoardResp>("addBoard", d =>
Expand Down
17 changes: 10 additions & 7 deletions cli/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ export async function runTest(
error(...data)
process.exit(1)
}
setTimeout(() => {
if (resolve) {
inst.devsStop()
console.log("timeout")
reject(new Error("timeout"))
}
}, parseInt(options.testTimeout) || 5000)
setTimeout(
() => {
if (resolve) {
inst.devsStop()
console.log("timeout")
reject(new Error("timeout"))
}
},
parseInt(options.testTimeout) || 5000
)
})
}

Expand Down
2 changes: 1 addition & 1 deletion cli/src/sidedata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const msgHandlers: Record<

export function addReqHandler<
Req extends SideReq,
Resp extends SideResp<Req["req"]> = SideResp<Req["req"]>
Resp extends SideResp<Req["req"]> = SideResp<Req["req"]>,
>(
req: Req["req"],
cb: (msg: Req, sender: DevToolsClient) => Promise<Resp["data"]>
Expand Down
Loading

0 comments on commit 25f9136

Please sign in to comment.