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

Require config by default #896

szhu opened this issue Aug 8, 2019 · 3 comments


Copy link

commented Aug 8, 2019

Consider the following sequence of events:

  1. A developer starts working with a codebase that uses Prettier
  2. The developer uses VSCode, and follows the project recommendation to install the Prettier VSCode extension
  3. Everything works great when the developer is working in this codebase!
  4. However, every time the developer saves a file in any other project that doesn't use Prettier, the code gets auto-formatted, sometimes causing a huge diff. The developer isn't sure why this is happening and there isn't an obvious way to stop this from happening other than uninstalling the extension. Worse, the developer might not even notice that this is happening until much later, when the original file contents are no longer in the undo history.

I love Prettier. As someone who introduces developers to Prettier all the time, it's frustrating when they run into (4). Because of this, every time I recommend developers install this extension, I have to immediately recommend that they go into settings and turn on the "Require prettierconfig" setting.

This means that I can't just drop this extension into a list of extensions that I recommend people install, because it by default will modify code that the user may not have written.

I think that this setting should just be on by default -- it will make me feel more comfortable introducing Prettier to more people, since it reduces the damage that I'm liable for.

Also, just to be clear, here are the steps to reproduce this behavior:

  1. Install Prettier and install this extension.
  2. In VSCode settings, turn on "Format on save".
  3. Open a big JS file that you didn't author.
  4. Make some of your own edits and save the file.
  5. Voila! All the existing code has been modified, too.

This comment has been minimized.

Copy link

commented Aug 8, 2019

To answer some questions that might come up -- Prettier is a tool I would like to recommend to beginning developers. These developers might not have the perfect Git setup yet, and they might be learning about 10 other plugins at the same time, so it's also understandable that they might forget which plugin is suddenly causing their code to change.

If this plugin doesn't want to cater to these users, that's fine -- my hope is that with this setting turned on by default, we can cater to these users with no negative impact on anyone else. If Prettier is a formatter that "just works", hopefully this extension can also be one where no settings need to be adjusted after installation.


This comment has been minimized.

Copy link

commented Aug 12, 2019

IMO, the benefits of this are outweighed by the negatives. By requiring prettier to be configured by default the flow a new user is completely interrupted. They would install the new extension and then nothing happens.

Are there other extensions that are disabled by default? I don't recall seeing this pattern.

@ntotten ntotten closed this Aug 12, 2019


This comment has been minimized.

Copy link

commented Aug 12, 2019

Thanks for your quick reply!

Those are good points. I'd like a flow that I can recommend to people who want to get set up with a particular project, without having it interrupt their flow in other projects.

I'll throw some ideas out there:

  • Adding a quick settings menu to the status bar item. Instead of just opening the output, it could open up a menu that has access to that setting and also an open to open the output.

  • Potentially having a modal, notification, or other dialog, upon install, that asks the user which setting they want to use. (Possibly have it pop up when they they open a project without a prettierrc for the first time.)

  • Possibly this is outside the scope of this extension, and perhaps there can be another extension that only adds in explicit Prettier support?

  • Asking VSCode to make it easier to install extensions per-project. (Currently, I believe the easiest way would require 3 steps: Install, Disable, then Enable for this project only.)

Let me know how these ideas sound! Once I have some sense of the general approach we should use, I'm happy to put in more work to make this happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.