简体   繁体   中英

Disable TypeScript Inline for an individual file

I have TS running with errors that I would like to ignore, compile, but when using

/* tslint:disable */

it still runs when running my build.

hutber@hutber:/var/www/bp/frontend$ git commit -m"feat: add basic foundations for theme & breadcrums"
husky > pre-commit (node v14.14.0)
$ tsc
components/Layouts/Breadcrums/index.tsx:17:13 - error TS2322: Type 'string' is not assignable to type 'HTMLCollection'.

17             {a}
               ~~~

In your tslint.json , you could try excluding the file:

{
  "extends": "tslint:latest",
  "linterOptions": {
      "exclude": [
          "bin",
          "<path to your excluded file here>"
      ]
  }
}

or adding your file to .eslintignore , if you have that instead.

I think TSLint is deprecated and one needs to use eg // eslint-disable-next-line @typescript-eslint/<type of error> . However, I'm not fully aware of your configuration, so this might need to fine tuning.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM