Fix lint too
This commit is contained in:
Родитель
c57bea7239
Коммит
5f323ae121
10
index.ts
10
index.ts
|
@ -12,10 +12,12 @@ Example:
|
|||
|
||||
/** Parse-able TypeScript versions. Only add to this list if we will support this version on DefinitelyTyped. */
|
||||
export type TypeScriptVersion =
|
||||
"2.0" | "2.1" | "2.2" | "2.3" | "2.4" | "2.5" | "2.6" | "2.7" | "2.8" | "2.9" | "3.0" | "3.1" | "3.2" | "3.3" | "3.4" | "3.5" | "3.6" | "3.7";
|
||||
| "2.0" | "2.1" | "2.2" | "2.3" | "2.4" | "2.5" | "2.6" | "2.7" | "2.8" | "2.9"
|
||||
| "3.0" | "3.1" | "3.2" | "3.3" | "3.4" | "3.5" | "3.6" | "3.7";
|
||||
export namespace TypeScriptVersion {
|
||||
export const all: ReadonlyArray<TypeScriptVersion> =
|
||||
["2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "3.0", "3.1", "3.2", "3.3", "3.4", "3.5", "3.6", "3.7"];
|
||||
["2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "2.8", "2.9",
|
||||
"3.0", "3.1", "3.2", "3.3", "3.4", "3.5", "3.6", "3.7"];
|
||||
export const lowest = all[0];
|
||||
/** Latest version that may be specified in a `// TypeScript Version:` header. */
|
||||
export const latest = all[all.length - 1];
|
||||
|
@ -252,7 +254,9 @@ function parseLabel(strict: boolean): pm.Parser<Label> {
|
|||
}
|
||||
|
||||
const [name, major, minor] = [reverse(nameReverse), reverse(majorReverse), reverse(minorReverse)];
|
||||
return pm.makeSuccess<Label>(end, { name, major: intOfString(major), minor: minor === "x" ? 0 : intOfString(minor) });
|
||||
return pm.makeSuccess<Label>(
|
||||
end,
|
||||
{ name, major: intOfString(major), minor: minor === "x" ? 0 : intOfString(minor) });
|
||||
|
||||
function fail(msg?: string): pm.Reply<Label> {
|
||||
let expected = "foo MAJOR.MINOR";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "definitelytyped-header-parser",
|
||||
"author": "Nathan Shively-Sanders <nathansa@microsoft.com> (http://github.com/Microsoft/definitelytyped-header-parser)",
|
||||
"version": "3.7.1",
|
||||
"version": "3.7.2",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
|
|
12
test/test.ts
12
test/test.ts
|
@ -70,8 +70,7 @@ describe("parse", () => {
|
|||
// TypeScript Version: 2.2
|
||||
|
||||
...file content...`;
|
||||
console.log(parseHeaderOrFail(src))
|
||||
assert.equal(parseHeaderOrFail(src).nonNpm, true);
|
||||
assert.equal(parseHeaderOrFail(src).nonNpm, true);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -91,20 +90,21 @@ describe("parseTypeScriptVersionLine", () => {
|
|||
|
||||
it("allows post 3 version tags", () => {
|
||||
const src = "// TypeScript Version: 3.0";
|
||||
assert.equal(parseTypeScriptVersionLine(src), "3.0")
|
||||
})
|
||||
assert.equal(parseTypeScriptVersionLine(src), "3.0");
|
||||
});
|
||||
|
||||
it("does not allow unallowed version tags", () => {
|
||||
const src = "// TypeScript Version: 4.7";
|
||||
assert.throws(() => parseTypeScriptVersionLine(src), `Could not parse version: line is ${src}`);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe("tagsToUpdate", () => {
|
||||
it("works", () => {
|
||||
assert.deepEqual(
|
||||
TypeScriptVersion.tagsToUpdate("2.5"),
|
||||
["ts2.5", "ts2.6", "ts2.7", "ts2.8", "ts2.9", "ts3.0", "ts3.1", "ts3.2", "ts3.3", "ts3.4", "ts3.5", "ts3.6", "ts3.7", "latest"]);
|
||||
["ts2.5", "ts2.6", "ts2.7", "ts2.8", "ts2.9",
|
||||
"ts3.0", "ts3.1", "ts3.2", "ts3.3", "ts3.4", "ts3.5", "ts3.6", "ts3.7", "latest"]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче