Skip to content

Conversation

@arcanis
Copy link

@arcanis arcanis commented Dec 28, 2018

This plugin wasn't properly forwarding the pluginSearchDirs option to Prettier, causing unexpected issues in some cases. This diff simply makes sure that the options are merged with the rc settings that are read right before.

@BPScott
Copy link
Member

BPScott commented Dec 28, 2018

Thanks @arcanis,

I think this should also include any options added within the eslint config - the eslintPrettierOptions object, can update your Object.assign to be:

Object.assign(
  { ignorePath: '.prettierignore' },
  prettierRcOptions,
  eslintPrettierOptions
)

Would it be possible to add a test for this as well?

@BPScott
Copy link
Member

BPScott commented May 11, 2019

Taking a deeper look into this, I don't think this code is correct.

The options that prettier.getFileInfo accepts are not the options that prettier.format accepts, so it doesn't make sense to merge the options that we pass to format into getFileInfo. (Annoyingly the docs are slightly out of date and don't mention the plugins option: https://github.com/prettier/prettier/blob/3fcf69a7d561a22314c9644b4e309907310db266/src/common/get-file-info.js#L8)

I've just merged #187 allows you to pass arbitrary options to getFileInfo. If you need to pass extra options into getFileInfo then you should use that.

@BPScott BPScott closed this May 11, 2019
@BPScott
Copy link
Member

BPScott commented May 11, 2019

It looks like getFileInfo doesn't ever use pluginSearchDirs (per https://github.com/prettier/prettier/blob/3fcf69a7d561a22314c9644b4e309907310db266/src/common/get-file-info.js) so if you need that you'll have to raise an issue in prettier itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants