wmonk / create-react-app-typescript

DEPRECATED: Create React apps using typescript with no build configuration.
3.71k stars 493 forks source link

tslint reference #271

Open Kaffiend opened 6 years ago

Kaffiend commented 6 years ago

project root tslint.json should take precedence over packaged tslint.json to change any rules you have to dig through node_modules and change the package tslint.json

Edit: even though the editor doesnt complain when coding, the build still fails.

boyangwang commented 6 years ago

Run into same problem. Changing project tslint.json doesn't seem to have any effect

I didn't even manage to find location of packaged tslint.json... @Kaffiend where did you find it?

Kaffiend commented 6 years ago

@boyangwang Its in the libs directory under your node_modules you have to dig through there and change it instead of the generated project tslint.json

boyangwang commented 6 years ago

Hi, I got it working. After some digging , I found that tslint.json is being used correctly. But, if you are seeing error from js files, then you need to add jsRules in tslint.json, parallel to rules... and then override whichever rules to suppress errors/warnings

hanorine commented 6 years ago

by default tslint.json doesn't have the rules property. Adding it solved it for me.

{
  "extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"],
  "rules": {
    "interface-name": false,
    "no-empty-interface": false,
    "ordered-imports": false,
    "interface-over-type-literal": false
  },
  "linterOptions": {
    "exclude": [
      "config/**/*.js",
      "node_modules/**/*.ts"
    ]
  }
}