-
-
Notifications
You must be signed in to change notification settings - Fork 95
Conversation
can't wait for this, thanks a lot for the hard work |
We should consider commiting transpiled files separately. It's a bit difficult to navigate and review big changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep formatting options and EditorConfig support (see comments).
For the rest, it totally makes sense to drop them in favor of the new config file.
I didn't look at the code specifically. I think the tests should be reliable enough for this kind of refactoring.
@@ -1,40 +0,0 @@ | |||
// @flow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might have misunderstood, but isn't this the feature that lets the package use local Prettier installs instead of the packaged one? I thought it was useful for a lot of devs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the one that determines whether or not to run formatOnSave based on whether prettier is installed, if the user has chosen the option. The code that gets the local instance is still in (that's getPrettierInstance
).
const handleError = require('./handleError'); | ||
|
||
const executePrettier = (editor: TextEditor, text: string) => | ||
getPrettierInstance(editor).format(text, buildPrettierOptions(editor)); | ||
getPrettierInstance(editor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally missed that point when you described it in #256
I feel like "use a config file or the defaults" is too radical.
We have no fallback if there is no config, and it reduces our coverage of use cases.
I understand this for ESLint because there are a lot of rules, but it's manageable for Prettier.
Consider this:
- Not all teams or projects work with config files (I'm in this situation).
- The package will not always be used in a project setting: I could hack on a single file without having to define a
.prettierrc
for example.
src/config-schema.json
Outdated
"description": | ||
"Use [EditorConfig](http://editorconfig.org/) configuration to load project-based settings for Prettier formatting.<br>Takes precedence over your settings. The following settings will be overriden if they are found in your `.editorconfig`: **Use tabs**, **Tab width**, **Print width**.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should keep this option? At least until prettier/prettier#42 is closed.
It's the third most popular request if you sort issues by 👍 reactions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And then do a reverse merge, like if it's in the prettier config's options, use that, if not, use the editor config's options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, basically keep it as a fallback for people who don't use config files.
@darahak So you think: keep:
remove:
|
@robwise Yes, basically keep formatting options because they are still a good interface for CLI single options, and EditorConfig support because Prettier Config is not a complete replacement IMO (see prettier/prettier#42 for related discussion). I'm not sure about these two:
In the end, it's just my opinion. It would be great to have some feedback from users. |
On second thought, would it be a good idea to add an option that says: only use Prettier Config or default options (current proposal)? If it's disabled, the package is able to fall back on user settings. |
Current PR for EditorConfig support: prettier/prettier#2760 |
Just an update, still working on this, but I have to wait until Prettier releases |
7e14b67
to
1adfed0
Compare
Codecov Report
@@ Coverage Diff @@
## master #261 +/- ##
=========================================
+ Coverage 76.29% 77.8% +1.51%
=========================================
Files 26 29 +3
Lines 426 455 +29
Branches 40 44 +4
=========================================
+ Hits 325 354 +29
Misses 87 87
Partials 14 14
Continue to review full report at Codecov.
|
Tracking for 1.6.2 which will include .sync() prettier/prettier#2804 |
9d0b326
to
0c07a43
Compare
86e1a22
to
2d68a4e
Compare
No description provided.