Tslint: Validate tslint.json Rule Options

Created on 20 Dec 2015  ยท  8Comments  ยท  Source: palantir/tslint

Ignores "max-line-length": 5

Here's my tslint.json:

{
    "rules": {
        "max-line-length": 5
    }
}

This doesn't result in any errors because I should have written [true, 5].

I'd prefer 5 alone to just work, but if not it would be nice to throw errors for bad rule options.

P2 Accepting PRs Feature Request ๐ŸŒน R.I.P. ๐ŸŒน

Most helpful comment

a tslint --validate can be very very helpful!

All 8 comments

Actually working on that as we speak. I went through added metadata to all the branches on this branch, and it should be possible to check if options are valid based off of that data.

In the meantime, rules should all have example configurations documented. (Website still a WIP.) The schema part refers to the format of data that comes after the [true, part and is identical to the config metadata each rule now has. This will all be better documented someday.

(I changed the title of this issue to make it more generic to reflect the bigger issue.)

Once #1311 merges, it should be fairly easy to implement this

It would be great to have this. Just noticed our trailing-comma rule didn't apply because I wrote "object": "always" instead of "objects": "always".

Is it possible to validate the tslint.json file from the CLI?

Maybe something like this: tslint --validate tslint.json

I think tslint -c tslint.json index.js does validate the configuration before running the linter, but a separate --validate flag could be helpful.

Wondering also if something like https://github.com/gristlabs/ts-interface-checker could be used to lessen the amount of work TSLint has to do... I could have sworn someone was Tweeting about a similar library recently but can't find it.

a tslint --validate can be very very helpful!

๐Ÿ’€ _It's time!_ ๐Ÿ’€

TSLint is being deprecated and no longer accepting pull requests for major new changes or features. See #4534. ๐Ÿ˜ฑ

If you'd like to see this change implemented, you have two choices:

  • Recommended: Check if this is available in ESLint + typescript-eslint โœ…
  • _Not Recommended: Fork TSLint locally_ ๐Ÿคทโ€โ™‚๏ธ

๐Ÿ‘‹ It was a pleasure open sourcing with you!

_If you believe this message was posted here in error, please comment so we can re-open the issue!_

๐Ÿค– Beep boop! ๐Ÿ‘‰ TSLint is deprecated ๐Ÿ‘ˆ _(#4534)_ and you should switch to typescript-eslint! ๐Ÿค–

๐Ÿ”’ This issue is being locked to prevent further unnecessary discussions. Thank you! ๐Ÿ‘‹

Was this page helpful?
0 / 5 - 0 ratings