Coder Social home page Coder Social logo

Rundown #3 (JSX) about prettier HOT 6 CLOSED

vramana avatar vramana commented on May 1, 2024 1
Rundown #3 (JSX)

from prettier.

Comments (6)

vjeux avatar vjeux commented on May 1, 2024 1

Should jscodefmt sort JSX props? I heard refmt does something like that. I haven't tried it yet.

Rewrite expression using ternary operator

Those are not safe operations to do in JavaScript. They may change the actual output of a program. So it's probably better to have a lint rule do them.

from prettier.

jlongster avatar jlongster commented on May 1, 2024 1

Good points, a few of them are already fixed on master from other comments, and the rest get into some difficult heuristics but it's worth seeing what we can do. I spent some time on JSX but there's definitely more things we could do.

I need to reduce the amount of time I'm working on this soon. I will slowly tweak things over time but it'd be great if those who proposed changes could actually open PRs. I will write more docs soon about how the printer works to aid this.

from prettier.

vramana avatar vramana commented on May 1, 2024

@vjeux Makes sense.

from prettier.

jlongster avatar jlongster commented on May 1, 2024

Probably a space before ( for anonymous generator functions

I don't think I want to do this. For consistency we'd have to put a space with anon functions too (function () which starts to get annoying. I don't think function*() { ... } looks bad and is consistent. This is one of those things where once you see if a few times you'll think it looks fine.

from prettier.

wmertens avatar wmertens commented on May 1, 2024

For the ...(foo && bar || meep) case, at least insert parens: ...((foo && bar) || meep). Operator precedence is sometimes surprising.

from prettier.

vramana avatar vramana commented on May 1, 2024

I am closing this to reduce noise since people have filed individual issues for most of the issues listed here.

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.