Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier v2.0.5 breaks linting #466

Open
jonahsnider opened this issue Apr 22, 2020 · 7 comments · Fixed by #505
Open

Prettier v2.0.5 breaks linting #466

jonahsnider opened this issue Apr 22, 2020 · 7 comments · Fixed by #505

Comments

@jonahsnider
Copy link
Contributor

Nearly identical stacktrace to #441. Makes me think something is wrong in how XO uses Prettier.

/home/runner/work/nextjs-starter/nextjs-starter/node_modules/.bin/xo
Error: Failed to load plugin 'prettier' declared in 'CLIOptions': Cannot find module 'eslint-plugin-prettier'
Require stack:
- /home/runner/work/nextjs-starter/nextjs-starter/__placeholder__.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.resolve (internal/modules/cjs/helpers.js:83:19)
    at Object.resolve (/home/runner/work/nextjs-starter/nextjs-starter/node_modules/eslint/lib/shared/relative-module-resolver.js:44:50)
    at ConfigArrayFactory._loadPlugin (/home/runner/work/nextjs-starter/nextjs-starter/node_modules/eslint/lib/cli-engine/config-array-factory.js:959:39)
    at /home/runner/work/nextjs-starter/nextjs-starter/node_modules/eslint/lib/cli-engine/config-array-factory.js:848:33
    at Array.reduce (<anonymous>)
    at ConfigArrayFactory._loadPlugins (/home/runner/work/nextjs-starter/nextjs-starter/node_modules/eslint/lib/cli-engine/config-array-factory.js:844:22)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/home/runner/work/nextjs-starter/nextjs-starter/node_modules/eslint/lib/cli-engine/config-array-factory.js:667:32)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (/home/runner/work/nextjs-starter/nextjs-starter/node_modules/eslint/lib/cli-engine/config-array-factory.js:596:20)
@sindresorhus
Copy link
Member

Are you using the latest XO version? XO only recently (e05efc3) received support for Prettier 2.

// @pvdlg

@jonahsnider
Copy link
Contributor Author

I am using the latest XO version. Prettier 2.0.4 works fine with XO.

@sindresorhus
Copy link
Member

I've locked Prettier at 2.0.4 until we can resolve this: https://github.com/xojs/xo/releases/tag/v0.30.0

@BarryThePenguin
Copy link

It's unfortunate as there are fixes for using prettier in editor plugins, including atom-linter-xo, in prettier 2.0.5

prettier/prettier#8047

Are they related at all?

@puka-tchou
Copy link

puka-tchou commented Sep 2, 2020

We're on prettier v2.1.1 and I've got the exact same problem. Is thers any fix coming?

As a temporary workaround, you can add eslint-plugin-prettier to your dependencies and use the latest version of prettier.

@jonahsnider
Copy link
Contributor Author

This is almost certainly the same root cause as why having a different Prettier version breaks. However XO is importing or using other modules isn't resilient to version changes and seems to force you to use whatever version is specified in the XO package.json.

Same issue with XO having different version than you. #483

@papb
Copy link

papb commented Nov 20, 2020

@sindresorhus I believe this issue shouldn't have been closed. PR #505 contained the sentence doesn't fix #466 but GitHub looked at fix #466 and went out to close this.

isaacs/github#1871

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants