Giter Site home page Giter Site logo

Comments (4)

kddnewton avatar kddnewton commented on July 29, 2024 2

@xfalcox --print-width is in the CLI for v3.1.0

from syntax_tree.

kddnewton avatar kddnewton commented on July 29, 2024 1

Yeah I don't really want to add more configuration but print width is so fundamental I think I have to. I think I'm going to add --print-width as a command-line option to all of the commands that it makes sense.

That being said @xfalcox I really wouldn't suggest increasing it all of the way to 120. It's fundamentally different from something like rubocop's line length for instance. This doc here: https://prettier.io/docs/en/options.html#print-width goes into why and is a pretty good explanation. I've seen people have success with 100 occasionally, but leaving it at 80 is definitely a better way to go in the long run (in my opinion).

That being said, I am going to support this option.

from syntax_tree.

xeger avatar xeger commented on July 29, 2024

Configurable line width would be a big help for me, too.

I have been focusing on the VS Code extension and not really on the core gem. The gem has a plugin architecture; if I were to do line width, I would see about making it a plugin (might need to adjust the core code to enable that).

The other factor is, how to specify the parameter (desired max width)? Your idea of using an environment variable was interesting. I know the philosophy of this gem is KISS / zero-config as much as possible -- introducing any config is a bit of a bummer.

An alternate idea would be to introduce a way to specify parameters for plugins, on the CLI or at instantiation time, --plugin=foo/bar:120 or something like that.

Or, perhaps the gem could ship with a plugin that expands line width to 120 / 160 / etc, and people can subclass that plugin and install their own subclass if they want another value.

Anyhow: random musings. Curious to hear @kddnewton's take on line length. It's not blocking adoption in my company but would be nice to have down the road.

from syntax_tree.

xfalcox avatar xfalcox commented on July 29, 2024

Hahaha you are right on the money with the 120. I implemented both 120 and 100 as plugins on my fork and we found 120 removing too much if blocks into guard clauses.

We are now evaluating 100 as a middle ground!

from syntax_tree.

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.