This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# npm-naming | ||
|
||
(This rule is specific to DefinitelyTyped.) | ||
|
||
Checks that the name of the type package matches a source package on npm. | ||
|
||
--- | ||
|
||
**Bad**: | ||
|
||
```ts | ||
// Type definitions for browser-only-package 1.2 | ||
``` | ||
|
||
* If the package is really browser-only, you have mark it with "non-npm package" | ||
* If the package actually has a matching npm package, you must use that name. | ||
|
||
**Good**: | ||
|
||
```ts | ||
// Type definitions for non-npm package browser-only-package 1.2 | ||
``` | ||
|
||
--- | ||
|
||
**Bad**: | ||
|
||
```ts | ||
// Type definitions for some-package 101.1 | ||
``` | ||
|
||
* The version number in the header must actually exist on npm for the source package. | ||
|
||
**Good**: | ||
|
||
```ts | ||
// Type definitions for some-package 10.1 | ||
``` | ||
|
||
--- | ||
|
||
**Bad**: | ||
|
||
`foo/index.d.ts`: | ||
|
||
```ts | ||
declare function f(): void; | ||
export default f; | ||
``` | ||
|
||
`foo/index.js`: | ||
|
||
```js | ||
module.exports = function () { | ||
}; | ||
``` | ||
|
||
* A commonjs module.exports assignment is not really an export default, and the d.ts should use the `export =` syntax. | ||
|
||
**Good**: | ||
|
||
`foo/index.d.ts`: | ||
|
||
```ts | ||
function f(): void; | ||
export = f; | ||
``` |