Copy README.md and PULL_REQUEST_TEMPLATE.md from types-2.0

This commit is contained in:
Andy Hanson
2016-11-16 10:02:19 -08:00
parent 34ad2b8bb8
commit b18b48560c
2 changed files with 25 additions and 37 deletions
+1
View File
@@ -4,6 +4,7 @@ Please fill in this template.
- [ ] Test the change in your own code.
- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped#make-a-pull-request).
- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped#common-mistakes).
- [ ] Run `npm run lint -- package-name` if a `tslint.json` is present.
If adding a new definition:
- [ ] The package does not provide its own types, and you can not add them.
+24 -37
View File
@@ -109,48 +109,15 @@ Your package should have this structure:
| foo-tests.ts | This contains sample code which tests the typings. This code does *not* run, but it is type-checked. |
| tsconfig.json | This allows you to run `tsc` within the package. |
`index.d.ts` should start with a header looking like:
Generate these by running `npm run new-package -- new-package-name`.
```ts
// Type definitions for foo 1.2
// Project: https://github.com/baz/foo
// Definitions by: My Self <https://github.com/me>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
```
The `Project` link does not have to be to GitHub, but prefer linking to a source code repository rather than to a project website.
`tsconfig.json` should look like this:
```json
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"foo-tests.ts"
]
}
```
These should be identical accross projects except that `foo-tests` will be replaced with the name of your test file,
and you may also add the `"jsx"` compiler option if your library needs it.
You may edit the `tsconfig.json` to add new files or to add the `"jsx"` compiler option.
DefinitelyTyped members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down.
For a good example package, see [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/base64-js).
#### Common mistakes
* First, follow advice from the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html).
@@ -186,7 +153,27 @@ Make a PR doing the following:
* Any other packages in DefinitelyTyped that referenced the deleted package should be updated to reference the bundled types.
To do this, add a `package.json` with `"dependencies": { "foo": "x.y.z" }`.
When a package is bundled, it no longer needs the header comment this is only used by DefinitelyTyped, not by the TypeScript compiler.
#### Lint
To lint a package, just add a `tslint.json` to that package containing `{ "extends": "../tslint.json" }`. All new packages must be linted.
If a `tslint.json` turns rules off, this is because that hasn't been fixed yet. For example:
```json
{
"extends": "../tslint.json",
"rules": {
// This package uses the Function type, and it will take effort to fix.
"forbidden-types": false
}
}
```
(To indicate that a lint rule truly does not apply, use `// tslint:disable:rule-name` or better, `//tslint:disable-next-line:rule-name`.)
Only `.d.ts` files are linted.
Test the linter by running `npm run lint -- package-name`. Do not use a globally installed tslint.
## FAQ