eslint-config-prettier: Cannot find module 'eslint-config-prettier/react'
eslint gives me the error: Cannot find module 'eslint-config-prettier/react'
with the following config, anything I’m doing wrong?
{
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"prettier",
"prettier/react"
],
"parser": "babel-eslint",
"plugins": [
"react",
"prettier"
],
"parserOptions": {
"ecmaVersion": 2016,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"es6": true,
"node": true
},
"globals": {
"localStorage": true,
"ga": true,
"fetch": true,
"window": true,
"document": true,
"Raven": true,
"ENV": true
},
"rules": {
"prettier/prettier": ["error", {"trailingComma": true, "singleQuote": true}],
"no-console": 0,
"react/sort-comp": [1, {
"order": [
"type-annotations",
"static-methods",
"lifecycle",
"everything-else",
"render"
]
}]
}
}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (5 by maintainers)
In version 8.0.0, all configs have been merged into one. So
"prettier/react"
does not exist anymore.The solution is to:
Update to eslint-config-prettier 8.0.0 or later.
Remove any
"prettier/*"
from"extends"
:⬇️
In version 8.0.0 extending
"prettier"
is enough – it includes all the React rules as well (and rules for other plugins).@theskillwithin Me too
I seem to be experiencing this now
npm i eslint-config-prettier@latest
can you share what was causing it? I am getting same error and I dont know what is causing it
yarn add --dev eslint-config-prettier
does anyone know how to get this to work when eslint is installed globally?