Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

How to deal with tslint "requires type checking" warnings #42

Closed
johannespetzold opened this issue Apr 12, 2017 · 3 comments
Closed

How to deal with tslint "requires type checking" warnings #42

johannespetzold opened this issue Apr 12, 2017 · 3 comments

Comments

@johannespetzold
Copy link

johannespetzold commented Apr 12, 2017

Thanks for creating and maintaining the typescript version of create-react-app! I'm new to all of this and it's been a great help.

My question - during build, I get warnings like the following:

Warning: The 'await-promise' rule requires type checking
Warning: The 'no-use-before-declare' rule requires type checking
Warning: The 'return-undefined' rule requires type checking
Warning: The 'no-floating-promises' rule requires type checking
Warning: The 'no-unnecessary-qualifier' rule requires type checking
Warning: The 'strict-type-predicates' rule requires type checking

(I'm using the tslint "standard" configuration.)

Is there any way to get rid of these warnings (without ejecting)? My understanding is that one has to run tslint with the --type-check option, but I'm not sure if create-react-app(-typescript) provides any hooks for that.

Thanks for any help!

@jquintozamora
Copy link

Hi @johannespetzold ,
What I used to do is:

Disable per line using this comment (https://palantir.github.io/tslint/usage/rule-flags/)

/* tslint:disable-next-line:no-var-requires */
const styles: any = require("./Viewer.module.css");

You want to disable everywhere, change the tslint.json file:

{
  "extends": ["tslint:latest", "tslint-react"],
  "rules": {
    "no-var-requires": false
   }
}

@johannespetzold
Copy link
Author

Thanks @jquintozamora. This will work but I was hoping to get the checks to actually run rather than disabling them. But I understand that one gives up configurability by using create-react-app, so if that's not possible so be it. Just wanted to see if that's indeed the case.

@wmonk wmonk closed this as completed Jun 15, 2017
@miracle2k
Copy link

I think for this we'd need to enable the typeCheck option in https://github.com/wbuchwalter/tslint-loader

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

4 participants