Comments (3)
This would be really useful, another example of this being unintuitive is with module.exports
. With --print-width
set to 80 it generally works as long as you don't have tiny function names, but with a larger width it puts them all onto one line.
$ ./node_modules/.bin/prettier form.js
module.exports = {
createForm: createForm,
listForm: listForm,
retrieveForm: retrieveForm,
updateForm: updateForm,
deleteForm: deleteForm
};
$ ./node_modules/.bin/prettier --print-width 180 form.js
module.exports = { createForm: createForm, listForm: listForm, retrieveForm: retrieveForm, updateForm: updateForm, deleteForm: deleteForm };
from prettier.
That's sort of the point of the formatter. It will fit code where it can. The printer will forcibly break a lot of constructs because that's how they look bests, but objects are going to collapse like that.
There are many other times where a short objects is what you want, and this is the kind of styling that I think we need to be less opinionated about. If you add more it's not more work to break it vertically when needed because the formatter will do it for you.
from prettier.
Sure, I assumed that would be the case, but just wanted to let you know that it could be a "fixable" issue, although it's mostly just a can of worms
Thanks for your work 😄
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.