Skip to content

Commit

Permalink
Make build tool configure TS to not complain about unused locals
Browse files Browse the repository at this point in the history
Also, prevent watch from stopping when a build errors
  • Loading branch information
marijnh committed Oct 11, 2019
1 parent bd217a4 commit f7cde72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 8 additions & 2 deletions bin/cm.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,19 @@ class Pkg {
}
}

const baseCompilerOptions = {
noImplicitReturns: false,
noUnusedLocals: false,
sourceMap: true
}

function tsPlugin(options) {
return require("rollup-plugin-typescript2")({
clean: true,
tsconfig: path.join(root, "tsconfig.base.json"),
tsconfigOverride: {
references: [],
compilerOptions: options,
compilerOptions: {...baseCompilerOptions, ...options},
include: []
}
})
Expand Down Expand Up @@ -261,7 +267,7 @@ class Watcher {
startWork() {
if (this.working) return
this.working = true
this.run().then(() => this.working = false, e => console.log(e.stack || String(e)))
this.run().catch(e => console.log(e.stack || String(e))).then(() => this.working = false)
}

async run() {
Expand Down
1 change: 0 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"types": [],
"noImplicitReturns": true,
"noUnusedLocals": true,
"sourceMap": true,
"strict": true,
"target": "es6",
"newLine": "lf",
Expand Down

0 comments on commit f7cde72

Please sign in to comment.