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

doc: spell out condition restrictions #55187

Closed
wants to merge 1 commit into from

Conversation

jkrems
Copy link
Contributor

@jkrems jkrems commented Sep 30, 2024

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.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Sep 30, 2024
jkrems added a commit to jkrems/node that referenced this pull request Sep 30, 2024
Copy link
Contributor

@guybedford guybedford left a 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.

Comment on lines 692 to 693
Conditions can be almost any string, including multi-byte characters and
whitespace. There's only a few restrictions:
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

jkrems added a commit to jkrems/node that referenced this pull request Sep 30, 2024
jkrems added a commit to jkrems/node that referenced this pull request Sep 30, 2024
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jkrems
Copy link
Contributor Author

jkrems commented Oct 15, 2024

@guybedford Let me know if you have objections to landing, otherwise I'm planning to land later today or tomorrow. :)

doc/api/packages.md Outdated Show resolved Hide resolved
doc/api/packages.md Outdated Show resolved Hide resolved
doc/api/packages.md Outdated Show resolved Hide resolved
@jkrems jkrems added the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 16, 2024
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Oct 16, 2024
@nodejs-github-bot
Copy link
Collaborator

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/.ncu
https://github.com/nodejs/node/actions/runs/11369002902

jkrems added a commit that referenced this pull request Oct 16, 2024
PR-URL: #55187
Reviewed-By: Matteo Collina <[email protected]>
@jkrems
Copy link
Contributor Author

jkrems commented Oct 16, 2024

Landed in 73414f3

@jkrems jkrems closed this Oct 16, 2024
@jkrems jkrems deleted the jk-condition-restrictions branch October 16, 2024 15:45
aduh95 pushed a commit that referenced this pull request Oct 19, 2024
@aduh95 aduh95 mentioned this pull request Oct 24, 2024
louwers pushed a commit to louwers/node that referenced this pull request Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commit-queue-failed An error occurred while landing this pull request using GitHub Actions. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants