@definitelytyped/dts-critic
Advanced tools
Comparing version 0.0.108 to 0.0.109-next.0
@@ -13,3 +13,3 @@ "use strict"; | ||
function getPackageDownloads(dtName) { | ||
const npmName = index_1.dtToNpmName(dtName); | ||
const npmName = (0, index_1.dtToNpmName)(dtName); | ||
const url = `https://api.npmjs.org/downloads/point/last-month/${npmName}`; | ||
@@ -54,3 +54,3 @@ const result = JSON.parse(cp.execFileSync("curl", ["--silent", "-L", url], { encoding: "utf8" })); | ||
for (const item of fs.readdirSync(dtTypesPath)) { | ||
isNpm[item] = index_1.getNpmInfo(item).isNpm; | ||
isNpm[item] = (0, index_1.getNpmInfo)(item).isNpm; | ||
} | ||
@@ -119,3 +119,3 @@ fs.writeFileSync(isNpmPath, JSON.stringify(isNpm), { encoding: "utf8" }); | ||
const dtsPath = path.join(getDtTypesPath(args.dtPath), dtPackage, "index.d.ts"); | ||
const errors = index_1.dtsCritic(dtsPath, /* sourcePath */ undefined, opts, args.debug); | ||
const errors = (0, index_1.dtsCritic)(dtsPath, /* sourcePath */ undefined, opts, args.debug); | ||
return { package: args.package, output: errors }; | ||
@@ -128,3 +128,3 @@ } | ||
function getOptions(modeArg, enabledErrors) { | ||
const mode = index_1.parseMode(modeArg); | ||
const mode = (0, index_1.parseMode)(modeArg); | ||
if (!mode) { | ||
@@ -144,3 +144,3 @@ throw new Error(`Could not find mode named '${modeArg}'.`); | ||
for (const name of errorNames) { | ||
const error = index_1.parseExportErrorKind(name); | ||
const error = (0, index_1.parseExportErrorKind)(name); | ||
if (error === undefined) { | ||
@@ -156,3 +156,3 @@ throw new Error(`Could not find error named '${name}'.`); | ||
try { | ||
const errors = index_1.checkSource(index_1.findDtsName(args.dtsFile), args.dtsFile, args.jsFile, new Map(), args.debug); | ||
const errors = (0, index_1.checkSource)((0, index_1.findDtsName)(args.dtsFile), args.dtsFile, args.jsFile, new Map(), args.debug); | ||
console.log(formatErrors(errors)); | ||
@@ -196,3 +196,3 @@ } | ||
} | ||
return index_1.getNpmInfo(name).isNpm; | ||
return (0, index_1.getNpmInfo)(name).isNpm; | ||
} | ||
@@ -199,0 +199,0 @@ function main() { |
@@ -33,3 +33,3 @@ "use strict"; | ||
if (hasNpmNamingLintRule(entry + "/tslint.json")) { | ||
const errors = index_1.dtsCritic(entry + "/index.d.ts"); | ||
const errors = (0, index_1.dtsCritic)(entry + "/index.d.ts"); | ||
for (const error of errors) { | ||
@@ -36,0 +36,0 @@ switch (error.kind) { |
@@ -77,6 +77,6 @@ "use strict"; | ||
function dtsCritic(dtsPath, sourcePath, options = defaultOpts, debug = false) { | ||
if (!command_exists_1.sync("tar")) { | ||
if (!(0, command_exists_1.sync)("tar")) { | ||
throw new Error("You need to have tar installed to run dts-critic, you can get it from https://www.gnu.org/software/tar"); | ||
} | ||
if (!command_exists_1.sync("npm")) { | ||
if (!(0, command_exists_1.sync)("npm")) { | ||
throw new Error("You need to have npm installed to run dts-critic, you can get it from https://www.npmjs.com/get-npm"); | ||
@@ -83,0 +83,0 @@ } |
@@ -14,15 +14,15 @@ "use strict"; | ||
absolutePath() { | ||
expect(index_1.findDtsName("~/dt/types/jquery/index.d.ts")).toBe("jquery"); | ||
expect((0, index_1.findDtsName)("~/dt/types/jquery/index.d.ts")).toBe("jquery"); | ||
}, | ||
relativePath() { | ||
expect(index_1.findDtsName("jquery/index.d.ts")).toBe("jquery"); | ||
expect((0, index_1.findDtsName)("jquery/index.d.ts")).toBe("jquery"); | ||
}, | ||
currentDirectory() { | ||
expect(index_1.findDtsName("index.d.ts")).toBe("DefinitelyTyped-tools"); | ||
expect((0, index_1.findDtsName)("index.d.ts")).toBe("DefinitelyTyped-tools"); | ||
}, | ||
relativeCurrentDirectory() { | ||
expect(index_1.findDtsName("./index.d.ts")).toBe("DefinitelyTyped-tools"); | ||
expect((0, index_1.findDtsName)("./index.d.ts")).toBe("DefinitelyTyped-tools"); | ||
}, | ||
emptyDirectory() { | ||
expect(index_1.findDtsName("")).toBe("DefinitelyTyped-tools"); | ||
expect((0, index_1.findDtsName)("")).toBe("DefinitelyTyped-tools"); | ||
} | ||
@@ -32,6 +32,6 @@ }); | ||
nonNpm() { | ||
expect(index_1.getNpmInfo("parseltongue")).toEqual({ isNpm: false }); | ||
expect((0, index_1.getNpmInfo)("parseltongue")).toEqual({ isNpm: false }); | ||
}, | ||
npm() { | ||
expect(index_1.getNpmInfo("typescript")).toEqual({ | ||
expect((0, index_1.getNpmInfo)("typescript")).toEqual({ | ||
isNpm: true, | ||
@@ -45,6 +45,6 @@ versions: expect.arrayContaining(["3.7.5"]), | ||
nonScoped() { | ||
expect(index_1.dtToNpmName("content-type")).toBe("content-type"); | ||
expect((0, index_1.dtToNpmName)("content-type")).toBe("content-type"); | ||
}, | ||
scoped() { | ||
expect(index_1.dtToNpmName("babel__core")).toBe("@babel/core"); | ||
expect((0, index_1.dtToNpmName)("babel__core")).toBe("@babel/core"); | ||
} | ||
@@ -54,9 +54,9 @@ }); | ||
existent() { | ||
expect(index_1.parseExportErrorKind("NoDefaultExport")).toBe(index_1.ErrorKind.NoDefaultExport); | ||
expect((0, index_1.parseExportErrorKind)("NoDefaultExport")).toBe(index_1.ErrorKind.NoDefaultExport); | ||
}, | ||
existentDifferentCase() { | ||
expect(index_1.parseExportErrorKind("JspropertyNotinDTS")).toBe(index_1.ErrorKind.JsPropertyNotInDts); | ||
expect((0, index_1.parseExportErrorKind)("JspropertyNotinDTS")).toBe(index_1.ErrorKind.JsPropertyNotInDts); | ||
}, | ||
nonexistent() { | ||
expect(index_1.parseExportErrorKind("FakeError")).toBe(undefined); | ||
expect((0, index_1.parseExportErrorKind)("FakeError")).toBe(undefined); | ||
} | ||
@@ -77,6 +77,6 @@ }); | ||
noErrors() { | ||
expect(index_1.checkSource("noErrors", testsource("noErrors.d.ts"), testsource("noErrors.js"), allErrors, false)).toEqual([]); | ||
expect((0, index_1.checkSource)("noErrors", testsource("noErrors.d.ts"), testsource("noErrors.js"), allErrors, false)).toEqual([]); | ||
}, | ||
missingJsProperty() { | ||
expect(index_1.checkSource("missingJsProperty", testsource("missingJsProperty.d.ts"), testsource("missingJsProperty.js"), allErrors, false)).toEqual(expect.arrayContaining([ | ||
expect((0, index_1.checkSource)("missingJsProperty", testsource("missingJsProperty.d.ts"), testsource("missingJsProperty.js"), allErrors, false)).toEqual(expect.arrayContaining([ | ||
{ | ||
@@ -90,6 +90,6 @@ kind: index_1.ErrorKind.JsPropertyNotInDts, | ||
noMissingWebpackProperty() { | ||
expect(index_1.checkSource("missingJsProperty", testsource("webpackPropertyNames.d.ts"), testsource("webpackPropertyNames.js"), allErrors, false)).toHaveLength(0); | ||
expect((0, index_1.checkSource)("missingJsProperty", testsource("webpackPropertyNames.d.ts"), testsource("webpackPropertyNames.js"), allErrors, false)).toHaveLength(0); | ||
}, | ||
missingDtsProperty() { | ||
expect(index_1.checkSource("missingDtsProperty", testsource("missingDtsProperty.d.ts"), testsource("missingDtsProperty.js"), allErrors, false)).toEqual(expect.arrayContaining([ | ||
expect((0, index_1.checkSource)("missingDtsProperty", testsource("missingDtsProperty.d.ts"), testsource("missingDtsProperty.js"), allErrors, false)).toEqual(expect.arrayContaining([ | ||
{ | ||
@@ -107,3 +107,3 @@ kind: index_1.ErrorKind.DtsPropertyNotInJs, | ||
missingDefaultExport() { | ||
expect(index_1.checkSource("missingDefault", testsource("missingDefault.d.ts"), testsource("missingDefault.js"), allErrors, false)).toEqual(expect.arrayContaining([ | ||
expect((0, index_1.checkSource)("missingDefault", testsource("missingDefault.d.ts"), testsource("missingDefault.js"), allErrors, false)).toEqual(expect.arrayContaining([ | ||
{ | ||
@@ -124,3 +124,3 @@ kind: index_1.ErrorKind.NoDefaultExport, | ||
missingJsSignatureExportEquals() { | ||
expect(index_1.checkSource("missingJsSignatureExportEquals", testsource("missingJsSignatureExportEquals.d.ts"), testsource("missingJsSignatureExportEquals.js"), allErrors, false)).toEqual(expect.arrayContaining([ | ||
expect((0, index_1.checkSource)("missingJsSignatureExportEquals", testsource("missingJsSignatureExportEquals.d.ts"), testsource("missingJsSignatureExportEquals.js"), allErrors, false)).toEqual(expect.arrayContaining([ | ||
{ | ||
@@ -134,3 +134,3 @@ kind: index_1.ErrorKind.JsSignatureNotInDts, | ||
missingJsSignatureNoExportEquals() { | ||
expect(index_1.checkSource("missingJsSignatureNoExportEquals", testsource("missingJsSignatureNoExportEquals.d.ts"), testsource("missingJsSignatureNoExportEquals.js"), allErrors, false)).toEqual(expect.arrayContaining([ | ||
expect((0, index_1.checkSource)("missingJsSignatureNoExportEquals", testsource("missingJsSignatureNoExportEquals.d.ts"), testsource("missingJsSignatureNoExportEquals.js"), allErrors, false)).toEqual(expect.arrayContaining([ | ||
{ | ||
@@ -147,3 +147,3 @@ kind: index_1.ErrorKind.JsSignatureNotInDts, | ||
missingDtsSignature() { | ||
expect(index_1.checkSource("missingDtsSignature", testsource("missingDtsSignature.d.ts"), testsource("missingDtsSignature.js"), allErrors, false)).toEqual(expect.arrayContaining([ | ||
expect((0, index_1.checkSource)("missingDtsSignature", testsource("missingDtsSignature.d.ts"), testsource("missingDtsSignature.js"), allErrors, false)).toEqual(expect.arrayContaining([ | ||
{ | ||
@@ -157,3 +157,3 @@ kind: index_1.ErrorKind.DtsSignatureNotInJs, | ||
missingExportEquals() { | ||
expect(index_1.checkSource("missingExportEquals", testsource("missingExportEquals.d.ts"), testsource("missingExportEquals.js"), allErrors, false)).toEqual(expect.arrayContaining([ | ||
expect((0, index_1.checkSource)("missingExportEquals", testsource("missingExportEquals.d.ts"), testsource("missingExportEquals.js"), allErrors, false)).toEqual(expect.arrayContaining([ | ||
{ | ||
@@ -171,6 +171,6 @@ kind: index_1.ErrorKind.NeedsExportEquals, | ||
noErrors() { | ||
expect(index_1.dtsCritic(testsource("dts-critic.d.ts"), testsource("dts-critic.js"))).toEqual([]); | ||
expect((0, index_1.dtsCritic)(testsource("dts-critic.d.ts"), testsource("dts-critic.js"))).toEqual([]); | ||
}, | ||
noMatchingNpmPackage() { | ||
expect(index_1.dtsCritic(testsource("parseltongue.d.ts"))).toEqual([ | ||
expect((0, index_1.dtsCritic)(testsource("parseltongue.d.ts"))).toEqual([ | ||
{ | ||
@@ -191,3 +191,3 @@ kind: index_1.ErrorKind.NoMatchingNpmPackage, | ||
noMatchingNpmVersion() { | ||
expect(index_1.dtsCritic(testsource("typescript.d.ts"))).toEqual([ | ||
expect((0, index_1.dtsCritic)(testsource("typescript.d.ts"))).toEqual([ | ||
{ | ||
@@ -201,3 +201,3 @@ kind: index_1.ErrorKind.NoMatchingNpmVersion, | ||
nonNpmHasMatchingPackage() { | ||
expect(index_1.dtsCritic(testsource("tslib.d.ts"))).toEqual([ | ||
expect((0, index_1.dtsCritic)(testsource("tslib.d.ts"))).toEqual([ | ||
{ | ||
@@ -204,0 +204,0 @@ kind: index_1.ErrorKind.NonNpmHasMatchingPackage, |
{ | ||
"name": "@definitelytyped/dts-critic", | ||
"version": "0.0.108", | ||
"version": "0.0.109-next.0", | ||
"author": "Nathan Shively-Sanders", | ||
@@ -22,3 +22,2 @@ "description": "Checks a new .d.ts against the Javascript source and tells you what problems it has", | ||
"@types/command-exists": "^1.2.0", | ||
"@types/node": "~10.17.0", | ||
"@types/rimraf": "^3.0.0", | ||
@@ -28,5 +27,3 @@ "@types/semver": "^6.0.1", | ||
"@types/tmp": "^0.2.0", | ||
"@types/yargs": "^12.0.8", | ||
"strip-json-comments": "^2.0.1", | ||
"typescript": "*" | ||
"strip-json-comments": "^2.0.1" | ||
}, | ||
@@ -38,3 +35,3 @@ "main": "dist/index.js", | ||
"dt": "node dist/dt.js", | ||
"prepublishOnly": "npm run build" | ||
"test": "../../node_modules/.bin/jest --config ../../jest.config.js packages/dts-critic" | ||
}, | ||
@@ -60,3 +57,3 @@ "repository": { | ||
}, | ||
"gitHead": "2c09689559893c039e59a511539e9d7c63e0b878" | ||
"gitHead": "922921a994587fca4a99d5ee0fceda6d1570f5c4" | ||
} |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
193771
6