Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@definitelytyped/dts-critic

Package Overview
Dependencies
Maintainers
7
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@definitelytyped/dts-critic - npm Package Compare versions

Comparing version 0.0.112-next.4 to 0.0.112-next.9

76

develop.ts

@@ -17,3 +17,3 @@ import fs = require("fs");

CheckOptions,
parseMode
parseMode,
} from "./index";

@@ -106,3 +106,3 @@

const isNpmJson = getAllIsNpm(dtPath);
return dtPackages.filter(pkg => isNpmPackage(pkg, /* header */ undefined, isNpmJson));
return dtPackages.filter((pkg) => isNpmPackage(pkg, /* header */ undefined, isNpmJson));
}

@@ -127,3 +127,3 @@

}
console.log(`List of non-npm packages on DT:\n${nonNpm.map(name => `DT name: ${name}\n`).join("")}`);
console.log(`List of non-npm packages on DT:\n${nonNpm.map((name) => `DT name: ${name}\n`).join("")}`);
}

@@ -153,3 +153,3 @@

function checkPackages(args: { packages: string[] } & CommonArgs): void {
const results = args.packages.map(pkg => doCheck({ package: pkg, ...args }));
const results = args.packages.map((pkg) => doCheck({ package: pkg, ...args }));
printResults(results, args.json);

@@ -203,3 +203,3 @@ }

}
return new Map(errors.map(err => [err, true]));
return new Map(errors.map((err) => [err, true]));
}

@@ -269,3 +269,3 @@

default: "../DefinitelyTyped",
describe: "Path of DT repository cloned locally."
describe: "Path of DT repository cloned locally.",
},

@@ -276,3 +276,3 @@ mode: {

choices: [Mode.NameOnly, Mode.Code],
describe: "Mode that defines which group of checks will be made."
describe: "Mode that defines which group of checks will be made.",
},

@@ -282,3 +282,3 @@ enableError: {

string: true,
describe: "Enable checking for a specific export error."
describe: "Enable checking for a specific export error.",
},

@@ -288,3 +288,3 @@ debug: {

default: false,
describe: "Turn debug logging on."
describe: "Turn debug logging on.",
},

@@ -294,4 +294,4 @@ json: {

default: false,
describe: "Format output result as json."
}
describe: "Format output result as json.",
},
},

@@ -308,3 +308,3 @@ checkAll

required: true,
describe: "Number of packages to be checked."
describe: "Number of packages to be checked.",
},

@@ -314,3 +314,3 @@ dtPath: {

default: "../DefinitelyTyped",
describe: "Path of DT repository cloned locally."
describe: "Path of DT repository cloned locally.",
},

@@ -321,3 +321,3 @@ mode: {

choices: [Mode.NameOnly, Mode.Code],
describe: "Mode that defines which group of checks will be made."
describe: "Mode that defines which group of checks will be made.",
},

@@ -327,3 +327,3 @@ enableError: {

string: true,
describe: "Enable checking for a specific export error."
describe: "Enable checking for a specific export error.",
},

@@ -333,3 +333,3 @@ debug: {

default: false,
describe: "Turn debug logging on."
describe: "Turn debug logging on.",
},

@@ -339,4 +339,4 @@ json: {

default: false,
describe: "Format output result as json."
}
describe: "Format output result as json.",
},
},

@@ -353,3 +353,3 @@ checkPopular

required: true,
describe: "Number of packages to be checked."
describe: "Number of packages to be checked.",
},

@@ -359,3 +359,3 @@ dtPath: {

default: "../DefinitelyTyped",
describe: "Path of DT repository cloned locally."
describe: "Path of DT repository cloned locally.",
},

@@ -366,3 +366,3 @@ mode: {

choices: [Mode.NameOnly, Mode.Code],
describe: "Mode that defines which group of checks will be made."
describe: "Mode that defines which group of checks will be made.",
},

@@ -372,3 +372,3 @@ enableError: {

string: true,
describe: "Enable checking for a specific export error."
describe: "Enable checking for a specific export error.",
},

@@ -378,3 +378,3 @@ debug: {

default: false,
describe: "Turn debug logging on."
describe: "Turn debug logging on.",
},

@@ -384,4 +384,4 @@ json: {

default: false,
describe: "Format output result as json."
}
describe: "Format output result as json.",
},
},

@@ -398,3 +398,3 @@ checkUnpopular

required: true,
describe: "DT name of a package."
describe: "DT name of a package.",
},

