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

Reference for stage 3 regex-escaping #36928

Merged
merged 11 commits into from
Nov 29, 2024
Merged

Conversation

Josh-Cena
Copy link
Member

Part of #36915

@Josh-Cena Josh-Cena requested a review from a team as a code owner November 22, 2024 19:05
@Josh-Cena Josh-Cena requested review from chrisdavidmills and hamishwillee and removed request for a team and chrisdavidmills November 22, 2024 19:05
@github-actions github-actions bot added Content:JS JavaScript docs size/m [PR only] 51-500 LoC changed labels Nov 22, 2024
Copy link
Contributor

github-actions bot commented Nov 22, 2024

Preview URLs

Flaws (1)

Note! 4 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/escape
Title: RegExp.escape()
Flaw count: 1

  • bad_bcd_queries:
    • No BCD data for query: javascript.builtins.RegExp.escape
External URLs (1)

URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/escape
Title: RegExp.escape()

(comment last updated: 2024-11-29 02:59:28)

@hamishwillee
Copy link
Collaborator

hamishwillee commented Nov 25, 2024

@Josh-Cena Looks great. I don't fully understand this gist linked from the proposal. But I take it to mean there might be risky places to insert the literal, even escaped. I assume this is to an issue because you would have mentioned it.

As an aside, you link to the escape sequence https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions#escape_sequences
The proposal escapes space in its example - I don't see space mentioned in the list. Might not be important - just noting in case it is an omission.

@Josh-Cena
Copy link
Member Author

Oh I forgot to ask but @ljharb @bakkot your reviews will be appreciated too. Thanks!


## See also

- [Polyfill of `RegExp.escape` in `core-js`](https://github.com/zloirock/core-js#regexp-escaping)
Copy link
Contributor

Choose a reason for hiding this comment

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

are you still only linking to core-js polyfills? if not, it'd be great to include https://www.npmjs.com/package/regexp.escape

Copy link
Member Author

Choose a reason for hiding this comment

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

I personally would not object, but I would need to see what others say. In the meantime let's hold the same policy that other maintainers have found acceptable, which is to only consistently include core-js polyfills. Hope you would understand.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure. Where can I go to revisit this discussion? Last time I tried it never went anywhere, and another polyfill maintainer tried recently and it seemed to get overly heated.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll discuss it internally.

Copy link
Member Author

Choose a reason for hiding this comment

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

It looks we still hold https://github.com/orgs/mdn/discussions/475 as our conclusion; i.e. as long as someone steps out to endorse es-shims we are happy to add it, and we should formally document a list of trusted polyfill sources and reject everything not in this list (with another process to endorse more). I'm happy to add es-shims, but I'm too busy to initiate the process in the next few months.

Copy link
Contributor

Choose a reason for hiding this comment

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

Who would need to endorse it? Who endorsed core-js originally? Does it require an MDN team member to initiate the process, or can I?

Copy link
Member Author

Choose a reason for hiding this comment

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

Who endorsed core-js originally?

I think that endorsement was implicitly given due to its wide usage via Babel. Happy to formalize the decision in the meta docs.

Who would need to endorse it? Does it require an MDN team member to initiate the process, or can I?

Just someone who raised a PR and got it merged without any objections. We don't know exactly yet as it's entirely new to us. I bet you can, too, as long as you get multiple feedback on your PR. I imagine it would be put under either https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/What_we_write/Criteria_for_inclusion or https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Writing_style_guide#external_links, as a new section called "Inclusion of polyfills" that basically restates the conclusion in https://github.com/orgs/mdn/discussions/475 and say "we only allow polyfills from trusted sources, which are the following:"

@hamishwillee hamishwillee self-requested a review November 29, 2024 02:44
@hamishwillee
Copy link
Collaborator

This is good to go from my perspective. I'll approve this when you let me know the discussions with the technical experts have wound down.

@Josh-Cena
Copy link
Member Author

I believe I've addressed all reviews.

@hamishwillee hamishwillee merged commit a73295d into mdn:main Nov 29, 2024
8 checks passed
@hamishwillee
Copy link
Collaborator

Thanks very much for this @Josh-Cena - also @bakkot @ljharb

@Josh-Cena Josh-Cena deleted the regex-escape branch November 29, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:JS JavaScript docs size/m [PR only] 51-500 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants