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 2.0 (old) #3503
Comments
All the changes you mentioned sound good (even switching single quote), now the big question is: do we think that the current suboptimal behavior is worth a breaking change. I’m not sure (in either way). For consistent key quotes, I think we should just do it regardless, I’m not sure why we haven’t already. |
I'm not certain either. The CLI breaking changes listed are quite small, and probably wont affect a large percentage of projects. The changes to the options are are trivial because you can just change them in a config file, so the "migration path" (if you can even call it that) is quite simple. But there's always the risk with breaking changes that people will not know that and simply stick with the older version. |
|
One thing I'd personally find really nice: removing the dependencies on non-JavaScript parsers. (In particular, all parsers other than babylon.) For example, a lot of people aren't using prettier to format TypeScript. But if they install prettier, it pulls in that whole package, which is something like 30 megs by itself. That makes me sad. If prettier adds support for python and installing prettier starts downloading python binaries, that would make me really sad. I would be delighted if prettier could stop trying to ship all of the parsers for anything anyone might want to format. Presumably then trying to format (say) a |
@bakkot Current package is 1.54 MB with zero dependencies on npm. npm-module-stats$ npm-module-stats --name=prettier --version=1.9.2 --format=minimal
Requesting module prettier@1.9.2
Results:
Total Size 1.54 MB
Total Dependencies 0
$ npm-module-stats --name=prettier --version=1.5.3 --format=minimal
Requesting module prettier@1.5.3
Results:
Total Size 1.11 MB
Total Dependencies 0
$ npm-module-stats --name=prettier --version=1.4.x --format=minimal
Requesting module prettier@1.4.4
Results:
Total Size 1.03 MB
Total Dependencies 0
$ npm-module-stats --name=prettier --version=1.3.x --format=minimal
Requesting module prettier@1.3.119.0.09.0.05
Results:
Total Size 943 kB
Total Dependencies 33 |
@azz Ah, I missed that the ( |
It's the size of the tarball that's on npm:
|
I’d like to make a poll to see if the |
Facebook uses |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
If we were to remove the option, I'd vote to make "no spacing" the default, to be consistent with other brackets |
@duailibe I like the style with spacing since it’s easier to focus on the stuff inside the brackets if there’s whitespace around it IMHO. |
We probably can't change the value and remove the option at the same time - we don't want people to not upgrade because it changes too much of their code. |
@j-f1 That's pretty much what people who asks for spacing between |
Let's kill it.. 🔥 |
@ljharb thanks for feedback, update first issue about this |
Can we conduct telemetry or ask users to share their configs somehow? If there are settings that a supermajority of users are choosing, we should probably set those as the default (and a github issue thread is not the best way to collect this data). A google form listed prominently in the readme and tweeted & pinned might be enough? |
I got use to having extra spaces after parenthesis like |
I don’t think that would be a good idea since you could unintentionally break complex syntax; however, if you really want to, you could run a regex replace over your code after running Prettier. |
I gotten use to most of these except extra space before a closing function bracket. If there is a way to add space to function parenthesis I would feel at home with my code formatting. |
I proposed implementing #3806 in a major version bump, so it probably should get added to the list here. |
Sorry for the pressure but I really hope a major release will come soon with the following:
Relying on old dependency versions makes the update increasingly more difficult over time. Supporting old Node.js versions makes this even worse. This seems to be a major diversion of time and attention that could be used for improvements and fixes. My understanding from #6748 (comment) is that the new release should be coming in January 2020, with support for Node.js pre-10 removed. Can someone from @prettier/core confirm? Is there anything special that outside contributors such as @fisker and I should do to propose breaking or potentially breaking changes for 2.0? P.S. Should this be discussed in a new issue? Should I raise a new issue to discuss this? |
@prettier/core |
Can we pin this issue as well? I think it could really help discussions with other projects, such as tildeio/simple-html-tokenizer#74. |
I crawled GitHub a bit and found out:
Total repos: 2648
If you want, I could publish a repo for the crawler tomorrow ^^ |
@Shinigami92 What about That resolves to |
It seems like this also doesn't account for projects using the default Prettier config with |
It should be noted that any review of current prettier configs obviously excludes those who have chosen not to use Prettier (due to missing settings), even if they'd like to. As I mentioned in my previous comment (with relevant links), because of the conflict between Prettier and Airbnb's style guide on parentheses-wrapped multiline expressions, anyone who follows the Airbnb style guide (both the code-quality and formatting rules) is not using Prettier (Prettier doesn't have the setting and ESLint has no plans to add auto fix for the conflict). That's a massive developer base who would no doubt like to use Prettier but literally can't, as it currently stands. Keep in mind, these developers are using single quotes. In other words, if the goal here is to figure out what current (biased) Prettier users are doing, then you'll likely see something pretty close to the current defaults. But surveying the developer community as a whole will yield very different results. |
Mh yea... it was late yesterday and I wanted to have some fun with GitHub's GraphQL ^^ I don't know if it's the right way to only look into repos |
@thorn0 time to close this issue, I think? |
Note added by @j-f1:
This is NOT the current plan for Prettier v2.0. We’ve significantly scaled back our plans for what Prettier 2.0 will do, allowing us to get a less-controversial release out sooner: #6888
I've been thinking a bit about what we would do if (don't create a milestone just yet 😉) we were to do a Prettier 2.0 release with some API/CLI breaking changes. No significant changes to code formatting other than perhaps changing some defaults.
Easy?
trailingComma
to"es5"
.The diff advantages alone are excellent, and this seems to be commonplace among the most popular JS projects.
CLI:
config file doesn't work at the way other libraries do #2691 - CLI defaults to
"**/*.{js,ts,...}"
.People should just be able to do
prettier --write
without passing messy globs #0CJSConsider replacing the "parser" option with "language" #2846 - Replace the "parser" option with "language".
e.g.
echo ".foo {}" | prettier --language css
Keep
--parser flow
or perhaps support something like--parser.js flow
for future extensibility.Remove
--flow-parser
option.Has been deprecated for a long time.
For debate
Consistently add quotes to object keys #838 - Consistently add quotes to object keys.
e.g. put quotes around
origin
in this example:Change the default value for
singleQuote
totrue
Outdated
Consider removing default parser / Skip processing unsupported file types #2884 - Remove the default parser.Fixed by Don't default parser to babylon #4528Space after function keyword - MOVED to #3847! #1139 - Put a space after then
infunction () {}
The text was updated successfully, but these errors were encountered: