{"name":"@definitelytyped/dtslint","version":"0.2.1","license":"MIT","_id":"@definitelytyped/dtslint@0.2.1","contributors":[{"url":"https://github.com/sandersn","name":"Nathan Shively-Sanders","email":"nathansa@microsoft.com"},{"url":"https://github.com/andy-ms","name":"Andy Hanson","email":"andy-ms@microsoft.com"},{"url":"https://github.com/danvk","name":"Dan Vanderkam","email":"danvdk@gmail.com"}],"homepage":"https://github.com/microsoft/DefinitelyTyped-tools#readme","bugs":{"url":"https://github.com/microsoft/DefinitelyTyped-tools/issues"},"bin":{"dtslint":"dist/index.js"},"dist":{"shasum":"752eddf58323e6777a45c8a653ff26286231cd03","tarball":"http://registry-npm.ywwl.com/@definitelytyped/dtslint/download/@definitelytyped/dtslint-0.2.1.tgz","fileCount":20,"integrity":"sha512-cYeaOLVchRWvY9rHocenKAnxtU41N5WoK8xNBPo+5dDa1JZZw2lKYmsUILM7KHitHkgaNPVnw9Q0YQmwmVC28A==","signatures":[{"sig":"MEQCIHEcrVj2k2kkMa4ZVi8yLEqfG1+3G0aYvcXxl2FQiICRAiBCJq3Gtwmu1JOuSsPABdTG8V93bU1yreh+KqHOphp6Wg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67676,"size":19581,"noattachment":false,"key":"/@definitelytyped/dtslint/-/@definitelytyped/dtslint-0.2.1.tgz"},"main":"./dist/index.js","_from":"file:definitelytyped-dtslint-0.2.1.tgz","types":"./dist/index.d.ts","engines":{"node":">=18.18.0"},"scripts":{"test":"../../node_modules/.bin/jest --config ../../jest.config.js packages/dtslint","build":"tsc -b ."},"_npmUser":{"name":"definitelytyped-publisher","email":"dt-publisher@microsoft.com"},"_resolved":"/tmp/87fe337bd9981c61e29ede83a0e4557d/definitelytyped-dtslint-0.2.1.tgz","_integrity":"sha512-cYeaOLVchRWvY9rHocenKAnxtU41N5WoK8xNBPo+5dDa1JZZw2lKYmsUILM7KHitHkgaNPVnw9Q0YQmwmVC28A==","repository":{"url":"git+https://github.com/microsoft/DefinitelyTyped-tools.git","type":"git","directory":"packages/dtslint"},"_npmVersion":"10.2.3","description":"Runs tests on TypeScript definition files","directories":{},"_nodeVersion":"20.10.0","dependencies":{"eslint":"^8.56.0","strip-json-comments":"^3.1.1","eslint-plugin-import":"^2.29.1","@definitelytyped/utils":"0.1.1","@typescript-eslint/types":"^6.19.0","@typescript-eslint/utils":"^6.19.0","@typescript-eslint/parser":"^6.19.0","@definitelytyped/header-parser":"0.2.1","@typescript-eslint/eslint-plugin":"^6.19.0","@definitelytyped/typescript-versions":"0.1.0","@typescript-eslint/typescript-estree":"^6.19.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.3","@types/eslint":"^8.56.2","@types/strip-json-comments":"^3.0.0"},"peerDependencies":{"typescript":">= 3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.7.0-dev || >= 3.8.0-dev || >= 3.9.0-dev || >= 4.0.0-dev || >=5.0.0-dev"},"_npmOperationalInternal":{"tmp":"tmp/dtslint_0.2.1_1705946189629_0.1354882398305317","host":"s3://npm-registry-packages"},"readme":"`dtslint` tests a TypeScript declaration file for style and correctness.\nIt will install `typescript` and `eslint` for you, so this is the only tool you need to test a type definition.\n\nLint rules new to dtslint are documented in the [docs](docs) directory.\n\n# Just looking for a type testing tool?\n\nIf you are just looking for a TypeScript type testing tool, use:\n\n- [`tsd`](https://github.com/tsdjs/tsd)\n- [`eslint-plugin-expect-type`](https://github.com/JoshuaKGoldberg/eslint-plugin-expect-type)\n- [`tstyche`](https://github.com/tstyche/tstyche)\n\n\n# Setup\n\nIf you are working on DefinitelyTyped, read the [DefinitelyTyped README](https://github.com/DefinitelyTyped/DefinitelyTyped#readme).\n\nIf you are writing the library in TypeScript, don't use `dtslint`.\nUse [`--declaration`](http://www.typescriptlang.org/docs/handbook/compiler-options.html) to have type definitions generated for you.\n\nIf you are a library author, read below.\n\n\n## Add types for a library (not on DefinitelyTyped)\n\n[`dts-gen`](https://github.com/Microsoft/dts-gen#readme) may help, but is not required.\n\nCreate a `types` directory. (Name is arbitrary.)\nAdd `\"types\": \"types\"` to your `package.json`.\nRead more on bundling types [here](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html).\n\n\n#### `types/index.d.ts`\n\nOnly `index.d.ts` and `package.json` need to be published to NPM. The other files will be required by Definitely Typed for testing.\nWrite your type definitions in `index.d.ts`.\nRefer to the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html) or `dts-gen`'s templates for how to do this.\n\n\n#### `types/tsconfig.json`\n\n```json5\n{\n    \"compilerOptions\": {\n        \"module\": \"commonjs\",\n        \"lib\": [\n            \"es6\",\n        ],\n        \"noImplicitAny\": true,\n        \"noImplicitThis\": true,\n        \"strictNullChecks\": true,\n        \"strictFunctionTypes\": true,\n        \"types\": [],\n        \"noEmit\": true,\n        \"forceConsistentCasingInFileNames\": true\n    },\n    \"files\": [\n        \"index.d.ts\",\n        \"PACKAGE-NAME-tests.ts\",\n    ]\n}\n```\n\nYou may extend `\"lib\"` to, for example, `[\"es6\", \"dom\"]` if you need those typings.\nYou may also have to add `\"target\": \"es6\"` if using certain language features.\n\n#### `types/package.json`\n\n```json5\n{\n    \"private\": true,\n    \"name\": \"@types/PACKAGE-NAME\",\n    \"version\": \"1.2.9999\",\n    \"projects\": [\n        \"https://example.com/\"\n    ],\n    \"dependencies\": {\n        \"@types/DEPENDENCY-1\": \"*\",\n        \"@types/DEPENDENCY-2\": \"*\"\n    },\n    \"devDependencies\": {\n        \"@types/PACKAGE-NAME\": \"workspace:.\"\n    },\n    \"owners\": [\n        {\n            \"name\": \"My Self\",\n            \"githubUsername\": \"ghost\"\n        }\n    ]\n}\n```\n\n1. If the types are for a scoped package, you must name-mangle `@scope/package` to `@types/scope__package`.\n2. The major and minor versions should match some published version of the npm package. The patch version must be 9999; Definitely Typed will increment published patch versions starting at 0, and the patch version of the types will not match the patch version of the npm package.\n3. `\"projects\"` is a link to the source project.\n4. There might not be any dependencies if the *types* don't rely on anything but standard types.\n5. `\"devDependencies\"` must include a self-reference like `\"@types/PACKAGE-NAME\": \"workspace:.`. Plus any dependencies used only by tests.\n6. Non-`@types` dependencies must be added to `allowedPackageJsonDependencies.txt` in the definitions-parser package. The PR must be approved by a Typescript team member.\n7. If you do not have a github user name, you can provide a `\"url\"` of your own instead.\n\nAlso:\n\nFor types that do not have a matching NPM package, add two properties:\n\n1. `\"nonNpm\": true`\n2. `\"nonNpmDescription\"`, a human-readable name for the project that is being typed.\n\n#### `types/.eslintrc.json`\n\nAn `.eslintrc.json` file is optional.\nYou can skip it if you don't need to modify any lint rule settings.\nWe recommend not adding an `.eslintrc.json` file.\n\n```json5\n{ \"extends\": \"@definitelytyped/dtslint/dt.json\" }\n```\n\nIf present, this will override `dtslint`'s default \"[`all`](https://github.com/microsoft/DefinitelyTyped-tools/blob/main/packages/eslint-plugin/src/configs/all.ts)\" config.\nYou can specify new [lint rules](https://eslint.org/docs/latest/rules/), or disable some. An example:\n\n```json5\n{\n    \"rules\": {\n        \"@definitelytyped/no-unnecessary-generics\": \"off\"\n    }\n}\n```\n\nPlease don't do this without a good reason.\nDisabling lint rules makes a Definitely Typed PR less likely to be merged, and will definitely take longer to review.\n\n\n#### `types/test.ts`\n\nYou can have any number of test files you want, with any names. See below on what to put in them.\n\n## Write tests\n\nA test file should be a piece of sample code that tests using the library. Tests are type-checked, but not run.\nTo assert that an expression is of a given type, use `$ExpectType`.\nTo assert that an expression causes a compile error, use `@ts-expect-error`.\n(Assertions will be checked by the `expect` lint rule.)\n\n```ts\nimport { f } from \"my-lib\"; // f is(n: number) => void\n\n// $ExpectType void\nf(1);\n\n// Can also write the assertion on the same line (but not if it's a multiline function call).\nf(2); // $ExpectType void\n\n// @ts-expect-error\nf(\"one\");\n```\n\n\n## Specify a TypeScript version\n\nNormally packages will be tested according to [DefinitelyType's support window](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window).\nTo restrict testing to new versions only, specify it in package.json:\n\n```ts\n\"minimumTypeScriptVersion: 5.0\"\n```\n\nThis tests only 5.0 and above, although people can still depend on the package with lower versions of Typescript if they want.\n\n## Run tests\n\n- `npm install --save-dev @definitelytyped/dtslint`\n- Add to your `package.json` `scripts`: `\"dtslint\": \"dtslint types\"`\n- `npm run dtslint`\n\n### Options\n\n- `--localTs`\n\nUse your locally installed version of TypeScript.\n\n```sh\ndtslint --localTs node_modules/typescript/lib types\n```\n- `--expectOnly`\n\nDisable all the lint rules except the one that checks for type correctness.\n\n```sh\ndtslint --expectOnly types\n```\n\n# Contributing\n\n## Build\n\n```sh\nnpm link . # Global 'dts-lint' should now refer to this.\nnpm run watch\n```\n\n## Test\n\nUse `pnpm test` to run all tests.\n\n## Code of Conduct\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n## FAQ\nI'm getting an error about a missing typescript install.\n```\nError: Cannot find module '/node_modules/dtslint/typescript-installs/3.1/node_modules/typescript`\n```\nYour dependencies may be out of date.\n[@definitelytyped/typescript-versions](https://github.com/microsoft/DefinitelyTyped-tools/tree/main/packages/typescript-versions) is the package that contains the list of TypeScript versions to install.\n\nAlternatively this error can be caused by concurrent dtslint invocations trampling each other's TypeScript installations, especially in the context of continuous integration, if dtslint is installed from scratch in each run.\nIf for example you use [Lerna](https://github.com/lerna/lerna/tree/main/commands/run#readme), try running dtslint with [`lerna --concurrency 1 run ...`](https://github.com/lerna/lerna/tree/main/core/global-options#--concurrency).\n","publish_time":1705946189772,"maintainers":[{"name":"jakebailey","email":"jacob.b.bailey@gmail.com"},{"name":"andrewbranch","email":"andrew@wheream.io"},{"name":"types","email":"ts-npm-types@microsoft.com"},{"name":"sanders_n","email":"nathan@shively-sanders.com"},{"name":"rbuckton","email":"rbuckton@chronicles.org"},{"name":"sheetalkamat","email":"shkamat@microsoft.com"},{"name":"weswigham","email":"wwigham@gmail.com"},{"name":"definitelytyped-publisher","email":"dt-publisher@microsoft.com"}],"_cnpm_publish_time":1705946189772,"dist-tags":{"latest":"0.2.52","next":"0.0.175-next.1"}}