@@ -404,3 +404,3 @@ dtPath: {

default: "../DefinitelyTyped",
describe: "Path of DT repository cloned locally."
describe: "Path of DT repository cloned locally.",
},

@@ -411,3 +411,3 @@ mode: {

choices: [Mode.NameOnly, Mode.Code],
describe: "Mode that defines which group of checks will be made."
describe: "Mode that defines which group of checks will be made.",
},

@@ -417,3 +417,3 @@ enableError: {

string: true,
describe: "Enable checking for a specific export error."
describe: "Enable checking for a specific export error.",
},

@@ -423,3 +423,3 @@ debug: {

default: false,
describe: "Turn debug logging on."
describe: "Turn debug logging on.",
},

@@ -429,4 +429,4 @@ json: {

default: false,
describe: "Format output result as json."
}
describe: "Format output result as json.",
},
},

@@ -443,3 +443,3 @@ checkPackage

required: true,
describe: "Path of JavaScript file."
describe: "Path of JavaScript file.",
},

@@ -450,3 +450,3 @@ dtsFile: {

required: true,
describe: "Path of declaration file."
describe: "Path of declaration file.",
},

@@ -456,4 +456,4 @@ debug: {

default: false,
describe: "Turn debug logging on."
}
describe: "Turn debug logging on.",
},
},

@@ -469,4 +469,4 @@ checkFile

default: "../DefinitelyTyped",
describe: "Path of DT repository cloned locally."
}
describe: "Path of DT repository cloned locally.",
},
},

@@ -473,0 +473,0 @@ getNonNpm

@@ -73,3 +73,3 @@ "use strict";

const isNpmJson = getAllIsNpm(dtPath);
return dtPackages.filter(pkg => isNpmPackage(pkg, /* header */ undefined, isNpmJson));
return dtPackages.filter((pkg) => isNpmPackage(pkg, /* header */ undefined, isNpmJson));
}

@@ -94,3 +94,3 @@ function getNonNpm(args) {

}
console.log(`List of non-npm packages on DT:\n${nonNpm.map(name => `DT name: ${name}\n`).join("")}`);
console.log(`List of non-npm packages on DT:\n${nonNpm.map((name) => `DT name: ${name}\n`).join("")}`);
}

@@ -108,3 +108,3 @@ function checkAll(args) {

function checkPackages(args) {
const results = args.packages.map(pkg => doCheck({ package: pkg, ...args }));
const results = args.packages.map((pkg) => doCheck({ package: pkg, ...args }));
printResults(results, args.json);

@@ -149,3 +149,3 @@ }

}
return new Map(errors.map(err => [err, true]));
return new Map(errors.map((err) => [err, true]));
}

@@ -204,3 +204,3 @@ function checkFile(args) {

default: "../DefinitelyTyped",
describe: "Path of DT repository cloned locally."
describe: "Path of DT repository cloned locally.",
},

@@ -211,3 +211,3 @@ mode: {

choices: [index_1.Mode.NameOnly, index_1.Mode.Code],
describe: "Mode that defines which group of checks will be made."
describe: "Mode that defines which group of checks will be made.",
},

@@ -217,3 +217,3 @@ enableError: {

string: true,
describe: "Enable checking for a specific export error."
describe: "Enable checking for a specific export error.",
},

@@ -223,3 +223,3 @@ debug: {

default: false,
describe: "Turn debug logging on."
describe: "Turn debug logging on.",
},

@@ -229,4 +229,4 @@ json: {

default: false,
describe: "Format output result as json."
}
describe: "Format output result as json.",
},
}, checkAll)

@@ -238,3 +238,3 @@ .command("check-popular", "Check source and declaration of most popular DT packages that are on NPM.", {

required: true,
describe: "Number of packages to be checked."
describe: "Number of packages to be checked.",
},

@@ -244,3 +244,3 @@ dtPath: {

default: "../DefinitelyTyped",
describe: "Path of DT repository cloned locally."
describe: "Path of DT repository cloned locally.",
},

@@ -251,3 +251,3 @@ mode: {

choices: [index_1.Mode.NameOnly, index_1.Mode.Code],
describe: "Mode that defines which group of checks will be made."
describe: "Mode that defines which group of checks will be made.",
},

@@ -257,3 +257,3 @@ enableError: {

string: true,
describe: "Enable checking for a specific export error."
describe: "Enable checking for a specific export error.",
},

@@ -263,3 +263,3 @@ debug: {

default: false,
describe: "Turn debug logging on."
describe: "Turn debug logging on.",
},

@@ -269,4 +269,4 @@ json: {

default: false,
describe: "Format output result as json."
}
describe: "Format output result as json.",
},
}, checkPopular)

