Comparing version 2.0.3 to 2.0.4
@@ -182,3 +182,3 @@ #!/usr/bin/env node | ||
if (minVersionFromComment !== undefined && inTypesVersionDirectory) { | ||
throw new Error(`Already in the \`ts${lowVersion}\` directory, don't need \`// TypeScript Version\`.`); | ||
throw new Error(`Already in the \`ts${lowVersion}\` directory, don't need \`// Minimum TypeScript Version\`.`); | ||
} | ||
@@ -223,8 +223,7 @@ const minVersion = lowVersion | ||
function getTypeScriptVersionFromComment(text) { | ||
const searchString = "// TypeScript Version: "; | ||
const x = text.indexOf(searchString); | ||
if (x === -1) { | ||
const match = text.match(/\/\/ (?:Minimum)? TypeScript Version: /); | ||
if (!match) { | ||
return undefined; | ||
} | ||
let line = text.slice(x, text.indexOf("\n", x)); | ||
let line = text.slice(match.index, text.indexOf("\n", match.index)); | ||
if (line.endsWith("\r")) { | ||
@@ -231,0 +230,0 @@ line = line.slice(0, line.length - 1); |
@@ -32,2 +32,3 @@ "use strict"; | ||
lookFor("// TypeScript Version", "TypeScript version should be specified under header in `index.d.ts`."); | ||
lookFor("// Minimum TypeScript Version", "TypeScript version should be specified under header in `index.d.ts`."); | ||
return; | ||
@@ -34,0 +35,0 @@ } |
@@ -171,3 +171,3 @@ "use strict"; | ||
? "TypeScript@next features not yet supported." | ||
: `Fix with a comment '// TypeScript Version: ${nextHigherVersion}' just under the header.`; | ||
: `Fix with a comment '// Minimum TypeScript Version: ${nextHigherVersion}' just under the header.`; | ||
return msg + explain; | ||
@@ -174,0 +174,0 @@ } |
{ | ||
"name": "dtslint", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Runs tests on TypeScript definition files", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -112,3 +112,3 @@ `dtslint` tests a TypeScript declaration file for style and correctness. | ||
```ts | ||
// TypeScript Version: 2.1 | ||
// Minimum TypeScript Version: 2.1 | ||
``` | ||
@@ -115,0 +115,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
184863