Search code examples
visual-studio-codeformattingeslintprettier-eslint

Hide ESLint errors but still format


I usually have auto-fixable ESLint errors and they are fixed instantly when I just CTRL+S and I am bored of hovering errors each time and checking if they are actually an error (for my case, TypeScript) or an ESLint one. How can I hide those ESLint warnings and errors and still be able to format with:

"eslint.format.enable": true,
"editor.formatOnSave": true,

I mean yes, I can just save but I don't want to see those formatting errors highlighted as red. I already see them before each time I commit because I have a pre-commit script installed that will format, check for errors etc.

I also will not modify my ESLint rules to do that because I usually use predefined configs and use extends to save time.

Disclosure: I've found the answer just before posting this while in the GitHub issues of the ESLint plugin. However, I still want to post this question and answer it myself.


Solution

    1. Open your settings.json in VSCode.
    2. Add the following configuration:
    "eslint.rules.customizations": [
      { "rule": "*", "severity": "off" }
    ]
    

    This configuration will suppress all warnings and errors. Adjust the rule pattern as needed to target specific rules or groups of rules.

    Remember, this method only affects the display of warnings and errors in VSCode. It doesn't change your actual ESLint configuration, so eslint fix command and other ESLint checks will still see and process these rules.