Skip to content
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

🚀 Feature: Don't require version if package has "private": true #250

Closed
3 tasks done
altano opened this issue Mar 27, 2024 · 6 comments · Fixed by #456
Closed
3 tasks done

🚀 Feature: Don't require version if package has "private": true #250

altano opened this issue Mar 27, 2024 · 6 comments · Fixed by #456
Labels
status: blocked Waiting for something else to be resolved type: feature New enhancement or request

Comments

@altano
Copy link
Contributor

altano commented Mar 27, 2024

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Overview

I have disabled the package-json/valid-version rule because it warns on private packages. Tools like changeset require that you remove the private package version number (instead of, say providing a useless one like 0.0.1) or it will try to manage that version, even if the package is private. Ideally this package would just allow no versions on private packages.

Thank you for making this package btw. It's great!

Additional Info

No response

@altano altano added the type: feature New enhancement or request label Mar 27, 2024
@JoshuaKGoldberg JoshuaKGoldberg added status: accepting prs Please, send a pull request to resolve this! and removed status: accepting prs Please, send a pull request to resolve this! labels Mar 27, 2024
@JoshuaKGoldberg
Copy link
Owner

Oh, that's good to know - thank you for reporting!

Right now, the rule's implementation is set to only complain if there is a "version" property. It doesn't complain if the property doesn't exist:

What situation are you seeing where there's an erroneous complaint?

@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for author Needs an action taken by the original poster label Mar 27, 2024
@altano
Copy link
Contributor Author

altano commented Mar 28, 2024

Sorry, I misspoke: it's the valid-package-def rule that is erroring when a package has a private specifier and no version:

/Volumes/sourcecode/npm-packages/packages/eslint-config-altano/package.json
  1:1  error  Missing required field: version  package-json/valid-package-def

This test case in valid-package-def.test.ts would reveal it:

		{
			code: `{
  "name": "panda",
  "private": true
}`,
			filename: "package.json",
		},

I can submit a PR if you'd like. I would create an exception for this error and only pass the Missing required field: version error through if private: true is not in the package? (I don't see a way of configuring package validator to use that logic itself). Would I somehow traverse the ast to determine it has a name, or ?

@JoshuaKGoldberg
Copy link
Owner

JoshuaKGoldberg commented Mar 28, 2024

I don't see a way of configuring package validator to use that logic itself

Ahh, good news, I'm also working on https://github.com/TechNickAI/package.json-validator. So this would be a good issue to file there! Could I trouble you to do that please?

@JoshuaKGoldberg JoshuaKGoldberg added status: blocked Waiting for something else to be resolved and removed status: waiting for author Needs an action taken by the original poster labels Mar 28, 2024
@JoshuaKGoldberg
Copy link
Owner

Ha, just hit this in my own work.

Clarifying my request for the issue: I like giving authors of issues & PRs proper attribution, and having them file things means they get credit more prominently. But I don't want to add more work to your plate on this clear bug in libraries that's inconveniencing you already. I've set myself a reminder to do everything on Monday if nothing's filed by then.

@altano
Copy link
Contributor Author

altano commented Mar 29, 2024

Filed: JoshuaKGoldberg/package.json-validator#84

Clarifying my request for the issue ...

I get it, you're fostering the spirit of open source, not being lazy.

But I don't want to add more work to your plate on this clear bug in libraries that's inconveniencing you already.

Nah, I'm just fucking around. You couldn't inconvenience me if you tried. I curate a little zen garden of npm packages that absolutely no one users over at https://github.com/altano/npm-packages and I'm adding package.json validation to it for absolutely no reason. So it's all good.

Copy link

🎉 This is included in version v0.15.1 🎉

The release is available on:

Cheers! 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: blocked Waiting for something else to be resolved type: feature New enhancement or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants