Skip to content

Commit

Permalink
Add a discouraged feature for RegExp static properties (#2688)
Browse files Browse the repository at this point in the history
The story of the specification is a little weird here, but I think this
tells an OK story to developers.

See-also: https://github.com/tc39/proposal-regexp-legacy-features/
See-also: tc39/ecma262#137
  • Loading branch information
ddbeck authored Feb 21, 2025
1 parent 8362f13 commit 9a21349
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
13 changes: 13 additions & 0 deletions features/regexp-static-properties.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: RegExp static properties
description: The `RegExp` object has several static properties to access the input and results of the most-recent regular expression match.
spec: https://github.com/tc39/proposal-regexp-legacy-features
discouraged:
according_to:
- https://github.com/tc39/proposal-regexp-legacy-features
compat_features:
- javascript.builtins.RegExp.input
- javascript.builtins.RegExp.lastMatch
- javascript.builtins.RegExp.lastParen
- javascript.builtins.RegExp.leftContext
- javascript.builtins.RegExp.n
- javascript.builtins.RegExp.rightContext
40 changes: 40 additions & 0 deletions features/regexp-static-properties.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Generated from: regexp-static-properties.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
support:
chrome: "1"
chrome_android: "18"
edge: "12"
firefox: "1"
firefox_android: "4"
safari: "3"
safari_ios: "1"
compat_features:
# baseline: false
# support:
# chrome: "1"
# chrome_android: "18"
# edge: "12"
# firefox: "1"
# firefox_android: "4"
# safari: "1"
# safari_ios: "1"
- javascript.builtins.RegExp.n

# ⬇️ Same status as overall feature ⬇️
# baseline: false
# support:
# chrome: "1"
# chrome_android: "18"
# edge: "12"
# firefox: "1"
# firefox_android: "4"
# safari: "3"
# safari_ios: "1"
- javascript.builtins.RegExp.input
- javascript.builtins.RegExp.lastMatch
- javascript.builtins.RegExp.lastParen
- javascript.builtins.RegExp.leftContext
- javascript.builtins.RegExp.rightContext
4 changes: 4 additions & 0 deletions scripts/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ const defaultAllowlist: allowlistItem[] = [
[
"https://w3c.github.io/editing/docs/execCommand/",
"Allowed because the execCommand feature points to it, to inform users that the feature is obsolete. The spec exists in a draft state only and will never move out of draft. It serves as a reference."
],
[
"https://github.com/tc39/proposal-regexp-legacy-features",
"Allowed because it's the most spec-like thing that exists for discouraged RegExp static properties. Remove when https://github.com/tc39/ecma262/issues/137 is resolved."
]
];

Expand Down

0 comments on commit 9a21349

Please sign in to comment.