@@ -278,3 +278,3 @@ .command("check-unpopular", "Check source and declaration of least popular DT packages that are on NPM.", {

required: true,
describe: "Number of packages to be checked."
describe: "Number of packages to be checked.",
},

@@ -284,3 +284,3 @@ dtPath: {

default: "../DefinitelyTyped",
describe: "Path of DT repository cloned locally."
describe: "Path of DT repository cloned locally.",
},

@@ -291,3 +291,3 @@ mode: {

choices: [index_1.Mode.NameOnly, index_1.Mode.Code],
describe: "Mode that defines which group of checks will be made."
describe: "Mode that defines which group of checks will be made.",
},

@@ -297,3 +297,3 @@ enableError: {

string: true,
describe: "Enable checking for a specific export error."
describe: "Enable checking for a specific export error.",
},

@@ -303,3 +303,3 @@ debug: {

default: false,
describe: "Turn debug logging on."
describe: "Turn debug logging on.",
},

@@ -309,4 +309,4 @@ json: {

default: false,
describe: "Format output result as json."
}
describe: "Format output result as json.",
},
}, checkUnpopular)

@@ -318,3 +318,3 @@ .command("check-package", "Check source and declaration of a DT package.", {

required: true,
describe: "DT name of a package."
describe: "DT name of a package.",
},

@@ -324,3 +324,3 @@ dtPath: {

default: "../DefinitelyTyped",
describe: "Path of DT repository cloned locally."
describe: "Path of DT repository cloned locally.",
},

@@ -331,3 +331,3 @@ mode: {

choices: [index_1.Mode.NameOnly, index_1.Mode.Code],
describe: "Mode that defines which group of checks will be made."
describe: "Mode that defines which group of checks will be made.",
},

@@ -337,3 +337,3 @@ enableError: {

string: true,
describe: "Enable checking for a specific export error."
describe: "Enable checking for a specific export error.",
},

@@ -343,3 +343,3 @@ debug: {

default: false,
describe: "Turn debug logging on."
describe: "Turn debug logging on.",
},

@@ -349,4 +349,4 @@ json: {

default: false,
describe: "Format output result as json."
}
describe: "Format output result as json.",
},
}, checkPackage)

@@ -358,3 +358,3 @@ .command("check-file", "Check a JavaScript file and its matching declaration file.", {

required: true,
describe: "Path of JavaScript file."
describe: "Path of JavaScript file.",
},

@@ -365,3 +365,3 @@ dtsFile: {

required: true,
describe: "Path of declaration file."
describe: "Path of declaration file.",
},

@@ -371,4 +371,4 @@ debug: {

default: false,
describe: "Turn debug logging on."
}
describe: "Turn debug logging on.",
},
}, checkFile)

@@ -379,4 +379,4 @@ .command("get-non-npm", "Get list of DT packages whose source package is not on NPM", {

default: "../DefinitelyTyped",
describe: "Path of DT repository cloned locally."
}
describe: "Path of DT repository cloned locally.",
},
}, getNonNpm)

@@ -383,0 +383,0 @@ .demandCommand(1)

@@ -148,3 +148,3 @@ "use strict";

describe: "Path of declaration file to be critiqued.",
type: "string"
type: "string",
})

@@ -154,3 +154,3 @@ .demandOption("dts", "Please provide a path to a d.ts file for me to critique.")

describe: "Path of JavaScript file to be used as source.",
type: "string"
type: "string",
})

@@ -161,3 +161,3 @@ .option("mode", {

default: Mode.NameOnly,
choices: [Mode.NameOnly, Mode.Code]
choices: [Mode.NameOnly, Mode.Code],
})

@@ -167,3 +167,3 @@ .option("debug", {

type: "boolean",
default: false
default: false,
})

@@ -193,3 +193,3 @@ .help().argv;

const infoResult = cp.spawnSync("npm", ["info", npmName, "--json", "--silent", "versions", "dist-tags"], {
encoding: "utf8"
encoding: "utf8",
});

@@ -212,3 +212,3 @@ const info = JSON.parse(infoResult.stdout || infoResult.stderr);

versions: info.versions,
tags: info["dist-tags"]
tags: info["dist-tags"],
};

@@ -228,3 +228,3 @@ }

${name}-browser
`
`,
};

@@ -250,3 +250,3 @@ }

Add -browser to the end of your name to make sure it doesn't conflict with existing npm packages.`
Add -browser to the end of your name to make sure it doesn't conflict with existing npm packages.`,
};

@@ -269,3 +269,3 @@ }

For example, if you're trying to match the latest version, use ${lateststring}.`
For example, if you're trying to match the latest version, use ${lateststring}.`,
};

@@ -350,3 +350,3 @@ }

}
return diagnostics.errors.filter(err => { var _a; return (_a = enabledErrors.get(err.kind)) !== null && _a !== void 0 ? _a : exports.defaultErrors.includes(err.kind); });
return diagnostics.errors.filter((err) => { var _a; return (_a = enabledErrors.get(err.kind)) !== null && _a !== void 0 ? _a : exports.defaultErrors.includes(err.kind); });
}

@@ -398,3 +398,3 @@ exports.checkSource = checkSource;

lines.push("Type's properties:");
lines.push(...properties.map(p => p.getName()));
lines.push(...properties.map((p) => p.getName()));
}

@@ -404,3 +404,3 @@ const signatures = type.getConstructSignatures().concat(type.getCallSignatures());

lines.push("Type's signatures:");
lines.push(...signatures.map(s => checker.signatureToString(s)));
lines.push(...signatures.map((s) => checker.signatureToString(s)));
}

@@ -416,3 +416,3 @@ lines.push(`Type string: ${checker.typeToString(type)}`);

const tscOpts = {
allowJs: true
allowJs: true,
};

@@ -437,3 +437,3 @@ const jsProgram = typescript_1.default.createProgram([sourcePath], tscOpts);

To learn more about 'export =' syntax, see ${exportEqualsLink}.`
To learn more about 'export =' syntax, see ${exportEqualsLink}.`,
};

@@ -454,3 +454,3 @@ errors.push(error);

The most common way to resolve this error is to use 'export =' syntax instead of 'export default'.
To learn more about 'export =' syntax, see ${exportEqualsLink}.`
To learn more about 'export =' syntax, see ${exportEqualsLink}.`,
});

@@ -463,3 +463,3 @@ }

dtsExportType: dtsDiagnostics.exportType,
errors
errors,
};

@@ -578,8 +578,8 @@ }

const configPath = path.join(dtsDir, "tsconfig.json");
const { config } = typescript_1.default.readConfigFile(configPath, p => fs.readFileSync(p, { encoding: "utf8" }));
const { config } = typescript_1.default.readConfigFile(configPath, (p) => fs.readFileSync(p, { encoding: "utf8" }));
const parseConfigHost = {
fileExists: fs.existsSync,
readDirectory: typescript_1.default.sys.readDirectory,
readFile: file => fs.readFileSync(file, { encoding: "utf8" }),
useCaseSensitiveFileNames: true
readFile: (file) => fs.readFileSync(file, { encoding: "utf8" }),
useCaseSensitiveFileNames: true,
};

@@ -591,5 +591,5 @@ const parsed = typescript_1.default.parseJsonConfigFileContent(config, parseConfigHost, path.resolve(dtsDir));

function getDtsModuleSymbol(sourceFile, checker, name) {
if (matches(sourceFile, node => typescript_1.default.isModuleDeclaration(node))) {
if (matches(sourceFile, (node) => typescript_1.default.isModuleDeclaration(node))) {
const npmName = dtToNpmName(name);
const moduleSymbol = checker.getAmbientModules().find(symbol => symbol.getName() === `"${npmName}"`);
const moduleSymbol = checker.getAmbientModules().find((symbol) => symbol.getName() === `"${npmName}"`);
if (moduleSymbol) {

@@ -646,3 +646,3 @@ return inferenceSuccess(moduleSymbol);

start: exportDefault,
length: "export default".length
length: "export default".length,
};

@@ -656,3 +656,3 @@ }

start: exportDefault.declarations[0].getStart(),
length: exportDefault.declarations[0].getWidth()
length: exportDefault.declarations[0].getWidth(),
};

@@ -696,3 +696,3 @@ }

message: `The declaration doesn't match the JavaScript module '${name}'. Reason:
The JavaScript module can be called or constructed, but the declaration module cannot.`
The JavaScript module can be called or constructed, but the declaration module cannot.`,
});

@@ -707,3 +707,3 @@ }

The most common way to resolve this error is to use 'export =' syntax.
To learn more about 'export =' syntax, see ${exportEqualsLink}.`
To learn more about 'export =' syntax, see ${exportEqualsLink}.`,
});

@@ -716,3 +716,3 @@ }

message: `The declaration doesn't match the JavaScript module '${name}'. Reason:
The declaration module can be called or constructed, but the JavaScript module cannot.`
The declaration module can be called or constructed, but the JavaScript module cannot.`,
});

@@ -726,7 +726,7 @@ }

continue;
if (!dtsProperties.find(s => s.getName() === sourceProperty.getName())) {
if (!dtsProperties.find((s) => s.getName() === sourceProperty.getName())) {
errors.push({
kind: ErrorKind.JsPropertyNotInDts,
message: `The declaration doesn't match the JavaScript module '${name}'. Reason:
The JavaScript module exports a property named '${sourceProperty.getName()}', which is missing from the declaration module.`
The JavaScript module exports a property named '${sourceProperty.getName()}', which is missing from the declaration module.`,
});

@@ -739,7 +739,7 @@ }

continue;
if (!sourceProperties.find(s => s.getName() === dtsProperty.getName())) {
if (!sourceProperties.find((s) => s.getName() === dtsProperty.getName())) {
const error = {
kind: ErrorKind.DtsPropertyNotInJs,
message: `The declaration doesn't match the JavaScript module '${name}'. Reason:
The declaration module exports a property named '${dtsProperty.getName()}', which is missing from the JavaScript module.`
The declaration module exports a property named '${dtsProperty.getName()}', which is missing from the JavaScript module.`,
};

@@ -750,3 +750,3 @@ const declaration = dtsProperty.declarations && dtsProperty.declarations.length > 0 ? dtsProperty.declarations[0] : undefined;

start: declaration.getStart(),
length: declaration.getWidth()
length: declaration.getWidth(),
};

@@ -770,3 +770,3 @@ }

if (node.modifiers) {
return node.modifiers.some(modifier => modifier.kind === typescript_1.default.SyntaxKind.ExportKeyword);
return node.modifiers.some((modifier) => modifier.kind === typescript_1.default.SyntaxKind.ExportKeyword);
}

@@ -773,0 +773,0 @@ return false;

@@ -27,3 +27,3 @@ "use strict";

expect((0, index_1.findDtsName)("")).toBe("DefinitelyTyped-tools");
}
},
});

@@ -38,5 +38,5 @@ suite("getNpmInfo", {

versions: expect.arrayContaining(["3.7.5"]),
tags: expect.objectContaining({ latest: expect.stringContaining("") })
tags: expect.objectContaining({ latest: expect.stringContaining("") }),
});
}
},
});

@@ -49,3 +49,3 @@ suite("dtToNpmName", {

expect((0, index_1.dtToNpmName)("babel__core")).toBe("@babel/core");
}
},
});

@@ -61,3 +61,3 @@ suite("parseExportErrorKind", {

expect((0, index_1.parseExportErrorKind)("FakeError")).toBe(undefined);
}
},
});

@@ -70,3 +70,3 @@ const allErrors = new Map([

[index_1.ErrorKind.DtsPropertyNotInJs, true],
[index_1.ErrorKind.JsPropertyNotInDts, true]
[index_1.ErrorKind.JsPropertyNotInDts, true],
]);

@@ -85,4 +85,4 @@ function testsource(filename) {

message: `The declaration doesn't match the JavaScript module 'missingJsProperty'. Reason:
The JavaScript module exports a property named 'foo', which is missing from the declaration module.`
}
The JavaScript module exports a property named 'foo', which is missing from the declaration module.`,
},
]));

@@ -101,5 +101,5 @@ },

start: 65,
length: 11
}
}
length: 11,
},
},
]));

@@ -118,5 +118,5 @@ },

start: 0,
length: 32
}
}
length: 32,
},
},
]));

@@ -129,4 +129,4 @@ },

message: `The declaration doesn't match the JavaScript module 'missingJsSignatureExportEquals'. Reason:
The JavaScript module can be called or constructed, but the declaration module cannot.`
}
The JavaScript module can be called or constructed, but the declaration module cannot.`,
},
]));

@@ -142,4 +142,4 @@ },

The most common way to resolve this error is to use 'export =' syntax.
To learn more about 'export =' syntax, see https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require.`
}
To learn more about 'export =' syntax, see https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require.`,
},
]));

@@ -152,4 +152,4 @@ },

