Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Add npm-naming documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sandersn committed Oct 31, 2019
1 parent 8eba4ac commit 3322677
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions docs/npm-naming.md
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;
```

0 comments on commit 3322677

Please sign in to comment.