diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1fc8897d23..3e8c430b55 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,19 +1,17 @@ Please fill in this template. -- [ ] Make your PR against the `master` branch. - [ ] Use a meaningful title for the pull request. Include the name of the package modified. - [ ] Test the change in your own code. (Compile and run.) - [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). -- [ ] Run `tsc` without errors. -- [ ] Run `npm run lint package-name` if a `tslint.json` is present. +- [ ] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). Select one of these and delete the others: If adding a new definition: - [ ] The package does not provide its own types, and you can not add them. - [ ] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package. -- [ ] Create it with `npm run new-package package-name`, not by basing it on an existing project. +- [ ] Create it with `dts-gen --dt`, not by basing it on an existing project. - [ ] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, and `strictNullChecks` set to `true`. If changing an existing definition: diff --git a/README.md b/README.md index 9dbb809b57..6868d116cf 100644 --- a/README.md +++ b/README.md @@ -110,9 +110,8 @@ Your package should have this structure: | tsconfig.json | This allows you to run `tsc` within the package. | | tslint.json | Enables linting. | -Generate these by running `npm run new-package -- --name my-package-name --template module`. -(Other templates are `module-class`, `module-function`, `module-plugin`, `global`, `global-plugin`, and `global-modifying-module`. -This just wraps [dts-gen](https://github.com/Microsoft/dts-gen), so it supports all options from that.) +Generate these by running `npm install -g dts-gen` and `dts-gen --dt --name my-package-name --template module`. +See all options at [dts-gen](https://github.com/Microsoft/dts-gen). You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (needed for async functions), to add to `"lib"`, or to add the `"jsx"` compiler option. @@ -167,9 +166,11 @@ If a `tslint.json` turns rules off, this is because that hasn't been fixed yet. } ``` -(To indicate that a lint rule truly does not apply, use `// tslint:disable:rule-name` or better, `//tslint:disable-next-line:rule-name`.) +(To indicate that a lint rule truly does not apply, use `// tslint:disable rule-name` or better, `//tslint:disable-next-line rule-name`.) + +Test by running `npm run lint package-name` where `package-name` is the name of your package. +This script uses [dtslint](https://github.com/Microsoft/dtslint). -Test the linter by running `npm run lint -- package-name`. Do not use a globally installed tslint. ## FAQ diff --git a/package.json b/package.json index 1dad46394d..77e57cbb44 100644 --- a/package.json +++ b/package.json @@ -16,13 +16,12 @@ }, "scripts": { "compile-scripts": "tsc -p scripts", - "new-package": "dts-gen --dt", "not-needed": "node scripts/not-needed.js", - "lint": "node scripts/lint.js", - "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 1" + "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 1", + "lint": "dtslint --dt types" }, "devDependencies": { - "types-publisher": "Microsoft/types-publisher#production", - "dts-gen": "latest" + "dtslint": "Microsoft/dtslint#production", + "types-publisher": "Microsoft/types-publisher#production" } } diff --git a/scripts/lint.js b/scripts/lint.js deleted file mode 100644 index 84ef71259d..0000000000 --- a/scripts/lint.js +++ /dev/null @@ -1,25 +0,0 @@ -// Usage: npm run lint -- my-package-name -const pkg = process.argv[2]; -const execSync = require("child_process").execSync; -const existsSync = require("fs").existsSync; -const path = require("path"); - -const pkgPath = path.join("types", pkg); - -// Path of tslint when `types-publisher` is symlinked -const symlinkedTslintPath = "../../node_modules/types-publisher/node_modules/tslint" -let tslintPath = existsSync(path.join(pkgPath, symlinkedTslintPath)) ? symlinkedTslintPath : "../node_modules/tslint"; -// An older version (e.g. abs/v0) is in a nested directory, so needs to look one more level up for tslint. -if (pkg.includes("/") && pkg[pkg.length - 1] !== "/") { - tslintPath = path.join("..", tslintPath); -} - -const cmd = `node ${tslintPath}/lib/tslint-cli --format stylish "**/*.ts"`; -console.log(cmd); - -try { - // Child process writes directly to our own stdout - execSync(cmd, { cwd: pkgPath, stdio: "inherit" }); -} catch (_) { - // Process should have printed out error info -} diff --git a/types/amplify-deferred/tslint.json b/types/amplify-deferred/tslint.json index f05741c59b..b0e7084e94 100644 --- a/types/amplify-deferred/tslint.json +++ b/types/amplify-deferred/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } diff --git a/types/amplify/tslint.json b/types/amplify/tslint.json index fe03bea79d..6e33505955 100644 --- a/types/amplify/tslint.json +++ b/types/amplify/tslint.json @@ -1,7 +1,7 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false, + "ban-types": false, "unified-signatures": false } } diff --git a/types/angular/tslint.json b/types/angular/tslint.json index 7ba374959e..6bbe7c9318 100644 --- a/types/angular/tslint.json +++ b/types/angular/tslint.json @@ -12,7 +12,7 @@ ], "align": true, "callable-types": false, - "forbidden-types": false, + "ban-types": false, "indent": [ true, "spaces" diff --git a/types/base64-js/base64-js-tests.ts b/types/base64-js/base64-js-tests.ts index 13c3f705b5..402ce43e88 100644 --- a/types/base64-js/base64-js-tests.ts +++ b/types/base64-js/base64-js-tests.ts @@ -1,5 +1,5 @@ import * as base64js from "base64-js"; -const length: number = base64js.byteLength(""); -const bytes: Uint8Array = base64js.toByteArray(""); -const decoded: string = base64js.fromByteArray(new Uint8Array(0)); +base64js.byteLength(""); // $ExpectType number +base64js.toByteArray(""); // $ExpectType Uint8Array +base64js.fromByteArray(new Uint8Array(0)); // $ExpectTpe string diff --git a/types/bluebird-global/tslint.json b/types/bluebird-global/tslint.json index b03221674a..37c90f2397 100644 --- a/types/bluebird-global/tslint.json +++ b/types/bluebird-global/tslint.json @@ -5,6 +5,6 @@ "no-empty-interface": false, "array-type": false, "unified-signatures": false, - "forbidden-types": false + "ban-types": false } } diff --git a/types/charm/tslint.json b/types/charm/tslint.json index f05741c59b..b0e7084e94 100644 --- a/types/charm/tslint.json +++ b/types/charm/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } diff --git a/types/co-views/tslint.json b/types/co-views/tslint.json index f05741c59b..b0e7084e94 100644 --- a/types/co-views/tslint.json +++ b/types/co-views/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } diff --git a/types/core-decorators/tslint.json b/types/core-decorators/tslint.json index 0332a8383e..caa1fde509 100644 --- a/types/core-decorators/tslint.json +++ b/types/core-decorators/tslint.json @@ -2,6 +2,6 @@ "extends": "../tslint.json", "rules": { "callable-types": false, - "forbidden-types": false + "ban-types": false } } diff --git a/types/core-js/tslint.json b/types/core-js/tslint.json index 0f47deabb4..3bfbe8c142 100644 --- a/types/core-js/tslint.json +++ b/types/core-js/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } \ No newline at end of file diff --git a/types/ember/tslint.json b/types/ember/tslint.json index fcd9410184..c91d42f0b2 100644 --- a/types/ember/tslint.json +++ b/types/ember/tslint.json @@ -2,7 +2,7 @@ "extends": "../tslint.json", "rules": { // Heavy use of Function type in this older package. - "forbidden-types": false, + "ban-types": false, "no-misused-new": false, // not sure what this means "no-single-declare-module": false diff --git a/types/fabric/tslint.json b/types/fabric/tslint.json index 525190cf34..4702666135 100644 --- a/types/fabric/tslint.json +++ b/types/fabric/tslint.json @@ -2,7 +2,7 @@ "extends": "../tslint.json", "rules": { "adjacent-overload-signatures": false, - "forbidden-types": false, + "ban-types": false, "interface-name": false, "no-empty-interface": false, "unified-signatures": false diff --git a/types/fullcalendar/tslint.json b/types/fullcalendar/tslint.json index fe03bea79d..6e33505955 100644 --- a/types/fullcalendar/tslint.json +++ b/types/fullcalendar/tslint.json @@ -1,7 +1,7 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false, + "ban-types": false, "unified-signatures": false } } diff --git a/types/fullcalendar/v1/tslint.json b/types/fullcalendar/v1/tslint.json index fe03bea79d..6e33505955 100644 --- a/types/fullcalendar/v1/tslint.json +++ b/types/fullcalendar/v1/tslint.json @@ -1,7 +1,7 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false, + "ban-types": false, "unified-signatures": false } } diff --git a/types/google.analytics/tslint.json b/types/google.analytics/tslint.json index e8bc207e33..de20a402c4 100644 --- a/types/google.analytics/tslint.json +++ b/types/google.analytics/tslint.json @@ -2,7 +2,7 @@ "extends": "../tslint.json", "rules": { "dt-header": false, - "forbidden-types": false, + "ban-types": false, "unified-signatures": false } } diff --git a/types/handsontable/tslint.json b/types/handsontable/tslint.json index 14c6526bd1..6efbba674b 100644 --- a/types/handsontable/tslint.json +++ b/types/handsontable/tslint.json @@ -1,7 +1,7 @@ -{ +{ "extends": "../tslint.json", "rules": { - "forbidden-types": false, + "ban-types": false, "no-single-declare-module": false } } \ No newline at end of file diff --git a/types/highcharts/tslint.json b/types/highcharts/tslint.json index 6fb4f705cf..a53062e5df 100644 --- a/types/highcharts/tslint.json +++ b/types/highcharts/tslint.json @@ -1,7 +1,7 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false, + "ban-types": false, "unified-signatures": false, "array-type": false, "no-empty-interface": false, diff --git a/types/ignite-ui/tslint.json b/types/ignite-ui/tslint.json index 71f9eaad3f..c1f39f62eb 100644 --- a/types/ignite-ui/tslint.json +++ b/types/ignite-ui/tslint.json @@ -2,7 +2,7 @@ "extends": "../tslint.json", "rules": { "dt-header": false, - "forbidden-types": false, + "ban-types": false, "unified-signatures": false, "max-line-length": false, "whitespace": false diff --git a/types/jasmine-ajax/tslint.json b/types/jasmine-ajax/tslint.json index fe03bea79d..6e33505955 100644 --- a/types/jasmine-ajax/tslint.json +++ b/types/jasmine-ajax/tslint.json @@ -1,7 +1,7 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false, + "ban-types": false, "unified-signatures": false } } diff --git a/types/jquery-mask-plugin/tslint.json b/types/jquery-mask-plugin/tslint.json index f05741c59b..b0e7084e94 100644 --- a/types/jquery-mask-plugin/tslint.json +++ b/types/jquery-mask-plugin/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } diff --git a/types/jquery.validation/tslint.json b/types/jquery.validation/tslint.json index f05741c59b..b0e7084e94 100644 --- a/types/jquery.validation/tslint.json +++ b/types/jquery.validation/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } diff --git a/types/js-data-http/tslint.json b/types/js-data-http/tslint.json index 394d3ce319..27b52dc1e1 100644 --- a/types/js-data-http/tslint.json +++ b/types/js-data-http/tslint.json @@ -1,7 +1,7 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false, + "ban-types": false, "no-misused-new": false } } diff --git a/types/jui-grid/tslint.json b/types/jui-grid/tslint.json index f05741c59b..b0e7084e94 100644 --- a/types/jui-grid/tslint.json +++ b/types/jui-grid/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } diff --git a/types/koa-views/tslint.json b/types/koa-views/tslint.json index 0f47deabb4..3bfbe8c142 100644 --- a/types/koa-views/tslint.json +++ b/types/koa-views/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } \ No newline at end of file diff --git a/types/libpq/tslint.json b/types/libpq/tslint.json index f05741c59b..b0e7084e94 100644 --- a/types/libpq/tslint.json +++ b/types/libpq/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } diff --git a/types/lodash/tslint.json b/types/lodash/tslint.json index 62d13dc883..7805e0387d 100644 --- a/types/lodash/tslint.json +++ b/types/lodash/tslint.json @@ -4,7 +4,7 @@ "array-type": false, "callable-types": false, "comment-format": false, - "forbidden-types": false, + "ban-types": false, "interface-name": false, "interface-over-type-literal": false, "max-line-length": false, diff --git a/types/mapbox/tslint.json b/types/mapbox/tslint.json index f05741c59b..b0e7084e94 100644 --- a/types/mapbox/tslint.json +++ b/types/mapbox/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } diff --git a/types/merge-descriptors/tslint.json b/types/merge-descriptors/tslint.json index f05741c59b..b0e7084e94 100644 --- a/types/merge-descriptors/tslint.json +++ b/types/merge-descriptors/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } diff --git a/types/ng-stomp/tslint.json b/types/ng-stomp/tslint.json index 2ab0c36fa8..867dfe94d3 100644 --- a/types/ng-stomp/tslint.json +++ b/types/ng-stomp/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } \ No newline at end of file diff --git a/types/pixi.js/tslint.json b/types/pixi.js/tslint.json index 6fa0ddab84..136166583e 100644 --- a/types/pixi.js/tslint.json +++ b/types/pixi.js/tslint.json @@ -1,7 +1,7 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false, + "ban-types": false, "interface-name": false, "no-single-declare-module": false, "unified-signatures": false, diff --git a/types/qlik-visualizationextensions/tslint.json b/types/qlik-visualizationextensions/tslint.json index cae1bdf2ad..97addf8511 100644 --- a/types/qlik-visualizationextensions/tslint.json +++ b/types/qlik-visualizationextensions/tslint.json @@ -1,7 +1,7 @@ -{ +{ "extends": "../tslint.json", "rules": { - "forbidden-types": false, + "ban-types": false, "no-empty-interface": false, "interface-name": false } diff --git a/types/react-native/tslint.json b/types/react-native/tslint.json index dd4e4a1cba..8ca9d9f2c3 100644 --- a/types/react-native/tslint.json +++ b/types/react-native/tslint.json @@ -2,6 +2,6 @@ "extends": "../tslint.json", "rules": { // Lowercase `object` is available in TypeScript 2.2 only. - "forbidden-types": false + "ban-types": false } } diff --git a/types/react-router-redux/v3/tslint.json b/types/react-router-redux/v3/tslint.json index d032145676..7a5f77c1dc 100644 --- a/types/react-router-redux/v3/tslint.json +++ b/types/react-router-redux/v3/tslint.json @@ -1,7 +1,7 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false, + "ban-types": false, "no-empty-interface": false } } diff --git a/types/react-router/v2/tslint.json b/types/react-router/v2/tslint.json index d032145676..7a5f77c1dc 100644 --- a/types/react-router/v2/tslint.json +++ b/types/react-router/v2/tslint.json @@ -1,7 +1,7 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false, + "ban-types": false, "no-empty-interface": false } } diff --git a/types/redux-localstorage/tslint.json b/types/redux-localstorage/tslint.json index d032145676..7a5f77c1dc 100644 --- a/types/redux-localstorage/tslint.json +++ b/types/redux-localstorage/tslint.json @@ -1,7 +1,7 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false, + "ban-types": false, "no-empty-interface": false } } diff --git a/types/reflux/tslint.json b/types/reflux/tslint.json index f05741c59b..b0e7084e94 100644 --- a/types/reflux/tslint.json +++ b/types/reflux/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } diff --git a/types/rx-dom/tslint.json b/types/rx-dom/tslint.json index 8dd3240216..ee6fc74495 100644 --- a/types/rx-dom/tslint.json +++ b/types/rx-dom/tslint.json @@ -2,7 +2,7 @@ "extends": "../tslint.json", "rules": { // this package augments Rx with namespace level functions - // it would be particualrly strange to type these functions differently - "forbidden-types": false + // it would be particualrly strange to type these functions differently + "ban-types": false } } diff --git a/types/rx-lite/tslint.json b/types/rx-lite/tslint.json index 1bec85bd5c..69a2063c99 100644 --- a/types/rx-lite/tslint.json +++ b/types/rx-lite/tslint.json @@ -3,7 +3,7 @@ "rules": { "unified-signatures": false, "no-empty-interface": false, - "forbidden-types": false, + "ban-types": false, "interface-name": false, "array-type": false, "max-line-length": false, diff --git a/types/selenium-webdriver/tslint.json b/types/selenium-webdriver/tslint.json index 93fffac84e..f38c4dfc69 100644 --- a/types/selenium-webdriver/tslint.json +++ b/types/selenium-webdriver/tslint.json @@ -1,8 +1,8 @@ { "extends": "../tslint.json", "rules": { + "ban-types": false, "callable-types": false, - "forbidden-types": false, "interface-name": [false], "no-empty-interface": false, "unified-signatures": false diff --git a/types/steed/tslint.json b/types/steed/tslint.json index 0f47deabb4..3bfbe8c142 100644 --- a/types/steed/tslint.json +++ b/types/steed/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } \ No newline at end of file diff --git a/types/tcomb/tslint.json b/types/tcomb/tslint.json index c3d18eb9dd..d3cce83dc9 100644 --- a/types/tcomb/tslint.json +++ b/types/tcomb/tslint.json @@ -2,7 +2,7 @@ "extends": "../tslint.json", "rules": { "callable-types": false, - "forbidden-types": false, + "ban-types": false, "no-empty-interface": false, "no-single-declare-module": false, "unified-signatures": false diff --git a/types/transducers-js/tslint.json b/types/transducers-js/tslint.json index f05741c59b..b0e7084e94 100644 --- a/types/transducers-js/tslint.json +++ b/types/transducers-js/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } } diff --git a/types/tslint.json b/types/tslint.json index 56b31d320a..6602359a97 100644 --- a/types/tslint.json +++ b/types/tslint.json @@ -1 +1 @@ -{ "extends": "../node_modules/types-publisher/tslint-definitions.json" } \ No newline at end of file +{ "extends": "dtslint/dtslint.json" } \ No newline at end of file diff --git a/types/universal-router/tslint.json b/types/universal-router/tslint.json index f05741c59b..b0e7084e94 100644 --- a/types/universal-router/tslint.json +++ b/types/universal-router/tslint.json @@ -1,6 +1,6 @@ { "extends": "../tslint.json", "rules": { - "forbidden-types": false + "ban-types": false } }