Coder Social home page Coder Social logo

Comments (3)

p8952 avatar p8952 commented on May 1, 2024

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.

jlongster avatar jlongster commented on May 1, 2024

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.

Haroenv avatar Haroenv commented on May 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.