简体   繁体   中英

Ignore specific file from specific eslint plugin

I am using eslint-plugin-tsdoc which works well, except for files where I don't require the linting, for instance, any api routes which use apidoc instead of tsdoc commenting styles.

This is causing errors when running any linting. Is there anyway that I can ignore files for the eslint-plugin-tsdoc ? I don't want to ignore the file altogether by eslint because I still need the typescript to be checked.

You can use the override property in.eslintrc file. Using configuration files to disable for a group of files

Since eslint-plugin-tsdoc only has one rule tsdoc/syntax .

You need to add this to your .eslintrc file.

{
  "rules": {...},
  "overrides": [
    {
      "files": ["*.test.ts", "/src/demo.ts"],
      "rules": {
        "tsdoc/syntax": "off"
      }
    }
  ]
}

So in the above example it will disable the rule for all files ending with .test.ts and the file /src/demo.ts and apply this rule for rest of the files.

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