question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: prettier.resolveConfig.sync is not a function

See original GitHub issue

It looks like there is a regression in 4.3.2:

$ node_modules/.bin/prettier-eslint path/to/file.js
prettier-eslint-cli [ERROR]: There was an error formatting "path/to/file.js":
    TypeError: prettier.resolveConfig.sync is not a function
        at getPrettierConfig (node_modules/prettier-eslint/dist/index.js:233:33)
        at format (node_modules/prettier-eslint/dist/index.js:90:51)
        at MapSubscriber.project (node_modules/prettier-eslint-cli/dist/format-files.js:275:55)
        at MapSubscriber._next (node_modules/rxjs/operator/map.js:77:35)
        at MapSubscriber.Subscriber.next (node_modules/rxjs/Subscriber.js:89:18)
        at AsyncSubject.Subject.next (node_modules/rxjs/Subject.js:55:25)
        at AsyncSubject.complete (node_modules/rxjs/AsyncSubject.js:46:35)
        at handlerFn (node_modules/rxjs/observable/BoundNodeCallbackObservable.js:193:33)
        at tryToString (fs.js:456:3)
        at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:443:12)

This only happens with version 4.3.2, not with 4.3.1 versions 4.3.2 and 4.3.1, not with 4.3.0. It also happens without a .prettierrc file.

  • prettier-eslint-cli version: 4.3.2
  • prettier-eslint version: 8.0.0
  • eslint version: 4.6.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:16
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
kentcdoddscommented, Sep 8, 2017

Ah yes, well that’s a problem… cc @robwise

I suggest locking down to prettier-eslint-cli@4.3.0 until the next version of prettier gets released.

I’m not using prettier-eslint anymore (I’m just using prettier) so I’m afraid my time on the project is pretty limited. If someone wants to take up the torch let me know 😃

3reactions
marcbachmanncommented, Sep 8, 2017

@kentcdodds I don’t think that the resolveConfig.sync is in the published prettier module yet. That landed 7 days ago on master. https://github.com/prettier/prettier/pull/2722 The most recent release was 10 days ago.

… I also just upgraded to node 8.4 and have the same issues with a clean install.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: prettier.resolveConfig.sync is not a function #124
Versions: prettier-eslint version: 4.3.2 node version: 8.4.0 yarn version: 1.0.1 Have you followed the debugging tips?
Read more >
"prettierApi.resolveConfig.sync is not a function" error when ...
when running the "Reformat with Prettier" action, the following error occurs: TypeError: prettierApi.resolveConfig.sync is not a function at PrettierPlugin.
Read more >
prettier.resolveConfig JavaScript and Node.js code examples
How to use. resolveConfig. function. in. prettier ... resolveConfig.sync(file, { config: prettierConfigPath, }); try { const fileInfo = prettier.
Read more >
API · Prettier
Use prettier.resolveConfig.sync(filePath [, options]) if you'd like to use sync version. prettier.resolveConfigFile([ ...
Read more >
How to use the prettier.resolveConfig function in prettier - Snyk
it("should be done based on prettier config", async () => { const config = await resolveConfig(__dirname); const files = glob.sync(join(__dirname, "./abis/*.ts") ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found