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

Using dtslint just for checking type correctness #208

Closed
Andarist opened this issue Feb 25, 2019 · 4 comments
Closed

Using dtslint just for checking type correctness #208

Andarist opened this issue Feb 25, 2019 · 4 comments

Comments

@Andarist
Copy link
Contributor

So I'm using this tool (as recommended) to write tests against my .d.ts files. I don't care about linting though.

It would be really helpful to have an option to disable linting.

@sandersn
Copy link
Member

Is --expectOnly good enough for your purposes?
Note that this currently disables all other lint rules, but it does not disable all other checks, such as the Definitely Typed header checks.

Would it be helpful to have the $ExpectError functionality available in a separate package that's basically a tsc wrapper? That's the only thing you're getting above basic tsc as far as I know.

@Andarist
Copy link
Contributor Author

Andarist commented Mar 4, 2019

Is --expectOnly good enough for your purposes?

Not sure what it does - from what I see it's a new thing and it hasnt been documented yet. Is it just a flag which is supposed to load other tslint config (dtslint-expect-only.json)? If yes - then I suppose it indeed is what I'm looking for.

Would it be helpful to have the $ExpectError functionality available in a separate package that's basically a tsc wrapper? That's the only thing you're getting above basic tsc as far as I know.

Not sure if other package would be helpful here. Truth to be told I'm slightly confused about what dtslint's goal is. I've started to use because I've got an impression that this is the recommended way of testings types with usage examples but at the moment, from what I observe in the community, people use tsc directly for that. $ExpectError is a nice addition which dtslint provides though so I guess I'm going to stick with it - although not sure what its future is, considering the fact that you (TS team) wants to migrate to ESLint in the long run. I guess it's an implementation detail though.

@sandersn
Copy link
Member

sandersn commented Mar 4, 2019

The purpose of dtslint is to be the test task for CI runs on Definitely Typed. That is, it has all the knowledge to determine whether typings on Definitely Typed are good enough to check in or not. It can be used on its own for people who want to add types to their own packages.

It might be useful for other things, but that's not the main purpose.
As you said, tslint is an implementation detail -- and $ExpectError support is too! That's why I wondered if you wanted that to be separate.

@Andarist
Copy link
Contributor Author

Andarist commented Mar 4, 2019

Thanks for clarifying. Seems like --expectOnly is exactly what I have needed.

Some included TSLint rules were too opinionated for my taste and that's why I have wanted to disable them. They might probably make sense for DefinitelyTyped repo - to keep some sort of unified style, but dtslint being more generic could not include them itself. In my opinion included rules should focus on type correctness & forbidding deprecated stuff.

Either way - thanks for the help!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants