Prettier 3.0.0 TypeError: prettier.resolveConfig.sync is not a function
Full error message
The error triggered after I run this command:
npx eslint "the code directory"
This is the first several line of the error
TypeError: prettier.resolveConfig.sync is not a function
Occurred while linting *the first line of the first code directory*
Rule: "prettier/prettier"
at Program (*the main directory*\node_modules\eslint-plugin-prettier\eslint-plugin-prettier.js:138:40)
These are eslint, prettier, and the other config taken from package.json
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-cypress": "^2.13.3",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "3.0.0",
"prettier-eslint": "^15.0.1"
I've tried delete the files from node_modules and run 'npm i' then restart the IDE (using VS Code), it still happens.Solutionsource: stackoverflow \u2197
There is an incompatibility between prettier 3 and eslint-plugin-prettier 4. You can fix this by using version 5 of eslint-plugin-prettier: yarn add -D [email protected] or npm install --save-dev [email protected] Official issue: https://github.com/prettier/eslint-plugin-prettier/issues/562 v5 release notes: https://github.com/prettier/eslint-plugin-prettier/releases/tag/v5.0.0
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/79329e7a4e58b4649978ef5ef7a40bdfb8a73cdcece336b04b5b6b12dd043baehash \u00b7 79329e7a4e58b4649978ef5ef7a40bdfb8a73cdcece336b04b5b6b12dd043bae