message: `The declaration doesn't match the JavaScript module 'missingDtsSignature'. Reason:
The declaration module can be called or constructed, but the JavaScript module cannot.`
}
The declaration module can be called or constructed, but the JavaScript module cannot.`,
},
]));

@@ -164,6 +164,6 @@ },

To learn more about 'export =' syntax, see https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require.`
}
To learn more about 'export =' syntax, see https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require.`,
},
]));
}
},
});

@@ -186,4 +186,4 @@ suite("dtsCritic", {

Add -browser to the end of your name to make sure it doesn't conflict with existing npm packages.`
}
Add -browser to the end of your name to make sure it doesn't conflict with existing npm packages.`,
},
]);

@@ -196,4 +196,4 @@ },

message: expect.stringContaining(`The types for 'typescript' must match a version that exists on npm.
You should copy the major and minor version from the package on npm.`)
}
You should copy the major and minor version from the package on npm.`),
},
]);

@@ -209,7 +209,7 @@ },

tslib-browser
`
}
`,
},
]);
}
},
});
//# sourceMappingURL=index.test.js.map

@@ -10,3 +10,3 @@ /// <reference types="jest" />

ErrorKind,
ExportErrorKind
ExportErrorKind,
} from "./index";

@@ -37,3 +37,3 @@

expect(findDtsName("")).toBe("DefinitelyTyped-tools");
}
},
});

@@ -48,5 +48,5 @@ suite("getNpmInfo", {

versions: expect.arrayContaining(["3.7.5"]),
tags: expect.objectContaining({ latest: expect.stringContaining("") })
tags: expect.objectContaining({ latest: expect.stringContaining("") }),
});
}
},
});

@@ -59,3 +59,3 @@ suite("dtToNpmName", {

expect(dtToNpmName("babel__core")).toBe("@babel/core");
}
},
});

@@ -71,3 +71,3 @@ suite("parseExportErrorKind", {

expect(parseExportErrorKind("FakeError")).toBe(undefined);
}
},
});

@@ -81,3 +81,3 @@

[ErrorKind.DtsPropertyNotInJs, true],
[ErrorKind.JsPropertyNotInDts, true]
[ErrorKind.JsPropertyNotInDts, true],
]);

@@ -109,4 +109,4 @@

message: `The declaration doesn't match the JavaScript module 'missingJsProperty'. Reason:
The JavaScript module exports a property named 'foo', which is missing from the declaration module.`
}
The JavaScript module exports a property named 'foo', which is missing from the declaration module.`,
},
])

@@ -143,5 +143,5 @@ );

start: 65,
length: 11
}
}
length: 11,
},
},
])

@@ -170,5 +170,5 @@ );

start: 0,
length: 32
}
}
length: 32,
},
},
])

@@ -191,4 +191,4 @@ );

message: `The declaration doesn't match the JavaScript module 'missingJsSignatureExportEquals'. Reason:
The JavaScript module can be called or constructed, but the declaration module cannot.`
}
The JavaScript module can be called or constructed, but the declaration module cannot.`,
},
])

@@ -214,4 +214,4 @@ );

The most common way to resolve this error is to use 'export =' syntax.
To learn more about 'export =' syntax, see https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require.`
}
To learn more about 'export =' syntax, see https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require.`,
},
])

@@ -234,4 +234,4 @@ );

message: `The declaration doesn't match the JavaScript module 'missingDtsSignature'. Reason:
The declaration module can be called or constructed, but the JavaScript module cannot.`
}
The declaration module can be called or constructed, but the JavaScript module cannot.`,
},
])

@@ -256,7 +256,7 @@ );

To learn more about 'export =' syntax, see https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require.`
}
To learn more about 'export =' syntax, see https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require.`,
},
])
);
}
},
});

@@ -279,4 +279,4 @@ suite("dtsCritic", {

Add -browser to the end of your name to make sure it doesn't conflict with existing npm packages.`
}
Add -browser to the end of your name to make sure it doesn't conflict with existing npm packages.`,
},
]);

@@ -289,4 +289,4 @@ },

message: expect.stringContaining(`The types for 'typescript' must match a version that exists on npm.
You should copy the major and minor version from the package on npm.`)
}
You should copy the major and minor version from the package on npm.`),
},
]);

@@ -302,6 +302,6 @@ },

tslib-browser
`
}
`,
},
]);
}
},
});

@@ -31,3 +31,3 @@ import yargs = require("yargs");

/** Declaration module has signatures, but JavaScript module does not. */
DtsSignatureNotInJs = "DtsSignatureNotInJs"
DtsSignatureNotInJs = "DtsSignatureNotInJs",
}

@@ -39,3 +39,3 @@

/** Checks based on the source JavaScript code, in addition to the checks performed in name-only mode. */
Code = "code"
Code = "code",
}

@@ -155,3 +155,3 @@

describe: "Path of declaration file to be critiqued.",
type: "string"
type: "string",
})

@@ -161,3 +161,3 @@ .demandOption("dts", "Please provide a path to a d.ts file for me to critique.")

describe: "Path of JavaScript file to be used as source.",
type: "string"
type: "string",
})

@@ -168,3 +168,3 @@ .option("mode", {

default: Mode.NameOnly,
choices: [Mode.NameOnly, Mode.Code]
choices: [Mode.NameOnly, Mode.Code],
})

@@ -174,3 +174,3 @@ .option("debug", {

type: "boolean",
default: false
default: false,
})

@@ -202,3 +202,3 @@ .help().argv;

const infoResult = cp.spawnSync("npm", ["info", npmName, "--json", "--silent", "versions", "dist-tags"], {
encoding: "utf8"
encoding: "utf8",
});

@@ -219,3 +219,3 @@ const info = JSON.parse(infoResult.stdout || infoResult.stderr);

versions: info.versions as string[],
tags: info["dist-tags"] as { [tag: string]: string | undefined }
tags: info["dist-tags"] as { [tag: string]: string | undefined },
};

@@ -235,3 +235,3 @@ }

${name}-browser
`
`,
};

@@ -258,3 +258,3 @@ }

Add -browser to the end of your name to make sure it doesn't conflict with existing npm packages.`
Add -browser to the end of your name to make sure it doesn't conflict with existing npm packages.`,
};

@@ -277,3 +277,3 @@ }

For example, if you're trying to match the latest version, use ${lateststring}.`
For example, if you're trying to match the latest version, use ${lateststring}.`,
};

@@ -372,3 +372,3 @@ }

return diagnostics.errors.filter(err => enabledErrors.get(err.kind) ?? defaultErrors.includes(err.kind));
return diagnostics.errors.filter((err) => enabledErrors.get(err.kind) ?? defaultErrors.includes(err.kind));
}

@@ -418,3 +418,3 @@

lines.push("Type's properties:");
lines.push(...properties.map(p => p.getName()));
lines.push(...properties.map((p) => p.getName()));
}

@@ -425,3 +425,3 @@

lines.push("Type's signatures:");
lines.push(...signatures.map(s => checker.signatureToString(s)));
lines.push(...signatures.map((s) => checker.signatureToString(s)));
}

@@ -439,3 +439,3 @@ lines.push(`Type string: ${checker.typeToString(type)}`);

const tscOpts = {
allowJs: true
allowJs: true,
};

@@ -466,3 +466,3 @@

To learn more about 'export =' syntax, see ${exportEqualsLink}.`
To learn more about 'export =' syntax, see ${exportEqualsLink}.`,
} as const;

@@ -491,3 +491,3 @@ errors.push(error);

The most common way to resolve this error is to use 'export =' syntax instead of 'export default'.
To learn more about 'export =' syntax, see ${exportEqualsLink}.`
To learn more about 'export =' syntax, see ${exportEqualsLink}.`,
});

@@ -501,3 +501,3 @@ }

dtsExportType: dtsDiagnostics.exportType,
errors
errors,
};

@@ -637,8 +637,8 @@ }

const configPath = path.join(dtsDir, "tsconfig.json");
const { config } = ts.readConfigFile(configPath, p => fs.readFileSync(p, { encoding: "utf8" }));
const { config } = ts.readConfigFile(configPath, (p) => fs.readFileSync(p, { encoding: "utf8" }));
const parseConfigHost: ts.ParseConfigHost = {
fileExists: fs.existsSync,
readDirectory: ts.sys.readDirectory,
readFile: file => fs.readFileSync(file, { encoding: "utf8" }),
useCaseSensitiveFileNames: true
readFile: (file) => fs.readFileSync(file, { encoding: "utf8" }),
useCaseSensitiveFileNames: true,
};

@@ -655,5 +655,5 @@ const parsed = ts.parseJsonConfigFileContent(config, parseConfigHost, path.resolve(dtsDir));

): InferenceResult<ts.Symbol> {
if (matches(sourceFile, node => ts.isModuleDeclaration(node))) {
if (matches(sourceFile, (node) => ts.isModuleDeclaration(node))) {
const npmName = dtToNpmName(name);
const moduleSymbol = checker.getAmbientModules().find(symbol => symbol.getName() === `"${npmName}"`);
const moduleSymbol = checker.getAmbientModules().find((symbol) => symbol.getName() === `"${npmName}"`);
if (moduleSymbol) {

@@ -722,3 +722,3 @@ return inferenceSuccess(moduleSymbol);

start: exportDefault,
length: "export default".length
length: "export default".length,
};

@@ -733,3 +733,3 @@ }

start: exportDefault.declarations[0].getStart(),
length: exportDefault.declarations[0].getWidth()
length: exportDefault.declarations[0].getWidth(),
};

@@ -782,3 +782,3 @@ }

message: `The declaration doesn't match the JavaScript module '${name}'. Reason:
The JavaScript module can be called or constructed, but the declaration module cannot.`
The JavaScript module can be called or constructed, but the declaration module cannot.`,
});

@@ -792,3 +792,3 @@ } else {

The most common way to resolve this error is to use 'export =' syntax.
To learn more about 'export =' syntax, see ${exportEqualsLink}.`
To learn more about 'export =' syntax, see ${exportEqualsLink}.`,
});

@@ -802,3 +802,3 @@ }

message: `The declaration doesn't match the JavaScript module '${name}'. Reason:
The declaration module can be called or constructed, but the JavaScript module cannot.`
The declaration module can be called or constructed, but the JavaScript module cannot.`,
});

@@ -812,7 +812,7 @@ }

if (ignoreProperty(sourceProperty)) continue;
if (!dtsProperties.find(s => s.getName() === sourceProperty.getName())) {
if (!dtsProperties.find((s) => s.getName() === sourceProperty.getName())) {
errors.push({
kind: ErrorKind.JsPropertyNotInDts,
message: `The declaration doesn't match the JavaScript module '${name}'. Reason:
The JavaScript module exports a property named '${sourceProperty.getName()}', which is missing from the declaration module.`
The JavaScript module exports a property named '${sourceProperty.getName()}', which is missing from the declaration module.`,
});

@@ -825,7 +825,7 @@ }

if (ignoreProperty(dtsProperty)) continue;
if (!sourceProperties.find(s => s.getName() === dtsProperty.getName())) {
if (!sourceProperties.find((s) => s.getName() === dtsProperty.getName())) {
const error: MissingExport = {
kind: ErrorKind.DtsPropertyNotInJs,
message: `The declaration doesn't match the JavaScript module '${name}'. Reason:
The declaration module exports a property named '${dtsProperty.getName()}', which is missing from the JavaScript module.`
The declaration module exports a property named '${dtsProperty.getName()}', which is missing from the JavaScript module.`,
};

@@ -837,3 +837,3 @@ const declaration =

start: declaration.getStart(),
length: declaration.getWidth()
length: declaration.getWidth(),
};

@@ -862,3 +862,3 @@ }

if (node.modifiers) {
return node.modifiers.some(modifier => modifier.kind === ts.SyntaxKind.ExportKeyword);
return node.modifiers.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword);
}

@@ -984,3 +984,3 @@ return false;

CommonJs = "CommonJs",
ES6 = "ES6"
ES6 = "ES6",
}

@@ -995,3 +995,3 @@

Required = "Required",
NotRequired = "Not required"
NotRequired = "Not required",
}

@@ -1001,3 +1001,3 @@

ExportEquals = "export =",
ES6Like = "ES6-like"
ES6Like = "ES6-like",
}

@@ -1027,3 +1027,3 @@

Error,
Success
Success,
}

@@ -1030,0 +1030,0 @@

{
"name": "@definitelytyped/dts-critic",
"version": "0.0.112-next.4",
"version": "0.0.112-next.9",
"author": "Nathan Shively-Sanders",

@@ -10,3 +10,3 @@ "description": "Checks a new .d.ts against the Javascript source and tells you what problems it has",

"dependencies": {
"@definitelytyped/header-parser": "^0.0.111",
"@definitelytyped/header-parser": "^0.0.112-next.9",
"command-exists": "^1.2.8",

@@ -55,3 +55,3 @@ "rimraf": "^3.0.2",

},
"gitHead": "fe885eda2d86bbb618d26cb277d62a666330efb1"
"gitHead": "66585fec16b4faf7e45fa49036c0df0872c58d90"
}

@@ -1,1 +0,1 @@

export default function(): void;
export default function (): void;

@@ -1,1 +0,1 @@

export default function(): void;
export default function (): void;

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc