Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

84
Views
Order of fields in package.json?

Recently I made a PR to a repo to add a typings field in package.json, and the maintainer proposed the following change:

-   "typings": "./src/index.d.ts",
-   "main": "./src/index.js",
-   "exports": "./src/index.js",
+   "main": "./src/index.js",
+   "exports": "./src/index.js",
+   "types": "./src/index.d.ts",

I wonder if there is a recommended rule or convention of orders of entries in package.json.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It could be that the maintainer has a formating tool enabled like prettier that automatically sorts the package.json file. Or maybe they just like ordering their scripts in order of execution. Either way it's a json object so ultimately the order of the fields does not matter, just the nesting.

Another thought is they could be using a special batch or shell script that hand cranks the package.json during CD, converting the scripts object to an array that gets run in order of execution. Without seeing the github I can't be sure though.

https://www.npmjs.com/package/prettier-package-json

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!