Skip to content

Commit f5694ce

Browse files
committed
fix(estree/tokens): reverse field order of regex object in tokens (#19679)
Our convention is that object properties are in source code order. Reverse `pattern` and `flags` properties of `regex` objects in ESTree tokens to align with this pattern. Bump `estree-conformance` submodule to include oxc-project/estree-conformance#182 which makes the same change in snapshots for conformance tests.
1 parent 8940f66 commit f5694ce

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

.github/scripts/clone-parallel.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const TEST262_SHA = "3aa9cb2c71afc21aefc1f82e899af1d0403351ba";
1515
const BABEL_SHA = "308c8d85b2c81f825f630f765387a135fbf066d9";
1616
const TYPESCRIPT_SHA = "347254895823a36a1b1b1c80471422da54ad77de";
1717
const PRETTIER_SHA = "812a4d0071270f61a7aa549d625b618be7e09d71";
18-
const ESTREE_CONFORMANCE_SHA = "eeda64c238d88512d0bf40dd7e85a08a08af26dc";
18+
const ESTREE_CONFORMANCE_SHA = "57b0d682b191655b68513165079080943eb279d4";
1919
const NODE_COMPAT_TABLE_SHA = "499beb6f1daa36f10c26b85a7f3ec3b3448ded23";
2020

2121
const repoRoot = join(import.meta.dirname, "..", "..");

apps/oxlint/test/fixtures/tokens/output.snap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@
507507
`----
508508
509509
x tokens-plugin(tokens): RegularExpression ("/abc/gu")
510-
| regex: {"flags":"gu","pattern":"abc"}
510+
| regex: {"pattern":"abc","flags":"gu"}
511511
,-[files/index.js:6:9]
512512
5 | // Another comment
513513
6 | let y = /abc/gu;

crates/oxc_estree_tokens/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ pub struct EstreeToken<'a> {
2727

2828
#[derive(Serialize)]
2929
pub struct EstreeRegExpToken<'a> {
30-
pub flags: &'a str,
3130
pub pattern: &'a str,
31+
pub flags: &'a str,
3232
}
3333

3434
#[derive(Debug, Clone, Copy)]
@@ -170,7 +170,7 @@ fn to_estree_tokens<'a>(
170170
source_value
171171
};
172172
let regex = if kind == Kind::RegExp {
173-
regex_parts(source_value).map(|(pattern, flags)| EstreeRegExpToken { flags, pattern })
173+
regex_parts(source_value).map(|(pattern, flags)| EstreeRegExpToken { pattern, flags })
174174
} else {
175175
None
176176
};

tasks/coverage/snapshots/estree_acorn_jsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
commit: eeda64c2
1+
commit: 57b0d682
22

33
estree_acorn_jsx Summary:
44
AST Parsed : 39/39 (100.00%)

tasks/coverage/snapshots/estree_acorn_jsx_tokens.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
commit: eeda64c2
1+
commit: 57b0d682
22

33
estree_acorn_jsx_tokens Summary:
44
AST Parsed : 39/39 (100.00%)

0 commit comments

Comments
 (0)