After upgrading Prettier to v2.0.1 XO started crashing:
$ xo --fix
Error: Failed to load plugin 'prettier' declared in 'CLIOptions': Cannot find module 'eslint-plugin-prettier'
Require stack:
- /project/__placeholder__.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
at Function.resolve (internal/modules/cjs/helpers.js:83:19)
at Object.resolve (/project/node_modules/eslint/lib/shared/relative-module-resolver.js:44:50)
at ConfigArrayFactory._loadPlugin (/project/node_modules/eslint/lib/cli-engine/config-array-factory.js:959:39)
at /project/node_modules/eslint/lib/cli-engine/config-array-factory.js:848:33
at Array.reduce (<anonymous>)
at ConfigArrayFactory._loadPlugins (/project/node_modules/eslint/lib/cli-engine/config-array-factory.js:844:22)
at ConfigArrayFactory._normalizeObjectConfigDataBody (/project/node_modules/eslint/lib/cli-engine/config-array-factory.js:667:32)
at _normalizeObjectConfigDataBody.next (<anonymous>)
at ConfigArrayFactory._normalizeObjectConfigData (/project/node_modules/eslint/lib/cli-engine/config-array-factory.js:596:20)
We haven't migrated to Prettier 2 yet.
You shouldn't have prettier as a dependency of your project. XO already defines prettier ass it's own dependency with the version that we support for now.
What about projects (like mine) that use Prettier to format non JavaScript files (ex. YAML)?
This (most popular) extension to use Prettier in VSCode uses bundled Prettier if there is no prettier dependency in the project.
And starting version 4.0.0 it uses Prettier 2.
So in order to have this extension works correctly with xo — prettier have to be as dependency inside package.json.
@pvdlg is it in the plans to migrate?
Is there anything we can do to help?
I intend to work on the migration but not sure how much work there is and when I'll have time.
Might take a week or so.