Giter VIP home page Giter VIP logo

Comments (10)

Glavin001 avatar Glavin001 commented on June 17, 2024 1

Prettier actually supports JSON.stringify-like formatting: prettier/prettier#4450
Uses json-stringify parser: https://github.com/prettier/prettier/blob/808ce8817b20eb016f404a03a7c822f4353660e4/src/language-js/index.js#L131-L144

from beautifier-sort-package-json.

Glavin001 avatar Glavin001 commented on June 17, 2024 1

@muuvmuuv they could be two separate beautifiers. Improve the existing Prettier beautifier to better support package.json and also create a new beautifier for sorting package.json keys. Then in .unibeautifyrc file, have both beautifers: ["Prettier", "Sort-Package-JSON"] for example. 🎉

from beautifier-sort-package-json.

muuvmuuv avatar muuvmuuv commented on June 17, 2024 1

@lassik I do not think this is the same. sort-package-json sort by the well-known keys from npm see https://www.npmjs.com/package/sort-package-json#how-does-it-sort

@Glavin001 I would take on this if we are going to create a beautifier for sort-package-json

from beautifier-sort-package-json.

lassik avatar lassik commented on June 17, 2024 1

OK, so it doesn't sort them in alphabetical order, but a custom one. Cool.

from beautifier-sort-package-json.

muuvmuuv avatar muuvmuuv commented on June 17, 2024

A possible beautifier name could be beautifier-npm, I think beautifier-sort-package-json is a little bit too long, but I can understand if we want to keep it consistent.

from beautifier-sort-package-json.

stevenzeck avatar stevenzeck commented on June 17, 2024

We generally want to keep the names the same so it doesn't confuse anyone. Does it format as well as sort?

from beautifier-sort-package-json.

muuvmuuv avatar muuvmuuv commented on June 17, 2024

@stevenzeck I need to check that. I guess it just sorts it. If not we could add a note for users to use it with prettier behind to beautify it first

Sent with GitHawk

from beautifier-sort-package-json.

muuvmuuv avatar muuvmuuv commented on June 17, 2024

@Glavin001 yes and Sort package would sort it not beautify it actually. I guess people can use it without Unibeautify but I thought it would be nice to have this on save

Sent with GitHawk

from beautifier-sort-package-json.

lassik avatar lassik commented on June 17, 2024

FYI: prettier/prettier#1096 Option to sort object keys

"Currently out of scope" for prettier.

EDIT: That issue seems to be about keys in JavaScript code, where the values of those keys can be executable code. JSON would be easier as order of keys cannot affect semantics.

from beautifier-sort-package-json.

Glavin001 avatar Glavin001 commented on June 17, 2024

@muuvmuuv repository created and all yours to take this on 🎉 . Thanks for the great idea and for contributing! 😃

from beautifier-sort-package-json.

Related Issues (1)

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.