From 50e5bd810d6542489085882e745b5d8493b89551 Mon Sep 17 00:00:00 2001 From: Denis Bezrukov <6227442+denbezrukov@users.noreply.github.com> Date: Tue, 11 Apr 2023 10:28:26 +0300 Subject: [PATCH 1/2] fix(rome_js_analyze): lint/correctness/noUndeclaredVariables incorrectly identifies AggregateError as an undeclared variable. #4365 --- CHANGELOG.md | 1 + crates/rome_js_analyze/src/globals/runtime.rs | 6 ++++-- .../noUndeclaredVariables/noUndeclaredVariables.js | 3 ++- .../noUndeclaredVariables/noUndeclaredVariables.js.snap | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d102e7c299..03772280fa8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - Code actions are formatted using Rome's formatter. If the formatter is disabled, the code action is not formatted. +- Fix `noUndeclaredVariables` incorrectly identifies `AggregateError` as an undeclared variable. https://github.com/rome/tools/issues/4365 #### New rules - [`noConfusingArrow`](https://docs.rome.tools/lint/rules/noConfusingArrow/) - [`noRedundantRoles`](https://docs.rome.tools/lint/rules/noRedundantRoles/) diff --git a/crates/rome_js_analyze/src/globals/runtime.rs b/crates/rome_js_analyze/src/globals/runtime.rs index edb742eba55..9964f52e869 100644 --- a/crates/rome_js_analyze/src/globals/runtime.rs +++ b/crates/rome_js_analyze/src/globals/runtime.rs @@ -1,4 +1,5 @@ -pub const BUILTIN: [&str; 65] = [ +pub const BUILTIN: [&str; 66] = [ + "AggregateError", "Array", "ArrayBuffer", "Atomics", @@ -295,7 +296,8 @@ pub const ES_2020: [&str; 63] = [ "valueOf", ]; -pub const ES_2021: [&str; 65] = [ +pub const ES_2021: [&str; 66] = [ + "AggregateError", "Array", "ArrayBuffer", "Atomics", diff --git a/crates/rome_js_analyze/tests/specs/correctness/noUndeclaredVariables/noUndeclaredVariables.js b/crates/rome_js_analyze/tests/specs/correctness/noUndeclaredVariables/noUndeclaredVariables.js index 65468770d6a..7997f75aa4f 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noUndeclaredVariables/noUndeclaredVariables.js +++ b/crates/rome_js_analyze/tests/specs/correctness/noUndeclaredVariables/noUndeclaredVariables.js @@ -9,4 +9,5 @@ assignment = "value"; // valid document; navigator; -new ArrayBuffer(); \ No newline at end of file +new ArrayBuffer(); +new AggregateError(); diff --git a/crates/rome_js_analyze/tests/specs/correctness/noUndeclaredVariables/noUndeclaredVariables.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noUndeclaredVariables/noUndeclaredVariables.js.snap index 09e4cfab289..8ec254f4355 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noUndeclaredVariables/noUndeclaredVariables.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noUndeclaredVariables/noUndeclaredVariables.js.snap @@ -16,6 +16,8 @@ assignment = "value"; document; navigator; new ArrayBuffer(); +new AggregateError(); + ``` # Diagnostics From 689446b0cddec6adc7b49b48c720ed5c0b2d520d Mon Sep 17 00:00:00 2001 From: Denis Bezrukov <6227442+denbezrukov@users.noreply.github.com> Date: Tue, 11 Apr 2023 10:43:38 +0300 Subject: [PATCH 2/2] fix(rome_js_analyze): lint/correctness/noUndeclaredVariables incorrectly identifies AggregateError as an undeclared variable. #4365 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03772280fa8..3d566e16584 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ - Code actions are formatted using Rome's formatter. If the formatter is disabled, the code action is not formatted. -- Fix `noUndeclaredVariables` incorrectly identifies `AggregateError` as an undeclared variable. https://github.com/rome/tools/issues/4365 +- Fix an issue when `noUndeclaredVariables` incorrectly identifies `AggregateError` as an undeclared variable. [#4365](https://github.com/rome/tools/issues/4365) #### New rules - [`noConfusingArrow`](https://docs.rome.tools/lint/rules/noConfusingArrow/) - [`noRedundantRoles`](https://docs.rome.tools/lint/rules/noRedundantRoles/)