Skip to content

Reference for stage 3 regex-escaping - #36928

Merged
hamishwillee merged 11 commits into
mdn:mainfrom
Josh-Cena:regex-escape
Nov 29, 2024
Merged

hamishwillee merged 11 commits into
mdn:mainfrom
Josh-Cena:regex-escape

Conversation

@Josh-Cena

Copy link
Copy Markdown
Member

Part of #36915

@Josh-Cena
Josh-Cena requested review from a team, 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
@github-actions

github-actions Bot commented Nov 22, 2024

Copy link
Copy Markdown
Contributor

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)

Comment thread files/en-us/web/javascript/reference/global_objects/regexp/escape/index.md Outdated
Comment thread files/en-us/web/javascript/reference/global_objects/regexp/escape/index.md Outdated
@hamishwillee

hamishwillee commented Nov 25, 2024

Copy link
Copy Markdown
Collaborator

@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.

Comment thread files/en-us/web/javascript/reference/global_objects/string/replaceall/index.md Outdated
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Comment thread files/en-us/web/javascript/reference/global_objects/regexp/escape/index.md Outdated
@Josh-Cena

Copy link
Copy Markdown
Member Author

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

Comment thread files/en-us/web/javascript/reference/global_objects/regexp/escape/index.md Outdated
Comment thread files/en-us/web/javascript/reference/global_objects/regexp/escape/index.md Outdated
Comment thread files/en-us/web/javascript/reference/global_objects/regexp/escape/index.md Outdated

## See also

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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:"

Comment thread files/en-us/web/javascript/reference/global_objects/regexp/escape/index.md Outdated
Comment thread files/en-us/web/javascript/reference/global_objects/regexp/escape/index.md Outdated
…laceall/index.md

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
…ape/index.md

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
@hamishwillee
hamishwillee self-requested a review November 29, 2024 02:44
@hamishwillee

Copy link
Copy Markdown
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.

…ape/index.md

Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
@Josh-Cena

Copy link
Copy Markdown
Member Author

I believe I've addressed all reviews.

@hamishwillee
hamishwillee merged commit a73295d into mdn:main Nov 29, 2024
@hamishwillee

Copy link
Copy Markdown
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
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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