Tslint: "The 'no-boolean-literal-compare' rule requires type information."

Created on 30 Apr 2018  ·  13Comments  ·  Source: palantir/tslint

Bug Report

  • __TSLint version__: 5.9.1
  • __TypeScript version__: 2.8.3
  • __Running TSLint via__: CLI

TypeScript code being linted

N/A. This is a general warning I see when linting an entire project.

with tslint.json configuration:

{
  "extends": "tslint-config-airbnb",
  "rules": {
    "variable-name": false,
    "import-name": false,
    "max-line-length": [true, 150],
    "no-else-after-return": false,
    "function-name": false,
    "no-this-assignment": [true, {"allow-destructuring": true}],
    "align": false
  }
}

Actual behavior

Running tslint from the command line generates the following warning:

Warning: The 'no-boolean-literal-compare' rule requires type information.

This behavior is also described here: https://github.com/progre/tslint-config-airbnb/issues/33

Expected behavior

No warning

Most helpful comment

@sangaman I'm not running tslint command explicitly, but rather letting VS Code display my linting errors. The above error is always displayed in VS Code's tslint output tab. Do you know a way to fix it? Perhaps I'm slow. 🤷‍♂️

All 13 comments

Figured this out myself. I needed to pass --project tsconfig.json to the tslint command. Warning no longer displays after taking this step.

@sangaman I'm not running tslint command explicitly, but rather letting VS Code display my linting errors. The above error is always displayed in VS Code's tslint output tab. Do you know a way to fix it? Perhaps I'm slow. 🤷‍♂️

I'm not sure actually, I haven't seen that message in vscode before. This looks like an open issue for what I'd have guessed would be the solution but looks like it's not an option currently: https://github.com/palantir/tslint/issues/3865.

Thanks, I'll be looking out for it.

Same problem.

Same problem.

Same problem!

Same problem
In output from tslint-loader and tslint extension output for VS Code

Same problem.

Could this issue be re-opened, please?

I run tslint via vscode and this issue breaks it - which means no more real time linting.

Besides, shouldn't tsconfig.json be the default file? Why do we need to define it now?

PS: I've opened a ticket on the vscode extension side to see if we can apply the workaround there.

@miltonbecker agreed. I think it might be reasonable to consider this a bug in TSLint, that if it can't run in some modes, there needs to be a way to configure it to run in that mode.

Could you please file a new bug and describe your thoughts on it there? That way you'll have ownership of it, rather than someone who might not want notifications around it 🙂.

@kallebornemark did you manage the solve your issue?

Currently I'm just adding the following line to my tslint.json:

"no-boolean-literal-compare": false

After adding this line TSLint started working.

@kallebornemark did you manage the solve your issue?

Currently I'm just adding the following line to my tslint.json:

"no-boolean-literal-compare": false

After adding this line TSLint started working.

After deleting my project, all the build errors go away! This isn't a valid solution.

Was this page helpful?
0 / 5 - 0 ratings