mirror of
https://github.com/chenasraf/DefinitelyTyped-tools.git
synced 2026-05-18 01:49:03 +00:00
Require either contributor url XOR githubUsername
Plus update typescript again to match DT
This commit is contained in:
@@ -307,7 +307,6 @@ function packageJson(packageName: string, version: string, dependencies: Record<
|
||||
"projects": ["https://project"],
|
||||
"contributors": [{
|
||||
"name": "The Dragon Quest Slime",
|
||||
"url": "https://github.com/slime",
|
||||
"githubUsername": "slime"
|
||||
}],
|
||||
"dependencies": {
|
||||
|
||||
@@ -44,8 +44,7 @@ describe(getTypingInfo, () => {
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Example",
|
||||
"url": "https://github.com/example",
|
||||
"githubUsername": "example"
|
||||
"url": "https://example.com/example",
|
||||
}
|
||||
],
|
||||
"devDependencies": {
|
||||
@@ -84,8 +83,7 @@ describe(getTypingInfo, () => {
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Example",
|
||||
"url": "https://github.com/ñ",
|
||||
"githubUsername": "ñ"
|
||||
"url": "https://zombo.com/ñ",
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
@@ -123,7 +121,6 @@ export function myFunction(arg:string): string;
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Example",
|
||||
"url": "https://github.com/ñ",
|
||||
"githubUsername": "ñ"
|
||||
}
|
||||
],
|
||||
@@ -193,7 +190,6 @@ export * from 'buffer';
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Noone",
|
||||
"url": "https://github.com/noone",
|
||||
"githubUsername": "noone"
|
||||
}
|
||||
],
|
||||
@@ -278,7 +274,6 @@ const a = new webpack.AutomaticPrefetchPlugin();
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Qubo",
|
||||
"url": "https://github.com/tkqubo",
|
||||
"githubUsername": "tkqubo"
|
||||
}
|
||||
],
|
||||
@@ -360,7 +355,6 @@ import route = require('@ember/routing/route');
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Chris Krycho",
|
||||
"url": "https://github.com/chriskrycho",
|
||||
"githubUsername": "chriskrycho"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Type Ref Fails",
|
||||
"url": "https://github.com/typeref-fails",
|
||||
"githubUsername": "typeref-fails"
|
||||
"url": "https://youtube.com/typeref-fails"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Nathan Bierema",
|
||||
"url": "https://github.com/Methuselah96",
|
||||
"githubUsername": "Methuselah96"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Typescript Bot",
|
||||
"url": "https://github.com/typescript-bot",
|
||||
"githubUsername": "typescript-bot"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Typescript Bot",
|
||||
"url": "https://github.com/typescript-bot",
|
||||
"githubUsername": "typescript-bot"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Typescript Bot",
|
||||
"url": "https://github.com/typescript-bot",
|
||||
"githubUsername": "typescript-bot"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Typescript Bot",
|
||||
"url": "https://github.com/typescript-bot",
|
||||
"githubUsername": "typescript-bot"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Typescript Bot",
|
||||
"url": "https://github.com/typescript-bot",
|
||||
"githubUsername": "typescript-bot"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { join } from "path";
|
||||
import { consoleTestResultHandler, runTest } from "tslint/lib/test";
|
||||
import { existsSync, readdirSync, statSync } from "fs";
|
||||
import { CompilerOptionsRaw, checkPackageJsonContents, checkTsconfig } from "../src/checks";
|
||||
import { CompilerOptionsRaw, checkTsconfig } from "../src/checks";
|
||||
import { assertPackageIsNotDeprecated } from "../src/index";
|
||||
|
||||
const testDir = __dirname;
|
||||
@@ -66,23 +66,19 @@ describe("dtslint", () => {
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Rafael Souza Fijalkowski",
|
||||
"url": "https://github.com/rafaelsouzaf",
|
||||
"githubUsername": "rafaelsouzaf"
|
||||
},
|
||||
{
|
||||
"name": "Justin Simms",
|
||||
"url": "https://github.com/jhsimms",
|
||||
"githubUsername": "jhsimms"
|
||||
},
|
||||
{
|
||||
"name": "Simon Schick",
|
||||
"url": "https://github.com/SimonSchick",
|
||||
"githubUsername": "SimonSchick"
|
||||
},
|
||||
{
|
||||
"name": "Rodrigo Saboya",
|
||||
"url": "https://github.com/saboya",
|
||||
"githubUsername": "saboya"
|
||||
"url": "https://example.com/saboya",
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -117,9 +113,6 @@ describe("dtslint", () => {
|
||||
]);
|
||||
});
|
||||
});
|
||||
describe("checkPackageJson", () => {
|
||||
;
|
||||
});
|
||||
describe("assertPackageIsNotDeprecated", () => {
|
||||
it("disallows packages that are in notNeededPackages.json", () => {
|
||||
expect(() => assertPackageIsNotDeprecated("foo", '{ "packages": { "foo": { } } }')).toThrow(
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jane Doe",
|
||||
"url": "https://github.com/janedoe",
|
||||
"githubUsername": "janedoe"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -85,6 +85,9 @@ export function validatePackageJson(packageName: string, packageJsonPath: string
|
||||
// "dependencies" / "license" checked by types-publisher,
|
||||
// TODO: asserts for other fields in types-publisher
|
||||
break;
|
||||
// TODO: Only until Jake drops it
|
||||
case "unmangledName":
|
||||
break;
|
||||
case "typesVersions":
|
||||
case "types":
|
||||
if (!needsTypesVersions) {
|
||||
@@ -296,28 +299,29 @@ function checkPackageJsonContributors(packageJsonPath: string, packageJsonContri
|
||||
const errors: string[] = []
|
||||
for (const c of packageJsonContributors) {
|
||||
if (typeof c !== "object" || c === null) {
|
||||
errors.push(`${packageJsonPath} has bad "contributors": must be an array of type Array<{ name: string, url: string, githubUsername: string}>.`)
|
||||
errors.push(`${packageJsonPath} has bad "contributors": must be an array of type Array<{ name: string, url: string } | { name: string, githubUsername: string}>.`)
|
||||
continue
|
||||
}
|
||||
if (!("name" in c) || typeof c.name !== "string") {
|
||||
errors.push(`${packageJsonPath} has bad "name" in contributor ${JSON.stringify(c)}
|
||||
Must be an object of type { name: string, url: string, githubUsername: string }.`)
|
||||
Must be an object of type { name: string, url: string } | { name: string, githubUsername: string}.`)
|
||||
}
|
||||
else if (c.name === "My Self") {
|
||||
errors.push(`${packageJsonPath} has bad "name" in contributor ${JSON.stringify(c)}
|
||||
Author name should be your name, not the default.`)
|
||||
}
|
||||
if (!("githubUsername" in c) || typeof c.githubUsername !== "string") {
|
||||
errors.push(`${packageJsonPath} has bad "githubUsername" in contributor ${JSON.stringify(c)}
|
||||
Must be an object of type { name: string, url: string, githubUsername: string }.`)
|
||||
if ("githubUsername" in c) {
|
||||
if (typeof c.githubUsername !== "string") {
|
||||
errors.push(`${packageJsonPath} has bad "githubUsername" in contributor ${JSON.stringify(c)}
|
||||
Must be an object of type { name: string, url: string } | { name: string, githubUsername: string}.`)
|
||||
}
|
||||
else if ("url" in c) {
|
||||
errors.push(`${packageJsonPath} has bad contributor: should not have both "githubUsername" and "url" properties in contributor ${JSON.stringify(c)}`)
|
||||
}
|
||||
}
|
||||
else if (!("url" in c) || typeof c.url !== "string") {
|
||||
else if ("url" in c && typeof c.url !== "string") {
|
||||
errors.push(`${packageJsonPath} has bad "url" in contributor ${JSON.stringify(c)}
|
||||
Must be an object of type { name: string, url: string, githubUsername: string }.`)
|
||||
}
|
||||
else if (c.url !== "https://github.com/" + c.githubUsername) {
|
||||
errors.push(`${packageJsonPath} has bad "url" in contributor ${JSON.stringify(c)}
|
||||
Must be "https://github.com/${c.githubUsername}".`)
|
||||
Must be an object of type { name: string, url: string } | { name: string, githubUsername: string}.`)
|
||||
}
|
||||
for (const key in c) {
|
||||
switch (key) {
|
||||
@@ -326,7 +330,7 @@ Must be "https://github.com/${c.githubUsername}".`)
|
||||
case "githubUsername":
|
||||
break;
|
||||
default:
|
||||
errors.push(`${packageJsonPath} has bad contributor ${JSON.stringify(c)}: should not include property ${key}`);
|
||||
errors.push(`${packageJsonPath} has bad contributor: should not include property ${key} in ${JSON.stringify(c)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,22 +26,18 @@ describe("validatePackageJson", () => {
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Rafael Souza Fijalkowski",
|
||||
"url": "https://github.com/rafaelsouzaf",
|
||||
"githubUsername": "rafaelsouzaf"
|
||||
},
|
||||
{
|
||||
"name": "Justin Simms",
|
||||
"url": "https://github.com/jhsimms",
|
||||
"githubUsername": "jhsimms"
|
||||
"url": "https://example.com/jhsimms",
|
||||
},
|
||||
{
|
||||
"name": "Simon Schick",
|
||||
"url": "https://github.com/SimonSchick",
|
||||
"githubUsername": "SimonSchick"
|
||||
},
|
||||
{
|
||||
"name": "Rodrigo Saboya",
|
||||
"url": "https://github.com/saboya",
|
||||
"githubUsername": "saboya"
|
||||
}
|
||||
]
|
||||
@@ -153,9 +149,3 @@ describe("makeTypesVersionsForPackageJson", () => {
|
||||
}`);
|
||||
});
|
||||
});
|
||||
|
||||
function dedent(strings: TemplateStringsArray): string {
|
||||
expect(strings).toHaveLength(1);
|
||||
const x = strings[0].trim();
|
||||
return x.replace(/\n +/g, "\n");
|
||||
}
|
||||
|
||||
@@ -8330,9 +8330,9 @@ typedarray@^0.0.6:
|
||||
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==
|
||||
|
||||
typescript@next:
|
||||
version "5.1.0-dev.20230410"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.0-dev.20230410.tgz#f5ccbb6629c3eb817914c6c2ffed75e5c100ad11"
|
||||
integrity sha512-7aQS6nNYt3XVJic6FBmnxasor6MZFwi5Odj0Z0UtHode4ID21KgCjFgJcdtiWrmSIZ/PLfrp6QiE179hwbB5tQ==
|
||||
version "5.1.0-dev.20230417"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.0-dev.20230417.tgz#3c6acdd4e49858bc10f7bdf535e768513ebc55e9"
|
||||
integrity sha512-bEjKfPjxAgvrUViweybCkB++3y9qyF4hCBeXOf998QQDJpLAcaQWmub4IoPZ5yTvrkuGuNzFpy46tytA4p1fbA==
|
||||
|
||||
uglify-js@^3.1.4:
|
||||
version "3.17.4"
|
||||
|
||||
Reference in New Issue
Block a user