visual-studio-code - 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
解决方案
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.
推荐阅读
- python - Python 多处理不会加速统计建模
- android - Spring 接收的 Multipart 文件为空
- javascript - OAuth "unsupported_grant_type" Discord API
- haskell - 使用 Haskell 类型类时如何优雅地避免“模糊类型变量”
- sql - sqlite3 strftime没有返回任何东西
- jpa - JPA-无法清除列值
- r - 创建包含行号的列表,其中第 i 列包含该行的最大值
- yaml - 在 YAML(yml) 中检索主机名 -f
- c# - C# 从列表中生成嵌套字典
- docker - Apache docket 容器未开始使用 docker-compose up