Code review comments

This commit is contained in:
Mohamed Hegazy 2017-03-07 23:03:47 -08:00
parent fb218b7897
commit e9f82145b7
11 changed files with 12 additions and 12 deletions

View file

@ -5880,11 +5880,11 @@ namespace ts {
}
}
const checkJsDirectiveRegEx = /^\/\/\/?\s*@check(\s+(true|false))?/gim;
const checkJsDirectiveRegEx = /^\/\/\/?\s*(@ts-check|@ts-nocheck)\s*$/gim;
const checkJsDirectiveMatchResult = checkJsDirectiveRegEx.exec(comment);
if (checkJsDirectiveMatchResult) {
checkJsDirective = {
enabled: compareStrings(checkJsDirectiveMatchResult[2], "false", /*ignoreCase*/ true) !== Comparison.EqualTo,
enabled: compareStrings(checkJsDirectiveMatchResult[1], "@ts-check", /*ignoreCase*/ true) === Comparison.EqualTo,
end: range.end,
pos: range.pos
};

View file

@ -904,7 +904,7 @@ namespace ts {
Debug.assert(!!sourceFile.bindDiagnostics);
const bindDiagnostics = sourceFile.bindDiagnostics;
// For JavaScript files, we don't want to report semantic errors unless ecplicitlly requested.
// For JavaScript files, we don't want to report semantic errors unless explicitly requested.
const includeCheckDiagnostics = !isSourceFileJavaScript(sourceFile) ||
(sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : options.checkJs);
const checkDiagnostics = includeCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : [];

View file

@ -3,7 +3,7 @@ tests/cases/compiler/a.js(4,1): error TS2322: Type '0' is not assignable to type
==== tests/cases/compiler/a.js (1 errors) ====
// @check
// @ts-check
var x = "string";
x = 0;
~

View file

@ -3,7 +3,7 @@ tests/cases/compiler/a.js(4,1): error TS2322: Type '0' is not assignable to type
==== tests/cases/compiler/a.js (1 errors) ====
// @check
// @ts-check
var x = "string";
x = 0;
~

View file

@ -3,7 +3,7 @@ tests/cases/compiler/a.js(4,1): error TS2322: Type '0' is not assignable to type
==== tests/cases/compiler/a.js (1 errors) ====
// @check true
// @ts-check
var x = "string";
x = 0;
~

View file

@ -1,6 +1,6 @@
=== tests/cases/compiler/a.js ===
// @check false
// @ts-nocheck
var x = "string";
>x : Symbol(x, Decl(a.js, 2, 3))

View file

@ -1,6 +1,6 @@
=== tests/cases/compiler/a.js ===
// @check false
// @ts-nocheck
var x = "string";
>x : string
>"string" : "string"

View file

@ -3,6 +3,6 @@
// @noEmit: true
// @fileName: a.js
// @check
// @ts-check
var x = "string";
x = 0;

View file

@ -2,6 +2,6 @@
// @noEmit: true
// @fileName: a.js
// @check
// @ts-check
var x = "string";
x = 0;

View file

@ -3,6 +3,6 @@
// @noEmit: true
// @fileName: a.js
// @check true
// @ts-check
var x = "string";
x = 0;

View file

@ -3,6 +3,6 @@
// @noEmit: true
// @fileName: a.js
// @check false
// @ts-nocheck
var x = "string";
x = 0;