Search code examples
visual-studio-codeeslintprettier

How to remove prettier plugin from ESLint in VS Code?


I've been using prettier plugin for ESLint for a while and now I've got project with different .eslintrc.js. My config use to be like:

module.exports = {
  ...
  extends: [
    'airbnb',
    'prettier',
    'prettier/react',
  ],
  ...
  plugins: [
    'react',
    'prettier',
  ],
  rules: {
    'prettier/prettier': [
      'error',
      {
        'trailingComma': 'es5',
        'singleQuote': true,
        'printWidth': 120,
      }
    ],
    'react/jsx-filename-extension': [1, { 'extensions': ['.js', '.jsx'] }],
  },
  ...
};

I got rid of all of those rules & plugins & extensions, however, I still get this error:

Failed to load plugin prettier: Cannot find module 'eslint-plugin-prettier' Happened while validating /.../file.js This can happen for a couple of reasons: 1. The plugin name is spelled incorrectly in an ESLint configuration file (e.g. .eslintrc). 2. If ESLint is installed globally, then make sure 'eslint-plugin-prettier' is installed globally as well. 3. If ESLint is installed locally, then 'eslint-plugin-prettier' isn't installed correctly.

I don't really want to use it no more, but this error doesn't allow me to use ESLint at all. Could this be because plugin is installed globally as well? How do I get rid of this plugin?

What I tried so far:

  • deleting repo and cloning it from github with correct ESLint file.
  • configuring ESLint file from template with eslint --init
  • replacing file with absolutely random and ridiculous setting from web

Solution

  • Turned out that I had .eslintrc.js configuration in the upper folder which had a priority to load. Removing this file and keeping an existing one in project fixed my problem.