-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
doc: spell out condition restrictions #55187
Conversation
Review requested:
|
d8704aa
to
e2fcec8
Compare
e2fcec8
to
f71b086
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The numbered points seem great to me, but ideally we shouldn't encourage people to use all characters I think? So let's be a little bit more cautious in the wording perhaps.
doc/api/packages.md
Outdated
Conditions can be almost any string, including multi-byte characters and | ||
whitespace. There's only a few restrictions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer that we do not say this, and instead say something less specific, eg that special characters are permitted in condition names. We should probably ban spaces IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could start this with a stronger recommendation (e.g. keep it to /^[a-z0-9:=-]+$/
) and only afterwards go into the technical side of what's enforced?
I'm +1 on banning whitespace and also banning quotes and non-ASCII characters. I don't see a clear use case for those but could see many confusing bugs. Conditions usually fail silently, so debugging a "looked like character A but was actually character B" problem seems super annoying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a more opinionated opening paragraph before delving into the technical restrictions.
f71b086
to
5c50184
Compare
5c50184
to
b223c49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@guybedford Let me know if you have objections to landing, otherwise I'm planning to land later today or tomorrow. :) |
b223c49
to
9e167f3
Compare
Commit Queue failed- Loading data for nodejs/node/pull/55187 ✔ Done loading data for nodejs/node/pull/55187 ----------------------------------- PR info ------------------------------------ Title doc: spell out condition restrictions (#55187) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch jkrems:jk-condition-restrictions -> nodejs:main Labels doc Commits 1 - doc: spell out condition restrictions Committers 1 - Jan Martin <[email protected]> PR-URL: https://github.com/nodejs/node/pull/55187 Reviewed-By: Matteo Collina <[email protected]> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/55187 Reviewed-By: Matteo Collina <[email protected]> -------------------------------------------------------------------------------- ⚠ Commits were pushed since the last approving review: ⚠ - doc: spell out condition restrictions ℹ This PR was created on Mon, 30 Sep 2024 18:09:00 GMT ✔ Approvals: 1 ✔ - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/55187#pullrequestreview-2369916989 ✔ Last GitHub CI successful ℹ Green GitHub CI is sufficient -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/11369002902 |
PR-URL: #55187 Reviewed-By: Matteo Collina <[email protected]>
Landed in 73414f3 |
PR-URL: #55187 Reviewed-By: Matteo Collina <[email protected]>
PR-URL: nodejs#55187 Reviewed-By: Matteo Collina <[email protected]>
I never really thought about what kinds of conditions are allowed and which aren't - and it looks like the answer is mostly "anything goes". This documents the status-quo from a practical perspective from what I can gather.
Some of these restrictions (e.g. "no comma") aren't actively enforced by nodejs but maybe should be in the future.