Comments (3)
I think we can make it so if you don't use brackets, it will try to put the single expression on the same line. The formatter always prints brackets across lines so we can't do the style above. I'd say if you want it on the same line don't use brackets.
from prettier.
I always use if (err) {return err}
for these short escape clauses. I like to always have {}
for safety.
Maybe the rule can be that if the body is small enough, it can go on the same line?
from prettier.
I think it shouldn't try to put a single line if on one line. Some styles prefer:
if (cond)
doSomething();
This should probably just be an option.
from prettier.
Related Issues (20)
- Issue when running prettier for any APEX class in my project HOT 1
- Range formatting doesn't work
- VSCode prettier extension and the `prettier --write .` giving two different results HOT 2
- In less file, automatically insert space between ) and ` HOT 2
- prettier leaves "prettier-ignore" statements in code HOT 3
- CLI: Exit code is 0 when --check is specified and "no parser could be inferred" (since version 3.1)
- Ignore CDATA in HTML or option to ignore it HOT 3
- Prettier adding trailing comma after implicit returns and after last param in function call in vue 2 projects HOT 2
- Add an option to optinaly disable changes introduced in 2.3.0 HOT 2
- JS multi-line comments are not formatted when there are spaces between lines that are created with `*` HOT 1
- Cannot read properties of undefined (reading 'languages') HOT 1
- Typescript parser takes exponentially more time with every nested generic, hangs with 100% CPU usage HOT 2
- singleAttributePerLine is not working on tsx files HOT 2
- markdown: Underline incorrectly recognized as italic HOT 2
- If you are using Auto Import - ES6, TS, JSX, TSX extension, try to uninstall it and replace it with Auto Import. HOT 2
- prettier formatWithCursor very slowed when use with *.min.js HOT 1
- [CSS] Remove extra indent for multiline `:where`, `:is` and `:not` selectors
- Ranged formatting for `yield` in iterators breaks with tuples HOT 1
- Ugly logical expression break in Vue `v-if`
- [bug] [yaml] list indent fix can result in invalid yaml or change the meaning of existing yaml
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettier.