-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow comments in package.json #178
Comments
Converting it to yaml? :) |
Only if you attempt to |
Ok, but this will make it non parseable by native JSON.parse command, right? |
I'm not sure this is a good idea, people might have expectation of |
I think this works well if someone fully bought into kpm and everyone who contributes to a project also does. As @kentaromiura points out, it does indeed happen that package.json files are read and parsed (Jest does this and rn packager too). We just need to make sure they never make it to the registry and projects that require package.json files don't use comments. The problem is though, when people do want to use comments and also need to require it, they need to use a custom parser, which does kinda suck. |
Going to punt this to later. |
Supporting |
@danielbayley assuming yarn doesn't wish to break the npm ecosystem, it wouldn't be entirely free because it'd have to be converted to a proper |
Just some inspiration on this topic: A dependency manifest (and even more so But of course I appreciate the rabbit hole of technical hurdles. Nevertheless I don't think the above point is made clear often enough. |
JSON already supports comments: {
"foo": "this field is for the version of foo",
"foo": "^1.2.3"
} Be as humane as you like! Don't forget to file bugs on tools that inadvertently destroy these duplicate keys ( |
Yarn is really our only morsel of hope. Npm is resolute in its intention not to include comments: npm/npm#4482 I'm not going to keep rehashing the same arguments. The point here is, the lack of comments in Javascript's canonical configuration specification is indicative of the broader critiques often levelled at the language. Yarn, taking the burden of initiative, is a commendable response to such critiques such that it contributes to an overall iterative improvement to the language and ecosystem as a whole. Considering this, is it appropriate that the community look to Yarn to, at the very least, explore the ultimate ideals of dependency management and the manifest document that defines it? @ljharb somewhat ironically, even Yarn itself will not fix key deduplication: #1669 |
Duplicate request: #3959 |
Why not just allow for a This is obviously something that could be setup as part of a webpack configuration. Not sure if this has anything to do with yarn though... Kind of reminds me of this comment: |
Not being able to easily add comments is to some degree, a security issue. Recently there was this |
That’s already achieved with npm depreciations and a semver range that doesn’t include the problem versions; nobody would read that comment since npm install/yarn add commands alter package.json without any human editing. |
@ljharb Thanks for the reply. Hmm, what I had in mind, is people editing the That no one reads that comment isn't totally true — I look at Anyway, never mind, barely matters. |
Fair, I was being hyperbolic - I think not enough people would read the comment for that to be a useful argument in favor of package.json comments. |
Most projects are missing a handy "why do I have this dependency and how did we vet it" comment, which could just be a pointer to the vetting ticket. Admittedly, git blame can sometimes help for that. Also, for those who really care (myself included): https://github.com/wiredmax/npm-json5 - altho I discovered it doesn't work with npm 4 or 5 wiredmax/npm-json5#2 much less yarn. There are of course a variety of tools which will read package.json and provide reports, but that's not exactly lightweight... |
@jcrben ok, interesting to read about those projects. Now I had a look in my Scala project dependencies file, and there, I've added comments for most of the dependencies about why they're needed, and what they do, in case they have not-descriptive names. And why one lib was choosen, in preference to another lib that does mostly the same thing. ... Comparing with |
7 years have passed, so just to recheck, is it still postponed? |
I still don't see any evolution... |
No description provided.
The text was updated successfully, but these errors were encountered: