🤖 Merge PR #46404 new package: validate-npm-package-name by @carboneater

* feat: new package: validate-npm-package-name

* fix: Fix Project Repo URL

Co-authored-by: Gabriel Fournier <gfournier@focusoptimization.com>
This commit is contained in:
Gabriel Fournier 2020-07-30 13:17:18 -04:00 committed by GitHub
parent 3851d98583
commit 67d24513cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,19 @@
// Type definitions for validate-npm-package-license 3.0
// Project: https://github.com/kemitchell/validate-npm-package-license.js#readme
// Definitions by: Gabriel Fournier <https://github.com/carboneater>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace validateLicense {
interface Result {
inFile?: string;
spdx?: true;
unlicensed?: true;
validForOldPackages: boolean;
validForNewPackages: boolean;
warnings?: string[];
}
}
declare function validateLicense(license: string): validateLicense.Result;
export = validateLicense;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"validate-npm-package-license-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -0,0 +1,9 @@
import validateLicense = require('validate-npm-package-license');
validateLicense('MIT'); // $ExpectType Result
validateLicense('BSD-2-Clause'); // $ExpectType Result
validateLicense('Apache-2.0'); // $ExpectType Result
validateLicense('ISC'); // $ExpectType Result
validateLicense('UNLICENSED'); // $ExpectType Result
validateLicense('(GPL-3.0-only OR BSD-2-Clause)'); // $ExpectType Result
validateLicense('LicenseRef-Made-Up'); // $ExpectType Result