Hykilpikonna
Hykilpikonna

Reputation: 2161

How to enable "error prevention only" in TSLint? (Disable style checks, etc.)

I've just created and ran my first Vue.js + TypeScript project, but after I reformatted the typescript code to my favorite formatting, this is prompted in the npm run serve command prompt:

WARNING in .../src/app/app.ts
7:1 misplaced opening brace
     5 | })
     6 | export default class App extends Vue
  >  7 | {
       | ^
     8 |
     9 | }
    10 |
No type errors found
Version: typescript 3.5.3, tslint 5.18.0
Time: 1148ms

Is there a way to enable only the error checks in TSLint without enabling any of the styling check rules?

I tried to remove all the rules in tslint.json according to TSLint: how to disable all style/readability rules, but it still prompts the same warning.

My current tslint.json file:

{
  "defaultSeverity": "warning",
  "extends": [
    "tslint:recommended"
  ],
  "linterOptions": {
    "exclude": [
      "node_modules/**"
    ]
  }/*,
  "rules": {
    "indent": [true, "spaces", 4],
    "quotemark": [true, "single"]
  }*/
}

Upvotes: 2

Views: 360

Answers (1)

Christopher Peisert
Christopher Peisert

Reputation: 24174

The configuration option:

"extends": [
    "tslint:recommended"
  ]

tells TSLint to use the built-in configuration preset recommended.

slint:recommended is a stable, somewhat opinionated set of rules which we encourage for general TypeScript programming.

Removing the extends section will provide a clean slate. The default preset sources may be viewed here.

You could also disable specific rules, such as:

"rules": { "curly": false }

Upvotes: 2

Related Questions