Skip to content

Commit 3674bfd

Browse files
committed
Emit warning diagnostics (e.g. type errors) and clean up comment-out code
1 parent ded8080 commit 3674bfd

File tree

1 file changed

+9
-45
lines changed

1 file changed

+9
-45
lines changed

lib/incremental-typescript-compiler.js

Lines changed: 9 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ const ts = require('typescript');
1616
const debugCompiler = require('debug')('ember-cli-typescript:compiler');
1717
const debugAutoresolve = require('debug')('ember-cli-typescript:autoresolve');
1818

19-
const formatHost = {
20-
getCanonicalFileName: path => path,
21-
getCurrentDirectory: ts.sys.getCurrentDirectory,
22-
getNewLine: () => ts.sys.newLine,
23-
};
24-
2519
module.exports = class IncrementalTypescriptCompiler {
2620
constructor(app, project) {
2721
if (project._incrementalTsCompiler) {
@@ -113,7 +107,8 @@ module.exports = class IncrementalTypescriptCompiler {
113107

114108
let project = this.project;
115109
let outDir = this.outDir();
116-
let tsc = compile(project, { outDir, watch: true }, {
110+
111+
compile(project, { outDir, watch: true }, {
117112
reportWatchStatus: (diagnostic) => {
118113
let text = diagnostic.messageText;
119114

@@ -139,46 +134,15 @@ module.exports = class IncrementalTypescriptCompiler {
139134
},
140135

141136
reportDiagnostic: (diagnostic) => {
142-
// if (diagnostic.category !== 2) {
143-
// this.project.ui.write(ts.formatDiagnostic(diagnostic, formatHost));
144-
// }
137+
if (diagnostic.category !== 2) {
138+
this.project.ui.write(ts.formatDiagnostic(diagnostic, {
139+
getCanonicalFileName: path => path,
140+
getCurrentDirectory: ts.sys.getCurrentDirectory,
141+
getNewLine: () => ts.sys.newLine,
142+
}));
143+
}
145144
}
146145
});
147-
148-
// tsc.stdout.on('data', data => {
149-
// let text = data
150-
// .toString()
151-
// .trim()
152-
// .replace(/\u001bc/g, '');
153-
154-
// if (text) {
155-
// this.project.ui.writeLine(text);
156-
// }
157-
158-
// if (data.indexOf('Starting incremental compilation') !== -1) {
159-
// debugCompiler('tsc detected a file change');
160-
// this.willRebuild();
161-
// clearTimeout(this._pendingAutoresolve);
162-
// }
163-
164-
// if (data.indexOf('Compilation complete') !== -1) {
165-
// debugCompiler('rebuild completed');
166-
167-
// this.didSync();
168-
169-
// if (this._didAutoresolve) {
170-
// this._touchRebuildTrigger();
171-
// this.maxBuildCount++;
172-
// }
173-
174-
// clearTimeout(this._pendingAutoresolve);
175-
// this._didAutoresolve = false;
176-
// }
177-
// });
178-
179-
// tsc.stderr.on('data', data => {
180-
// this.project.ui.writeError(data.toString().trim());
181-
// });
182146
}
183147

184148
willRebuild() {

0 commit comments

Comments
 (0)