typescripteslinttsdoc

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.


Solution

  • 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.