Skip to content

TsLint PreCommit hook failing with tslint@5.9.1 #549

@garrinmf

Description

@garrinmf
> overcommit --version
overcommit 0.42.0
> tslint --version
5.9.1

Expected result

with tslint semicolon rule enabled overcommit would stop a commit missing a semi colon from proceeding

Actual result

it lets you commit no problem

Debugging

I've tracked it down and it appears that it's related to the default flag option on the TsLint rule --t=prose. As far back as I checked that flag should apparently NOT work, it's either -t or --format. But as of tslint@5.2.0 --t=prose appears to have the same effect as either -t prose or --format prose. With the latest version, tslint@5.9.1 you get a good exit status but an error is shown:

error: unknown option '--t=prose'

I can't find anything on tslint saying there were changes, I'm guessing that the downstream dependency on commander updated in the interim and how commander parsed args changed.

The workaround for now is to remove the flags, as prose is the default formatter:

  TsLint:
    enabled: true
    flags: []

The weird thing, and why I didn't just do a PR, is that for whatever reason, while -t prose and --format prose both work with tslint@5.9.1 from the cli, changing the flag argument to either of those still fails with the error that it's an unknown option. Hopefully someone with more knowledge than I knows the reason and in the meantime, this workaround is out there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions