Skip to content

Commit 25f9136

Browse files
authored
Lint (#654)
1 parent dc633d5 commit 25f9136

File tree

102 files changed

+1942
-2328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1942
-2328
lines changed

cli/src/build.ts

+21-17
Original file line numberDiff line numberDiff line change
@@ -501,18 +501,20 @@ export async function saveLibFiles(
501501
const customServices =
502502
buildConfig.services.filter(srv => srv.catalog !== undefined) || []
503503
// generate source files
504-
await Promise.all(["ts", "c"].map(async(lang) => {
505-
const converter = converters()[lang]
506-
let constants = ""
507-
for (const srv of customServices) {
508-
constants += converter(srv) + "\n"
509-
}
510-
const dir = join(pref, GENDIR, lang)
511-
await mkdirp(dir)
512-
return writeFile(join(dir, `constants.${lang}`), constants, {
513-
encoding: "utf-8",
504+
await Promise.all(
505+
["ts", "c"].map(async lang => {
506+
const converter = converters()[lang]
507+
let constants = ""
508+
for (const srv of customServices) {
509+
constants += converter(srv) + "\n"
510+
}
511+
const dir = join(pref, GENDIR, lang)
512+
await mkdirp(dir)
513+
return writeFile(join(dir, `constants.${lang}`), constants, {
514+
encoding: "utf-8",
515+
})
514516
})
515-
}))
517+
)
516518
// json specs
517519
{
518520
const dir = join(pref, GENDIR)
@@ -528,13 +530,15 @@ export async function saveLibFiles(
528530
}
529531

530532
export async function buildAll(options: BuildOptions) {
531-
await Promise.all((await glob("src/main*.ts")).map((file) => {
532-
log(`build ${file}`)
533-
return build(file, {
534-
...options,
535-
outDir: BINDIR + "/" + file.slice(8, -3),
533+
await Promise.all(
534+
(await glob("src/main*.ts")).map(file => {
535+
log(`build ${file}`)
536+
return build(file, {
537+
...options,
538+
outDir: BINDIR + "/" + file.slice(8, -3),
539+
})
536540
})
537-
}))
541+
)
538542
}
539543

540544
export async function build(file: string, options: BuildOptions) {

cli/src/exitcodes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export const EXIT_CODE_EADDRINUSE = 100
2-
export const EXIT_CODE_COMPILATION_ERROR = 101
2+
export const EXIT_CODE_COMPILATION_ERROR = 101

cli/src/init.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,7 @@ export async function init(dir: string | undefined, options: InitOptions) {
452452
const pkg = readJSON5Sync("package.json") as PackageManifest
453453

454454
// name needed in worspace for install to work
455-
if (!pkg.name)
456-
pkg.name = dir || basename(process.cwd())
455+
if (!pkg.name) pkg.name = dir || basename(process.cwd())
457456

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

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

513-
export interface AddSimOptions extends InitOptions { }
512+
export interface AddSimOptions extends InitOptions {}
514513

515514
export async function addSim(options: AddSimOptions) {
516515
log(`Adding simulator support`)
@@ -569,7 +568,7 @@ export interface AddNpmOptions extends InitOptions {
569568
name?: string
570569
}
571570

572-
export interface AddSettingsOptions extends InitOptions { }
571+
export interface AddSettingsOptions extends InitOptions {}
573572

574573
export function execCmd(cmd: string) {
575574
try {
@@ -729,7 +728,7 @@ export async function addTest(options: AddTestOptions) {
729728
)
730729
}
731730

732-
export interface AddTestOptions extends InitOptions { }
731+
export interface AddTestOptions extends InitOptions {}
733732

734733
export function initAddCmds() {
735734
addReqHandler<SideAddBoardReq, SideAddBoardResp>("addBoard", d =>

cli/src/run.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,16 @@ export async function runTest(
8181
error(...data)
8282
process.exit(1)
8383
}
84-
setTimeout(() => {
85-
if (resolve) {
86-
inst.devsStop()
87-
console.log("timeout")
88-
reject(new Error("timeout"))
89-
}
90-
}, parseInt(options.testTimeout) || 5000)
84+
setTimeout(
85+
() => {
86+
if (resolve) {
87+
inst.devsStop()
88+
console.log("timeout")
89+
reject(new Error("timeout"))
90+
}
91+
},
92+
parseInt(options.testTimeout) || 5000
93+
)
9194
})
9295
}
9396

cli/src/sidedata.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const msgHandlers: Record<
5555

5656
export function addReqHandler<
5757
Req extends SideReq,
58-
Resp extends SideResp<Req["req"]> = SideResp<Req["req"]>
58+
Resp extends SideResp<Req["req"]> = SideResp<Req["req"]>,
5959
>(
6060
req: Req["req"],
6161
cb: (msg: Req, sender: DevToolsClient) => Promise<Resp["data"]>

0 commit comments

Comments
 (0)