diff --git a/crates/rome_analyze/src/lib.rs b/crates/rome_analyze/src/lib.rs index 72cbd7e777c..48eb0466735 100644 --- a/crates/rome_analyze/src/lib.rs +++ b/crates/rome_analyze/src/lib.rs @@ -1,7 +1,5 @@ #![deny(rustdoc::broken_intra_doc_links)] -use rome_console::codespan::Severity; -use rome_diagnostics::v2::{category, Category}; use std::cmp::Ordering; use std::collections::{BTreeMap, BinaryHeap}; use std::ops; @@ -36,6 +34,10 @@ pub use crate::syntax::SyntaxVisitor; pub use crate::visitor::{NodeVisitor, Visitor, VisitorContext, VisitorFinishContext}; use rome_console::markup; use rome_diagnostics::file::{FileId, FileSpan}; +use rome_diagnostics::{ + v2::{category, Category}, + Severity, +}; use rome_diagnostics::{Diagnostic, SubDiagnostic}; use rome_rowan::{ AstNode, Direction, Language, SyntaxElement, SyntaxToken, TextRange, TextSize, TriviaPieceKind, diff --git a/crates/rome_analyze/src/matcher.rs b/crates/rome_analyze/src/matcher.rs index 377c1c1db90..ed8b8ebf807 100644 --- a/crates/rome_analyze/src/matcher.rs +++ b/crates/rome_analyze/src/matcher.rs @@ -155,8 +155,7 @@ where #[cfg(test)] mod tests { - use rome_console::codespan::Severity; - use rome_diagnostics::{file::FileId, v2::category, Diagnostic}; + use rome_diagnostics::{file::FileId, v2::category, Diagnostic, Severity}; use rome_rowan::{ raw_language::{RawLanguage, RawLanguageKind, RawLanguageRoot, RawSyntaxTreeBuilder}, AstNode, TextRange, TextSize, TriviaPiece, TriviaPieceKind, diff --git a/crates/rome_cli/tests/snapshots/main_check/downgrade_severity.snap b/crates/rome_cli/tests/snapshots/main_check/downgrade_severity.snap index caa905da526..b34ad44dad2 100644 --- a/crates/rome_cli/tests/snapshots/main_check/downgrade_severity.snap +++ b/crates/rome_cli/tests/snapshots/main_check/downgrade_severity.snap @@ -31,10 +31,8 @@ file.js:1:1 lint/correctness/noDebugger FIXABLE ━━━━━━━━━━ ! This is an unexpected use of the debugger statement. - ┌─ file.js:1:1 - │ - 1 │ debugger; - │ ^^^^^^^^^ + > 1 │ debugger; + │ ^^^^^^^^^ i Suggested fix: Remove debugger statement diff --git a/crates/rome_cli/tests/snapshots/main_check/lint_error.snap b/crates/rome_cli/tests/snapshots/main_check/lint_error.snap index 392ac118615..4a8ec60f17c 100644 --- a/crates/rome_cli/tests/snapshots/main_check/lint_error.snap +++ b/crates/rome_cli/tests/snapshots/main_check/lint_error.snap @@ -22,10 +22,9 @@ check.js:1:1 lint/correctness/useBlockStatements FIXABLE ━━━━━━━ × Block statements are preferred in this position. - ┌─ check.js:1:1 - │ - 1 │ for(;true;); - │ ^^^^^^^^^^^^ + > 1 │ for(;true;); + │ ^^^^^^^^^^^^ + 2 │ i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -41,10 +40,9 @@ check.js:1:1 lint/correctness/useWhile FIXABLE ━━━━━━━━━━ × Use while loops instead of for loops. - ┌─ check.js:1:1 - │ - 1 │ for(;true;); - │ ^^^^^^^^^^^ + > 1 │ for(;true;); + │ ^^^^^^^^^^^ + 2 │ i Suggested fix: Use a while loop diff --git a/crates/rome_cli/tests/snapshots/main_check/maximum_diagnostics.snap b/crates/rome_cli/tests/snapshots/main_check/maximum_diagnostics.snap index 1b9047dc4e9..787f399ab8a 100644 --- a/crates/rome_cli/tests/snapshots/main_check/maximum_diagnostics.snap +++ b/crates/rome_cli/tests/snapshots/main_check/maximum_diagnostics.snap @@ -30,10 +30,10 @@ check.js:2:1 lint/correctness/useBlockStatements FIXABLE ━━━━━━━ × Block statements are preferred in this position. - ┌─ check.js:2:1 - │ - 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^^ + > 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^^ + 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -53,10 +53,10 @@ check.js:2:1 lint/correctness/useWhile FIXABLE ━━━━━━━━━━ × Use while loops instead of for loops. - ┌─ check.js:2:1 - │ - 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^ + > 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^ + 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Use a while loop @@ -76,10 +76,10 @@ check.js:2:13 lint/correctness/useBlockStatements FIXABLE ━━━━━━ × Block statements are preferred in this position. - ┌─ check.js:2:13 - │ - 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^^ + > 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^^ + 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -99,10 +99,10 @@ check.js:2:13 lint/correctness/useWhile FIXABLE ━━━━━━━━━━ × Use while loops instead of for loops. - ┌─ check.js:2:13 - │ - 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^ + > 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^ + 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Use a while loop @@ -122,10 +122,10 @@ check.js:2:25 lint/correctness/useBlockStatements FIXABLE ━━━━━━ × Block statements are preferred in this position. - ┌─ check.js:2:25 - │ - 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^^ + > 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^^ + 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -145,10 +145,10 @@ check.js:2:25 lint/correctness/useWhile FIXABLE ━━━━━━━━━━ × Use while loops instead of for loops. - ┌─ check.js:2:25 - │ - 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^ + > 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^ + 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Use a while loop @@ -168,10 +168,10 @@ check.js:2:37 lint/correctness/useBlockStatements FIXABLE ━━━━━━ × Block statements are preferred in this position. - ┌─ check.js:2:37 - │ - 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^^ + > 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^^ + 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -191,10 +191,10 @@ check.js:2:37 lint/correctness/useWhile FIXABLE ━━━━━━━━━━ × Use while loops instead of for loops. - ┌─ check.js:2:37 - │ - 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^ + > 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^ + 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Use a while loop @@ -214,10 +214,10 @@ check.js:2:49 lint/correctness/useBlockStatements FIXABLE ━━━━━━ × Block statements are preferred in this position. - ┌─ check.js:2:49 - │ - 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^^ + > 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^^ + 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -237,10 +237,10 @@ check.js:2:49 lint/correctness/useWhile FIXABLE ━━━━━━━━━━ × Use while loops instead of for loops. - ┌─ check.js:2:49 - │ - 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^ + > 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^ + 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Use a while loop @@ -260,10 +260,10 @@ check.js:2:61 lint/correctness/useBlockStatements FIXABLE ━━━━━━ × Block statements are preferred in this position. - ┌─ check.js:2:61 - │ - 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^^ + > 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^^ + 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -283,10 +283,10 @@ check.js:2:61 lint/correctness/useWhile FIXABLE ━━━━━━━━━━ × Use while loops instead of for loops. - ┌─ check.js:2:61 - │ - 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^ + > 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^ + 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Use a while loop @@ -306,10 +306,11 @@ check.js:3:1 lint/correctness/useBlockStatements FIXABLE ━━━━━━━ × Block statements are preferred in this position. - ┌─ check.js:3:1 - │ - 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^^ + 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + > 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^^ + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 5 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -330,10 +331,11 @@ check.js:3:1 lint/correctness/useWhile FIXABLE ━━━━━━━━━━ × Use while loops instead of for loops. - ┌─ check.js:3:1 - │ - 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^ + 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + > 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^ + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 5 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Use a while loop @@ -354,10 +356,11 @@ check.js:3:13 lint/correctness/useBlockStatements FIXABLE ━━━━━━ × Block statements are preferred in this position. - ┌─ check.js:3:13 - │ - 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^^ + 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + > 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^^ + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 5 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -378,10 +381,11 @@ check.js:3:13 lint/correctness/useWhile FIXABLE ━━━━━━━━━━ × Use while loops instead of for loops. - ┌─ check.js:3:13 - │ - 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^ + 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + > 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^ + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 5 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Use a while loop @@ -402,10 +406,11 @@ check.js:3:25 lint/correctness/useBlockStatements FIXABLE ━━━━━━ × Block statements are preferred in this position. - ┌─ check.js:3:25 - │ - 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^^ + 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + > 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^^ + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 5 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -426,10 +431,11 @@ check.js:3:25 lint/correctness/useWhile FIXABLE ━━━━━━━━━━ × Use while loops instead of for loops. - ┌─ check.js:3:25 - │ - 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^ + 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + > 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^ + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 5 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Use a while loop @@ -450,10 +456,11 @@ check.js:3:37 lint/correctness/useBlockStatements FIXABLE ━━━━━━ × Block statements are preferred in this position. - ┌─ check.js:3:37 - │ - 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^^ + 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + > 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^^ + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 5 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -474,10 +481,11 @@ check.js:3:37 lint/correctness/useWhile FIXABLE ━━━━━━━━━━ × Use while loops instead of for loops. - ┌─ check.js:3:37 - │ - 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); - │ ^^^^^^^^^^^ + 2 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + > 3 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + │ ^^^^^^^^^^^ + 4 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); + 5 │ for(;true;);for(;true;);for(;true;);for(;true;);for(;true;);for(;true;); i Suggested fix: Use a while loop diff --git a/crates/rome_cli/tests/snapshots/main_check/parse_error.snap b/crates/rome_cli/tests/snapshots/main_check/parse_error.snap index 33b8c1e8945..e9396d087ea 100644 --- a/crates/rome_cli/tests/snapshots/main_check/parse_error.snap +++ b/crates/rome_cli/tests/snapshots/main_check/parse_error.snap @@ -24,10 +24,9 @@ check.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━ × the file ends here - ┌─ check.js:2:1 - │ - 2 │ - │ ^ + 1 │ if + > 2 │ + │ ``` diff --git a/crates/rome_cli/tests/snapshots/main_check/upgrade_severity.snap b/crates/rome_cli/tests/snapshots/main_check/upgrade_severity.snap index 47282d111fb..45c1cf5004b 100644 --- a/crates/rome_cli/tests/snapshots/main_check/upgrade_severity.snap +++ b/crates/rome_cli/tests/snapshots/main_check/upgrade_severity.snap @@ -43,11 +43,14 @@ file.js:3:9 lint/nursery/noUnreachable ━━━━━━━━━━━━━ × This code is unreachable - ┌─ file.js:3:9 - │ - 3 │ ┌ continue; - 4 │ │ break; - │ └──────────────^ + 1 │ function f() { + 2 │ for (;;) { + > 3 │ continue; + │ ^^^^^^^^^ + > 4 │ break; + │ ^^^^^^ + 5 │ } + 6 │ } ``` @@ -57,10 +60,10 @@ file.js:1:10 lint/nursery/noUnusedVariables ━━━━━━━━━━━━ × This function is unused. - ┌─ file.js:1:10 - │ - 1 │ function f() { - │ ^ + > 1 │ function f() { + │ ^ + 2 │ for (;;) { + 3 │ continue; i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. diff --git a/crates/rome_cli/tests/snapshots/main_ci/ci_lint_error.snap b/crates/rome_cli/tests/snapshots/main_ci/ci_lint_error.snap index 9343970197f..29c9567acb7 100644 --- a/crates/rome_cli/tests/snapshots/main_ci/ci_lint_error.snap +++ b/crates/rome_cli/tests/snapshots/main_ci/ci_lint_error.snap @@ -22,10 +22,9 @@ ci.js:1:1 lint/correctness/useBlockStatements FIXABLE ━━━━━━━━ × Block statements are preferred in this position. - ┌─ ci.js:1:1 - │ - 1 │ for(;true;); - │ ^^^^^^^^^^^^ + > 1 │ for(;true;); + │ ^^^^^^^^^^^^ + 2 │ i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -41,10 +40,9 @@ ci.js:1:1 lint/correctness/useWhile FIXABLE ━━━━━━━━━━━ × Use while loops instead of for loops. - ┌─ ci.js:1:1 - │ - 1 │ for(;true;); - │ ^^^^^^^^^^^ + > 1 │ for(;true;); + │ ^^^^^^^^^^^ + 2 │ i Suggested fix: Use a while loop diff --git a/crates/rome_cli/tests/snapshots/main_ci/ci_parse_error.snap b/crates/rome_cli/tests/snapshots/main_ci/ci_parse_error.snap index 6876ba5dc48..8c4e05ce34a 100644 --- a/crates/rome_cli/tests/snapshots/main_ci/ci_parse_error.snap +++ b/crates/rome_cli/tests/snapshots/main_ci/ci_parse_error.snap @@ -24,10 +24,9 @@ ci.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━ × the file ends here - ┌─ ci.js:2:1 - │ - 2 │ - │ ^ + 1 │ if + > 2 │ + │ ``` diff --git a/crates/rome_console/src/codespan/LICENSE b/crates/rome_console/src/codespan/LICENSE deleted file mode 100644 index 261eeb9e9f8..00000000000 --- a/crates/rome_console/src/codespan/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/crates/rome_console/src/codespan/mod.rs b/crates/rome_console/src/codespan/mod.rs deleted file mode 100644 index dc06d9e2645..00000000000 --- a/crates/rome_console/src/codespan/mod.rs +++ /dev/null @@ -1,677 +0,0 @@ -//! This module is a fork of -//! adapted to use the `rome_console` markup for formatting -use std::collections::BTreeMap; -use std::io; - -use crate::fmt::{Display, Formatter}; -use crate::markup::MarkupBuf; -use rome_text_size::{TextRange, TextSize}; - -use self::render::{MultiLabel, Renderer, SingleLabel}; - -mod render; - -pub use self::render::WithSeverity; - -const START_CONTEXT_LINES: usize = 3; -const END_CONTEXT_LINES: usize = 1; - -/// A label describing an underlined region of code associated with a diagnostic. -#[derive(Clone)] -pub struct Label { - /// The style of the label. - pub style: LabelStyle, - /// The range in bytes we are going to include in the final snippet. - pub range: TextRange, - /// An optional message to provide some additional information for the - /// underlined code. These should not include line breaks. - pub message: MarkupBuf, -} - -#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd)] -pub enum LabelStyle { - /// Labels that describe the primary cause of a diagnostic. - Primary, - /// Labels that provide additional context for a diagnostic. - Secondary, -} - -/// A severity level for diagnostic messages. -/// -/// These are ordered in the following way: -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] -#[cfg_attr( - feature = "serde", - derive(serde::Serialize, serde::Deserialize, schemars::JsonSchema) -)] -pub enum Severity { - /// A help message. - Help, - /// A note. - Note, - /// A warning. - Warning, - /// An error. - Error, - /// An unexpected bug. - Bug, -} - -impl From for &'static str { - fn from(level: Severity) -> Self { - match level { - Severity::Bug => "bug", - Severity::Error => "error", - Severity::Warning => "warning", - Severity::Help => "help", - Severity::Note => "note", - } - } -} - -/// The 'location focus' of a source code snippet. -#[derive(Copy, Clone)] -pub enum Locus<'diagnostic> { - File { - /// The user-facing name of the file. - name: &'diagnostic str, - }, - FileLocation { - /// The user-facing name of the file. - name: &'diagnostic str, - /// The location. - location: Location, - }, -} - -impl<'diagnostic> Display for Locus<'diagnostic> { - fn fmt(&self, fmt: &mut Formatter) -> io::Result<()> { - match self { - Locus::File { name } => write!(fmt, "{name}"), - Locus::FileLocation { name, location } => write!( - fmt, - "{name}:{line_number}:{column_number}", - name = name, - line_number = location.line_number, - column_number = location.column_number, - ), - } - } -} - -/// A user-facing location in a source file. -#[derive(Debug, Copy, Clone, PartialEq, Eq)] -pub struct Location { - /// The user-facing line number. - pub line_number: usize, - /// The user-facing column number. - pub column_number: usize, -} - -#[derive(Copy, Clone)] -pub struct Codespan<'diagnostic> { - /// Source code and line indices for the file being annotated - pub source_file: SourceFile<'diagnostic>, - /// Overall severity of the codespan, used to select a color for primary labels - pub severity: Severity, - /// Optional locus to show at the top of the codespan - pub locus: Option>, - /// List of labels to draw on top of the source file - pub labels: &'diagnostic [Label], -} - -impl<'diagnostic> Display for Codespan<'diagnostic> { - fn fmt(&self, fmt: &mut Formatter) -> io::Result<()> { - let mut outer_padding = 0; - let mut labeled_file: Option = None; - - for label in self.labels { - let start_line_index = self.source_file.line_index(label.range.start()); - let start_line_number = self.source_file.line_number(start_line_index); - - let start_line_range = self.source_file.line_range(start_line_index)?; - let end_line_index = self.source_file.line_index(label.range.end()); - let end_line_number = self.source_file.line_number(end_line_index); - - let end_line_range = self.source_file.line_range(end_line_index)?; - - outer_padding = std::cmp::max(outer_padding, count_digits(start_line_number)); - outer_padding = std::cmp::max(outer_padding, count_digits(end_line_number)); - - let labeled_file = match &mut labeled_file { - Some(labeled_file) => { - // other labezls already exist in this codespan - if labeled_file.max_label_style > label.style - || (labeled_file.max_label_style == label.style - && labeled_file.start > label.range.start()) - { - // this label has a higher style or has the same style but starts earlier - labeled_file.start = label.range.start(); - labeled_file.location = self.source_file.location(label.range.start())?; - labeled_file.max_label_style = label.style; - } - labeled_file - } - None => { - // this is the first label inserted into this codespan - labeled_file.get_or_insert(LabeledFile { - start: label.range.start(), - location: self.source_file.location(label.range.start())?, - num_multi_labels: 0, - lines: BTreeMap::new(), - max_label_style: label.style, - }) - } - }; - - if start_line_index == end_line_index { - // Single line - // - // ```text - // 2 │ (+ test "") - // │ ^^ expected `Int` but found `String` - // ``` - let label_start = label.range.start() - start_line_range.start(); - // Ensure that we print at least one caret, even when we - // have a zero-length source range. - let label_end = TextSize::max( - label.range.end() - start_line_range.start(), - label_start + TextSize::from(1u32), - ); - - let line = labeled_file.get_or_insert_line( - start_line_index, - start_line_range, - start_line_number, - ); - - // Ensure that the single line labels are lexicographically - // sorted by the range of source code that they cover. - let index = match line.single_labels.binary_search_by(|(_, range, _)| { - // `TextRange` doesn't implement `Ord`, so convert to `(usize, usize)` - // to piggyback off its lexicographic comparison implementation. - (range.start(), range.end()).cmp(&(label_start, label_end)) - }) { - // If the ranges are the same, order the labels in reverse - // to how they were originally specified in the diagnostic. - // This helps with printing in the renderer. - Ok(index) | Err(index) => index, - }; - - line.single_labels.insert( - index, - ( - label.style, - TextRange::new(label_start, label_end), - &label.message, - ), - ); - - // If this line is not rendered, the SingleLabel is not visible. - line.must_render = true; - } else { - // Multiple lines - // - // ```text - // 4 │ fizz₁ num = case (mod num 5) (mod num 3) of - // │ ╭─────────────^ - // 5 │ │ 0 0 => "FizzBuzz" - // 6 │ │ 0 _ => "Fizz" - // 7 │ │ _ 0 => "Buzz" - // 8 │ │ _ _ => num - // │ ╰──────────────^ `case` clauses have incompatible types - // ``` - - let label_index = labeled_file.num_multi_labels; - labeled_file.num_multi_labels += 1; - - // First labeled line - let label_start = label.range.start() - start_line_range.start(); - - let start_line = labeled_file.get_or_insert_line( - start_line_index, - start_line_range, - start_line_number, - ); - - start_line.multi_labels.push(( - label_index, - label.style, - MultiLabel::Top(label_start), - )); - - // The first line has to be rendered so the start of the label is visible. - start_line.must_render = true; - - // Marked lines - // - // ```text - // 5 │ │ 0 0 => "FizzBuzz" - // 6 │ │ 0 _ => "Fizz" - // 7 │ │ _ 0 => "Buzz" - // ``` - for line_index in (start_line_index + 1)..end_line_index { - let line_range = self.source_file.line_range(line_index)?; - let line_number = self.source_file.line_number(line_index); - - outer_padding = std::cmp::max(outer_padding, count_digits(line_number)); - - let line = labeled_file.get_or_insert_line(line_index, line_range, line_number); - - line.multi_labels - .push((label_index, label.style, MultiLabel::Left)); - - // The line should be rendered to match the configuration of how much context to show. - line.must_render |= - // Is this line part of the context after the start of the label? - line_index - start_line_index <= START_CONTEXT_LINES - || - // Is this line part of the context before the end of the label? - end_line_index - line_index <= END_CONTEXT_LINES; - } - - // Last labeled line - // - // ```text - // 8 │ │ _ _ => num - // │ ╰──────────────^ `case` clauses have incompatible types - // ``` - let label_end = label.range.end() - end_line_range.start(); - - let end_line = labeled_file.get_or_insert_line( - end_line_index, - end_line_range, - end_line_number, - ); - - end_line.multi_labels.push(( - label_index, - label.style, - MultiLabel::Bottom(label_end, &label.message), - )); - - // The last line has to be rendered so the end of the label is visible. - end_line.must_render = true; - } - } - - let mut renderer = Renderer::new(&mut *fmt); - let file = match &labeled_file { - Some(file) => file, - None => return Ok(()), - }; - - // Top left border and locus. - // - // ```text - // ┌─ test:2:9 - // ``` - if !file.lines.is_empty() { - if let Some(locus) = &self.locus { - renderer.render_snippet_start(outer_padding, locus)?; - } - - renderer.render_snippet_empty( - outer_padding, - self.severity, - file.num_multi_labels, - &[], - )?; - } - - let mut lines = file - .lines - .iter() - .filter(|(_, line)| line.must_render) - .peekable(); - - while let Some((line_index, line)) = lines.next() { - renderer.render_snippet_source( - outer_padding, - line.number, - line.range, - self.source_file.source, - self.severity, - &line.single_labels, - file.num_multi_labels, - &line.multi_labels, - )?; - - // Check to see if we need to render any intermediate stuff - // before rendering the next line. - if let Some((next_line_index, _)) = lines.peek() { - match next_line_index.checked_sub(*line_index) { - // Consecutive lines - Some(1) => {} - // One line between the current line and the next line - Some(2) => { - // This line was not intended to be rendered initially. - // To render the line right, we have to get back the original labels. - let labels = file - .lines - .get(&(line_index + 1)) - .map_or(&[][..], |line| &line.multi_labels[..]); - - let line_number = self.source_file.line_number(line_index + 1); - let line_range = self - .source_file - .line_range(line_index + 1) - .map_err(|_| io::Error::new(io::ErrorKind::Other, "overflow error"))?; - - renderer.render_snippet_source( - outer_padding, - line_number, - line_range, - self.source_file.source, - self.severity, - &[], - file.num_multi_labels, - labels, - )?; - } - // More than one line between the current line and the next line. - Some(_) | None => { - // Source break - // - // ```text - // · - // ``` - renderer.render_snippet_break( - outer_padding, - self.severity, - file.num_multi_labels, - &line.multi_labels, - )?; - } - } - } - } - - Ok(()) - } -} - -/// Representation of a single source file holding additional information for -/// efficiently rendering [Codespan] -#[derive(Clone, Copy)] -pub struct SourceFile<'diagnostic> { - /// The source code of the file. - pub source: &'diagnostic str, - /// The starting byte indices in the source code. - pub line_starts: &'diagnostic [TextSize], -} - -impl<'diagnostic> SourceFile<'diagnostic> { - /// Create a new [SourceFile] from a slice of text - pub fn new(source: &'diagnostic str, line_starts: &'diagnostic [TextSize]) -> Self { - Self { - source, - line_starts, - } - } - - /// Return the starting byte index of each line in the source string. - pub fn line_starts(source: &'_ str) -> impl '_ + Iterator { - std::iter::once(0) - .chain(source.match_indices(&['\n', '\r']).filter_map(|(i, _)| { - let bytes = source.as_bytes(); - - match bytes[i] { - // Filter out the `\r` in `\r\n` to avoid counting the line break twice - b'\r' if i + 1 < bytes.len() && bytes[i + 1] == b'\n' => None, - _ => Some(i + 1), - } - })) - .map(|i| TextSize::try_from(i).expect("integer overflow")) - } - - /// Return the starting byte index of the line with the specified line index. - /// Convenience method that already generates errors if necessary. - fn line_start(&self, line_index: usize) -> io::Result { - use std::cmp::Ordering; - - match line_index.cmp(&self.line_starts.len()) { - Ordering::Less => Ok(self - .line_starts - .get(line_index) - .cloned() - .expect("failed despite previous check")), - Ordering::Equal => Ok(TextSize::of(self.source)), - Ordering::Greater => Err(io::Error::new( - io::ErrorKind::InvalidInput, - "overflow error", - )), - } - } - - fn line_index(&self, byte_index: TextSize) -> usize { - self.line_starts - .binary_search(&byte_index) - .unwrap_or_else(|next_line| next_line - 1) - } - - fn line_range(&self, line_index: usize) -> io::Result { - let line_start = self.line_start(line_index)?; - let next_line_start = self.line_start(line_index + 1)?; - - Ok(TextRange::new(line_start, next_line_start)) - } - - fn line_number(&self, line_index: usize) -> usize { - line_index + 1 - } - - fn column_number(&self, line_index: usize, byte_index: TextSize) -> io::Result { - let source = self.source; - let line_range = self.line_range(line_index)?; - let column_index = column_index(source, line_range, byte_index); - - Ok(column_index + 1) - } - - /// Get a source location from a byte index into the text of this file - pub fn location(&self, byte_index: TextSize) -> io::Result { - let line_index = self.line_index(byte_index); - - Ok(Location { - line_number: self.line_number(line_index), - column_number: self.column_number(line_index, byte_index)?, - }) - } -} - -/// The column index at the given byte index in the source file. -/// This is the number of characters to the given byte index. -/// -/// If the byte index is smaller than the start of the line, then `0` is returned. -/// If the byte index is past the end of the line, the column index of the last -/// character `+ 1` is returned. -fn column_index(source: &str, line_range: TextRange, byte_index: TextSize) -> usize { - let end_index = std::cmp::min( - byte_index, - std::cmp::min(line_range.end(), TextSize::of(source)), - ); - - (usize::from(line_range.start())..usize::from(end_index)) - .filter(|byte_index| source.is_char_boundary(byte_index + 1)) - .count() -} - -/// Count the number of decimal digits in `n`. -fn count_digits(mut n: usize) -> usize { - let mut count = 0; - while n != 0 { - count += 1; - n /= 10; // remove last digit - } - count -} - -struct LabeledFile<'diagnostic> { - start: TextSize, - location: Location, - num_multi_labels: usize, - lines: BTreeMap>, - max_label_style: LabelStyle, -} - -impl<'diagnostic> LabeledFile<'diagnostic> { - fn get_or_insert_line( - &mut self, - line_index: usize, - line_range: TextRange, - line_number: usize, - ) -> &mut Line<'diagnostic> { - self.lines.entry(line_index).or_insert_with(|| Line { - range: line_range, - number: line_number, - single_labels: vec![], - multi_labels: vec![], - // This has to be false by default so we know if it must be rendered by another condition already. - must_render: false, - }) - } -} - -struct Line<'diagnostic> { - number: usize, - range: TextRange, - // TODO: How do we reuse these allocations? - single_labels: Vec>, - multi_labels: Vec<(usize, LabelStyle, MultiLabel<'diagnostic>)>, - must_render: bool, -} - -#[cfg(test)] -mod tests { - use rome_text_size::{TextRange, TextSize}; - - use crate::codespan::SourceFile; - use crate::{self as rome_console, BufferConsole, ConsoleExt, LogLevel, Markup}; - use crate::{ - codespan::{Codespan, Label, LabelStyle, Location, Locus, Severity}, - markup, - }; - - #[test] - fn test_codespan() { - const SOURCE: &str = "Lorem ipsum dolor sit amet, -consectetur adipiscing elit, -sed do eiusmod tempor incididunt ut -labore et dolore magna aliqua"; - - const DIAGNOSTIC: Markup<'static> = markup! { - " ""┌─"" file_name:2:12\n " - "│"" \n" - "2"" ""│"" consectetur ""adipiscing elit"",\n " - "│" " ""^^^^^^^^^^^^^^^"" ""Important"" message""\n" - "3"" ""│"" sed do eiusmod tempor incididunt ut\n " - "│"" " "┌───────────────'""\n" - "4"" " "│"" ""│"" labore et dolore magna aliqua\n " - "│"" " "│"" ""---------"" ""Secondary message""\n " - "│"" " "└──────' Multiline message""\n" - }; - - let lines_starts: Vec<_> = SourceFile::line_starts(SOURCE).collect(); - let source_file = SourceFile::new(SOURCE, &lines_starts); - - let codespan = Codespan { - source_file, - severity: Severity::Error, - locus: Some(Locus::FileLocation { - name: "file_name", - location: Location { - line_number: 2, - column_number: 12, - }, - }), - labels: &[ - Label { - style: LabelStyle::Primary, - range: TextRange::new(TextSize::from(40u32), TextSize::from(55u32)), - message: markup! { - "Important"" message" - } - .to_owned(), - }, - Label { - style: LabelStyle::Secondary, - range: TextRange::new(TextSize::from(71u32), TextSize::from(99u32)), - message: markup! { - "Multiline message" - } - .to_owned(), - }, - Label { - style: LabelStyle::Secondary, - range: TextRange::new(TextSize::from(100u32), TextSize::from(109u32)), - message: markup! { - "Secondary message" - } - .to_owned(), - }, - ], - }; - - let mut console = BufferConsole::default(); - console.log(markup! { - {codespan} - }); - - let mut iter = console.out_buffer.into_iter(); - - let message = iter - .next() - .expect("the buffer console should have a message in memory"); - - assert_eq!(message.level, LogLevel::Log); - assert_eq!(message.content, DIAGNOSTIC.to_owned()); - - assert!(iter.next().is_none()); - } - - #[test] - fn line_starts_with_carriage_return_line_feed() { - let input = "a\r\nb\r\nc"; - let starts = SourceFile::line_starts(input).collect::>(); - - assert_eq!( - vec![ - TextSize::from(0u32), - TextSize::from(3u32), - TextSize::from(6u32) - ], - starts - ); - } - - #[test] - fn line_starts_with_carriage_return() { - let input = "a\rb\rc"; - let starts = SourceFile::line_starts(input).collect::>(); - - assert_eq!( - vec![ - TextSize::from(0u32), - TextSize::from(2u32), - TextSize::from(4u32) - ], - starts - ); - } - - #[test] - fn line_starts_with_line_feed() { - let input = "a\nb\nc"; - let starts = SourceFile::line_starts(input).collect::>(); - - assert_eq!( - vec![ - TextSize::from(0u32), - TextSize::from(2u32), - TextSize::from(4u32) - ], - starts - ); - } -} diff --git a/crates/rome_console/src/codespan/render.rs b/crates/rome_console/src/codespan/render.rs deleted file mode 100644 index 415d5821fde..00000000000 --- a/crates/rome_console/src/codespan/render.rs +++ /dev/null @@ -1,1078 +0,0 @@ -use std::io; -use std::{io::Error, ops::Range}; - -use rome_text_size::{TextRange, TextSize}; - -use crate::fmt::Display; -use crate::markup::MarkupBuf; -use crate::{self as rome_console, MarkupNode}; -use crate::{ - codespan::{LabelStyle, Locus, Severity}, - fmt::Formatter, - markup, Markup, MarkupElement, -}; - -const MAX_LINE_LENGTH: u32 = 250; - -const SOURCE_BORDER_TOP_LEFT: char = '┌'; -const SOURCE_BORDER_TOP: char = '─'; -const SOURCE_BORDER_LEFT: char = '│'; -const SOURCE_BORDER_LEFT_BREAK: char = '·'; - -const SINGLE_PRIMARY_CARET: char = '^'; -const SINGLE_SECONDARY_CARET: char = '-'; - -const MULTI_PRIMARY_CARET_START: char = '^'; -const MULTI_SECONDARY_CARET_START: char = '\''; -const MULTI_TOP_LEFT: char = '┌'; -const MULTI_TOP: char = '─'; -const MULTI_BOTTOM_LEFT: char = '└'; -const MULTI_BOTTOM: char = '─'; -const MULTI_LEFT: char = '│'; - -const POINTER_LEFT: char = '│'; - -/// Prints a piece of markup with the appropriate formatting for the given -/// label style and severity -#[derive(Clone, Copy)] -pub struct WithSeverity<'a>(pub LabelStyle, pub Severity, pub &'a dyn Display); - -impl<'a> Display for WithSeverity<'a> { - fn fmt(&self, fmt: &mut Formatter) -> io::Result<()> { - let element = match (self.0, self.1) { - (LabelStyle::Primary, Severity::Bug) => MarkupElement::Error, - (LabelStyle::Primary, Severity::Error) => MarkupElement::Error, - (LabelStyle::Primary, Severity::Warning) => MarkupElement::Warn, - (LabelStyle::Primary, Severity::Note) => MarkupElement::Success, - (LabelStyle::Primary, Severity::Help) => MarkupElement::Info, - (LabelStyle::Secondary, _) => MarkupElement::Info, - }; - - fmt.write_markup(Markup(&[MarkupNode { - elements: &[element], - content: self.2, - }])) - } -} - -/// Single-line label, with an optional message. -/// -/// ```text -/// ^^^^^^^^^ blah blah -/// ``` -pub(super) type SingleLabel<'diagnostic> = (LabelStyle, TextRange, &'diagnostic MarkupBuf); - -/// A multi-line label to render. -/// -/// Locations are relative to the start of where the source code is rendered. -pub(super) enum MultiLabel<'diagnostic> { - /// Multi-line label top. - /// The contained value indicates where the label starts. - /// - /// ```text - /// ╭────────────^ - /// ``` - /// - /// Can also be rendered at the beginning of the line - /// if there is only whitespace before the label starts. - /// - /// /// ```text - /// ╭ - /// ``` - Top(TextSize), - /// Left vertical labels for multi-line labels. - /// - /// ```text - /// │ - /// ``` - Left, - /// Multi-line label bottom, with an optional message. - /// The first value indicates where the label ends. - /// - /// ```text - /// ╰────────────^ blah blah - /// ``` - Bottom(TextSize, &'diagnostic MarkupBuf), -} - -#[derive(Copy, Clone)] -enum VerticalBound { - Top, - Bottom, -} - -type Underline = (LabelStyle, VerticalBound); - -/// A renderer of display list entries. -/// -/// The following diagram gives an overview of each of the parts of the renderer's output: -/// -/// ```text -/// ┌ outer gutter -/// │ ┌ left border -/// │ │ ┌ inner gutter -/// │ │ │ ┌─────────────────────────── source ─────────────────────────────┐ -/// │ │ │ │ │ -/// ┌──────────────────────────────────────────────────────────────────────────── -/// snippet start ── │ ┌─ test:9:0 -/// snippet empty ── │ │ -/// snippet line ── │ 9 │ ╭ Cupcake ipsum dolor. Sit amet marshmallow topping cheesecake -/// snippet line ── │ 10 │ │ muffin. Halvah croissant candy canes bonbon candy. Apple pie jelly -/// │ │ ╭─│─────────^ -/// snippet break ── │ · │ │ -/// snippet line ── │ 33 │ │ │ Muffin danish chocolate soufflé pastry icing bonbon oat cake. -/// snippet line ── │ 34 │ │ │ Powder cake jujubes oat cake. Lemon drops tootsie roll marshmallow -/// │ │ │ ╰─────────────────────────────^ blah blah -/// snippet break ── │ · │ -/// snippet line ── │ 38 │ │ Brownie lemon drops chocolate jelly-o candy canes. Danish marzipan -/// snippet line ── │ 39 │ │ jujubes soufflé carrot cake marshmallow tiramisu caramels candy canes. -/// │ │ │ ^^^^^^^^^^^^^^^^^^^ -------------------- blah blah -/// │ │ │ │ -/// │ │ │ blah blah -/// │ │ │ note: this is a note -/// snippet line ── │ 40 │ │ Fruitcake jelly-o danish toffee. Tootsie roll pastry cheesecake -/// snippet line ── │ 41 │ │ soufflé marzipan. Chocolate bar oat cake jujubes lollipop pastry -/// snippet line ── │ 42 │ │ cupcake. Candy canes cupcake toffee gingerbread candy canes muffin -/// │ │ │ ^^^^^^^^^^^^^^^^^^ blah blah -/// │ │ ╰──────────^ blah blah -/// snippet break ── │ · -/// snippet line ── │ 82 │ gingerbread toffee chupa chups chupa chups jelly-o cotton candy. -/// │ │ ^^^^^^ ------- blah blah -/// empty ── │ -/// ``` -/// -/// Filler text from http://www.cupcakeipsum.com -pub(super) struct Renderer<'render, 'fmt> { - writer: &'render mut Formatter<'fmt>, -} - -impl<'render, 'fmt> Renderer<'render, 'fmt> { - /// Construct a renderer from the given writer and config. - pub(super) fn new(writer: &'render mut Formatter<'fmt>) -> Renderer<'render, 'fmt> { - Renderer { writer } - } - - /// Top left border and locus. - /// - /// ```text - /// ┌─ test:2:9 - /// ``` - pub(super) fn render_snippet_start( - &mut self, - outer_padding: usize, - locus: &Locus, - ) -> Result<(), Error> { - self.outer_gutter(outer_padding)?; - self.writer.write_markup(markup! { - {SOURCE_BORDER_TOP_LEFT}{SOURCE_BORDER_TOP}" "{locus}"\n" - }) - } - - #[allow(clippy::too_many_arguments)] - fn render_snippet_source_impl( - &mut self, - outer_padding: usize, - line_number: usize, - source: &str, - severity: Severity, - single_labels: &[SingleLabel<'_>], - num_multi_labels: usize, - multi_labels: &[(usize, LabelStyle, MultiLabel<'_>)], - ) -> Result<(), Error> { - // Trim trailing newlines, linefeeds, and null chars from source, if they exist. - // FIXME: Use the number of trimmed placeholders when rendering single line carets - let source = source.trim_end_matches(['\n', '\r', '\0'].as_ref()); - - // Write source line - // - // ```text - // 10 │ │ muffin. Halvah croissant candy canes bonbon candy. Apple pie jelly - // ``` - { - // Write outer gutter (with line number) and border - self.outer_gutter_number(line_number, outer_padding)?; - self.border_left()?; - - // Write inner gutter (with multi-line continuations on the left if necessary) - let mut multi_labels_iter = multi_labels.iter().peekable(); - for label_column in 0..num_multi_labels { - match multi_labels_iter.peek() { - Some((label_index, label_style, label)) if *label_index == label_column => { - match label { - MultiLabel::Top(start) - if *start - <= TextSize::of(source) - TextSize::of(source.trim_start()) => - { - self.label_multi_top_left(severity, *label_style)?; - } - MultiLabel::Top(..) => self.inner_gutter_space()?, - MultiLabel::Left | MultiLabel::Bottom(..) => { - self.label_multi_left(severity, *label_style, None)?; - } - } - multi_labels_iter.next(); - } - Some((_, _, _)) | None => self.inner_gutter_space()?, - } - } - - // Write source text - write!(self.writer, " ")?; - for (metrics, ch) in self.char_metrics(source.char_indices()) { - let column_range = - TextRange::new(metrics.byte_index, metrics.byte_index + TextSize::of(ch)); - - // Check if we are overlapping a primary label - let is_primary = single_labels.iter().any(|(ls, range, _)| { - *ls == LabelStyle::Primary && is_overlapping(range, &column_range) - }) || multi_labels.iter().any(|(_, ls, label)| { - *ls == LabelStyle::Primary - && match label { - MultiLabel::Top(start) => column_range.start() >= *start, - MultiLabel::Left => true, - MultiLabel::Bottom(start, _) => column_range.end() <= *start, - } - }); - - match ch { - '\t' => { - (0..metrics.unicode_width).try_for_each(|_| write!(self.writer, " "))? - } - _ => { - // Set the source color if we are in a primary label - if is_primary { - let style = match severity { - Severity::Bug | Severity::Error => MarkupElement::Error, - Severity::Warning => MarkupElement::Warn, - Severity::Note => MarkupElement::Info, - Severity::Help => MarkupElement::Info, - }; - - self.writer.write_markup(Markup(&[MarkupNode { - elements: &[style], - content: &ch, - }]))? - } else { - write!(self.writer, "{}", ch)? - } - } - } - } - writeln!(self.writer)?; - } - - // Write single labels underneath source - // - // ```text - // │ - ---- ^^^ second mutable borrow occurs here - // │ │ │ - // │ │ first mutable borrow occurs here - // │ first borrow later used by call - // │ help: some help here - // ``` - if !single_labels.is_empty() { - // Our plan is as follows: - // - // 1. Do an initial scan to find: - // - The number of non-empty messages. - // - The right-most start and end positions of labels. - // - A candidate for a trailing label (where the label's message - // is printed to the left of the caret). - // 2. Check if the trailing label candidate overlaps another label - - // if so we print it underneath the carets with the other labels. - // 3. Print a line of carets, and (possibly) the trailing message - // to the left. - // 4. Print vertical lines pointing to the carets, and the messages - // for those carets. - // - // We try our best avoid introducing new dynamic allocations, - // instead preferring to iterate over the labels multiple times. It - // is unclear what the performance tradeoffs are however, so further - // investigation may be required. - - // The number of non-empty messages to print. - let mut num_messages = 0; - // The right-most start position, eg: - // - // ```text - // -^^^^---- ^^^^^^^ - // │ - // right-most start position - // ``` - let mut max_label_start = TextSize::from(0u32); - // The right-most end position, eg: - // - // ```text - // -^^^^---- ^^^^^^^ - // │ - // right-most end position - // ``` - let mut max_label_end = TextSize::from(0u32); - // A trailing message, eg: - // - // ```text - // ^^^ second mutable borrow occurs here - // ``` - let mut trailing_label = None; - - for (label_index, label) in single_labels.iter().enumerate() { - let (_, range, message) = label; - if !message.is_empty() { - num_messages += 1; - } - max_label_start = std::cmp::max(max_label_start, range.start()); - max_label_end = std::cmp::max(max_label_end, range.end()); - // This is a candidate for the trailing label, so let's record it. - if range.end() == max_label_end { - if message.is_empty() { - trailing_label = None; - } else { - trailing_label = Some((label_index, label)); - } - } - } - - if let Some((trailing_label_index, (_, trailing_range, _))) = trailing_label { - // Check to see if the trailing label candidate overlaps any of - // the other labels on the current line. - if single_labels - .iter() - .enumerate() - .filter(|(label_index, _)| *label_index != trailing_label_index) - .any(|(_, (_, range, _))| is_overlapping(trailing_range, range)) - { - // If it does, we'll instead want to render it below the - // carets along with the other hanging labels. - trailing_label = None; - } - } - - // Write a line of carets - // - // ```text - // │ ^^^^^^ -------^^^^^^^^^-------^^^^^----- ^^^^ trailing label message - // ``` - self.outer_gutter(outer_padding)?; - self.border_left()?; - self.inner_gutter(severity, num_multi_labels, multi_labels)?; - write!(self.writer, " ")?; - - let placeholder_metrics = Metrics { - byte_index: TextSize::of(source), - unicode_width: 1, - }; - for (metrics, ch) in self - .char_metrics(source.char_indices()) - // Add a placeholder source column at the end to allow for - // printing carets at the end of lines, eg: - // - // ```text - // 1 │ Hello world! - // │ ^ - // ``` - .chain(std::iter::once((placeholder_metrics, '\0'))) - { - // Find the current label style at this column - let column_range = - TextRange::new(metrics.byte_index, metrics.byte_index + TextSize::of(ch)); - let current_label_style = single_labels - .iter() - .filter(|(_, range, _)| is_overlapping(range, &column_range)) - .map(|(label_style, _, _)| *label_style) - .max_by_key(label_priority_key); - - let caret_ch = match current_label_style { - Some(LabelStyle::Primary) => Some(SINGLE_PRIMARY_CARET), - Some(LabelStyle::Secondary) => Some(SINGLE_SECONDARY_CARET), - // Only print padding if we are before the end of the last single line caret - None if metrics.byte_index < max_label_end => Some(' '), - None => None, - }; - - match (current_label_style, caret_ch) { - (_, None) => {} - (None, Some(caret_ch)) => { - // FIXME: improve rendering of carets between character boundaries - (0..metrics.unicode_width) - .try_for_each(|_| write!(self.writer, "{}", caret_ch))?; - } - (Some(label_style), Some(caret_ch)) => { - for _ in 0..metrics.unicode_width { - self.writer.write_markup(markup! { - {WithSeverity(label_style, severity, &markup! { {caret_ch} })} - })?; - } - } - } - } - // Write first trailing label message - if let Some((_, (label_style, _, message))) = trailing_label { - if !message.is_empty() { - write!(self.writer, " ")?; - self.writer.write_markup(markup! { - {WithSeverity(*label_style, severity, message)} - })?; - } - } - writeln!(self.writer)?; - - // Write hanging labels pointing to carets - // - // ```text - // │ │ │ - // │ │ first mutable borrow occurs here - // │ first borrow later used by call - // │ help: some help here - // ``` - if num_messages > trailing_label.iter().count() { - // Write first set of vertical lines before hanging labels - // - // ```text - // │ │ │ - // ``` - self.outer_gutter(outer_padding)?; - self.border_left()?; - self.inner_gutter(severity, num_multi_labels, multi_labels)?; - write!(self.writer, " ")?; - self.caret_pointers( - severity, - max_label_start, - single_labels, - trailing_label, - source.char_indices(), - )?; - writeln!(self.writer)?; - - // Write hanging labels pointing to carets - // - // ```text - // │ │ first mutable borrow occurs here - // │ first borrow later used by call - // │ help: some help here - // ``` - for (label_style, range, message) in - hanging_labels(single_labels, trailing_label).rev() - { - self.outer_gutter(outer_padding)?; - self.border_left()?; - self.inner_gutter(severity, num_multi_labels, multi_labels)?; - write!(self.writer, " ")?; - self.caret_pointers( - severity, - max_label_start, - single_labels, - trailing_label, - source - .char_indices() - .take_while(|(byte_index, _)| *byte_index < range.start().into()), - )?; - self.writer.write_markup(markup! { - {WithSeverity(*label_style, severity, *message)} - })?; - writeln!(self.writer)?; - } - } - } - - // Write top or bottom label carets underneath source - // - // ```text - // │ ╰───│──────────────────^ woops - // │ ╭─│─────────^ - // ``` - for (multi_label_index, (_, label_style, label)) in multi_labels.iter().enumerate() { - let (label_style, range, bottom_message) = match label { - MultiLabel::Left => continue, // no label caret needed - // no label caret needed if this can be started in front of the line - MultiLabel::Top(start) - if *start <= TextSize::of(source) - TextSize::of(source.trim_start()) => - { - continue - } - MultiLabel::Top(range) => (*label_style, range, None), - MultiLabel::Bottom(range, message) => (*label_style, range, Some(message)), - }; - - self.outer_gutter(outer_padding)?; - self.border_left()?; - - // Write inner gutter. - // - // ```text - // │ ╭─│───│ - // ``` - let mut underline = None; - let mut multi_labels_iter = multi_labels.iter().enumerate().peekable(); - for label_column in 0..num_multi_labels { - match multi_labels_iter.peek() { - Some((i, (label_index, ls, label))) if *label_index == label_column => { - match label { - MultiLabel::Left => { - self.label_multi_left(severity, *ls, underline.map(|(s, _)| s))?; - } - MultiLabel::Top(..) if multi_label_index > *i => { - self.label_multi_left(severity, *ls, underline.map(|(s, _)| s))?; - } - MultiLabel::Bottom(..) if multi_label_index < *i => { - self.label_multi_left(severity, *ls, underline.map(|(s, _)| s))?; - } - MultiLabel::Top(..) if multi_label_index == *i => { - underline = Some((*ls, VerticalBound::Top)); - self.label_multi_top_left(severity, label_style)? - } - MultiLabel::Bottom(..) if multi_label_index == *i => { - underline = Some((*ls, VerticalBound::Bottom)); - self.label_multi_bottom_left(severity, label_style)?; - } - MultiLabel::Top(..) | MultiLabel::Bottom(..) => { - self.inner_gutter_column(severity, underline)?; - } - } - multi_labels_iter.next(); - } - Some((_, _)) | None => self.inner_gutter_column(severity, underline)?, - } - } - - // Finish the top or bottom caret - match bottom_message { - None => self.label_multi_top_caret(severity, label_style, source, *range)?, - Some(message) => { - self.label_multi_bottom_caret(severity, label_style, source, *range, message)? - } - } - } - - Ok(()) - } - - fn render_snippet_source_inside_of_long_line( - &mut self, - line_number: usize, - line_range: TextRange, - severity: Severity, - single_labels: &mut Vec<(LabelStyle, TextRange, &MarkupBuf)>, - outer_padding: usize, - source: &str, - ) -> Result<(), Error> { - let labels_start = single_labels - .first() - .map_or(line_range.start(), |x| x.1.start()); - let labels_end = single_labels.last().map_or(line_range.end(), |x| x.1.end()); - - // If labels width are larger then max_line_length, we will - // trim the label - let labels_width = (labels_end - labels_start).min(TextSize::from(MAX_LINE_LENGTH)); - - let spacing = u32::from(TextSize::from(MAX_LINE_LENGTH) - labels_width) / 2; - - // We will try to center the interesting part of the line - let interesting_part_start = - TextSize::from(u32::from(labels_start).saturating_sub(spacing)); - let interesting_part_end = TextSize::from(u32::from(labels_end).saturating_add(spacing)); - let interesting_part_range = TextRange::new(interesting_part_start, interesting_part_end); - - // labels range are relative to the start of the line, now we - // need the range relative to the file start. - let mut new_code_range = TextRange::new( - TextSize::from( - u32::from(line_range.start()).saturating_add(interesting_part_range.start().into()), - ), - TextSize::from( - u32::from(line_range.start()).saturating_add(interesting_part_range.end().into()), - ), - ); - - // We need to adjust all labels ranges to be relative to the start - // of the interesting part - for label in single_labels.iter_mut() { - label.1 = TextRange::new( - label.1.start() - interesting_part_range.start(), - // We need to limit the width of the range - (label.1.end() - interesting_part_range.start()) - .min(interesting_part_range.start() + TextSize::from(MAX_LINE_LENGTH)), - ); - } - - // and the width of what we are going to print - new_code_range = TextRange::new( - new_code_range.start(), - new_code_range - .end() - .min(new_code_range.start() + TextSize::from(MAX_LINE_LENGTH)), - ); - - let source = source - .get(Range::::from(new_code_range)) - .unwrap_or_else(|| &source[line_range]); - - self.render_snippet_source_impl( - outer_padding, - line_number, - source, - severity, - single_labels.as_slice(), - 0, - &[], - )?; - - Ok(()) - } - - /// A line of source code. - /// - /// ```text - /// 10 │ │ muffin. Halvah croissant candy canes bonbon candy. Apple pie jelly - /// │ ╭─│─────────^ - /// ``` - #[allow(clippy::too_many_arguments)] - pub(super) fn render_snippet_source( - &mut self, - outer_padding: usize, - line_number: usize, - line_range: TextRange, - source: &str, - severity: Severity, - single_labels: &[SingleLabel<'_>], - num_multi_labels: usize, - multi_labels: &[(usize, LabelStyle, MultiLabel<'_>)], - ) -> Result<(), Error> { - // if the line is smaller than max_line_length, we print it entirely... - // we also print it entirely if there are multi_labels - let line_candidate = &source[line_range]; - if (TextSize::of(line_candidate) < TextSize::from(MAX_LINE_LENGTH)) - || !multi_labels.is_empty() - { - return self.render_snippet_source_impl( - outer_padding, - line_number, - line_candidate, - severity, - single_labels, - num_multi_labels, - multi_labels, - ); - } else { - // ... if not, we try to fit as many single_labels as possible - // showing only the interesting part of the line. - let mut candidates = vec![]; - for single_label in single_labels.iter() { - candidates.push(*single_label); - - // We need to know which part of the long line we are going to display - let labels_start = candidates - .first() - .map_or(line_range.start(), |x| x.1.start()); - let labels_end = candidates.last().map_or(line_range.end(), |x| x.1.end()); - let labels_width = labels_end - labels_start; - - if labels_width >= TextSize::from(MAX_LINE_LENGTH) { - self.render_snippet_source_inside_of_long_line( - line_number, - line_range, - severity, - &mut candidates, - outer_padding, - source, - )?; - candidates.clear(); - } - } - - if !candidates.is_empty() { - self.render_snippet_source_inside_of_long_line( - line_number, - line_range, - severity, - &mut candidates, - outer_padding, - source, - )?; - } - } - - Ok(()) - } - - /// An empty source line, for providing additional whitespace to source snippets. - /// - /// ```text - /// │ │ │ - /// ``` - pub(super) fn render_snippet_empty( - &mut self, - outer_padding: usize, - severity: Severity, - num_multi_labels: usize, - multi_labels: &[(usize, LabelStyle, MultiLabel<'_>)], - ) -> Result<(), Error> { - self.outer_gutter(outer_padding)?; - self.border_left()?; - self.inner_gutter(severity, num_multi_labels, multi_labels)?; - writeln!(self.writer)?; - Ok(()) - } - - /// A broken source line, for labeling skipped sections of source. - /// - /// ```text - /// · │ │ - /// ``` - pub(super) fn render_snippet_break( - &mut self, - outer_padding: usize, - severity: Severity, - num_multi_labels: usize, - multi_labels: &[(usize, LabelStyle, MultiLabel<'_>)], - ) -> Result<(), Error> { - self.outer_gutter(outer_padding)?; - self.border_left_break()?; - self.inner_gutter(severity, num_multi_labels, multi_labels)?; - writeln!(self.writer)?; - Ok(()) - } - - /// Adds tab-stop aware unicode-width computations to an iterator over - /// character indices. Assumes that the character indices begin at the start - /// of the line. - fn char_metrics( - &self, - char_indices: impl Iterator + Clone, - ) -> impl Iterator + Clone { - use unicode_width::UnicodeWidthChar; - - let tab_width = 4; - let mut unicode_column = 0; - - char_indices.map(move |(byte_index, ch)| { - let metrics = Metrics { - byte_index: TextSize::try_from(byte_index).expect("integer overflow"), - unicode_width: match (ch, tab_width) { - ('\t', 0) => 0, // Guard divide-by-zero - ('\t', _) => tab_width - (unicode_column % tab_width), - (ch, _) => ch.width().unwrap_or(0), - }, - }; - unicode_column += metrics.unicode_width; - - (metrics, ch) - }) - } - - /// The outer gutter of a source line. - fn outer_gutter(&mut self, outer_padding: usize) -> Result<(), Error> { - write!( - self.writer, - "{space: >width$} ", - space = "", - width = outer_padding - )?; - Ok(()) - } - - /// The outer gutter of a source line, with line number. - fn outer_gutter_number( - &mut self, - line_number: usize, - outer_padding: usize, - ) -> Result<(), Error> { - self.writer.write_markup(markup! { - - {format_args!( - "{line_number: >width$}", - line_number = line_number, - width = outer_padding - )} - - })?; - write!(self.writer, " ")?; - Ok(()) - } - - /// The left-hand border of a source line. - fn border_left(&mut self) -> Result<(), Error> { - self.writer.write_markup(markup! { - {SOURCE_BORDER_LEFT} - })?; - Ok(()) - } - - /// The broken left-hand border of a source line. - fn border_left_break(&mut self) -> Result<(), Error> { - self.writer.write_markup(markup! { - {SOURCE_BORDER_LEFT_BREAK} - })?; - Ok(()) - } - - /// Write vertical lines pointing to carets. - fn caret_pointers( - &mut self, - severity: Severity, - max_label_start: TextSize, - single_labels: &[SingleLabel<'_>], - trailing_label: Option<(usize, &SingleLabel<'_>)>, - char_indices: impl Iterator + Clone, - ) -> Result<(), Error> { - for (metrics, ch) in self.char_metrics(char_indices) { - let column_range = metrics.byte_index..(metrics.byte_index + TextSize::of(ch)); - let label_style = hanging_labels(single_labels, trailing_label) - .filter(|(_, range, _)| column_range.contains(&range.start())) - .map(|(label_style, _, _)| *label_style) - .max_by_key(label_priority_key); - - let mut spaces = match label_style { - None => 0..metrics.unicode_width, - Some(label_style) => { - self.writer.write_markup(markup! { - {WithSeverity(label_style, severity, &POINTER_LEFT)} - })?; - 1..metrics.unicode_width - } - }; - // Only print padding if we are before the end of the last single line caret - if metrics.byte_index <= max_label_start { - spaces.try_for_each(|_| write!(self.writer, " "))?; - } - } - - Ok(()) - } - - /// The left of a multi-line label. - /// - /// ```text - /// │ - /// ``` - fn label_multi_left( - &mut self, - severity: Severity, - label_style: LabelStyle, - underline: Option, - ) -> Result<(), Error> { - match underline { - None => write!(self.writer, " ")?, - // Continue an underline horizontally - Some(label_style) => { - self.writer.write_markup(markup! { - {WithSeverity(label_style, severity, &MULTI_TOP)} - })?; - } - } - self.writer.write_markup(markup! { - {WithSeverity(label_style, severity, &MULTI_LEFT)} - })?; - Ok(()) - } - - /// The top-left of a multi-line label. - /// - /// ```text - /// ╭ - /// ``` - fn label_multi_top_left( - &mut self, - severity: Severity, - label_style: LabelStyle, - ) -> Result<(), Error> { - write!(self.writer, " ")?; - self.writer.write_markup(markup! { - {WithSeverity(label_style, severity, &MULTI_TOP_LEFT)} - })?; - Ok(()) - } - - /// The bottom left of a multi-line label. - /// - /// ```text - /// ╰ - /// ``` - fn label_multi_bottom_left( - &mut self, - severity: Severity, - label_style: LabelStyle, - ) -> Result<(), Error> { - write!(self.writer, " ")?; - self.writer.write_markup(markup! { - {WithSeverity(label_style, severity, &MULTI_BOTTOM_LEFT)} - })?; - Ok(()) - } - - /// Multi-line label top. - /// - /// ```text - /// ─────────────^ - /// ``` - fn label_multi_top_caret( - &mut self, - severity: Severity, - label_style: LabelStyle, - source: &str, - start: TextSize, - ) -> Result<(), Error> { - self.writer.write_markup(markup! { - {WithSeverity(label_style, severity, &MultiCaret { - label_style, - message: &MarkupBuf(Vec::new()), - caret: MULTI_TOP, - char_metrics: self - .char_metrics(source.char_indices()) - .take_while(|(metrics, _)| metrics.byte_index < start + TextSize::from(1u32)), - })} - })?; - - writeln!(self.writer)?; - Ok(()) - } - - /// Multi-line label bottom, with a message. - /// - /// ```text - /// ─────────────^ expected `Int` but found `String` - /// ``` - fn label_multi_bottom_caret( - &mut self, - severity: Severity, - label_style: LabelStyle, - source: &str, - start: TextSize, - message: &MarkupBuf, - ) -> Result<(), Error> { - self.writer.write_markup(markup! { - {WithSeverity(label_style, severity, &MultiCaret { - label_style, - message, - caret: MULTI_BOTTOM, - char_metrics: self - .char_metrics(source.char_indices()) - .take_while(|(metrics, _)| metrics.byte_index < start), - })} - })?; - - writeln!(self.writer)?; - Ok(()) - } - - /// Writes an empty gutter space, or continues an underline horizontally. - fn inner_gutter_column( - &mut self, - severity: Severity, - underline: Option, - ) -> Result<(), Error> { - match underline { - None => self.inner_gutter_space(), - Some((label_style, vertical_bound)) => { - let ch = match vertical_bound { - VerticalBound::Top => MULTI_TOP, - VerticalBound::Bottom => MULTI_BOTTOM, - }; - self.writer.write_markup(markup! { - {WithSeverity(label_style, severity, &markup!{ - {ch}{ch} - })} - })?; - Ok(()) - } - } - } - - /// Writes an empty gutter space. - fn inner_gutter_space(&mut self) -> Result<(), Error> { - write!(self.writer, " ")?; - Ok(()) - } - - /// Writes an inner gutter, with the left lines if necessary. - fn inner_gutter( - &mut self, - severity: Severity, - num_multi_labels: usize, - multi_labels: &[(usize, LabelStyle, MultiLabel<'_>)], - ) -> Result<(), Error> { - let mut multi_labels_iter = multi_labels.iter().peekable(); - for label_column in 0..num_multi_labels { - match multi_labels_iter.peek() { - Some((label_index, ls, label)) if *label_index == label_column => match label { - MultiLabel::Left | MultiLabel::Bottom(..) => { - self.label_multi_left(severity, *ls, None)?; - multi_labels_iter.next(); - } - MultiLabel::Top(..) => { - self.inner_gutter_space()?; - multi_labels_iter.next(); - } - }, - Some((_, _, _)) | None => self.inner_gutter_space()?, - } - } - - Ok(()) - } -} - -#[derive(Clone, Copy)] -struct MultiCaret<'a, I> { - label_style: LabelStyle, - message: &'a MarkupBuf, - caret: char, - char_metrics: I, -} - -impl<'a, I> Display for MultiCaret<'a, I> -where - I: Iterator + Clone, -{ - fn fmt(&self, fmt: &mut Formatter) -> io::Result<()> { - for (metrics, _) in self.char_metrics.clone() { - // FIXME: improve rendering of carets between character boundaries - (0..metrics.unicode_width).try_for_each(|_| write!(fmt, "{}", self.caret))?; - } - - let caret_end = match self.label_style { - LabelStyle::Primary => MULTI_PRIMARY_CARET_START, - LabelStyle::Secondary => MULTI_SECONDARY_CARET_START, - }; - - write!(fmt, "{}", caret_end)?; - - if !self.message.is_empty() { - fmt.write_markup(markup! { " "{self.message} })?; - } - - Ok(()) - } -} -struct Metrics { - byte_index: TextSize, - unicode_width: usize, -} - -/// Check if two ranges overlap -fn is_overlapping(range0: &TextRange, range1: &TextRange) -> bool { - let start = std::cmp::max(range0.start(), range1.start()); - let end = std::cmp::min(range0.end(), range1.end()); - start < end -} - -/// For prioritizing primary labels over secondary labels when rendering carets. -fn label_priority_key(label_style: &LabelStyle) -> u8 { - match label_style { - LabelStyle::Secondary => 0, - LabelStyle::Primary => 1, - } -} - -/// Return an iterator that yields the labels that require hanging messages -/// rendered underneath them. -fn hanging_labels<'labels, 'diagnostic>( - single_labels: &'labels [SingleLabel<'diagnostic>], - trailing_label: Option<(usize, &'labels SingleLabel<'diagnostic>)>, -) -> impl 'labels + DoubleEndedIterator> { - single_labels - .iter() - .enumerate() - .filter(|(_, (_, _, message))| !message.is_empty()) - .filter(move |(i, _)| trailing_label.map_or(true, |(j, _)| *i != j)) - .map(|(_, label)| label) -} diff --git a/crates/rome_console/src/lib.rs b/crates/rome_console/src/lib.rs index f7031074463..d82bbf65d49 100644 --- a/crates/rome_console/src/lib.rs +++ b/crates/rome_console/src/lib.rs @@ -5,7 +5,6 @@ use std::panic::RefUnwindSafe; use termcolor::{ColorChoice, StandardStream}; use write::Termcolor; -pub mod codespan; pub mod diff; pub mod fmt; mod markup; diff --git a/crates/rome_diagnostics/examples/serde.rs b/crates/rome_diagnostics/examples/serde.rs index 7b1b8fc6b29..6c1cbff4602 100644 --- a/crates/rome_diagnostics/examples/serde.rs +++ b/crates/rome_diagnostics/examples/serde.rs @@ -1,5 +1,7 @@ -use rome_console::{codespan::SourceFile, markup, ConsoleExt, EnvConsole}; -use rome_diagnostics::v2::{Diagnostic, PrintDiagnostic, Resource, Result, SourceCode}; +use rome_console::{markup, ConsoleExt, EnvConsole}; +use rome_diagnostics::v2::{ + Diagnostic, LineIndexBuf, PrintDiagnostic, Resource, Result, SourceCode, +}; use rome_rowan::{TextRange, TextSize}; use serde_json::Error; @@ -14,12 +16,12 @@ struct SerdeDiagnostic { #[location(span)] span: Option, #[location(source_code)] - source_code: SourceCode>, + source_code: SourceCode, } impl SerdeDiagnostic { fn new(input: &str, error: Error) -> Self { - let line_starts: Vec<_> = SourceFile::line_starts(input).collect(); + let line_starts = LineIndexBuf::from_source_text(input); let line_index = error.line().checked_sub(1); let span = line_index.and_then(|line_index| { diff --git a/crates/rome_diagnostics/src/diagnostic.rs b/crates/rome_diagnostics/src/diagnostic.rs index 8259fa18764..ea4cd22a5b4 100644 --- a/crates/rome_diagnostics/src/diagnostic.rs +++ b/crates/rome_diagnostics/src/diagnostic.rs @@ -2,7 +2,7 @@ use crate::suggestion::SuggestionChange; use crate::{ file::{FileId, FileSpan, Span}, v2::Category, - Applicability, CodeSuggestion, DiagnosticTag, Severity, SuggestionStyle, + Applicability, CodeSuggestion, DiagnosticTag, SuggestionStyle, }; use rome_console::fmt::Display; use rome_console::{markup, MarkupBuf}; @@ -424,6 +424,36 @@ impl Diagnostic { } } +/// A severity level for diagnostic messages. +/// +/// These are ordered in the following way: +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize)] +#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] +pub enum Severity { + /// A help message. + Help, + /// A note. + Note, + /// A warning. + Warning, + /// An error. + Error, + /// An unexpected bug. + Bug, +} + +impl From for &'static str { + fn from(level: Severity) -> Self { + match level { + Severity::Bug => "bug", + Severity::Error => "error", + Severity::Warning => "warning", + Severity::Help => "help", + Severity::Note => "note", + } + } +} + /// Everything that can be added to a diagnostic, like /// a suggestion that will be displayed under the actual error. #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] diff --git a/crates/rome_diagnostics/src/emit.rs b/crates/rome_diagnostics/src/emit.rs index eaae4551b53..139d888618f 100644 --- a/crates/rome_diagnostics/src/emit.rs +++ b/crates/rome_diagnostics/src/emit.rs @@ -1,15 +1,13 @@ //! Implementation of converting, and emitting diagnostics -//! using `codespan`. +//! into the console use crate::file::FileSpan; use crate::v2::advice::{LogCategory, Visit}; use crate::v2::{ self, advice, Category, DiagnosticTags, FilePath, Location, PrintDiagnostic, Resource, - SourceCode, }; use crate::{file::Files, Diagnostic}; -use crate::{Applicability, SubDiagnostic, SuggestionChange, SuggestionStyle}; -use rome_console::codespan::Severity; +use crate::{Applicability, Severity, SubDiagnostic, SuggestionChange, SuggestionStyle}; use rome_console::{ fmt::{Display, Formatter, Termcolor}, markup, @@ -86,7 +84,6 @@ struct DiagnosticPrinter<'a> { impl DiagnosticPrinter<'_> { fn lookup_location(&self, span: FileSpan) -> Option> { let path = self.files.name(span.file)?; - let source = self.files.source(span.file); Some(Location { resource: Resource::File(FilePath::PathAndId { @@ -95,10 +92,7 @@ impl DiagnosticPrinter<'_> { }), span: Some(span.range), source_code: if self.include_source { - source.map(|source| SourceCode { - text: source.source, - line_starts: Some(source.line_starts), - }) + self.files.source(span.file) } else { None }, @@ -202,7 +196,7 @@ impl v2::Diagnostic for DiagnosticPrinter<'_> { .files .source(suggestion.span.file) .expect("Non existant file id") - .source; + .text; let new = match &suggestion.substitution { SuggestionChange::Indels(indels) => { @@ -234,7 +228,7 @@ impl v2::Diagnostic for DiagnosticPrinter<'_> { .files .source(suggestion.span.file) .expect("Non existant file id") - .source + .text .to_string(); apply_indels(indels, &mut new); new @@ -257,7 +251,6 @@ impl v2::Diagnostic for DiagnosticPrinter<'_> { fn location(&self) -> Option> { let path = self.files.name(self.d.file_id)?; - let source = self.files.source(self.d.file_id); Some(Location { resource: Resource::File(FilePath::PathAndId { @@ -266,10 +259,7 @@ impl v2::Diagnostic for DiagnosticPrinter<'_> { }), span: self.d.primary.as_ref().map(|label| label.span.range), source_code: if self.include_source { - source.map(|source| SourceCode { - text: source.source, - line_starts: Some(source.line_starts), - }) + self.files.source(self.d.file_id) } else { None }, @@ -301,13 +291,13 @@ impl v2::Diagnostic for DiagnosticPrinter<'_> { #[cfg(test)] mod tests { - use rome_console::{codespan::Severity, markup, BufferConsole, ConsoleExt}; + use rome_console::{markup, BufferConsole, ConsoleExt}; use rome_text_edit::{TextRange, TextSize}; use crate::{ file::SimpleFile, v2::{category, FileId}, - Applicability, Diagnostic, + Applicability, Diagnostic, Severity, }; #[test] @@ -324,10 +314,11 @@ labore et dolore magna aliqua"; " \n" " ✖"" ""label""\n" " \n" - " ""┌─"" file_name:2:13\n" - " ""│""\n" - " 2"" ""│"" consectetur ""adipiscing elit"",\n" - " ""│"" ""^^^^^^^^^^^^^^^""\n" + " ""1 │ ""Lorem ipsum dolor sit amet,\n" + " >"" ""2 │ ""consectetur adipiscing elit,\n" + " "" │ "" ""^^^^^^^^^^^^^^^""\n" + " ""3 │ ""sed do eiusmod tempor incididunt ut\n" + " ""4 │ ""labore et dolore magna aliqua\n" " \n" " ℹ"" ""footer note""\n" " \n" @@ -378,7 +369,11 @@ labore et dolore magna aliqua"; other => panic!("unexpected message {other:?}"), }; - assert_eq!(message.content, expected); + assert_eq!( + message.content, expected, + "\nactual:\n{:#?}\nexpected:\n{expected:#?}", + message.content + ); assert!(iter.next().is_none()); } diff --git a/crates/rome_diagnostics/src/file.rs b/crates/rome_diagnostics/src/file.rs index 7cb27bda2e0..a9a61ff9dc9 100644 --- a/crates/rome_diagnostics/src/file.rs +++ b/crates/rome_diagnostics/src/file.rs @@ -1,9 +1,9 @@ -use rome_console::codespan::SourceFile; use rome_rowan::{Language, SyntaxElement, SyntaxNode, SyntaxToken, TextRange, TextSize}; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, fmt::Debug, ops::Range}; pub use crate::v2::FileId; +use crate::v2::{LineIndex, LineIndexBuf, SourceCode}; /// A value which can be used as the range inside of a diagnostic. /// @@ -132,7 +132,7 @@ pub trait Files { fn name(&self, id: FileId) -> Option<&str>; /// Returns the source of the file identified by the id. - fn source(&self, id: FileId) -> Option>; + fn source(&self, id: FileId) -> Option>; } /// A file database that contains only one file. @@ -140,14 +140,14 @@ pub trait Files { pub struct SimpleFile { name: String, source: String, - line_starts: Vec, + line_starts: LineIndexBuf, } impl SimpleFile { /// Create a new file with the name and source. pub fn new(name: String, source: String) -> Self { Self { - line_starts: SourceFile::line_starts(&source).collect(), + line_starts: LineIndexBuf::from_source_text(&source), name, source, } @@ -164,8 +164,11 @@ impl Files for SimpleFile { Some(&self.name) } - fn source(&self, _id: FileId) -> Option> { - Some(SourceFile::new(&self.source, &self.line_starts)) + fn source(&self, _id: FileId) -> Option> { + Some(SourceCode { + text: &self.source, + line_starts: Some(&self.line_starts), + }) } } @@ -199,7 +202,7 @@ impl Files for SimpleFiles { self.files.get(&id)?.name(id) } - fn source(&self, id: FileId) -> Option> { + fn source(&self, id: FileId) -> Option> { self.files.get(&id)?.source(id) } } diff --git a/crates/rome_diagnostics/src/lib.rs b/crates/rome_diagnostics/src/lib.rs index 91ab5ad845a..c6b649e797e 100644 --- a/crates/rome_diagnostics/src/lib.rs +++ b/crates/rome_diagnostics/src/lib.rs @@ -9,12 +9,11 @@ mod diagnostic; mod emit; mod suggestion; -pub use diagnostic::{Diagnostic, Footer, SubDiagnostic}; +pub use diagnostic::{Diagnostic, Footer, Severity, SubDiagnostic}; pub use emit::Emitter; pub use file::Span; pub use suggestion::*; -pub use rome_console::codespan::Severity; pub use termcolor; #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)] diff --git a/crates/rome_diagnostics/src/v2/context.rs b/crates/rome_diagnostics/src/v2/context.rs index c531df1f456..78c8a711244 100644 --- a/crates/rome_diagnostics/src/v2/context.rs +++ b/crates/rome_diagnostics/src/v2/context.rs @@ -154,11 +154,11 @@ mod internal { use std::{fmt::Debug, io}; use rome_console::{fmt, markup}; - use rome_text_edit::TextSize; use crate::v2::{ diagnostic::internal::AsDiagnostic, Advices, Backtrace, Category, Diagnostic, - DiagnosticTags, Location, LogCategory, Resource, Severity, SourceCode, Visit, + DiagnosticTags, LineIndex, LineIndexBuf, Location, LogCategory, Resource, Severity, + SourceCode, Visit, }; /// This trait is inherited by `DiagnosticExt` and `Context`, since it's @@ -395,7 +395,7 @@ mod internal { /// uses `source_code` as its location source code if `source` doesn't /// return one. pub struct FileSourceCodeDiagnostic { - pub(super) source_code: Option>>, + pub(super) source_code: Option>, pub(super) source: E, } @@ -470,7 +470,7 @@ mod internal { /// the location of code frame advices if they don't have one already. struct FileSourceCodeVisitor<'a> { visitor: &'a mut dyn Visit, - source_code: SourceCode<&'a str, &'a [TextSize]>, + source_code: SourceCode<&'a str, &'a LineIndex>, } impl Visit for FileSourceCodeVisitor<'_> { diff --git a/crates/rome_diagnostics/src/v2/display.rs b/crates/rome_diagnostics/src/v2/display.rs index 76a378769a8..b6a2be0ca64 100644 --- a/crates/rome_diagnostics/src/v2/display.rs +++ b/crates/rome_diagnostics/src/v2/display.rs @@ -1,7 +1,6 @@ -use std::{borrow::Cow, io, iter}; +use std::{io, iter}; use rome_console::{ - codespan::SourceFile, diff::{Diff, DiffMode}, fmt, markup, Markup, MarkupBuf, MarkupElement, MarkupNode, }; @@ -10,6 +9,8 @@ use unicode_width::UnicodeWidthStr; mod backtrace; mod frame; +use crate::v2::display::frame::SourceFile; + use super::{ diagnostic::internal::AsDiagnostic, Advices, Diagnostic, DiagnosticTags, Location, LogCategory, Resource, Severity, Visit, @@ -77,15 +78,10 @@ impl<'fmt, D: Diagnostic + ?Sized> fmt::Display for PrintHeader<'fmt, D> { // Print the line and column position if the location has a span and source code // (the source code is necessary to convert a byte offset into a line + column) if let (Some(span), Some(source_code)) = (location.span, location.source_code) { - let line_starts = source_code.line_starts.map_or_else( - || Cow::Owned(SourceFile::line_starts(source_code.text).collect()), - Cow::Borrowed, - ); - - let file = SourceFile::new(source_code.text, line_starts.as_ref()); + let file = SourceFile::new(source_code); if let Ok(location) = file.location(span.start()) { fmt.write_markup(markup! { - ":"{location.line_number}":"{location.column_number} + ":"{location.line_number.get()}":"{location.column_number.get()} })?; } } @@ -742,14 +738,15 @@ mod tests { "\n" " ✖"" ""diagnostic message""\n" " \n" - " ""┌─"" path:1:1\n" - " ""│""\n" - " 1"" ""│"" ""source"" code\n" - " ""│"" ""^^^^^^""\n" + " >"" ""1 │ ""source code\n" + " "" │ ""^^^^^^""\n" " \n" }.to_owned(); - assert_eq!(diag, expected); + assert_eq!( + diag, expected, + "\nactual:\n{diag:#?}\nexpected:\n{expected:#?}" + ); } #[test] fn test_log_advices() { @@ -775,7 +772,10 @@ mod tests { " \n" }.to_owned(); - assert_eq!(diag, expected); + assert_eq!( + diag, expected, + "\nactual:\n{diag:#?}\nexpected:\n{expected:#?}" + ); } #[test] @@ -797,7 +797,10 @@ mod tests { " \n" }.to_owned(); - assert_eq!(diag, expected); + assert_eq!( + diag, expected, + "\nactual:\n{diag:#?}\nexpected:\n{expected:#?}" + ); } #[test] @@ -814,14 +817,15 @@ mod tests { "\n" " ✖"" ""diagnostic message""\n" " \n" - " ""┌─"" other_path:1:9\n" - " ""│""\n" - " 1"" ""│"" context ""location"" context\n" - " ""│"" ""^^^^^^^^""\n" + " >"" ""1 │ ""context location context\n" + " "" │ "" ""^^^^^^^^""\n" " \n" }.to_owned(); - assert_eq!(diag, expected); + assert_eq!( + diag, expected, + "\nactual:\n{diag:#?}\nexpected:\n{expected:#?}" + ); } #[test] @@ -844,7 +848,10 @@ mod tests { " \n" }.to_owned(); - assert_eq!(diag, expected); + assert_eq!( + diag, expected, + "\nactual:\n{diag:#?}\nexpected:\n{expected:#?}" + ); } #[test] @@ -867,7 +874,10 @@ mod tests { " at crate/src/module.rs:8:16\n" }.to_owned(); - assert_eq!(diag, expected); + assert_eq!( + diag, expected, + "\nactual:\n{diag:#?}\nexpected:\n{expected:#?}" + ); } #[test] @@ -888,7 +898,10 @@ mod tests { " \n" }.to_owned(); - assert_eq!(diag, expected); + assert_eq!( + diag, expected, + "\nactual:\n{diag:#?}\nexpected:\n{expected:#?}" + ); } #[test] @@ -917,6 +930,9 @@ mod tests { " \n" }.to_owned(); - assert_eq!(diag, expected); + assert_eq!( + diag, expected, + "\nactual:\n{diag:#?}\nexpected:\n{expected:#?}" + ); } } diff --git a/crates/rome_diagnostics/src/v2/display/frame.rs b/crates/rome_diagnostics/src/v2/display/frame.rs index 671a0e27847..d92cec131f1 100644 --- a/crates/rome_diagnostics/src/v2/display/frame.rs +++ b/crates/rome_diagnostics/src/v2/display/frame.rs @@ -1,53 +1,664 @@ -use std::{borrow::Cow, io}; +use std::{ + borrow::Cow, + io, + iter::FusedIterator, + num::NonZeroUsize, + ops::{Bound, RangeBounds}, +}; + +use rome_console::{fmt, markup}; +use rome_text_size::{TextRange, TextSize}; +use unicode_width::UnicodeWidthChar; -use rome_console::{ - codespan::{Codespan, Label, LabelStyle, Locus, Severity, SourceFile}, - fmt, markup, +use crate::v2::{ + location::{BorrowedSourceCode, LineIndex}, + LineIndexBuf, Location, }; -use rome_text_edit::TextRange; -use crate::v2::{Location, Resource}; +// SAFETY: These constants `NonZeroUsize` are being initialized with non-zero values +const ONE: NonZeroUsize = unsafe { NonZeroUsize::new_unchecked(1) }; +const CODE_FRAME_CONTEXT_LINES: NonZeroUsize = unsafe { NonZeroUsize::new_unchecked(2) }; + +const MAX_CODE_FRAME_LINES: usize = 8; +const HALF_MAX_CODE_FRAME_LINES: usize = MAX_CODE_FRAME_LINES / 2; -/// Prints a code frame advice as a [Codespan]. +/// Prints a code frame advice pub(super) fn print_frame(fmt: &mut fmt::Formatter<'_>, location: Location<'_>) -> io::Result<()> { - let source_span = location.source_code.as_ref().and_then(|source_code| { - let span = location.span.as_ref()?; - Some((&source_code.text, source_code.line_starts, span)) - }); + let source_span = location + .source_code + .and_then(|source_code| Some((source_code, location.span?))); - if let Some((source, line_starts, span)) = source_span { - // Either re-use the existing line index provided by the diagnostic or create one - let line_starts = line_starts - .map(Cow::Borrowed) - .unwrap_or_else(|| Cow::Owned(SourceFile::line_starts(source).collect())); + let (source_code, span) = match source_span { + Some(source_span) => source_span, + None => return Ok(()), + }; + + let source_file = SourceFile::new(source_code); - let start = span.start(); - let end = span.end(); + let start_index = span.start(); + let start_location = match source_file.location(start_index) { + Ok(location) => location, + Err(_) => return Ok(()), + }; - let source_file = SourceFile::new(source, &line_starts); + let end_index = span.end(); + let end_location = match source_file.location(end_index) { + Ok(location) => location, + Err(_) => return Ok(()), + }; - let locus = match location.resource { - Resource::File(file) => file.path().map(|name| match source_file.location(start) { - Ok(location) => Locus::FileLocation { name, location }, - Err(_) => Locus::File { name }, - }), - _ => None, + // Increase the amount of lines we should show for "context" + let context_start = start_location + .line_number + .saturating_sub(CODE_FRAME_CONTEXT_LINES.get()); + + let mut context_end = end_location + .line_number + .saturating_add(CODE_FRAME_CONTEXT_LINES.get()) + .min(OneIndexed::new(source_file.line_starts.len()).unwrap_or(OneIndexed::MIN)); + + // Remove trailing blank lines + for line_index in IntoIter::new(context_start..=context_end).rev() { + if line_index == end_location.line_number { + break; + } + + let line_start = match source_file.line_start(line_index.to_zero_indexed()) { + Ok(index) => index, + Err(_) => continue, + }; + let line_end = match source_file.line_start(line_index.to_zero_indexed() + 1) { + Ok(index) => index, + Err(_) => continue, + }; + + let line_range = TextRange::new(line_start, line_end); + let line_text = source_file.source[line_range].trim(); + if !line_text.is_empty() { + break; + } + + context_end = line_index; + } + + // If we have too many lines in our selection, then collapse them to an ellipsis + let range_len = (context_end.get() + 1).saturating_sub(context_start.get()); + let ellipsis_range = if range_len > MAX_CODE_FRAME_LINES + 2 { + let ellipsis_start = context_start.saturating_add(HALF_MAX_CODE_FRAME_LINES); + let ellipsis_end = context_end.saturating_sub(HALF_MAX_CODE_FRAME_LINES); + Some(ellipsis_start..=ellipsis_end) + } else { + None + }; + + // Calculate the maximum width of the line number + let max_gutter_len = calculate_print_width(context_end); + let mut printed_lines = false; + + for line_index in IntoIter::new(context_start..=context_end) { + if let Some(ellipsis_range) = &ellipsis_range { + if ellipsis_range.contains(&line_index) { + if *ellipsis_range.start() == line_index { + for _ in 0..max_gutter_len.get() { + fmt.write_str(" ")?; + } + + fmt.write_markup(markup! { " ...\n" })?; + printed_lines = true; + } + continue; + } + } + + let line_start = match source_file.line_start(line_index.to_zero_indexed()) { + Ok(index) => index, + Err(_) => continue, + }; + let line_end = match source_file.line_start(line_index.to_zero_indexed() + 1) { + Ok(index) => index, + Err(_) => continue, }; + let line_range = TextRange::new(line_start, line_end); + let line_text = source_file.source[line_range].trim_end_matches(['\r', '\n']); + + // Ensure that the frame doesn't start with whitespace + if !printed_lines && line_index != start_location.line_number && line_text.trim().is_empty() + { + continue; + } + + printed_lines = true; + + // If this is within the highlighted line range + let should_highlight = + line_index >= start_location.line_number && line_index <= end_location.line_number; + + let padding_width = max_gutter_len + .get() + .saturating_sub(calculate_print_width(line_index).get()); + + for _ in 0..padding_width { + fmt.write_str(" ")?; + } + + if should_highlight { + fmt.write_markup(markup! { + '>'' ' + })?; + } else { + fmt.write_str(" ")?; + } + fmt.write_markup(markup! { - {Codespan { - source_file, - severity: Severity::Error, - locus, - labels: &[Label { - style: LabelStyle::Primary, - range: TextRange::new(start, end), - message: markup!().to_owned(), - }], - }} - "\n" + {format_args!("{line_index} \u{2502} ")} })?; + + // Show invisible characters + print_invisibles( + fmt, + line_text, + PrintInvisiblesOptions { + ignore_trailing_carriage_return: true, + ignore_leading_tabs: true, + ignore_lone_spaces: true, + at_line_start: true, + at_line_end: true, + }, + )?; + + fmt.write_str("\n")?; + + if should_highlight { + let is_first_line = line_index == start_location.line_number; + let is_last_line = line_index == end_location.line_number; + + let marker = if is_first_line && is_last_line { + // Only line in the selection + let start_index = + TextSize::try_from(start_location.column_number.to_zero_indexed()) + .expect("integer overflow"); + let end_index = TextSize::try_from(end_location.column_number.to_zero_indexed()) + .expect("integer overflow"); + Some(TextRange::new(start_index, end_index)) + } else if is_first_line { + // First line in selection + let start_index = + TextSize::try_from(start_location.column_number.to_zero_indexed()) + .expect("integer overflow"); + let end_index = TextSize::of(line_text); + Some(TextRange::new(start_index, end_index)) + } else if is_last_line { + // Last line in selection + let start_index = TextSize::of(line_text) + .checked_sub(TextSize::of(line_text.trim_start())) + // SAFETY: The length of `line_text.trim_start()` should + // never be larger than `line_text` itself + .expect("integer overflow"); + let end_index = TextSize::try_from(end_location.column_number.to_zero_indexed()) + .expect("integer overflow"); + Some(TextRange::new(start_index, end_index)) + } else { + None + }; + + if let Some(marker) = marker { + for _ in 0..max_gutter_len.get() { + fmt.write_str(" ")?; + } + + fmt.write_markup(markup! { + " \u{2502} " + })?; + + // Align the start of the marker with the line above by a + // number of space characters equal to the unicode print width + // of the leading part of the line (before the start of the + // marker), with a special exception for tab characters that + // still get printed as tabs to respect the user-defined tab + // display width + let leading_range = TextRange::new(TextSize::from(0), marker.start()); + for c in line_text[leading_range].chars() { + match c { + '\t' => fmt.write_str("\t")?, + _ => { + if let Some(width) = c.width() { + for _ in 0..width { + fmt.write_str(" ")?; + } + } + } + } + } + + let marker_width = text_width(&line_text[marker]); + for _ in 0..marker_width { + fmt.write_markup(markup! { + '^' + })?; + } + + fmt.write_str("\n")?; + } + } } - Ok(()) + fmt.write_str("\n") +} + +/// Calculate the length of the string representation of `value` +fn calculate_print_width(mut value: OneIndexed) -> NonZeroUsize { + // SAFETY: Constant is being initialized with a non-zero value + const TEN: OneIndexed = unsafe { OneIndexed::new_unchecked(10) }; + + let mut width = ONE; + + while value >= TEN { + value = OneIndexed::new(value.get() / 10).unwrap_or(OneIndexed::MIN); + width = width.checked_add(1).unwrap(); + } + + width +} + +/// We need to set a value here since we have no way of knowing what the user's +/// preferred tab display width is, so this is set to `2` to match how tab +/// characters are printed by [print_invisibles] +const TAB_WIDTH: usize = 2; + +/// Compute the unicode display width of a string, with the width of tab +/// characters set to [TAB_WIDTH] and the width of control characters set to 0 +fn text_width(text: &str) -> usize { + text.chars() + .map(|char| match char { + '\t' => TAB_WIDTH, + _ => char.width().unwrap_or(0), + }) + .sum() +} + +struct PrintInvisiblesOptions { + /// Do not print tab characters at the start of the string + ignore_leading_tabs: bool, + /// If this is set to true, space characters will only be substituted when + /// at least two of them are found in a row + ignore_lone_spaces: bool, + /// Do not print `'\r'` characters if they're followed by `'\n'` + ignore_trailing_carriage_return: bool, + // Set to `true` to show invisible characters at the start of the string + at_line_start: bool, + // Set to `true` to show invisible characters at the end of the string + at_line_end: bool, +} + +/// Print `input` to `fmt` with invisible characters replaced with an +/// appropriate visual representation. Return `true` if any non-whitespace +/// character was printed +fn print_invisibles( + fmt: &mut fmt::Formatter<'_>, + input: &str, + options: PrintInvisiblesOptions, +) -> io::Result { + let mut had_non_whitespace = false; + + // Get the first trailing whitespace character in the string + let trailing_whitespace_index = input + .char_indices() + .rev() + .find_map(|(index, char)| { + if !char.is_ascii_whitespace() { + Some(index) + } else { + None + } + }) + .unwrap_or(input.len()); + + let mut iter = input.char_indices().peekable(); + let mut prev_char_was_whitespace = false; + + while let Some((i, char)) = iter.next() { + let mut show_invisible = true; + + // Only highlight spaces when surrounded by other spaces + if char == ' ' && options.ignore_lone_spaces { + show_invisible = false; + + let next_char_is_whitespace = iter + .peek() + .map_or(false, |(_, char)| char.is_ascii_whitespace()); + + if prev_char_was_whitespace || next_char_is_whitespace { + show_invisible = false; + } + } + + prev_char_was_whitespace = char.is_ascii_whitespace(); + + // Don't show leading tabs + if options.at_line_start + && !had_non_whitespace + && char == '\t' + && options.ignore_leading_tabs + { + show_invisible = false; + } + + // Always show if at the end of line + if options.at_line_end && i >= trailing_whitespace_index { + show_invisible = true; + } + + // If we are a carriage return next to a \n then don't show the character as visible + if options.ignore_trailing_carriage_return && char == '\r' { + let next_char_is_line_feed = iter.peek().map_or(false, |(_, char)| *char == '\n'); + if next_char_is_line_feed { + continue; + } + } + + if !show_invisible { + if !char.is_ascii_whitespace() { + had_non_whitespace = true; + } + + write!(fmt, "{char}")?; + continue; + } + + if let Some(visible) = show_invisible_char(char) { + fmt.write_markup(markup! { {visible} })?; + continue; + } + + if (char.is_whitespace() && !char.is_ascii_whitespace()) || char.is_control() { + let code = u32::from(char); + fmt.write_markup(markup! { "U+"{format_args!("{code:x}")} })?; + continue; + } + + write!(fmt, "{char}")?; + } + + Ok(had_non_whitespace) +} + +fn show_invisible_char(char: char) -> Option<&'static str> { + match char { + ' ' => Some("\u{b7}"), // Middle Dot + '\r' => Some("\u{240d}"), // Carriage Return Symbol + '\n' => Some("\u{23ce}"), // Return Symbol + '\t' => Some("\u{2192} "), // Rightwards Arrow + '\0' => Some("\u{2400}"), // Null Symbol + '\x0b' => Some("\u{240b}"), // Vertical Tabulation Symbol + '\x08' => Some("\u{232b}"), // Backspace Symbol + '\x0c' => Some("\u{21a1}"), // Downards Two Headed Arrow + _ => None, + } +} + +/// A user-facing location in a source file. +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub(super) struct SourceLocation { + /// The user-facing line number. + pub(super) line_number: OneIndexed, + /// The user-facing column number. + pub(super) column_number: OneIndexed, +} + +/// Representation of a single source file holding additional information for +/// efficiently rendering code frames +#[derive(Clone)] +pub(super) struct SourceFile<'diagnostic> { + /// The source code of the file. + source: &'diagnostic str, + /// The starting byte indices in the source code. + line_starts: Cow<'diagnostic, LineIndex>, +} + +impl<'diagnostic> SourceFile<'diagnostic> { + /// Create a new [SourceFile] from a slice of text + pub(super) fn new(source_code: BorrowedSourceCode<'diagnostic>) -> Self { + // Either re-use the existing line index provided by the diagnostic or create one + Self { + source: source_code.text, + line_starts: source_code.line_starts.map_or_else( + || Cow::Owned(LineIndexBuf::from_source_text(source_code.text)), + Cow::Borrowed, + ), + } + } + + /// Return the starting byte index of the line with the specified line index. + /// Convenience method that already generates errors if necessary. + fn line_start(&self, line_index: usize) -> io::Result { + use std::cmp::Ordering; + + match line_index.cmp(&self.line_starts.len()) { + Ordering::Less => Ok(self + .line_starts + .get(line_index) + .cloned() + .expect("failed despite previous check")), + Ordering::Equal => Ok(TextSize::of(self.source)), + Ordering::Greater => Err(io::Error::new( + io::ErrorKind::InvalidInput, + "overflow error", + )), + } + } + + fn line_index(&self, byte_index: TextSize) -> usize { + self.line_starts + .binary_search(&byte_index) + .unwrap_or_else(|next_line| next_line - 1) + } + + fn line_range(&self, line_index: usize) -> io::Result { + let line_start = self.line_start(line_index)?; + let next_line_start = self.line_start(line_index + 1)?; + + Ok(TextRange::new(line_start, next_line_start)) + } + + fn line_number(&self, line_index: usize) -> OneIndexed { + // SAFETY: Adding `1` to the value of `line_index` ensures it's non-zero + OneIndexed::from_zero_indexed(line_index) + } + + fn column_number(&self, line_index: usize, byte_index: TextSize) -> io::Result { + let source = self.source; + let line_range = self.line_range(line_index)?; + let column_index = column_index(source, line_range, byte_index); + + // SAFETY: Adding `1` to the value of `column_index` ensures it's non-zero + Ok(OneIndexed::from_zero_indexed(column_index)) + } + + /// Get a source location from a byte index into the text of this file + pub(super) fn location(&self, byte_index: TextSize) -> io::Result { + let line_index = self.line_index(byte_index); + + Ok(SourceLocation { + line_number: self.line_number(line_index), + column_number: self.column_number(line_index, byte_index)?, + }) + } +} + +/// The column index at the given byte index in the source file. +/// This is the number of characters to the given byte index. +/// +/// If the byte index is smaller than the start of the line, then `0` is returned. +/// If the byte index is past the end of the line, the column index of the last +/// character `+ 1` is returned. +fn column_index(source: &str, line_range: TextRange, byte_index: TextSize) -> usize { + let end_index = std::cmp::min( + byte_index, + std::cmp::min(line_range.end(), TextSize::of(source)), + ); + + (usize::from(line_range.start())..usize::from(end_index)) + .filter(|byte_index| source.is_char_boundary(byte_index + 1)) + .count() +} + +/// Type-safe wrapper for a value whose logical range starts at `1`, for +/// instance the line or column numbers in a file +/// +/// Internally this is represented as a [NonZeroUsize], this enables some +/// memory optimizations +#[repr(transparent)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct OneIndexed(NonZeroUsize); + +impl OneIndexed { + // SAFETY: These constants are being initialized with non-zero values + /// The smallest value that can be represented by this integer type. + pub const MIN: Self = unsafe { Self::new_unchecked(1) }; + /// The largest value that can be represented by this integer type + pub const MAX: Self = unsafe { Self::new_unchecked(usize::MAX) }; + + /// Creates a non-zero if the given value is not zero. + pub const fn new(value: usize) -> Option { + match NonZeroUsize::new(value) { + Some(value) => Some(Self(value)), + None => None, + } + } + + /// Creates a non-zero without checking whether the value is non-zero. + /// This results in undefined behaviour if the value is zero. + /// + /// # Safety + /// + /// The value must not be zero. + pub const unsafe fn new_unchecked(value: usize) -> Self { + Self(NonZeroUsize::new_unchecked(value)) + } + + /// Construct a new [OneIndexed] from a zero-indexed value + pub const fn from_zero_indexed(value: usize) -> Self { + // SAFETY: Adding `1` to `value` ensures it's non-zero + Self(unsafe { NonZeroUsize::new_unchecked(value.saturating_add(1)) }) + } + + /// Returns the value as a primitive type. + pub const fn get(self) -> usize { + self.0.get() + } + + /// Return the zero-indexed primitive value for this [OneIndexed] + pub const fn to_zero_indexed(self) -> usize { + self.0.get() - 1 + } + + /// Saturating integer addition. Computes `self + rhs`, saturating at + /// the numeric bounds instead of overflowing. + pub const fn saturating_add(self, rhs: usize) -> Self { + match NonZeroUsize::new(self.0.get().saturating_add(rhs)) { + Some(value) => Self(value), + None => Self::MAX, + } + } + + /// Saturating integer subtraction. Computes `self - rhs`, saturating + /// at the numeric bounds instead of overflowing. + pub const fn saturating_sub(self, rhs: usize) -> Self { + match NonZeroUsize::new(self.0.get().saturating_sub(rhs)) { + Some(value) => Self(value), + None => Self::MIN, + } + } +} + +impl fmt::Display for OneIndexed { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> io::Result<()> { + self.0.get().fmt(f) + } +} + +impl std::fmt::Display for OneIndexed { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.get().fmt(f) + } +} + +/// Adapter type implementing [Iterator] for ranges of [OneIndexed], +/// since [std::iter::Step] is unstable +pub struct IntoIter(std::ops::Range); + +impl IntoIter { + /// Construct a new iterator over a range of [OneIndexed] of any kind + /// (`..`, `a..`, `..b`, `..=c`, `d..e`, or `f..=g`) + pub fn new>(range: R) -> Self { + let start = match range.start_bound() { + Bound::Included(value) => value.get(), + Bound::Excluded(value) => value.get() + 1, + Bound::Unbounded => 1, + }; + + let end = match range.end_bound() { + Bound::Included(value) => value.get() + 1, + Bound::Excluded(value) => value.get(), + Bound::Unbounded => usize::MAX, + }; + + Self(start..end) + } +} + +impl Iterator for IntoIter { + type Item = OneIndexed; + + fn next(&mut self) -> Option { + self.0.next().map(|index| OneIndexed::new(index).unwrap()) + } + + fn size_hint(&self) -> (usize, Option) { + self.0.size_hint() + } +} + +impl DoubleEndedIterator for IntoIter { + fn next_back(&mut self) -> Option { + self.0 + .next_back() + .map(|index| OneIndexed::new(index).unwrap()) + } +} + +impl FusedIterator for IntoIter {} + +#[cfg(test)] +mod tests { + use std::num::NonZeroUsize; + + use super::{calculate_print_width, OneIndexed}; + + #[test] + fn print_width() { + let one = NonZeroUsize::new(1).unwrap(); + let two = NonZeroUsize::new(2).unwrap(); + let three = NonZeroUsize::new(3).unwrap(); + let four = NonZeroUsize::new(4).unwrap(); + + assert_eq!(calculate_print_width(OneIndexed::new(1).unwrap()), one); + assert_eq!(calculate_print_width(OneIndexed::new(9).unwrap()), one); + + assert_eq!(calculate_print_width(OneIndexed::new(10).unwrap()), two); + assert_eq!(calculate_print_width(OneIndexed::new(11).unwrap()), two); + assert_eq!(calculate_print_width(OneIndexed::new(19).unwrap()), two); + assert_eq!(calculate_print_width(OneIndexed::new(20).unwrap()), two); + assert_eq!(calculate_print_width(OneIndexed::new(21).unwrap()), two); + assert_eq!(calculate_print_width(OneIndexed::new(99).unwrap()), two); + + assert_eq!(calculate_print_width(OneIndexed::new(100).unwrap()), three); + assert_eq!(calculate_print_width(OneIndexed::new(101).unwrap()), three); + assert_eq!(calculate_print_width(OneIndexed::new(110).unwrap()), three); + assert_eq!(calculate_print_width(OneIndexed::new(199).unwrap()), three); + assert_eq!(calculate_print_width(OneIndexed::new(999).unwrap()), three); + + assert_eq!(calculate_print_width(OneIndexed::new(1000).unwrap()), four); + } } diff --git a/crates/rome_diagnostics/src/v2/location.rs b/crates/rome_diagnostics/src/v2/location.rs index 6fcaf569de0..d973fd86d54 100644 --- a/crates/rome_diagnostics/src/v2/location.rs +++ b/crates/rome_diagnostics/src/v2/location.rs @@ -1,4 +1,4 @@ -use std::ops::Deref; +use std::{borrow::Borrow, ops::Deref}; use rome_text_edit::{TextRange, TextSize}; use serde::{Deserialize, Serialize}; @@ -201,8 +201,8 @@ impl From for usize { } } -type OwnedSourceCode = SourceCode>; -type BorrowedSourceCode<'a> = SourceCode<&'a str, &'a [TextSize]>; +type OwnedSourceCode = SourceCode; +pub(crate) type BorrowedSourceCode<'a> = SourceCode<&'a str, &'a LineIndex>; /// Represents the source code of a file. #[derive(Debug, Clone, Copy)] @@ -229,7 +229,7 @@ impl SourceCode { } impl BorrowedSourceCode<'_> { - /// Converts a `SourceCode<&str, &[TextSize]>` to `SourceCode>`. + /// Converts a `SourceCode<&str, &LineIndex>` to `SourceCode`. pub(crate) fn to_owned(self) -> OwnedSourceCode { SourceCode { text: self.text.to_owned(), @@ -238,6 +238,70 @@ impl BorrowedSourceCode<'_> { } } +#[derive(Debug)] +pub struct LineIndex([TextSize]); + +impl LineIndex { + pub fn new(slice: &'_ [TextSize]) -> &'_ Self { + // SAFETY: Transmuting `&[TextSize]` to `&LineIndex` is safe since + // `LineIndex` is a `repr(transparent)` struct containing a `[TextSize]` + // and thus has the same memory layout + unsafe { std::mem::transmute(slice) } + } +} + +impl Deref for LineIndex { + type Target = [TextSize]; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl ToOwned for LineIndex { + type Owned = LineIndexBuf; + + fn to_owned(&self) -> Self::Owned { + LineIndexBuf(self.0.to_owned()) + } +} + +#[derive(Debug, Clone)] +pub struct LineIndexBuf(Vec); + +impl LineIndexBuf { + pub fn from_source_text(source: &str) -> Self { + Self( + std::iter::once(0) + .chain(source.match_indices(&['\n', '\r']).filter_map(|(i, _)| { + let bytes = source.as_bytes(); + + match bytes[i] { + // Filter out the `\r` in `\r\n` to avoid counting the line break twice + b'\r' if i + 1 < bytes.len() && bytes[i + 1] == b'\n' => None, + _ => Some(i + 1), + } + })) + .map(|i| TextSize::try_from(i).expect("integer overflow")) + .collect(), + ) + } +} + +impl Deref for LineIndexBuf { + type Target = LineIndex; + + fn deref(&self) -> &Self::Target { + LineIndex::new(self.0.as_slice()) + } +} + +impl Borrow for LineIndexBuf { + fn borrow(&self) -> &LineIndex { + self + } +} + /// Builder type for the [Location] struct pub struct LocationBuilder<'a> { resource: Option>, @@ -402,3 +466,55 @@ impl AsSourceCode for String { }) } } + +#[cfg(test)] +mod tests { + use rome_text_size::TextSize; + + use super::LineIndexBuf; + + #[test] + fn line_starts_with_carriage_return_line_feed() { + let input = "a\r\nb\r\nc"; + let LineIndexBuf(starts) = LineIndexBuf::from_source_text(input); + + assert_eq!( + vec![ + TextSize::from(0u32), + TextSize::from(3u32), + TextSize::from(6u32) + ], + starts + ); + } + + #[test] + fn line_starts_with_carriage_return() { + let input = "a\rb\rc"; + let LineIndexBuf(starts) = LineIndexBuf::from_source_text(input); + + assert_eq!( + vec![ + TextSize::from(0u32), + TextSize::from(2u32), + TextSize::from(4u32) + ], + starts + ); + } + + #[test] + fn line_starts_with_line_feed() { + let input = "a\nb\nc"; + let LineIndexBuf(starts) = LineIndexBuf::from_source_text(input); + + assert_eq!( + vec![ + TextSize::from(0u32), + TextSize::from(2u32), + TextSize::from(4u32) + ], + starts + ); + } +} diff --git a/crates/rome_diagnostics/src/v2/mod.rs b/crates/rome_diagnostics/src/v2/mod.rs index 2491286010f..a2d06ba96f6 100644 --- a/crates/rome_diagnostics/src/v2/mod.rs +++ b/crates/rome_diagnostics/src/v2/mod.rs @@ -22,7 +22,7 @@ pub use context::{Context, DiagnosticExt}; pub use diagnostic::{Diagnostic, DiagnosticTags, Severity}; pub use display::{set_bottom_frame, Backtrace, PrintDescription, PrintDiagnostic}; pub use error::{Error, Result}; -pub use location::{FileId, FilePath, Location, Resource, SourceCode}; +pub use location::{FileId, FilePath, LineIndex, LineIndexBuf, Location, Resource, SourceCode}; pub mod prelude { //! Anonymously re-exports all the traits declared by this module, this is diff --git a/crates/rome_js_analyze/src/lib.rs b/crates/rome_js_analyze/src/lib.rs index 96fd316daf4..2deb4dd87bf 100644 --- a/crates/rome_js_analyze/src/lib.rs +++ b/crates/rome_js_analyze/src/lib.rs @@ -102,7 +102,7 @@ where mod tests { use rome_analyze::Never; - use rome_console::codespan::Severity; + use rome_diagnostics::Severity; use rome_diagnostics::{file::FileId, v2::category}; use rome_js_parser::parse; use rome_js_syntax::{SourceType, TextRange, TextSize}; diff --git a/crates/rome_js_analyze/src/semantic_analyzers/nursery/no_dangerously_set_inner_html.rs b/crates/rome_js_analyze/src/semantic_analyzers/nursery/no_dangerously_set_inner_html.rs index a80e37e4a13..f5a834b488e 100644 --- a/crates/rome_js_analyze/src/semantic_analyzers/nursery/no_dangerously_set_inner_html.rs +++ b/crates/rome_js_analyze/src/semantic_analyzers/nursery/no_dangerously_set_inner_html.rs @@ -2,8 +2,8 @@ use crate::react::ReactCreateElementCall; use crate::semantic_services::Semantic; use rome_analyze::context::RuleContext; use rome_analyze::{declare_rule, Rule, RuleCategory, RuleDiagnostic}; -use rome_console::codespan::Severity; use rome_console::markup; +use rome_diagnostics::Severity; use rome_js_syntax::{JsCallExpression, JsLiteralMemberName, JsxAnyAttributeName, JsxAttribute}; use rome_rowan::{declare_node_union, AstNode}; diff --git a/crates/rome_js_analyze/src/semantic_analyzers/nursery/use_button_type.rs b/crates/rome_js_analyze/src/semantic_analyzers/nursery/use_button_type.rs index 8f80d3a49d1..17f01147adf 100644 --- a/crates/rome_js_analyze/src/semantic_analyzers/nursery/use_button_type.rs +++ b/crates/rome_js_analyze/src/semantic_analyzers/nursery/use_button_type.rs @@ -1,8 +1,8 @@ use crate::react::{ReactApiCall, ReactCreateElementCall}; use crate::semantic_services::Semantic; use rome_analyze::{context::RuleContext, declare_rule, Rule, RuleCategory, RuleDiagnostic}; -use rome_console::codespan::Severity; use rome_console::markup; +use rome_diagnostics::Severity; use rome_js_syntax::{ JsCallExpression, JsObjectExpression, JsStringLiteralExpression, JsxAnyElementName, JsxOpeningElement, JsxString, diff --git a/crates/rome_js_analyze/tests/spec_tests.rs b/crates/rome_js_analyze/tests/spec_tests.rs index b37ad76a26d..e3773f465e3 100644 --- a/crates/rome_js_analyze/tests/spec_tests.rs +++ b/crates/rome_js_analyze/tests/spec_tests.rs @@ -3,13 +3,13 @@ use std::{ }; use rome_analyze::{AnalysisFilter, AnalyzerAction, ControlFlow, Never, RuleFilter}; -use rome_console::codespan::Severity; use rome_console::{ diff::{Diff, DiffMode}, fmt::{Formatter, Termcolor}, markup, Markup, }; use rome_diagnostics::file::FileId; +use rome_diagnostics::Severity; use rome_diagnostics::{file::SimpleFile, termcolor::NoColor, Diagnostic}; use rome_js_parser::{ parse, diff --git a/crates/rome_js_analyze/tests/specs/correctness/noArguments.cjs.snap b/crates/rome_js_analyze/tests/specs/correctness/noArguments.cjs.snap index d8daa9d24c0..8cca7e7f575 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noArguments.cjs.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noArguments.cjs.snap @@ -20,10 +20,11 @@ noArguments.cjs:2:17 lint/correctness/noArguments ━━━━━━━━━━ ! Use the rest parameters instead of arguments. - ┌─ noArguments.cjs:2:17 - │ - 2 │ console.log(arguments); - │ ^^^^^^^^^ + 1 │ function f() { + > 2 │ console.log(arguments); + │ ^^^^^^^^^ + 3 │ } + 4 │ i arguments does not have Array.prototype methods and can be inconvenient to use. diff --git a/crates/rome_js_analyze/tests/specs/correctness/noAsyncPromiseExecutor.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noAsyncPromiseExecutor.js.snap index d35ab8098a3..5b75c2cf6c2 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noAsyncPromiseExecutor.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noAsyncPromiseExecutor.js.snap @@ -21,10 +21,12 @@ noAsyncPromiseExecutor.js:7:13 lint/correctness/noAsyncPromiseExecutor ━━━ ! Promise executor functions should not be `async`. - ┌─ noAsyncPromiseExecutor.js:7:13 - │ - 7 │ new Promise(async function foo(resolve, reject) {}) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ new Foo((( (resolve, reject) => {} ))) + 6 │ // invalid + > 7 │ new Promise(async function foo(resolve, reject) {}) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 8 │ new Promise(async (resolve, reject) => {}) + 9 │ new Promise(((((async () => {}))))) ``` @@ -34,10 +36,11 @@ noAsyncPromiseExecutor.js:8:13 lint/correctness/noAsyncPromiseExecutor ━━━ ! Promise executor functions should not be `async`. - ┌─ noAsyncPromiseExecutor.js:8:13 - │ - 8 │ new Promise(async (resolve, reject) => {}) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 6 │ // invalid + 7 │ new Promise(async function foo(resolve, reject) {}) + > 8 │ new Promise(async (resolve, reject) => {}) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 9 │ new Promise(((((async () => {}))))) ``` @@ -47,10 +50,10 @@ noAsyncPromiseExecutor.js:9:17 lint/correctness/noAsyncPromiseExecutor ━━━ ! Promise executor functions should not be `async`. - ┌─ noAsyncPromiseExecutor.js:9:17 - │ - 9 │ new Promise(((((async () => {}))))) - │ ^^^^^^^^^^^^^^ + 7 │ new Promise(async function foo(resolve, reject) {}) + 8 │ new Promise(async (resolve, reject) => {}) + > 9 │ new Promise(((((async () => {}))))) + │ ^^^^^^^^^^^^^^ ``` diff --git a/crates/rome_js_analyze/tests/specs/correctness/noCatchAssign.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noCatchAssign.js.snap index 1b5351b421d..2915d291145 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noCatchAssign.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noCatchAssign.js.snap @@ -22,17 +22,19 @@ noCatchAssign.js:2:24 lint/correctness/noCatchAssign ━━━━━━━━━ ! Do not reassign catch parameters. - ┌─ noCatchAssign.js:2:24 - │ - 2 │ try { } catch (e) { e; e = 10; } - │ ^ + 1 │ // invalid + > 2 │ try { } catch (e) { e; e = 10; } + │ ^ + 3 │ try { + 4 │ i The catch parameter is declared here - ┌─ noCatchAssign.js:2:16 - │ - 2 │ try { } catch (e) { e; e = 10; } - │ ^ + 1 │ // invalid + > 2 │ try { } catch (e) { e; e = 10; } + │ ^ + 3 │ try { + 4 │ i Use a local variable instead. @@ -44,17 +46,20 @@ noCatchAssign.js:6:3 lint/correctness/noCatchAssign ━━━━━━━━━ ! Do not reassign catch parameters. - ┌─ noCatchAssign.js:6:3 - │ - 6 │ error = 100; - │ ^^^^^ + 5 │ } catch (error) { + > 6 │ error = 100; + │ ^^^^^ + 7 │ { + 8 │ error = 10; i The catch parameter is declared here - ┌─ noCatchAssign.js:5:10 - │ - 5 │ } catch (error) { - │ ^^^^^ + 3 │ try { + 4 │ + > 5 │ } catch (error) { + │ ^^^^^ + 6 │ error = 100; + 7 │ { i Use a local variable instead. @@ -66,17 +71,21 @@ noCatchAssign.js:8:5 lint/correctness/noCatchAssign ━━━━━━━━━ ! Do not reassign catch parameters. - ┌─ noCatchAssign.js:8:5 - │ - 8 │ error = 10; - │ ^^^^^ + 6 │ error = 100; + 7 │ { + > 8 │ error = 10; + │ ^^^^^ + 9 │ } + 10 │ } i The catch parameter is declared here - ┌─ noCatchAssign.js:5:10 - │ - 5 │ } catch (error) { - │ ^^^^^ + 3 │ try { + 4 │ + > 5 │ } catch (error) { + │ ^^^^^ + 6 │ error = 100; + 7 │ { i Use a local variable instead. diff --git a/crates/rome_js_analyze/tests/specs/correctness/noCommentText.tsx.snap b/crates/rome_js_analyze/tests/specs/correctness/noCommentText.tsx.snap index b50dc6d1ae8..a822a884302 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noCommentText.tsx.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noCommentText.tsx.snap @@ -20,10 +20,11 @@ noCommentText.tsx:2:17 lint/correctness/noCommentText FIXABLE ━━━━━ ! Wrap comments inside children within braces. - ┌─ noCommentText.tsx:2:17 - │ - 2 │ const a3 =
// comment
; - │ ^^^^^^^^^^ + 1 │ // invalid + > 2 │ const a3 =
// comment
; + │ ^^^^^^^^^^ + 3 │ const a4 =
/* comment */
; + 4 │ const a5 =
/** comment */
; i Suggested fix: Wrap the comments with braces @@ -43,10 +44,12 @@ noCommentText.tsx:3:17 lint/correctness/noCommentText FIXABLE ━━━━━ ! Wrap comments inside children within braces. - ┌─ noCommentText.tsx:3:17 - │ - 3 │ const a4 =
/* comment */
; - │ ^^^^^^^^^^^^^ + 1 │ // invalid + 2 │ const a3 =
// comment
; + > 3 │ const a4 =
/* comment */
; + │ ^^^^^^^^^^^^^ + 4 │ const a5 =
/** comment */
; + 5 │ // valid i Suggested fix: Wrap the comments with braces @@ -67,10 +70,12 @@ noCommentText.tsx:4:17 lint/correctness/noCommentText FIXABLE ━━━━━ ! Wrap comments inside children within braces. - ┌─ noCommentText.tsx:4:17 - │ - 4 │ const a5 =
/** comment */
; - │ ^^^^^^^^^^^^^^ + 2 │ const a3 =
// comment
; + 3 │ const a4 =
/* comment */
; + > 4 │ const a5 =
/** comment */
; + │ ^^^^^^^^^^^^^^ + 5 │ // valid + 6 │ const a =
{/* comment */}
; i Suggested fix: Wrap the comments with braces diff --git a/crates/rome_js_analyze/tests/specs/correctness/noCompareNegZero.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noCompareNegZero.js.snap index 0be6975a2f2..18b8ced3c7b 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noCompareNegZero.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noCompareNegZero.js.snap @@ -64,10 +64,12 @@ noCompareNegZero.js:32:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the === operator to compare against -0. - ┌─ noCompareNegZero.js:32:1 - │ - 32 │ x === -0; - │ ^^^^^^^^ + 30 │ x === +0; + 31 │ // invalid + > 32 │ x === -0; + │ ^^^^^^^^ + 33 │ x == -0; + 34 │ -0 == x; i Safe fix: Replace -0 with 0 @@ -89,10 +91,12 @@ noCompareNegZero.js:33:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the == operator to compare against -0. - ┌─ noCompareNegZero.js:33:1 - │ - 33 │ x == -0; - │ ^^^^^^^ + 31 │ // invalid + 32 │ x === -0; + > 33 │ x == -0; + │ ^^^^^^^ + 34 │ -0 == x; + 35 │ x < -0; i Safe fix: Replace -0 with 0 @@ -114,10 +118,12 @@ noCompareNegZero.js:34:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the == operator to compare against -0. - ┌─ noCompareNegZero.js:34:1 - │ - 34 │ -0 == x; - │ ^^^^^^^ + 32 │ x === -0; + 33 │ x == -0; + > 34 │ -0 == x; + │ ^^^^^^^ + 35 │ x < -0; + 36 │ -0 < x; i Safe fix: Replace -0 with 0 @@ -139,10 +145,12 @@ noCompareNegZero.js:35:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the < operator to compare against -0. - ┌─ noCompareNegZero.js:35:1 - │ - 35 │ x < -0; - │ ^^^^^^ + 33 │ x == -0; + 34 │ -0 == x; + > 35 │ x < -0; + │ ^^^^^^ + 36 │ -0 < x; + 37 │ x <= -0; i Safe fix: Replace -0 with 0 @@ -164,10 +172,12 @@ noCompareNegZero.js:36:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the < operator to compare against -0. - ┌─ noCompareNegZero.js:36:1 - │ - 36 │ -0 < x; - │ ^^^^^^ + 34 │ -0 == x; + 35 │ x < -0; + > 36 │ -0 < x; + │ ^^^^^^ + 37 │ x <= -0; + 38 │ -0 <= x; i Safe fix: Replace -0 with 0 @@ -189,10 +199,12 @@ noCompareNegZero.js:37:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the <= operator to compare against -0. - ┌─ noCompareNegZero.js:37:1 - │ - 37 │ x <= -0; - │ ^^^^^^^ + 35 │ x < -0; + 36 │ -0 < x; + > 37 │ x <= -0; + │ ^^^^^^^ + 38 │ -0 <= x; + 39 │ x > -0; i Safe fix: Replace -0 with 0 @@ -214,10 +226,12 @@ noCompareNegZero.js:38:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the <= operator to compare against -0. - ┌─ noCompareNegZero.js:38:1 - │ - 38 │ -0 <= x; - │ ^^^^^^^ + 36 │ -0 < x; + 37 │ x <= -0; + > 38 │ -0 <= x; + │ ^^^^^^^ + 39 │ x > -0; + 40 │ -0 > x; i Safe fix: Replace -0 with 0 @@ -239,10 +253,12 @@ noCompareNegZero.js:39:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the > operator to compare against -0. - ┌─ noCompareNegZero.js:39:1 - │ - 39 │ x > -0; - │ ^^^^^^ + 37 │ x <= -0; + 38 │ -0 <= x; + > 39 │ x > -0; + │ ^^^^^^ + 40 │ -0 > x; + 41 │ x >= -0; i Safe fix: Replace -0 with 0 @@ -264,10 +280,12 @@ noCompareNegZero.js:40:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the > operator to compare against -0. - ┌─ noCompareNegZero.js:40:1 - │ - 40 │ -0 > x; - │ ^^^^^^ + 38 │ -0 <= x; + 39 │ x > -0; + > 40 │ -0 > x; + │ ^^^^^^ + 41 │ x >= -0; + 42 │ -0 >= x; i Safe fix: Replace -0 with 0 @@ -289,10 +307,12 @@ noCompareNegZero.js:41:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the >= operator to compare against -0. - ┌─ noCompareNegZero.js:41:1 - │ - 41 │ x >= -0; - │ ^^^^^^^ + 39 │ x > -0; + 40 │ -0 > x; + > 41 │ x >= -0; + │ ^^^^^^^ + 42 │ -0 >= x; + 43 │ x != -0; i Safe fix: Replace -0 with 0 @@ -314,10 +334,12 @@ noCompareNegZero.js:42:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the >= operator to compare against -0. - ┌─ noCompareNegZero.js:42:1 - │ - 42 │ -0 >= x; - │ ^^^^^^^ + 40 │ -0 > x; + 41 │ x >= -0; + > 42 │ -0 >= x; + │ ^^^^^^^ + 43 │ x != -0; + 44 │ -0 != x; i Safe fix: Replace -0 with 0 @@ -339,10 +361,12 @@ noCompareNegZero.js:43:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the != operator to compare against -0. - ┌─ noCompareNegZero.js:43:1 - │ - 43 │ x != -0; - │ ^^^^^^^ + 41 │ x >= -0; + 42 │ -0 >= x; + > 43 │ x != -0; + │ ^^^^^^^ + 44 │ -0 != x; + 45 │ -0 !== x; i Safe fix: Replace -0 with 0 @@ -364,10 +388,12 @@ noCompareNegZero.js:44:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the != operator to compare against -0. - ┌─ noCompareNegZero.js:44:1 - │ - 44 │ -0 != x; - │ ^^^^^^^ + 42 │ -0 >= x; + 43 │ x != -0; + > 44 │ -0 != x; + │ ^^^^^^^ + 45 │ -0 !== x; + 46 │ -0 === -0; i Safe fix: Replace -0 with 0 @@ -389,10 +415,12 @@ noCompareNegZero.js:45:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the !== operator to compare against -0. - ┌─ noCompareNegZero.js:45:1 - │ - 45 │ -0 !== x; - │ ^^^^^^^^ + 43 │ x != -0; + 44 │ -0 != x; + > 45 │ -0 !== x; + │ ^^^^^^^^ + 46 │ -0 === -0; + 47 │ -0 /** commnet **/ === 4; i Safe fix: Replace -0 with 0 @@ -414,10 +442,12 @@ noCompareNegZero.js:46:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the === operator to compare against -0. - ┌─ noCompareNegZero.js:46:1 - │ - 46 │ -0 === -0; - │ ^^^^^^^^^ + 44 │ -0 != x; + 45 │ -0 !== x; + > 46 │ -0 === -0; + │ ^^^^^^^^^ + 47 │ -0 /** commnet **/ === 4; + 48 │ -0 i Safe fix: Replace -0 with 0 @@ -439,10 +469,12 @@ noCompareNegZero.js:47:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the === operator to compare against -0. - ┌─ noCompareNegZero.js:47:1 - │ - 47 │ -0 /** commnet **/ === 4; - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 45 │ -0 !== x; + 46 │ -0 === -0; + > 47 │ -0 /** commnet **/ === 4; + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 48 │ -0 + 49 │ // comment i Safe fix: Replace -0 with 0 @@ -464,12 +496,15 @@ noCompareNegZero.js:48:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the === operator to compare against -0. - ┌─ noCompareNegZero.js:48:1 - │ - 48 │ ┌ -0 - 49 │ │ // comment - 50 │ │ === 4; - │ └─────^ + 46 │ -0 === -0; + 47 │ -0 /** commnet **/ === 4; + > 48 │ -0 + │ ^^ + > 49 │ // comment + > 50 │ === 4; + │ ^^^^^ + 51 │ 4 === // comment + 52 │ -0 i Safe fix: Replace -0 with 0 @@ -491,11 +526,12 @@ noCompareNegZero.js:51:1 lint/correctness/noCompareNegZero FIXABLE ━━━ ! Do not use the === operator to compare against -0. - ┌─ noCompareNegZero.js:51:1 - │ - 51 │ ┌ 4 === // comment - 52 │ │ -0 - │ └──^ + 49 │ // comment + 50 │ === 4; + > 51 │ 4 === // comment + │ ^^^^^^^^^^^^^^^^ + > 52 │ -0 + │ ^^ i Safe fix: Replace -0 with 0 diff --git a/crates/rome_js_analyze/tests/specs/correctness/noDebugger.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noDebugger.js.snap index e9d5f67e450..98ee25a4872 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noDebugger.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noDebugger.js.snap @@ -22,10 +22,12 @@ noDebugger.js:3:10 lint/correctness/noDebugger FIXABLE ━━━━━━━ ! This is an unexpected use of the debugger statement. - ┌─ noDebugger.js:3:10 - │ - 3 │ if (foo) debugger - │ ^^^^^^^^ + 1 │ const test = { debugger: 1 }; test.debugger; + 2 │ + > 3 │ if (foo) debugger + │ ^^^^^^^^ + 4 │ + 5 │ debugger; i Suggested fix: Remove debugger statement @@ -46,10 +48,12 @@ noDebugger.js:5:1 lint/correctness/noDebugger FIXABLE ━━━━━━━━ ! This is an unexpected use of the debugger statement. - ┌─ noDebugger.js:5:1 - │ - 5 │ debugger; - │ ^^^^^^^^^ + 3 │ if (foo) debugger + 4 │ + > 5 │ debugger; + │ ^^^^^^^^^ + 6 │ + 7 │ function test() { i Suggested fix: Remove debugger statement @@ -71,10 +75,11 @@ noDebugger.js:9:3 lint/correctness/noDebugger FIXABLE ━━━━━━━━ ! This is an unexpected use of the debugger statement. - ┌─ noDebugger.js:9:3 - │ - 9 │ debugger; - │ ^^^^^^^^^ + 7 │ function test() { + 8 │ let a = 3; + > 9 │ debugger; + │ ^^^^^^^^^ + 10 │ } i Suggested fix: Remove debugger statement diff --git a/crates/rome_js_analyze/tests/specs/correctness/noDelete.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noDelete.js.snap index f56959e6550..3c91b00a755 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noDelete.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noDelete.js.snap @@ -25,10 +25,10 @@ noDelete.js:1:1 lint/correctness/noDelete FIXABLE ━━━━━━━━━ ! This is an unexpected use of the delete operator. - ┌─ noDelete.js:1:1 - │ - 1 │ delete a.b; - │ ^^^^^^^^^^ + > 1 │ delete a.b; + │ ^^^^^^^^^^ + 2 │ delete a?.b; + 3 │ delete a["b"]; i Suggested fix: Replace with undefined assignment @@ -47,10 +47,12 @@ noDelete.js:3:1 lint/correctness/noDelete FIXABLE ━━━━━━━━━ ! This is an unexpected use of the delete operator. - ┌─ noDelete.js:3:1 - │ - 3 │ delete a["b"]; - │ ^^^^^^^^^^^^^ + 1 │ delete a.b; + 2 │ delete a?.b; + > 3 │ delete a["b"]; + │ ^^^^^^^^^^^^^ + 4 │ delete a?.["b"]; + 5 │ delete a.b.c; i Suggested fix: Replace with undefined assignment @@ -71,10 +73,12 @@ noDelete.js:5:1 lint/correctness/noDelete FIXABLE ━━━━━━━━━ ! This is an unexpected use of the delete operator. - ┌─ noDelete.js:5:1 - │ - 5 │ delete a.b.c; - │ ^^^^^^^^^^^^ + 3 │ delete a["b"]; + 4 │ delete a?.["b"]; + > 5 │ delete a.b.c; + │ ^^^^^^^^^^^^ + 6 │ delete a.b?.c; + 7 │ delete a.b["c"]; i Suggested fix: Replace with undefined assignment @@ -96,10 +100,12 @@ noDelete.js:7:1 lint/correctness/noDelete FIXABLE ━━━━━━━━━ ! This is an unexpected use of the delete operator. - ┌─ noDelete.js:7:1 - │ - 7 │ delete a.b["c"]; - │ ^^^^^^^^^^^^^^^ + 5 │ delete a.b.c; + 6 │ delete a.b?.c; + > 7 │ delete a.b["c"]; + │ ^^^^^^^^^^^^^^^ + 8 │ delete a.b?.["c"]; + 9 │ delete a?.b.c; i Suggested fix: Replace with undefined assignment diff --git a/crates/rome_js_analyze/tests/specs/correctness/noDoubleEquals.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noDoubleEquals.js.snap index 4197405e7af..b7d8b7966b6 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noDoubleEquals.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noDoubleEquals.js.snap @@ -20,10 +20,10 @@ noDoubleEquals.js:1:18 lint/correctness/noDoubleEquals FIXABLE ━━━━━ ! == is only allowed when comparing against null - ┌─ noDoubleEquals.js:1:18 - │ - 1 │ const isZero = a == 0; - │ ^^ + > 1 │ const isZero = a == 0; + │ ^^ + 2 │ const isNonZero = a != 0; + 3 │ i Using === may be unsafe if you are relying on type coercion @@ -46,10 +46,11 @@ noDoubleEquals.js:2:21 lint/correctness/noDoubleEquals FIXABLE ━━━━━ ! != is only allowed when comparing against null - ┌─ noDoubleEquals.js:2:21 - │ - 2 │ const isNonZero = a != 0; - │ ^^ + 1 │ const isZero = a == 0; + > 2 │ const isNonZero = a != 0; + │ ^^ + 3 │ + 4 │ const isNull = a == null; i Using !== may be unsafe if you are relying on type coercion diff --git a/crates/rome_js_analyze/tests/specs/correctness/noDupeArgs.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noDupeArgs.js.snap index 13395b2be8b..d053f13f650 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noDupeArgs.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noDupeArgs.js.snap @@ -47,10 +47,12 @@ noDupeArgs.js:9:18 lint/correctness/noDupeArgs ━━━━━━━━━━━ ! Duplicate argument name - ┌─ noDupeArgs.js:9:18 - │ - 9 │ function b(a, b, b) {} - │ ^ + 7 │ function test(a = function (a) {}) {} + 8 │ // invalid + > 9 │ function b(a, b, b) {} + │ ^ + 10 │ + 11 │ function c(a, a, a) {} ``` @@ -60,10 +62,12 @@ noDupeArgs.js:11:15 lint/correctness/noDupeArgs ━━━━━━━━━━ ! Duplicate argument name - ┌─ noDupeArgs.js:11:15 - │ - 11 │ function c(a, a, a) {} - │ ^ + 9 │ function b(a, b, b) {} + 10 │ + > 11 │ function c(a, a, a) {} + │ ^ + 12 │ + 13 │ const d = (a, b, a) => {}; ``` @@ -73,10 +77,12 @@ noDupeArgs.js:13:18 lint/correctness/noDupeArgs ━━━━━━━━━━ ! Duplicate argument name - ┌─ noDupeArgs.js:13:18 - │ - 13 │ const d = (a, b, a) => {}; - │ ^ + 11 │ function c(a, a, a) {} + 12 │ + > 13 │ const d = (a, b, a) => {}; + │ ^ + 14 │ + 15 │ function e(a, b, a, b) {} ``` @@ -86,10 +92,12 @@ noDupeArgs.js:15:18 lint/correctness/noDupeArgs ━━━━━━━━━━ ! Duplicate argument name - ┌─ noDupeArgs.js:15:18 - │ - 15 │ function e(a, b, a, b) {} - │ ^ + 13 │ const d = (a, b, a) => {}; + 14 │ + > 15 │ function e(a, b, a, b) {} + │ ^ + 16 │ + 17 │ var f = function (a, b, b) {}; ``` @@ -99,10 +107,12 @@ noDupeArgs.js:17:25 lint/correctness/noDupeArgs ━━━━━━━━━━ ! Duplicate argument name - ┌─ noDupeArgs.js:17:25 - │ - 17 │ var f = function (a, b, b) {}; - │ ^ + 15 │ function e(a, b, a, b) {} + 16 │ + > 17 │ var f = function (a, b, b) {}; + │ ^ + 18 │ + 19 │ class G { ``` @@ -112,10 +122,11 @@ noDupeArgs.js:20:9 lint/correctness/noDupeArgs ━━━━━━━━━━━ ! Duplicate argument name - ┌─ noDupeArgs.js:20:9 - │ - 20 │ ggg(a, a, a) {} - │ ^ + 19 │ class G { + > 20 │ ggg(a, a, a) {} + │ ^ + 21 │ } + 22 │ ``` @@ -125,10 +136,11 @@ noDupeArgs.js:24:18 lint/correctness/noDupeArgs ━━━━━━━━━━ ! Duplicate argument name - ┌─ noDupeArgs.js:24:18 - │ - 24 │ method(a, b, c, c) { - │ ^ + 23 │ let objectMethods = { + > 24 │ method(a, b, c, c) { + │ ^ + 25 │ + 26 │ } ``` @@ -138,10 +150,12 @@ noDupeArgs.js:29:25 lint/correctness/noDupeArgs ━━━━━━━━━━ ! Duplicate argument name - ┌─ noDupeArgs.js:29:25 - │ - 29 │ var h = function (a, b, a) {}; - │ ^ + 27 │ } + 28 │ + > 29 │ var h = function (a, b, a) {}; + │ ^ + 30 │ + 31 │ export default function (a, b, a, a) {} ``` @@ -151,10 +165,12 @@ noDupeArgs.js:31:32 lint/correctness/noDupeArgs ━━━━━━━━━━ ! Duplicate argument name - ┌─ noDupeArgs.js:31:32 - │ - 31 │ export default function (a, b, a, a) {} - │ ^ + 29 │ var h = function (a, b, a) {}; + 30 │ + > 31 │ export default function (a, b, a, a) {} + │ ^ + 32 │ function f({ test: res = 3 }, res) {} + 33 │ ``` @@ -164,10 +180,11 @@ noDupeArgs.js:32:31 lint/correctness/noDupeArgs ━━━━━━━━━━ ! Duplicate argument name - ┌─ noDupeArgs.js:32:31 - │ - 32 │ function f({ test: res = 3 }, res) {} - │ ^^^ + 31 │ export default function (a, b, a, a) {} + > 32 │ function f({ test: res = 3 }, res) {} + │ ^^^ + 33 │ + 34 │ export function f2(a, b, c = (a, b, b) => {}) {} ``` @@ -177,10 +194,11 @@ noDupeArgs.js:34:37 lint/correctness/noDupeArgs ━━━━━━━━━━ ! Duplicate argument name - ┌─ noDupeArgs.js:34:37 - │ - 34 │ export function f2(a, b, c = (a, b, b) => {}) {} - │ ^ + 32 │ function f({ test: res = 3 }, res) {} + 33 │ + > 34 │ export function f2(a, b, c = (a, b, b) => {}) {} + │ ^ + 35 │ ``` diff --git a/crates/rome_js_analyze/tests/specs/correctness/noEmptyPattern.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noEmptyPattern.js.snap index 4a687de702e..77b657ae541 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noEmptyPattern.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noEmptyPattern.js.snap @@ -29,10 +29,12 @@ noEmptyPattern.js:9:5 lint/correctness/noEmptyPattern ━━━━━━━━ ! Unexpected empty object pattern. - ┌─ noEmptyPattern.js:9:5 - │ - 9 │ var {} = foo; - │ ^^ + 7 │ var [a] = foo; + 8 │ // invalid + > 9 │ var {} = foo; + │ ^^ + 10 │ var [] = foo; + 11 │ var {a: {}} = foo; ``` @@ -42,10 +44,12 @@ noEmptyPattern.js:10:5 lint/correctness/noEmptyPattern ━━━━━━━━ ! Unexpected empty array pattern. - ┌─ noEmptyPattern.js:10:5 - │ - 10 │ var [] = foo; - │ ^^ + 8 │ // invalid + 9 │ var {} = foo; + > 10 │ var [] = foo; + │ ^^ + 11 │ var {a: {}} = foo; + 12 │ var {a, b: {}} = foo; ``` @@ -55,10 +59,12 @@ noEmptyPattern.js:11:9 lint/correctness/noEmptyPattern ━━━━━━━━ ! Unexpected empty object pattern. - ┌─ noEmptyPattern.js:11:9 - │ - 11 │ var {a: {}} = foo; - │ ^^ + 9 │ var {} = foo; + 10 │ var [] = foo; + > 11 │ var {a: {}} = foo; + │ ^^ + 12 │ var {a, b: {}} = foo; + 13 │ var {a: []} = foo; ``` @@ -68,10 +74,12 @@ noEmptyPattern.js:12:12 lint/correctness/noEmptyPattern ━━━━━━━━ ! Unexpected empty object pattern. - ┌─ noEmptyPattern.js:12:12 - │ - 12 │ var {a, b: {}} = foo; - │ ^^ + 10 │ var [] = foo; + 11 │ var {a: {}} = foo; + > 12 │ var {a, b: {}} = foo; + │ ^^ + 13 │ var {a: []} = foo; + 14 │ function foo({}) {}; ``` @@ -81,10 +89,12 @@ noEmptyPattern.js:13:9 lint/correctness/noEmptyPattern ━━━━━━━━ ! Unexpected empty array pattern. - ┌─ noEmptyPattern.js:13:9 - │ - 13 │ var {a: []} = foo; - │ ^^ + 11 │ var {a: {}} = foo; + 12 │ var {a, b: {}} = foo; + > 13 │ var {a: []} = foo; + │ ^^ + 14 │ function foo({}) {}; + 15 │ function foo([]) {}; ``` @@ -94,10 +104,12 @@ noEmptyPattern.js:14:14 lint/correctness/noEmptyPattern ━━━━━━━━ ! Unexpected empty object pattern. - ┌─ noEmptyPattern.js:14:14 - │ - 14 │ function foo({}) {}; - │ ^^ + 12 │ var {a, b: {}} = foo; + 13 │ var {a: []} = foo; + > 14 │ function foo({}) {}; + │ ^^ + 15 │ function foo([]) {}; + 16 │ function foo({a: {}}) {}; ``` @@ -107,10 +119,12 @@ noEmptyPattern.js:15:14 lint/correctness/noEmptyPattern ━━━━━━━━ ! Unexpected empty array pattern. - ┌─ noEmptyPattern.js:15:14 - │ - 15 │ function foo([]) {}; - │ ^^ + 13 │ var {a: []} = foo; + 14 │ function foo({}) {}; + > 15 │ function foo([]) {}; + │ ^^ + 16 │ function foo({a: {}}) {}; + 17 │ function foo({a: []}) {}; ``` @@ -120,10 +134,11 @@ noEmptyPattern.js:16:18 lint/correctness/noEmptyPattern ━━━━━━━━ ! Unexpected empty object pattern. - ┌─ noEmptyPattern.js:16:18 - │ - 16 │ function foo({a: {}}) {}; - │ ^^ + 14 │ function foo({}) {}; + 15 │ function foo([]) {}; + > 16 │ function foo({a: {}}) {}; + │ ^^ + 17 │ function foo({a: []}) {}; ``` @@ -133,10 +148,10 @@ noEmptyPattern.js:17:18 lint/correctness/noEmptyPattern ━━━━━━━━ ! Unexpected empty array pattern. - ┌─ noEmptyPattern.js:17:18 - │ - 17 │ function foo({a: []}) {}; - │ ^^ + 15 │ function foo([]) {}; + 16 │ function foo({a: {}}) {}; + > 17 │ function foo({a: []}) {}; + │ ^^ ``` diff --git a/crates/rome_js_analyze/tests/specs/correctness/noExtraBooleanCast.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noExtraBooleanCast.js.snap index 617e70a365e..3f780bca5af 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noExtraBooleanCast.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noExtraBooleanCast.js.snap @@ -41,10 +41,11 @@ noExtraBooleanCast.js:2:5 lint/correctness/noExtraBooleanCast FIXABLE ━━ ! Avoid redundant `Boolean` call - ┌─ noExtraBooleanCast.js:2:5 - │ - 2 │ if (Boolean(foo)) { - │ ^^^^^^^^^^^^ + 1 │ // invalid + > 2 │ if (Boolean(foo)) { + │ ^^^^^^^^^^^^ + 3 │ } + 4 │ if (!!Boolean(foo)) { i It is not necessary to use `Boolean` call when a value will already be coerced to a boolean. @@ -66,10 +67,12 @@ noExtraBooleanCast.js:4:5 lint/correctness/noExtraBooleanCast FIXABLE ━━ ! Avoid redundant double-negation. - ┌─ noExtraBooleanCast.js:4:5 - │ - 4 │ if (!!Boolean(foo)) { - │ ^^^^^^^^^^^^^^ + 2 │ if (Boolean(foo)) { + 3 │ } + > 4 │ if (!!Boolean(foo)) { + │ ^^^^^^^^^^^^^^ + 5 │ } + 6 │ if (!Boolean(foo)) { i It is not necessary to use double-negation when a value will already be coerced to a boolean. @@ -93,10 +96,12 @@ noExtraBooleanCast.js:4:7 lint/correctness/noExtraBooleanCast FIXABLE ━━ ! Avoid redundant `Boolean` call - ┌─ noExtraBooleanCast.js:4:7 - │ - 4 │ if (!!Boolean(foo)) { - │ ^^^^^^^^^^^^ + 2 │ if (Boolean(foo)) { + 3 │ } + > 4 │ if (!!Boolean(foo)) { + │ ^^^^^^^^^^^^ + 5 │ } + 6 │ if (!Boolean(foo)) { i It is not necessary to use `Boolean` call when a value will already be coerced to a boolean. @@ -120,10 +125,12 @@ noExtraBooleanCast.js:6:6 lint/correctness/noExtraBooleanCast FIXABLE ━━ ! Avoid redundant `Boolean` call - ┌─ noExtraBooleanCast.js:6:6 - │ - 6 │ if (!Boolean(foo)) { - │ ^^^^^^^^^^^^ + 4 │ if (!!Boolean(foo)) { + 5 │ } + > 6 │ if (!Boolean(foo)) { + │ ^^^^^^^^^^^^ + 7 │ } + 8 │ while (!!foo) {} i It is not necessary to use `Boolean` call when a value will already be coerced to a boolean. @@ -147,10 +154,12 @@ noExtraBooleanCast.js:8:8 lint/correctness/noExtraBooleanCast FIXABLE ━━ ! Avoid redundant double-negation. - ┌─ noExtraBooleanCast.js:8:8 - │ - 8 │ while (!!foo) {} - │ ^^^^^ + 6 │ if (!Boolean(foo)) { + 7 │ } + > 8 │ while (!!foo) {} + │ ^^^^^ + 9 │ let x = 1; + 10 │ do { i It is not necessary to use double-negation when a value will already be coerced to a boolean. @@ -174,10 +183,12 @@ noExtraBooleanCast.js:12:10 lint/correctness/noExtraBooleanCast FIXABLE ━━ ! Avoid redundant `Boolean` call - ┌─ noExtraBooleanCast.js:12:10 - │ - 12 │ } while (Boolean(x)); - │ ^^^^^^^^^^ + 10 │ do { + 11 │ 1 + 1; + > 12 │ } while (Boolean(x)); + │ ^^^^^^^^^^ + 13 │ + 14 │ for (; !!foo; ) {} i It is not necessary to use `Boolean` call when a value will already be coerced to a boolean. @@ -201,10 +212,12 @@ noExtraBooleanCast.js:14:8 lint/correctness/noExtraBooleanCast FIXABLE ━━ ! Avoid redundant double-negation. - ┌─ noExtraBooleanCast.js:14:8 - │ - 14 │ for (; !!foo; ) {} - │ ^^^^^ + 12 │ } while (Boolean(x)); + 13 │ + > 14 │ for (; !!foo; ) {} + │ ^^^^^ + 15 │ + 16 │ new Boolean(!!x); i It is not necessary to use double-negation when a value will already be coerced to a boolean. @@ -228,10 +241,12 @@ noExtraBooleanCast.js:16:13 lint/correctness/noExtraBooleanCast FIXABLE ━━ ! Avoid redundant double-negation. - ┌─ noExtraBooleanCast.js:16:13 - │ - 16 │ new Boolean(!!x); - │ ^^^ + 14 │ for (; !!foo; ) {} + 15 │ + > 16 │ new Boolean(!!x); + │ ^^^ + 17 │ + 18 │ !!!x; i It is not necessary to use double-negation when a value will already be coerced to a boolean. @@ -255,10 +270,12 @@ noExtraBooleanCast.js:18:2 lint/correctness/noExtraBooleanCast FIXABLE ━━ ! Avoid redundant double-negation. - ┌─ noExtraBooleanCast.js:18:2 - │ - 18 │ !!!x; - │ ^^^ + 16 │ new Boolean(!!x); + 17 │ + > 18 │ !!!x; + │ ^^^ + 19 │ + 20 │ !Boolean(x); i It is not necessary to use double-negation when a value will already be coerced to a boolean. @@ -282,10 +299,12 @@ noExtraBooleanCast.js:20:2 lint/correctness/noExtraBooleanCast FIXABLE ━━ ! Avoid redundant `Boolean` call - ┌─ noExtraBooleanCast.js:20:2 - │ - 20 │ !Boolean(x); - │ ^^^^^^^^^^ + 18 │ !!!x; + 19 │ + > 20 │ !Boolean(x); + │ ^^^^^^^^^^ + 21 │ // valid + 22 │ Boolean(!x); i It is not necessary to use `Boolean` call when a value will already be coerced to a boolean. diff --git a/crates/rome_js_analyze/tests/specs/correctness/noFunctionAssign.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noFunctionAssign.js.snap index c34e6587595..6ba488f2eac 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noFunctionAssign.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noFunctionAssign.js.snap @@ -37,17 +37,18 @@ noFunctionAssign.js:1:10 lint/correctness/noFunctionAssign ━━━━━━━ ! Do not reassign a function declaration. - ┌─ noFunctionAssign.js:1:10 - │ - 1 │ function foo() { }; - │ ^^^ + > 1 │ function foo() { }; + │ ^^^ + 2 │ foo = bar; + 3 │ i Reassigned here. - ┌─ noFunctionAssign.js:2:1 - │ - 2 │ foo = bar; - │ ^^^ + 1 │ function foo() { }; + > 2 │ foo = bar; + │ ^^^ + 3 │ + 4 │ function foo2() { foo2 = bar; } i Use a local variable instead. @@ -59,17 +60,21 @@ noFunctionAssign.js:4:10 lint/correctness/noFunctionAssign ━━━━━━━ ! Do not reassign a function declaration. - ┌─ noFunctionAssign.js:4:10 - │ - 4 │ function foo2() { foo2 = bar; } - │ ^^^^ + 2 │ foo = bar; + 3 │ + > 4 │ function foo2() { foo2 = bar; } + │ ^^^^ + 5 │ + 6 │ foo3 = bar; i Reassigned here. - ┌─ noFunctionAssign.js:4:19 - │ - 4 │ function foo2() { foo2 = bar; } - │ ^^^^ + 2 │ foo = bar; + 3 │ + > 4 │ function foo2() { foo2 = bar; } + │ ^^^^ + 5 │ + 6 │ foo3 = bar; i Use a local variable instead. @@ -81,17 +86,20 @@ noFunctionAssign.js:7:10 lint/correctness/noFunctionAssign ━━━━━━━ ! Do not reassign a function declaration. - ┌─ noFunctionAssign.js:7:10 - │ - 7 │ function foo3() { }; - │ ^^^^ + 6 │ foo3 = bar; + > 7 │ function foo3() { }; + │ ^^^^ + 8 │ + 9 │ [foo4] = bar; i Reassigned here. - ┌─ noFunctionAssign.js:6:1 - │ - 6 │ foo3 = bar; - │ ^^^^ + 4 │ function foo2() { foo2 = bar; } + 5 │ + > 6 │ foo3 = bar; + │ ^^^^ + 7 │ function foo3() { }; + 8 │ i Reassignment happens here because the function declaration is hoisted. @@ -105,17 +113,20 @@ noFunctionAssign.js:10:10 lint/correctness/noFunctionAssign ━━━━━━ ! Do not reassign a function declaration. - ┌─ noFunctionAssign.js:10:10 - │ - 10 │ function foo4() { }; - │ ^^^^ + 9 │ [foo4] = bar; + > 10 │ function foo4() { }; + │ ^^^^ + 11 │ + 12 │ ({ x: foo5 = 0 } = bar); i Reassigned here. - ┌─ noFunctionAssign.js:9:2 - │ - 9 │ [foo4] = bar; - │ ^^^^ + 7 │ function foo3() { }; + 8 │ + > 9 │ [foo4] = bar; + │ ^^^^ + 10 │ function foo4() { }; + 11 │ i Reassignment happens here because the function declaration is hoisted. @@ -129,17 +140,20 @@ noFunctionAssign.js:13:10 lint/correctness/noFunctionAssign ━━━━━━ ! Do not reassign a function declaration. - ┌─ noFunctionAssign.js:13:10 - │ - 13 │ function foo5() { }; - │ ^^^^ + 12 │ ({ x: foo5 = 0 } = bar); + > 13 │ function foo5() { }; + │ ^^^^ + 14 │ + 15 │ function foo6() { [foo6] = bar; } i Reassigned here. - ┌─ noFunctionAssign.js:12:7 - │ - 12 │ ({ x: foo5 = 0 } = bar); - │ ^^^^ + 10 │ function foo4() { }; + 11 │ + > 12 │ ({ x: foo5 = 0 } = bar); + │ ^^^^ + 13 │ function foo5() { }; + 14 │ i Reassignment happens here because the function declaration is hoisted. @@ -153,17 +167,21 @@ noFunctionAssign.js:15:10 lint/correctness/noFunctionAssign ━━━━━━ ! Do not reassign a function declaration. - ┌─ noFunctionAssign.js:15:10 - │ - 15 │ function foo6() { [foo6] = bar; } - │ ^^^^ + 13 │ function foo5() { }; + 14 │ + > 15 │ function foo6() { [foo6] = bar; } + │ ^^^^ + 16 │ + 17 │ (function () { ({ x: foo7 = 0 } = bar); function foo7() { }; })(); i Reassigned here. - ┌─ noFunctionAssign.js:15:20 - │ - 15 │ function foo6() { [foo6] = bar; } - │ ^^^^ + 13 │ function foo5() { }; + 14 │ + > 15 │ function foo6() { [foo6] = bar; } + │ ^^^^ + 16 │ + 17 │ (function () { ({ x: foo7 = 0 } = bar); function foo7() { }; })(); i Use a local variable instead. @@ -175,17 +193,21 @@ noFunctionAssign.js:17:50 lint/correctness/noFunctionAssign ━━━━━━ ! Do not reassign a function declaration. - ┌─ noFunctionAssign.js:17:50 - │ - 17 │ (function () { ({ x: foo7 = 0 } = bar); function foo7() { }; })(); - │ ^^^^ + 15 │ function foo6() { [foo6] = bar; } + 16 │ + > 17 │ (function () { ({ x: foo7 = 0 } = bar); function foo7() { }; })(); + │ ^^^^ + 18 │ + 19 │ // Valid i Reassigned here. - ┌─ noFunctionAssign.js:17:22 - │ - 17 │ (function () { ({ x: foo7 = 0 } = bar); function foo7() { }; })(); - │ ^^^^ + 15 │ function foo6() { [foo6] = bar; } + 16 │ + > 17 │ (function () { ({ x: foo7 = 0 } = bar); function foo7() { }; })(); + │ ^^^^ + 18 │ + 19 │ // Valid i Reassignment happens here because the function declaration is hoisted. diff --git a/crates/rome_js_analyze/tests/specs/correctness/noImplicitBoolean.jsx.snap b/crates/rome_js_analyze/tests/specs/correctness/noImplicitBoolean.jsx.snap index 9757e04ee74..845984fd71c 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noImplicitBoolean.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noImplicitBoolean.jsx.snap @@ -26,10 +26,11 @@ noImplicitBoolean.jsx:11:8 lint/correctness/noImplicitBoolean FIXABLE ━━ ! Use explicit boolean values for boolean JSX props. - ┌─ noImplicitBoolean.jsx:11:8 - │ - 11 │ ; - │ ^^^^^^^^ + 10 │ //invalid + > 11 │ ; + │ ^^^^^^^^ + 12 │ ; + 13 │ ; i Safe fix: Add explicit `true` literal for this attribute @@ -50,10 +51,12 @@ noImplicitBoolean.jsx:12:8 lint/correctness/noImplicitBoolean FIXABLE ━━ ! Use explicit boolean values for boolean JSX props. - ┌─ noImplicitBoolean.jsx:12:8 - │ - 12 │ ; - │ ^^^^^^ + 10 │ //invalid + 11 │ ; + > 12 │ ; + │ ^^^^^^ + 13 │ ; + 14 │ i Safe fix: Add explicit `true` literal for this attribute @@ -73,10 +76,11 @@ noImplicitBoolean.jsx:13:28 lint/correctness/noImplicitBoolean FIXABLE ━━ ! Use explicit boolean values for boolean JSX props. - ┌─ noImplicitBoolean.jsx:13:28 - │ - 13 │ ; - │ ^^^^^^ + 11 │ ; + 12 │ ; + > 13 │ ; + │ ^^^^^^ + 14 │ i Safe fix: Add explicit `true` literal for this attribute diff --git a/crates/rome_js_analyze/tests/specs/correctness/noImportAssign.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noImportAssign.js.snap index c0ede7bfd5e..1d1a32e4679 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noImportAssign.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noImportAssign.js.snap @@ -51,17 +51,20 @@ noImportAssign.js:4:1 lint/correctness/noImportAssign ━━━━━━━━ ! The imported variable x is read-only - ┌─ noImportAssign.js:4:1 - │ - 4 │ x = 1; - │ ^ + 2 │ // invalid + 3 │ import x from "y"; + > 4 │ x = 1; + │ ^ + 5 │ + 6 │ import y from "y"; i The variable is imported here - ┌─ noImportAssign.js:3:8 - │ - 3 │ import x from "y"; - │ ^ + 2 │ // invalid + > 3 │ import x from "y"; + │ ^ + 4 │ x = 1; + 5 │ i Use a local variable instead of reassigning an import. @@ -73,17 +76,20 @@ noImportAssign.js:7:2 lint/correctness/noImportAssign ━━━━━━━━ ! The imported variable y is read-only - ┌─ noImportAssign.js:7:2 - │ - 7 │ [y] = 1; - │ ^ + 6 │ import y from "y"; + > 7 │ [y] = 1; + │ ^ + 8 │ + 9 │ import z from "y"; i The variable is imported here - ┌─ noImportAssign.js:6:8 - │ - 6 │ import y from "y"; - │ ^ + 4 │ x = 1; + 5 │ + > 6 │ import y from "y"; + │ ^ + 7 │ [y] = 1; + 8 │ i Use a local variable instead of reassigning an import. @@ -95,17 +101,20 @@ noImportAssign.js:10:4 lint/correctness/noImportAssign ━━━━━━━━ ! The imported variable z is read-only - ┌─ noImportAssign.js:10:4 - │ - 10 │ ({ z } = 1); - │ ^ + 9 │ import z from "y"; + > 10 │ ({ z } = 1); + │ ^ + 11 │ + 12 │ import a from "y"; i The variable is imported here - ┌─ noImportAssign.js:9:8 - │ - 9 │ import z from "y"; - │ ^ + 7 │ [y] = 1; + 8 │ + > 9 │ import z from "y"; + │ ^ + 10 │ ({ z } = 1); + 11 │ i Use a local variable instead of reassigning an import. @@ -117,17 +126,20 @@ noImportAssign.js:13:5 lint/correctness/noImportAssign ━━━━━━━━ ! The imported variable a is read-only - ┌─ noImportAssign.js:13:5 - │ - 13 │ [...a] = 1; - │ ^ + 12 │ import a from "y"; + > 13 │ [...a] = 1; + │ ^ + 14 │ + 15 │ import b from "y"; i The variable is imported here - ┌─ noImportAssign.js:12:8 - │ - 12 │ import a from "y"; - │ ^ + 10 │ ({ z } = 1); + 11 │ + > 12 │ import a from "y"; + │ ^ + 13 │ [...a] = 1; + 14 │ i Use a local variable instead of reassigning an import. @@ -139,17 +151,20 @@ noImportAssign.js:16:7 lint/correctness/noImportAssign ━━━━━━━━ ! The imported variable b is read-only - ┌─ noImportAssign.js:16:7 - │ - 16 │ ({ ...b } = 1); - │ ^ + 15 │ import b from "y"; + > 16 │ ({ ...b } = 1); + │ ^ + 17 │ + 18 │ import c from "y"; i The variable is imported here - ┌─ noImportAssign.js:15:8 - │ - 15 │ import b from "y"; - │ ^ + 13 │ [...a] = 1; + 14 │ + > 15 │ import b from "y"; + │ ^ + 16 │ ({ ...b } = 1); + 17 │ i Use a local variable instead of reassigning an import. @@ -161,17 +176,20 @@ noImportAssign.js:19:6 lint/correctness/noImportAssign ━━━━━━━━ ! The imported variable c is read-only - ┌─ noImportAssign.js:19:6 - │ - 19 │ for (c in y) {}; - │ ^ + 18 │ import c from "y"; + > 19 │ for (c in y) {}; + │ ^ + 20 │ + 21 │ import d from "y"; i The variable is imported here - ┌─ noImportAssign.js:18:8 - │ - 18 │ import c from "y"; - │ ^ + 16 │ ({ ...b } = 1); + 17 │ + > 18 │ import c from "y"; + │ ^ + 19 │ for (c in y) {}; + 20 │ i Use a local variable instead of reassigning an import. @@ -183,17 +201,20 @@ noImportAssign.js:22:1 lint/correctness/noImportAssign ━━━━━━━━ ! The imported variable d is read-only - ┌─ noImportAssign.js:22:1 - │ - 22 │ d += 1; - │ ^ + 21 │ import d from "y"; + > 22 │ d += 1; + │ ^ + 23 │ + 24 │ import * as e from "y"; i The variable is imported here - ┌─ noImportAssign.js:21:8 - │ - 21 │ import d from "y"; - │ ^ + 19 │ for (c in y) {}; + 20 │ + > 21 │ import d from "y"; + │ ^ + 22 │ d += 1; + 23 │ i Use a local variable instead of reassigning an import. @@ -205,17 +226,20 @@ noImportAssign.js:25:1 lint/correctness/noImportAssign ━━━━━━━━ ! The imported variable e is read-only - ┌─ noImportAssign.js:25:1 - │ - 25 │ e = 1; - │ ^ + 24 │ import * as e from "y"; + > 25 │ e = 1; + │ ^ + 26 │ + 27 │ import { f } from "y"; i The variable is imported here - ┌─ noImportAssign.js:24:13 - │ - 24 │ import * as e from "y"; - │ ^ + 22 │ d += 1; + 23 │ + > 24 │ import * as e from "y"; + │ ^ + 25 │ e = 1; + 26 │ i Use a local variable instead of reassigning an import. @@ -227,17 +251,20 @@ noImportAssign.js:28:1 lint/correctness/noImportAssign ━━━━━━━━ ! The imported variable f is read-only - ┌─ noImportAssign.js:28:1 - │ - 28 │ f = 1; - │ ^ + 27 │ import { f } from "y"; + > 28 │ f = 1; + │ ^ + 29 │ f = 2; + 30 │ i The variable is imported here - ┌─ noImportAssign.js:27:10 - │ - 27 │ import { f } from "y"; - │ ^ + 25 │ e = 1; + 26 │ + > 27 │ import { f } from "y"; + │ ^ + 28 │ f = 1; + 29 │ f = 2; i Use a local variable instead of reassigning an import. @@ -249,17 +276,21 @@ noImportAssign.js:29:1 lint/correctness/noImportAssign ━━━━━━━━ ! The imported variable f is read-only - ┌─ noImportAssign.js:29:1 - │ - 29 │ f = 2; - │ ^ + 27 │ import { f } from "y"; + 28 │ f = 1; + > 29 │ f = 2; + │ ^ + 30 │ + 31 │ import {xx} from 'y'; i The variable is imported here - ┌─ noImportAssign.js:27:10 - │ - 27 │ import { f } from "y"; - │ ^ + 25 │ e = 1; + 26 │ + > 27 │ import { f } from "y"; + │ ^ + 28 │ f = 1; + 29 │ f = 2; i Use a local variable instead of reassigning an import. @@ -271,17 +302,20 @@ noImportAssign.js:32:1 lint/correctness/noImportAssign ━━━━━━━━ ! The imported variable xx is read-only - ┌─ noImportAssign.js:32:1 - │ - 32 │ xx=1; - │ ^^ + 31 │ import {xx} from 'y'; + > 32 │ xx=1; + │ ^^ + 33 │ + 34 │ import xxx, * as yyy from "d" i The variable is imported here - ┌─ noImportAssign.js:31:9 - │ - 31 │ import {xx} from 'y'; - │ ^^ + 29 │ f = 2; + 30 │ + > 31 │ import {xx} from 'y'; + │ ^^ + 32 │ xx=1; + 33 │ i Use a local variable instead of reassigning an import. @@ -293,17 +327,20 @@ noImportAssign.js:35:1 lint/correctness/noImportAssign ━━━━━━━━ ! The imported variable xxx is read-only - ┌─ noImportAssign.js:35:1 - │ - 35 │ xxx = 4; - │ ^^^ + 34 │ import xxx, * as yyy from "d" + > 35 │ xxx = 4; + │ ^^^ + 36 │ yyy = 4; + 37 │ // valid i The variable is imported here - ┌─ noImportAssign.js:34:8 - │ - 34 │ import xxx, * as yyy from "d" - │ ^^^ + 32 │ xx=1; + 33 │ + > 34 │ import xxx, * as yyy from "d" + │ ^^^ + 35 │ xxx = 4; + 36 │ yyy = 4; i Use a local variable instead of reassigning an import. @@ -315,17 +352,21 @@ noImportAssign.js:36:1 lint/correctness/noImportAssign ━━━━━━━━ ! The imported variable yyy is read-only - ┌─ noImportAssign.js:36:1 - │ - 36 │ yyy = 4; - │ ^^^ + 34 │ import xxx, * as yyy from "d" + 35 │ xxx = 4; + > 36 │ yyy = 4; + │ ^^^ + 37 │ // valid + 38 │ import { g } from "y"; i The variable is imported here - ┌─ noImportAssign.js:34:18 - │ - 34 │ import xxx, * as yyy from "d" - │ ^^^ + 32 │ xx=1; + 33 │ + > 34 │ import xxx, * as yyy from "d" + │ ^^^ + 35 │ xxx = 4; + 36 │ yyy = 4; i Use a local variable instead of reassigning an import. diff --git a/crates/rome_js_analyze/tests/specs/correctness/noLabelVar.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noLabelVar.js.snap index 7a8297ffcdf..e00f3c601f3 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noLabelVar.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noLabelVar.js.snap @@ -27,17 +27,20 @@ noLabelVar.js:3:1 lint/correctness/noLabelVar ━━━━━━━━━━━ ! Do not use the x1 variable name as a label - ┌─ noLabelVar.js:3:1 - │ - 3 │ x1: expr; - │ ^^ + 1 │ // invalid + 2 │ const x1 = "test"; + > 3 │ x1: expr; + │ ^^ + 4 │ // nested scope· + 5 │ function test() { i The variable is declared here - ┌─ noLabelVar.js:2:7 - │ - 2 │ const x1 = "test"; - │ ^^ + 1 │ // invalid + > 2 │ const x1 = "test"; + │ ^^ + 3 │ x1: expr; + 4 │ // nested scope· i Creating a label with the same name as an in-scope variable leads to confusion. @@ -49,17 +52,20 @@ noLabelVar.js:7:5 lint/correctness/noLabelVar ━━━━━━━━━━━ ! Do not use the x1 variable name as a label - ┌─ noLabelVar.js:7:5 - │ - 7 │ x1: for (let i = 0; i < 10; i++) { - │ ^^ + 5 │ function test() { + 6 │ { + > 7 │ x1: for (let i = 0; i < 10; i++) { + │ ^^ + 8 │ } + 9 │ } i The variable is declared here - ┌─ noLabelVar.js:2:7 - │ - 2 │ const x1 = "test"; - │ ^^ + 1 │ // invalid + > 2 │ const x1 = "test"; + │ ^^ + 3 │ x1: expr; + 4 │ // nested scope· i Creating a label with the same name as an in-scope variable leads to confusion. diff --git a/crates/rome_js_analyze/tests/specs/correctness/noMultipleSpacesInRegularExpressionLiterals.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noMultipleSpacesInRegularExpressionLiterals.js.snap index bc64840233f..2afe9cec45d 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noMultipleSpacesInRegularExpressionLiterals.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noMultipleSpacesInRegularExpressionLiterals.js.snap @@ -25,10 +25,12 @@ noMultipleSpacesInRegularExpressionLiterals.js:7:2 lint/correctness/noMultipleSp ! This regular expression contains unclear uses of multiple spaces. - ┌─ noMultipleSpacesInRegularExpressionLiterals.js:7:2 - │ - 7 │ / /; - │ ^^^ + 5 │ /foo /; + 6 │ // invalid + > 7 │ / /; + │ ^^^ + 8 │ / foo/; + 9 │ /foo /; i Suggested fix: It's hard to visually count the amount of spaces, it's clearer if you use a quantifier instead. eg / {3}/ @@ -50,10 +52,12 @@ noMultipleSpacesInRegularExpressionLiterals.js:8:2 lint/correctness/noMultipleSp ! This regular expression contains unclear uses of multiple spaces. - ┌─ noMultipleSpacesInRegularExpressionLiterals.js:8:2 - │ - 8 │ / foo/; - │ ^^ + 6 │ // invalid + 7 │ / /; + > 8 │ / foo/; + │ ^^ + 9 │ /foo /; + 10 │ /foo bar/; i Suggested fix: It's hard to visually count the amount of spaces, it's clearer if you use a quantifier instead. eg / {2}/ @@ -75,10 +79,12 @@ noMultipleSpacesInRegularExpressionLiterals.js:9:5 lint/correctness/noMultipleSp ! This regular expression contains unclear uses of multiple spaces. - ┌─ noMultipleSpacesInRegularExpressionLiterals.js:9:5 - │ - 9 │ /foo /; - │ ^^^ + 7 │ / /; + 8 │ / foo/; + > 9 │ /foo /; + │ ^^^ + 10 │ /foo bar/; + 11 │ /foo bar baz/; i Suggested fix: It's hard to visually count the amount of spaces, it's clearer if you use a quantifier instead. eg / {3}/ @@ -100,10 +106,12 @@ noMultipleSpacesInRegularExpressionLiterals.js:10:5 lint/correctness/noMultipleS ! This regular expression contains unclear uses of multiple spaces. - ┌─ noMultipleSpacesInRegularExpressionLiterals.js:10:5 - │ - 10 │ /foo bar/; - │ ^^ + 8 │ / foo/; + 9 │ /foo /; + > 10 │ /foo bar/; + │ ^^ + 11 │ /foo bar baz/; + 12 │ /foo [ba]r b(a|z)/; i Suggested fix: It's hard to visually count the amount of spaces, it's clearer if you use a quantifier instead. eg / {2}/ @@ -124,10 +132,12 @@ noMultipleSpacesInRegularExpressionLiterals.js:11:5 lint/correctness/noMultipleS ! This regular expression contains unclear uses of multiple spaces. - ┌─ noMultipleSpacesInRegularExpressionLiterals.js:11:5 - │ - 11 │ /foo bar baz/; - │ ^^^^^^^^^^ + 9 │ /foo /; + 10 │ /foo bar/; + > 11 │ /foo bar baz/; + │ ^^^^^^^^^^ + 12 │ /foo [ba]r b(a|z)/; + 13 │ i Suggested fix: It's hard to visually count the amount of spaces, it's clearer if you use a quantifier instead. eg / {7}/ @@ -147,10 +157,11 @@ noMultipleSpacesInRegularExpressionLiterals.js:12:11 lint/correctness/noMultiple ! This regular expression contains unclear uses of multiple spaces. - ┌─ noMultipleSpacesInRegularExpressionLiterals.js:12:11 - │ - 12 │ /foo [ba]r b(a|z)/; - │ ^^ + 10 │ /foo bar/; + 11 │ /foo bar baz/; + > 12 │ /foo [ba]r b(a|z)/; + │ ^^ + 13 │ i Suggested fix: It's hard to visually count the amount of spaces, it's clearer if you use a quantifier instead. eg / {2}/ diff --git a/crates/rome_js_analyze/tests/specs/correctness/noShadowRestrictedNames.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noShadowRestrictedNames.js.snap index 44b49518c58..55704f779ad 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noShadowRestrictedNames.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noShadowRestrictedNames.js.snap @@ -26,10 +26,10 @@ noShadowRestrictedNames.js:1:10 lint/correctness/noShadowRestrictedNames ━━ ! Do not shadow the global "NaN" property. - ┌─ noShadowRestrictedNames.js:1:10 - │ - 1 │ function NaN() {} - │ ^^^ + > 1 │ function NaN() {} + │ ^^^ + 2 │ function undefined() {} + 3 │ function Infinity() {} i Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. @@ -41,10 +41,11 @@ noShadowRestrictedNames.js:2:10 lint/correctness/noShadowRestrictedNames ━━ ! Do not shadow the global "undefined" property. - ┌─ noShadowRestrictedNames.js:2:10 - │ - 2 │ function undefined() {} - │ ^^^^^^^^^ + 1 │ function NaN() {} + > 2 │ function undefined() {} + │ ^^^^^^^^^ + 3 │ function Infinity() {} + 4 │ //function arguments() {} i Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. @@ -56,10 +57,12 @@ noShadowRestrictedNames.js:3:10 lint/correctness/noShadowRestrictedNames ━━ ! Do not shadow the global "Infinity" property. - ┌─ noShadowRestrictedNames.js:3:10 - │ - 3 │ function Infinity() {} - │ ^^^^^^^^ + 1 │ function NaN() {} + 2 │ function undefined() {} + > 3 │ function Infinity() {} + │ ^^^^^^^^ + 4 │ //function arguments() {} + 5 │ //function eval() {} i Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. @@ -71,10 +74,12 @@ noShadowRestrictedNames.js:6:10 lint/correctness/noShadowRestrictedNames ━━ ! Do not shadow the global "Array" property. - ┌─ noShadowRestrictedNames.js:6:10 - │ - 6 │ function Array() {} - │ ^^^^^ + 4 │ //function arguments() {} + 5 │ //function eval() {} + > 6 │ function Array() {} + │ ^^^^^ + 7 │ + 8 │ function test(JSON) { i Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. @@ -86,10 +91,12 @@ noShadowRestrictedNames.js:8:15 lint/correctness/noShadowRestrictedNames ━━ ! Do not shadow the global "JSON" property. - ┌─ noShadowRestrictedNames.js:8:15 - │ - 8 │ function test(JSON) { - │ ^^^^ + 6 │ function Array() {} + 7 │ + > 8 │ function test(JSON) { + │ ^^^^ + 9 │ console.log(JSON); + 10 │ } i Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. @@ -101,10 +108,12 @@ noShadowRestrictedNames.js:11:5 lint/correctness/noShadowRestrictedNames ━━ ! Do not shadow the global "Set" property. - ┌─ noShadowRestrictedNames.js:11:5 - │ - 11 │ let Set; - │ ^^^ + 9 │ console.log(JSON); + 10 │ } + > 11 │ let Set; + │ ^^^ + 12 │ try { + 13 │ } catch (Object) {} i Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. @@ -116,10 +125,11 @@ noShadowRestrictedNames.js:13:10 lint/correctness/noShadowRestrictedNames ━━ ! Do not shadow the global "Object" property. - ┌─ noShadowRestrictedNames.js:13:10 - │ - 13 │ } catch (Object) {} - │ ^^^^^^ + 11 │ let Set; + 12 │ try { + > 13 │ } catch (Object) {} + │ ^^^^^^ + 14 │ i Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. diff --git a/crates/rome_js_analyze/tests/specs/correctness/noSparseArray.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noSparseArray.js.snap index 4aadcf2829d..255d25bfbb2 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noSparseArray.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noSparseArray.js.snap @@ -23,10 +23,11 @@ noSparseArray.js:5:11 lint/correctness/noSparseArray FIXABLE ━━━━━ ! This array contains an empty slot. - ┌─ noSparseArray.js:5:11 - │ - 5 │ const b = [/**test*/,]; - │ ^^^^^^^^^^^^ + 4 │ // invalid + > 5 │ const b = [/**test*/,]; + │ ^^^^^^^^^^^^ + 6 │ const c = [,,]; + 7 │ const d = [,2]; i Suggested fix: Replace hole with undefined @@ -48,10 +49,12 @@ noSparseArray.js:6:11 lint/correctness/noSparseArray FIXABLE ━━━━━ ! This array contains an empty slot. - ┌─ noSparseArray.js:6:11 - │ - 6 │ const c = [,,]; - │ ^^^^ + 4 │ // invalid + 5 │ const b = [/**test*/,]; + > 6 │ const c = [,,]; + │ ^^^^ + 7 │ const d = [,2]; + 8 │ i Suggested fix: Replace hole with undefined @@ -73,10 +76,12 @@ noSparseArray.js:7:11 lint/correctness/noSparseArray FIXABLE ━━━━━ ! This array contains an empty slot. - ┌─ noSparseArray.js:7:11 - │ - 7 │ const d = [,2]; - │ ^^^^ + 5 │ const b = [/**test*/,]; + 6 │ const c = [,,]; + > 7 │ const d = [,2]; + │ ^^^^ + 8 │ + 9 │ const e = [1,,] i Suggested fix: Replace hole with undefined @@ -98,10 +103,12 @@ noSparseArray.js:9:11 lint/correctness/noSparseArray FIXABLE ━━━━━ ! This array contains an empty slot. - ┌─ noSparseArray.js:9:11 - │ - 9 │ const e = [1,,] - │ ^^^^^ + 7 │ const d = [,2]; + 8 │ + > 9 │ const e = [1,,] + │ ^^^^^ + 10 │ const f = [1,,2] + 11 │ i Suggested fix: Replace hole with undefined @@ -121,10 +128,10 @@ noSparseArray.js:10:11 lint/correctness/noSparseArray FIXABLE ━━━━━ ! This array contains an empty slot. - ┌─ noSparseArray.js:10:11 - │ - 10 │ const f = [1,,2] - │ ^^^^^^ + 9 │ const e = [1,,] + > 10 │ const f = [1,,2] + │ ^^^^^^ + 11 │ i Suggested fix: Replace hole with undefined diff --git a/crates/rome_js_analyze/tests/specs/correctness/noUnnecessaryContinue.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noUnnecessaryContinue.js.snap index 20bcc21b8f4..286ff511459 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noUnnecessaryContinue.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noUnnecessaryContinue.js.snap @@ -86,10 +86,12 @@ noUnnecessaryContinue.js:3:2 lint/correctness/noUnnecessaryContinue FIXABLE ! Unnecessary continue statement - ┌─ noUnnecessaryContinue.js:3:2 - │ - 3 │ continue loop; - │ ^^^^^^^^^^^^^^ + 1 │ // invalid + 2 │ loop: for (let i = 0; i < 5; i++) { + > 3 │ continue loop; + │ ^^^^^^^^^^^^^^ + 4 │ } + 5 │ while (i--) { i Suggested fix: Delete the unnecessary continue statement @@ -109,10 +111,12 @@ noUnnecessaryContinue.js:6:2 lint/correctness/noUnnecessaryContinue FIXABLE ! Unnecessary continue statement - ┌─ noUnnecessaryContinue.js:6:2 - │ - 6 │ continue; - │ ^^^^^^^^^ + 4 │ } + 5 │ while (i--) { + > 6 │ continue; + │ ^^^^^^^^^ + 7 │ } + 8 │ while (1) { i Suggested fix: Delete the unnecessary continue statement @@ -133,10 +137,12 @@ noUnnecessaryContinue.js:9:2 lint/correctness/noUnnecessaryContinue FIXABLE ! Unnecessary continue statement - ┌─ noUnnecessaryContinue.js:9:2 - │ - 9 │ continue; - │ ^^^^^^^^^ + 7 │ } + 8 │ while (1) { + > 9 │ continue; + │ ^^^^^^^^^ + 10 │ } + 11 │ for (let i = 0; i < 10; i++) { i Suggested fix: Delete the unnecessary continue statement @@ -157,10 +163,12 @@ noUnnecessaryContinue.js:14:3 lint/correctness/noUnnecessaryContinue FIXABLE ! Unnecessary continue statement - ┌─ noUnnecessaryContinue.js:14:3 - │ - 14 │ continue; - │ ^^^^^^^^^ + 12 │ if (i > 5) { + 13 │ console.log("foo"); + > 14 │ continue; + │ ^^^^^^^^^ + 15 │ } else if (i >= 5 && i < 8) { + 16 │ console.log("test"); i Suggested fix: Delete the unnecessary continue statement @@ -181,10 +189,12 @@ noUnnecessaryContinue.js:22:2 lint/correctness/noUnnecessaryContinue FIXABLE ! Unnecessary continue statement - ┌─ noUnnecessaryContinue.js:22:2 - │ - 22 │ continue; - │ ^^^^^^^^^ + 20 │ } + 21 │ for (let i = 0; i < 9; i++) { + > 22 │ continue; + │ ^^^^^^^^^ + 23 │ } + 24 │ i Suggested fix: Delete the unnecessary continue statement @@ -205,10 +215,12 @@ noUnnecessaryContinue.js:25:35 lint/correctness/noUnnecessaryContinue FIXABLE ! Unnecessary continue statement - ┌─ noUnnecessaryContinue.js:25:35 - │ - 25 │ test: for (let i = 0; i < 9; i++) continue test; - │ ^^^^^^^^^^^^^^ + 23 │ } + 24 │ + > 25 │ test: for (let i = 0; i < 9; i++) continue test; + │ ^^^^^^^^^^^^^^ + 26 │ + 27 │ test2: do { i Suggested fix: Delete the unnecessary continue statement @@ -230,10 +242,11 @@ noUnnecessaryContinue.js:28:2 lint/correctness/noUnnecessaryContinue FIXABLE ! Unnecessary continue statement - ┌─ noUnnecessaryContinue.js:28:2 - │ - 28 │ continue test2; - │ ^^^^^^^^^^^^^^^ + 27 │ test2: do { + > 28 │ continue test2; + │ ^^^^^^^^^^^^^^^ + 29 │ } while (true); + 30 │ // valid i Suggested fix: Delete the unnecessary continue statement diff --git a/crates/rome_js_analyze/tests/specs/correctness/noUnsafeNegation.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noUnsafeNegation.js.snap index 4ffd32fd82f..4dd5328b992 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noUnsafeNegation.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noUnsafeNegation.js.snap @@ -23,10 +23,12 @@ noUnsafeNegation.js:9:1 lint/correctness/noUnsafeNegation FIXABLE ━━━━ ! The negation operator is used unsafely on the left side of this binary expression. - ┌─ noUnsafeNegation.js:9:1 - │ - 9 │ !1 in [1,2]; - │ ^^^^^^^^^^^ + 7 │ +1 instanceof [1,2]; + 8 │ // invalid + > 9 │ !1 in [1,2]; + │ ^^^^^^^^^^^ + 10 │ /**test*/!/** test*/1 instanceof [1,2]; + 11 │ i Suggested fix: Wrap the expression with a parenthesis @@ -46,10 +48,11 @@ noUnsafeNegation.js:10:10 lint/correctness/noUnsafeNegation FIXABLE ━━━ ! The negation operator is used unsafely on the left side of this binary expression. - ┌─ noUnsafeNegation.js:10:10 - │ - 10 │ /**test*/!/** test*/1 instanceof [1,2]; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 8 │ // invalid + 9 │ !1 in [1,2]; + > 10 │ /**test*/!/** test*/1 instanceof [1,2]; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 │ i Suggested fix: Wrap the expression with a parenthesis diff --git a/crates/rome_js_analyze/tests/specs/correctness/noUnusedTemplateLiteral.js.snap b/crates/rome_js_analyze/tests/specs/correctness/noUnusedTemplateLiteral.js.snap index b30edc8ee8e..47eb57e08b8 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/noUnusedTemplateLiteral.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/noUnusedTemplateLiteral.js.snap @@ -36,10 +36,12 @@ noUnusedTemplateLiteral.js:13:11 lint/correctness/noUnusedTemplateLiteral FIXAB ! Do not use template literals if interpolation and special-character handling are not needed. - ┌─ noUnusedTemplateLiteral.js:13:11 - │ - 13 │ var foo = `bar`; - │ ^^^^^ + 11 │ else`; + 12 │ //invalid + > 13 │ var foo = `bar`; + │ ^^^^^ + 14 │ var foo1 = `bar `; + 15 │ var foo = `back\rtick`; i Suggested fix: Replace with string literal @@ -61,10 +63,12 @@ noUnusedTemplateLiteral.js:14:12 lint/correctness/noUnusedTemplateLiteral FIXAB ! Do not use template literals if interpolation and special-character handling are not needed. - ┌─ noUnusedTemplateLiteral.js:14:12 - │ - 14 │ var foo1 = `bar `; - │ ^^^^^^ + 12 │ //invalid + 13 │ var foo = `bar`; + > 14 │ var foo1 = `bar `; + │ ^^^^^^ + 15 │ var foo = `back\rtick`; + 16 │ var foo = `back\ntick`; i Suggested fix: Replace with string literal @@ -86,10 +90,12 @@ noUnusedTemplateLiteral.js:15:11 lint/correctness/noUnusedTemplateLiteral FIXAB ! Do not use template literals if interpolation and special-character handling are not needed. - ┌─ noUnusedTemplateLiteral.js:15:11 - │ - 15 │ var foo = `back\rtick`; - │ ^^^^^^^^^^^^ + 13 │ var foo = `bar`; + 14 │ var foo1 = `bar `; + > 15 │ var foo = `back\rtick`; + │ ^^^^^^^^^^^^ + 16 │ var foo = `back\ntick`; + 17 │ var foo = `back\u2028tick` i Suggested fix: Replace with string literal @@ -111,10 +117,12 @@ noUnusedTemplateLiteral.js:16:11 lint/correctness/noUnusedTemplateLiteral FIXAB ! Do not use template literals if interpolation and special-character handling are not needed. - ┌─ noUnusedTemplateLiteral.js:16:11 - │ - 16 │ var foo = `back\ntick`; - │ ^^^^^^^^^^^^ + 14 │ var foo1 = `bar `; + 15 │ var foo = `back\rtick`; + > 16 │ var foo = `back\ntick`; + │ ^^^^^^^^^^^^ + 17 │ var foo = `back\u2028tick` + 18 │ var foo = `back\u2029tick`; i Suggested fix: Replace with string literal @@ -136,10 +144,12 @@ noUnusedTemplateLiteral.js:17:11 lint/correctness/noUnusedTemplateLiteral FIXAB ! Do not use template literals if interpolation and special-character handling are not needed. - ┌─ noUnusedTemplateLiteral.js:17:11 - │ - 17 │ var foo = `back\u2028tick` - │ ^^^^^^^^^^^^^^^^ + 15 │ var foo = `back\rtick`; + 16 │ var foo = `back\ntick`; + > 17 │ var foo = `back\u2028tick` + │ ^^^^^^^^^^^^^^^^ + 18 │ var foo = `back\u2029tick`; + 19 │ var foo = `back\\\\\ntick`; i Suggested fix: Replace with string literal @@ -161,10 +171,12 @@ noUnusedTemplateLiteral.js:18:11 lint/correctness/noUnusedTemplateLiteral FIXAB ! Do not use template literals if interpolation and special-character handling are not needed. - ┌─ noUnusedTemplateLiteral.js:18:11 - │ - 18 │ var foo = `back\u2029tick`; - │ ^^^^^^^^^^^^^^^^ + 16 │ var foo = `back\ntick`; + 17 │ var foo = `back\u2028tick` + > 18 │ var foo = `back\u2029tick`; + │ ^^^^^^^^^^^^^^^^ + 19 │ var foo = `back\\\\\ntick`; + 20 │ var foo = `\n`; i Suggested fix: Replace with string literal @@ -186,10 +198,12 @@ noUnusedTemplateLiteral.js:19:11 lint/correctness/noUnusedTemplateLiteral FIXAB ! Do not use template literals if interpolation and special-character handling are not needed. - ┌─ noUnusedTemplateLiteral.js:19:11 - │ - 19 │ var foo = `back\\\\\ntick`; - │ ^^^^^^^^^^^^^^^^ + 17 │ var foo = `back\u2028tick` + 18 │ var foo = `back\u2029tick`; + > 19 │ var foo = `back\\\\\ntick`; + │ ^^^^^^^^^^^^^^^^ + 20 │ var foo = `\n`; + 21 │ function foo() { `use strict`; foo(); } i Suggested fix: Replace with string literal @@ -211,10 +225,12 @@ noUnusedTemplateLiteral.js:20:11 lint/correctness/noUnusedTemplateLiteral FIXAB ! Do not use template literals if interpolation and special-character handling are not needed. - ┌─ noUnusedTemplateLiteral.js:20:11 - │ - 20 │ var foo = `\n`; - │ ^^^^ + 18 │ var foo = `back\u2029tick`; + 19 │ var foo = `back\\\\\ntick`; + > 20 │ var foo = `\n`; + │ ^^^^ + 21 │ function foo() { `use strict`; foo(); } + 22 │ var foo = `foo\\nbar`; i Suggested fix: Replace with string literal @@ -236,10 +252,12 @@ noUnusedTemplateLiteral.js:21:18 lint/correctness/noUnusedTemplateLiteral FIXAB ! Do not use template literals if interpolation and special-character handling are not needed. - ┌─ noUnusedTemplateLiteral.js:21:18 - │ - 21 │ function foo() { `use strict`; foo(); } - │ ^^^^^^^^^^^^ + 19 │ var foo = `back\\\\\ntick`; + 20 │ var foo = `\n`; + > 21 │ function foo() { `use strict`; foo(); } + │ ^^^^^^^^^^^^ + 22 │ var foo = `foo\\nbar`; + 23 │ var foo = `foo\\\nbar`; i Suggested fix: Replace with string literal @@ -261,10 +279,12 @@ noUnusedTemplateLiteral.js:22:11 lint/correctness/noUnusedTemplateLiteral FIXAB ! Do not use template literals if interpolation and special-character handling are not needed. - ┌─ noUnusedTemplateLiteral.js:22:11 - │ - 22 │ var foo = `foo\\nbar`; - │ ^^^^^^^^^^^ + 20 │ var foo = `\n`; + 21 │ function foo() { `use strict`; foo(); } + > 22 │ var foo = `foo\\nbar`; + │ ^^^^^^^^^^^ + 23 │ var foo = `foo\\\nbar`; + 24 │ var foo = `foo\\\\\\\nbar`; i Suggested fix: Replace with string literal @@ -285,10 +305,11 @@ noUnusedTemplateLiteral.js:23:11 lint/correctness/noUnusedTemplateLiteral FIXAB ! Do not use template literals if interpolation and special-character handling are not needed. - ┌─ noUnusedTemplateLiteral.js:23:11 - │ - 23 │ var foo = `foo\\\nbar`; - │ ^^^^^^^^^^^^ + 21 │ function foo() { `use strict`; foo(); } + 22 │ var foo = `foo\\nbar`; + > 23 │ var foo = `foo\\\nbar`; + │ ^^^^^^^^^^^^ + 24 │ var foo = `foo\\\\\\\nbar`; i Suggested fix: Replace with string literal @@ -308,10 +329,10 @@ noUnusedTemplateLiteral.js:24:11 lint/correctness/noUnusedTemplateLiteral FIXAB ! Do not use template literals if interpolation and special-character handling are not needed. - ┌─ noUnusedTemplateLiteral.js:24:11 - │ - 24 │ var foo = `foo\\\\\\\nbar`; - │ ^^^^^^^^^^^^^^^^ + 22 │ var foo = `foo\\nbar`; + 23 │ var foo = `foo\\\nbar`; + > 24 │ var foo = `foo\\\\\\\nbar`; + │ ^^^^^^^^^^^^^^^^ i Suggested fix: Replace with string literal diff --git a/crates/rome_js_analyze/tests/specs/correctness/useBlockStatements.js.snap b/crates/rome_js_analyze/tests/specs/correctness/useBlockStatements.js.snap index da037d06d53..fad2ce9ef0d 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/useBlockStatements.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/useBlockStatements.js.snap @@ -57,10 +57,11 @@ useBlockStatements.js:2:1 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:2:1 - │ - 2 │ if (x) x; - │ ^^^^^^^^^ + 1 │ // invalid + > 2 │ if (x) x; + │ ^^^^^^^^^ + 3 │ if (x) { + 4 │ x; i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -80,10 +81,12 @@ useBlockStatements.js:5:3 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:5:3 - │ - 5 │ } else y; - │ ^^^^^^^ + 3 │ if (x) { + 4 │ x; + > 5 │ } else y; + │ ^^^^^^^ + 6 │ if (x) { + 7 │ x; i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -105,10 +108,12 @@ useBlockStatements.js:8:8 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:8:8 - │ - 8 │ } else if (y) y; - │ ^^^^^^^^^ + 6 │ if (x) { + 7 │ x; + > 8 │ } else if (y) y; + │ ^^^^^^^^^ + 9 │ for (;;); + 10 │ for (p in obj); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -130,10 +135,12 @@ useBlockStatements.js:9:1 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:9:1 - │ - 9 │ for (;;); - │ ^^^^^^^^^ + 7 │ x; + 8 │ } else if (y) y; + > 9 │ for (;;); + │ ^^^^^^^^^ + 10 │ for (p in obj); + 11 │ for (x of xs); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -155,10 +162,12 @@ useBlockStatements.js:10:1 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:10:1 - │ - 10 │ for (p in obj); - │ ^^^^^^^^^^^^^^^ + 8 │ } else if (y) y; + 9 │ for (;;); + > 10 │ for (p in obj); + │ ^^^^^^^^^^^^^^^ + 11 │ for (x of xs); + 12 │ do; i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -180,10 +189,12 @@ useBlockStatements.js:11:1 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:11:1 - │ - 11 │ for (x of xs); - │ ^^^^^^^^^^^^^^ + 9 │ for (;;); + 10 │ for (p in obj); + > 11 │ for (x of xs); + │ ^^^^^^^^^^^^^^ + 12 │ do; + 13 │ while (x); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -205,11 +216,14 @@ useBlockStatements.js:12:1 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:12:1 - │ - 12 │ ┌ do; - 13 │ │ while (x); - │ └──────────^ + 10 │ for (p in obj); + 11 │ for (x of xs); + > 12 │ do; + │ ^^^ + > 13 │ while (x); + │ ^^^^^^^^^^ + 14 │ while (x); + 15 │ i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -231,10 +245,12 @@ useBlockStatements.js:14:1 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:14:1 - │ - 14 │ while (x); - │ ^^^^^^^^^^ + 12 │ do; + 13 │ while (x); + > 14 │ while (x); + │ ^^^^^^^^^^ + 15 │ + 16 │ if (x); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -256,10 +272,12 @@ useBlockStatements.js:16:1 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:16:1 - │ - 16 │ if (x); - │ ^^^^^^^ + 14 │ while (x); + 15 │ + > 16 │ if (x); + │ ^^^^^^^ + 17 │ + 18 │ if (test); i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -281,12 +299,15 @@ useBlockStatements.js:18:1 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:18:1 - │ - 18 │ ┌ if (test); - 19 │ │ else if (test); - 20 │ │ else; - │ └─────^ + 16 │ if (x); + 17 │ + > 18 │ if (test); + │ ^^^^^^^^^^ + > 19 │ else if (test); + > 20 │ else; + │ ^^^^^ + 21 │ + 22 │ while (test) i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -308,12 +329,13 @@ useBlockStatements.js:19:6 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:19:6 - │ - 19 │ else if (test); - │ ┌──────^ - 20 │ │ else; - │ └─────^ + 18 │ if (test); + > 19 │ else if (test); + │ ^^^^^^^^^^ + > 20 │ else; + │ ^^^^^ + 21 │ + 22 │ while (test) i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -335,10 +357,12 @@ useBlockStatements.js:20:1 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:20:1 - │ - 20 │ else; - │ ^^^^^ + 18 │ if (test); + 19 │ else if (test); + > 20 │ else; + │ ^^^^^ + 21 │ + 22 │ while (test) i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -360,11 +384,14 @@ useBlockStatements.js:22:1 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:22:1 - │ - 22 │ ┌ while (test) - 23 │ │ bar - │ └─────^ + 20 │ else; + 21 │ + > 22 │ while (test) + │ ^^^^^^^^^^^^ + > 23 │ bar + │ ^^^ + 24 │ + 25 │ while (test) i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -388,11 +415,14 @@ useBlockStatements.js:25:3 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:25:3 - │ - 25 │ ┌ while (test) - 26 │ │ bar - │ └───────^ + 23 │ bar + 24 │ + > 25 │ while (test) + │ ^^^^^^^^^^^^ + > 26 │ bar + │ ^^^ + 27 │ + 28 │ if (test) i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -416,15 +446,18 @@ useBlockStatements.js:28:1 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:28:1 - │ - 28 │ ┌ if (test) - 29 │ │ bar - 30 │ │ else if(test) - 31 │ │ bar - 32 │ │ else - 33 │ │ bar - │ └─────^ + 26 │ bar + 27 │ + > 28 │ if (test) + │ ^^^^^^^^^ + > 29 │ bar + > 30 │ else if(test) + > 31 │ bar + > 32 │ else + > 33 │ bar + │ ^^^ + 34 │ + 35 │ if (test) i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -448,14 +481,16 @@ useBlockStatements.js:30:6 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:30:6 - │ - 30 │ else if(test) - │ ┌──────^ - 31 │ │ bar - 32 │ │ else - 33 │ │ bar - │ └─────^ + 28 │ if (test) + 29 │ bar + > 30 │ else if(test) + │ ^^^^^^^^ + > 31 │ bar + > 32 │ else + > 33 │ bar + │ ^^^ + 34 │ + 35 │ if (test) i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -479,11 +514,14 @@ useBlockStatements.js:32:1 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:32:1 - │ - 32 │ ┌ else - 33 │ │ bar - │ └─────^ + 30 │ else if(test) + 31 │ bar + > 32 │ else + │ ^^^^ + > 33 │ bar + │ ^^^ + 34 │ + 35 │ if (test) i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -507,15 +545,18 @@ useBlockStatements.js:35:3 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:35:3 - │ - 35 │ ┌ if (test) - 36 │ │ bar - 37 │ │ else if(test) - 38 │ │ bar - 39 │ │ else - 40 │ │ bar - │ └───────^ + 33 │ bar + 34 │ + > 35 │ if (test) + │ ^^^^^^^^^ + > 36 │ bar + > 37 │ else if(test) + > 38 │ bar + > 39 │ else + > 40 │ bar + │ ^^^ + 41 │ + 42 │ if (test) { i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -539,14 +580,16 @@ useBlockStatements.js:37:8 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:37:8 - │ - 37 │ else if(test) - │ ┌────────^ - 38 │ │ bar - 39 │ │ else - 40 │ │ bar - │ └───────^ + 35 │ if (test) + 36 │ bar + > 37 │ else if(test) + │ ^^^^^^^^ + > 38 │ bar + > 39 │ else + > 40 │ bar + │ ^^^ + 41 │ + 42 │ if (test) { i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -570,11 +613,14 @@ useBlockStatements.js:39:3 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:39:3 - │ - 39 │ ┌ else - 40 │ │ bar - │ └───────^ + 37 │ else if(test) + 38 │ bar + > 39 │ else + │ ^^^^ + > 40 │ bar + │ ^^^ + 41 │ + 42 │ if (test) { i Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -598,10 +644,11 @@ useBlockStatements.js:44:3 lint/correctness/useBlockStatements FIXABLE ━━ ! Block statements are preferred in this position. - ┌─ useBlockStatements.js:44:3 - │ - 44 │ } else console.log("false") // comment - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 42 │ if (test) { + 43 │ correct; + > 44 │ } else console.log("false") // comment + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 45 │ i Suggested fix: Wrap the statement with a `JsBlockStatement` diff --git a/crates/rome_js_analyze/tests/specs/correctness/useSimplifiedLogicExpression.js.snap b/crates/rome_js_analyze/tests/specs/correctness/useSimplifiedLogicExpression.js.snap index f3392aa24b8..ba39a9342a7 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/useSimplifiedLogicExpression.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/useSimplifiedLogicExpression.js.snap @@ -30,10 +30,12 @@ useSimplifiedLogicExpression.js:10:11 lint/correctness/useSimplifiedLogicExpress ! Logical expression contains unnecessary complexity. - ┌─ useSimplifiedLogicExpression.js:10:11 - │ - 10 │ const r = true && boolExp; - │ ^^^^^^^^^^^^^^^ + 8 │ // invalid + 9 │ const boolExp = true; + > 10 │ const r = true && boolExp; + │ ^^^^^^^^^^^^^^^ + 11 │ const boolExp2 = true; + 12 │ const r2 = boolExp || true; i Suggested fix: Discard redundant terms from the logical expression. @@ -55,10 +57,12 @@ useSimplifiedLogicExpression.js:12:12 lint/correctness/useSimplifiedLogicExpress ! Logical expression contains unnecessary complexity. - ┌─ useSimplifiedLogicExpression.js:12:12 - │ - 12 │ const r2 = boolExp || true; - │ ^^^^^^^^^^^^^^^ + 10 │ const r = true && boolExp; + 11 │ const boolExp2 = true; + > 12 │ const r2 = boolExp || true; + │ ^^^^^^^^^^^^^^^ + 13 │ const nonNullExp = 123; + 14 │ const r3 = null ?? nonNullExp; i Suggested fix: Discard redundant terms from the logical expression. @@ -80,10 +84,12 @@ useSimplifiedLogicExpression.js:14:12 lint/correctness/useSimplifiedLogicExpress ! Logical expression contains unnecessary complexity. - ┌─ useSimplifiedLogicExpression.js:14:12 - │ - 14 │ const r3 = null ?? nonNullExp; - │ ^^^^^^^^^^^^^^^^^^ + 12 │ const r2 = boolExp || true; + 13 │ const nonNullExp = 123; + > 14 │ const r3 = null ?? nonNullExp; + │ ^^^^^^^^^^^^^^^^^^ + 15 │ const boolExpr1 = true; + 16 │ const boolExpr2 = false; i Suggested fix: Discard redundant terms from the logical expression. @@ -105,10 +111,11 @@ useSimplifiedLogicExpression.js:17:12 lint/correctness/useSimplifiedLogicExpress ! Logical expression contains unnecessary complexity. - ┌─ useSimplifiedLogicExpression.js:17:12 - │ - 17 │ const r4 = !boolExpr1 || !boolExpr2; - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 15 │ const boolExpr1 = true; + 16 │ const boolExpr2 = false; + > 17 │ const r4 = !boolExpr1 || !boolExpr2; + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 18 │ i Suggested fix: Reduce the complexity of the logical expression. diff --git a/crates/rome_js_analyze/tests/specs/correctness/useSingleCaseStatement.js.snap b/crates/rome_js_analyze/tests/specs/correctness/useSingleCaseStatement.js.snap index ffcad4309a1..316bcc4d575 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/useSingleCaseStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/useSingleCaseStatement.js.snap @@ -55,11 +55,14 @@ useSingleCaseStatement.js:4:9 lint/correctness/useSingleCaseStatement FIXABLE ! A switch case should only have a single statement. If you want more, then wrap it in a block. - ┌─ useSingleCaseStatement.js:4:9 - │ - 4 │ ┌ let foo = ''; - 5 │ │ foo; - │ └────────────^ + 2 │ case true: + 3 │ case false: + > 4 │ let foo = ''; + │ ^^^^^^^^^^^^^ + > 5 │ foo; + │ ^^^^ + 6 │ } + 7 │ i Suggested fix: Wrap the statements in a block @@ -83,11 +86,14 @@ useSingleCaseStatement.js:11:9 lint/correctness/useSingleCaseStatement FIXABLE ! A switch case should only have a single statement. If you want more, then wrap it in a block. - ┌─ useSingleCaseStatement.js:11:9 - │ - 11 │ ┌ let foo = ''; - 12 │ │ foo; - │ └────────────^ + 9 │ // comment + 10 │ case false : + > 11 │ let foo = ''; + │ ^^^^^^^^^^^^^ + > 12 │ foo; + │ ^^^^ + 13 │ } + 14 │ i Suggested fix: Wrap the statements in a block @@ -112,11 +118,14 @@ useSingleCaseStatement.js:17:9 lint/correctness/useSingleCaseStatement FIXABLE ! A switch case should only have a single statement. If you want more, then wrap it in a block. - ┌─ useSingleCaseStatement.js:17:9 - │ - 17 │ ┌ let foo = ''; - 18 │ │ foo; - │ └────────────^ + 15 │ switch (foo) { + 16 │ case false : // comment + > 17 │ let foo = ''; + │ ^^^^^^^^^^^^^ + > 18 │ foo; + │ ^^^^ + 19 │ } + 20 │ i Suggested fix: Wrap the statements in a block @@ -141,11 +150,14 @@ useSingleCaseStatement.js:24:9 lint/correctness/useSingleCaseStatement FIXABLE ! A switch case should only have a single statement. If you want more, then wrap it in a block. - ┌─ useSingleCaseStatement.js:24:9 - │ - 24 │ ┌ let foo = ''; - 25 │ │ foo; - │ └────────────^ + 22 │ case false + 23 │ /* comment */ : + > 24 │ let foo = ''; + │ ^^^^^^^^^^^^^ + > 25 │ foo; + │ ^^^^ + 26 │ } + 27 │ i Suggested fix: Wrap the statements in a block diff --git a/crates/rome_js_analyze/tests/specs/correctness/useSingleVarDeclarator.js.snap b/crates/rome_js_analyze/tests/specs/correctness/useSingleVarDeclarator.js.snap index ddc42975752..dff74f1787c 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/useSingleVarDeclarator.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/useSingleVarDeclarator.js.snap @@ -23,10 +23,10 @@ useSingleVarDeclarator.js:1:1 lint/correctness/useSingleVarDeclarator FIXABLE ! Declare variables separately - ┌─ useSingleVarDeclarator.js:1:1 - │ - 1 │ var x, y - │ ^^^^^^^^ + > 1 │ var x, y + │ ^^^^^^^^ + 2 │ + 3 │ function test() { i Suggested fix: Break out into multiple declarations @@ -46,10 +46,12 @@ useSingleVarDeclarator.js:5:2 lint/correctness/useSingleVarDeclarator FIXABLE ! Declare variables separately - ┌─ useSingleVarDeclarator.js:5:2 - │ - 5 │ let foo, bar; - │ ^^^^^^^^^^^^^ + 3 │ function test() { + 4 │ // Comment + > 5 │ let foo, bar; + │ ^^^^^^^^^^^^^ + 6 │ } + 7 │ i Suggested fix: Break out into multiple declarations @@ -72,12 +74,14 @@ useSingleVarDeclarator.js:8:1 lint/correctness/useSingleVarDeclarator FIXABLE ! Declare variables separately - ┌─ useSingleVarDeclarator.js:8:1 - │ - 8 │ ┌ var x = 1, - 9 │ │ // comment - 10 │ │ y = 2 - │ └─────────^ + 6 │ } + 7 │ + > 8 │ var x = 1, + │ ^^^^^^^^^^ + > 9 │ // comment + > 10 │ y = 2 + │ ^^^^^ + 11 │ i Suggested fix: Break out into multiple declarations diff --git a/crates/rome_js_analyze/tests/specs/correctness/useTemplate.js.snap b/crates/rome_js_analyze/tests/specs/correctness/useTemplate.js.snap index 1cd504d83ed..fce9554fa49 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/useTemplate.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/useTemplate.js.snap @@ -30,10 +30,12 @@ useTemplate.js:6:13 lint/correctness/useTemplate FIXABLE ━━━━━━━ ! Template literals are preferred over string concatenation. - ┌─ useTemplate.js:6:13 - │ - 6 │ console.log(foo + "baz"); - │ ^^^^^^^^^^^ + 4 │ // invalid + 5 │ const foo = "bar"; + > 6 │ console.log(foo + "baz"); + │ ^^^^^^^^^^^ + 7 │ console.log(1 * 2 + "foo"); + 8 │ console.log(1 + "foo" + 2 + "bar" + "baz" + 3); i Suggested fix: Use a TemplateLiteral. @@ -55,10 +57,12 @@ useTemplate.js:7:13 lint/correctness/useTemplate FIXABLE ━━━━━━━ ! Template literals are preferred over string concatenation. - ┌─ useTemplate.js:7:13 - │ - 7 │ console.log(1 * 2 + "foo"); - │ ^^^^^^^^^^^^^ + 5 │ const foo = "bar"; + 6 │ console.log(foo + "baz"); + > 7 │ console.log(1 * 2 + "foo"); + │ ^^^^^^^^^^^^^ + 8 │ console.log(1 + "foo" + 2 + "bar" + "baz" + 3); + 9 │ console.log((1 + "foo") * 2); i Suggested fix: Use a TemplateLiteral. @@ -80,10 +84,12 @@ useTemplate.js:8:13 lint/correctness/useTemplate FIXABLE ━━━━━━━ ! Template literals are preferred over string concatenation. - ┌─ useTemplate.js:8:13 - │ - 8 │ console.log(1 + "foo" + 2 + "bar" + "baz" + 3); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 6 │ console.log(foo + "baz"); + 7 │ console.log(1 * 2 + "foo"); + > 8 │ console.log(1 + "foo" + 2 + "bar" + "baz" + 3); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 9 │ console.log((1 + "foo") * 2); + 10 │ console.log(1 * (2 + "foo") + "bar"); i Suggested fix: Use a TemplateLiteral. @@ -105,10 +111,12 @@ useTemplate.js:9:14 lint/correctness/useTemplate FIXABLE ━━━━━━━ ! Template literals are preferred over string concatenation. - ┌─ useTemplate.js:9:14 - │ - 9 │ console.log((1 + "foo") * 2); - │ ^^^^^^^^^ + 7 │ console.log(1 * 2 + "foo"); + 8 │ console.log(1 + "foo" + 2 + "bar" + "baz" + 3); + > 9 │ console.log((1 + "foo") * 2); + │ ^^^^^^^^^ + 10 │ console.log(1 * (2 + "foo") + "bar"); + 11 │ console.log("foo" + 1); i Suggested fix: Use a TemplateLiteral. @@ -130,10 +138,12 @@ useTemplate.js:10:13 lint/correctness/useTemplate FIXABLE ━━━━━━ ! Template literals are preferred over string concatenation. - ┌─ useTemplate.js:10:13 - │ - 10 │ console.log(1 * (2 + "foo") + "bar"); - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 8 │ console.log(1 + "foo" + 2 + "bar" + "baz" + 3); + 9 │ console.log((1 + "foo") * 2); + > 10 │ console.log(1 * (2 + "foo") + "bar"); + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 11 │ console.log("foo" + 1); + 12 │ console.log("foo" + `bar${`baz${"bat" + "bam"}`}` + "boo"); i Suggested fix: Use a TemplateLiteral. @@ -155,10 +165,12 @@ useTemplate.js:10:18 lint/correctness/useTemplate FIXABLE ━━━━━━ ! Template literals are preferred over string concatenation. - ┌─ useTemplate.js:10:18 - │ - 10 │ console.log(1 * (2 + "foo") + "bar"); - │ ^^^^^^^^^ + 8 │ console.log(1 + "foo" + 2 + "bar" + "baz" + 3); + 9 │ console.log((1 + "foo") * 2); + > 10 │ console.log(1 * (2 + "foo") + "bar"); + │ ^^^^^^^^^ + 11 │ console.log("foo" + 1); + 12 │ console.log("foo" + `bar${`baz${"bat" + "bam"}`}` + "boo"); i Suggested fix: Use a TemplateLiteral. @@ -180,10 +192,12 @@ useTemplate.js:11:13 lint/correctness/useTemplate FIXABLE ━━━━━━ ! Template literals are preferred over string concatenation. - ┌─ useTemplate.js:11:13 - │ - 11 │ console.log("foo" + 1); - │ ^^^^^^^^^ + 9 │ console.log((1 + "foo") * 2); + 10 │ console.log(1 * (2 + "foo") + "bar"); + > 11 │ console.log("foo" + 1); + │ ^^^^^^^^^ + 12 │ console.log("foo" + `bar${`baz${"bat" + "bam"}`}` + "boo"); + 13 │ console.log("foo" + 1 + 2); i Suggested fix: Use a TemplateLiteral. @@ -205,10 +219,12 @@ useTemplate.js:12:13 lint/correctness/useTemplate FIXABLE ━━━━━━ ! Template literals are preferred over string concatenation. - ┌─ useTemplate.js:12:13 - │ - 12 │ console.log("foo" + `bar${`baz${"bat" + "bam"}`}` + "boo"); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 10 │ console.log(1 * (2 + "foo") + "bar"); + 11 │ console.log("foo" + 1); + > 12 │ console.log("foo" + `bar${`baz${"bat" + "bam"}`}` + "boo"); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 13 │ console.log("foo" + 1 + 2); + 14 │ 1 + "2" - 3; i Suggested fix: Use a TemplateLiteral. @@ -230,10 +246,12 @@ useTemplate.js:13:13 lint/correctness/useTemplate FIXABLE ━━━━━━ ! Template literals are preferred over string concatenation. - ┌─ useTemplate.js:13:13 - │ - 13 │ console.log("foo" + 1 + 2); - │ ^^^^^^^^^^^^^ + 11 │ console.log("foo" + 1); + 12 │ console.log("foo" + `bar${`baz${"bat" + "bam"}`}` + "boo"); + > 13 │ console.log("foo" + 1 + 2); + │ ^^^^^^^^^^^^^ + 14 │ 1 + "2" - 3; + 15 │ foo() + " bar"; i Suggested fix: Use a TemplateLiteral. @@ -255,10 +273,12 @@ useTemplate.js:14:1 lint/correctness/useTemplate FIXABLE ━━━━━━━ ! Template literals are preferred over string concatenation. - ┌─ useTemplate.js:14:1 - │ - 14 │ 1 + "2" - 3; - │ ^^^^^^^ + 12 │ console.log("foo" + `bar${`baz${"bat" + "bam"}`}` + "boo"); + 13 │ console.log("foo" + 1 + 2); + > 14 │ 1 + "2" - 3; + │ ^^^^^^^ + 15 │ foo() + " bar"; + 16 │ i Suggested fix: Use a TemplateLiteral. @@ -280,10 +300,12 @@ useTemplate.js:15:1 lint/correctness/useTemplate FIXABLE ━━━━━━━ ! Template literals are preferred over string concatenation. - ┌─ useTemplate.js:15:1 - │ - 15 │ foo() + " bar"; - │ ^^^^^^^^^^^^^^ + 13 │ console.log("foo" + 1 + 2); + 14 │ 1 + "2" - 3; + > 15 │ foo() + " bar"; + │ ^^^^^^^^^^^^^^ + 16 │ + 17 │ 1 * /**leading*/"foo" /**trailing */ + "bar" i Suggested fix: Use a TemplateLiteral. @@ -304,10 +326,11 @@ useTemplate.js:17:1 lint/correctness/useTemplate FIXABLE ━━━━━━━ ! Template literals are preferred over string concatenation. - ┌─ useTemplate.js:17:1 - │ - 17 │ 1 * /**leading*/"foo" /**trailing */ + "bar" - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 15 │ foo() + " bar"; + 16 │ + > 17 │ 1 * /**leading*/"foo" /**trailing */ + "bar" + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 18 │ i Suggested fix: Use a TemplateLiteral. diff --git a/crates/rome_js_analyze/tests/specs/correctness/useValidTypeof.js.snap b/crates/rome_js_analyze/tests/specs/correctness/useValidTypeof.js.snap index 5dcafdabf7c..a9c4e847e58 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/useValidTypeof.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/useValidTypeof.js.snap @@ -32,10 +32,11 @@ useValidTypeof.js:7:16 lint/correctness/useValidTypeof ━━━━━━━━ ! not a valid type name - ┌─ useValidTypeof.js:7:16 - │ - 7 │ typeof foo === "strnig" - │ ^^^^^^^^ + 6 │ // Invalid literals + > 7 │ typeof foo === "strnig" + │ ^^^^^^^^ + 8 │ typeof foo == "undefimed" + 9 │ typeof bar != "nunber" ``` @@ -47,10 +48,12 @@ useValidTypeof.js:8:15 lint/correctness/useValidTypeof ━━━━━━━━ ! not a valid type name - ┌─ useValidTypeof.js:8:15 - │ - 8 │ typeof foo == "undefimed" - │ ^^^^^^^^^^^ + 6 │ // Invalid literals + 7 │ typeof foo === "strnig" + > 8 │ typeof foo == "undefimed" + │ ^^^^^^^^^^^ + 9 │ typeof bar != "nunber" + 10 │ typeof bar !== "fucntion" ``` @@ -62,10 +65,12 @@ useValidTypeof.js:9:15 lint/correctness/useValidTypeof ━━━━━━━━ ! not a valid type name - ┌─ useValidTypeof.js:9:15 - │ - 9 │ typeof bar != "nunber" - │ ^^^^^^^^ + 7 │ typeof foo === "strnig" + 8 │ typeof foo == "undefimed" + > 9 │ typeof bar != "nunber" + │ ^^^^^^^^ + 10 │ typeof bar !== "fucntion" + 11 │ ``` @@ -77,10 +82,12 @@ useValidTypeof.js:10:16 lint/correctness/useValidTypeof ━━━━━━━━ ! not a valid type name - ┌─ useValidTypeof.js:10:16 - │ - 10 │ typeof bar !== "fucntion" - │ ^^^^^^^^^^ + 8 │ typeof foo == "undefimed" + 9 │ typeof bar != "nunber" + > 10 │ typeof bar !== "fucntion" + │ ^^^^^^^^^^ + 11 │ + 12 │ // Invalid expressions ``` @@ -92,10 +99,11 @@ useValidTypeof.js:13:16 lint/correctness/useValidTypeof FIXABLE ━━━━ ! not a string literal - ┌─ useValidTypeof.js:13:16 - │ - 13 │ typeof foo === undefined - │ ^^^^^^^^^ + 12 │ // Invalid expressions + > 13 │ typeof foo === undefined + │ ^^^^^^^^^ + 14 │ typeof bar == Object + 15 │ typeof foo === baz i Suggested fix: Compare the result of `typeof` with a valid type name @@ -119,10 +127,12 @@ useValidTypeof.js:14:15 lint/correctness/useValidTypeof FIXABLE ━━━━ ! not a string literal - ┌─ useValidTypeof.js:14:15 - │ - 14 │ typeof bar == Object - │ ^^^^^^ + 12 │ // Invalid expressions + 13 │ typeof foo === undefined + > 14 │ typeof bar == Object + │ ^^^^^^ + 15 │ typeof foo === baz + 16 │ typeof foo == 5 i Suggested fix: Compare the result of `typeof` with a valid type name @@ -146,10 +156,12 @@ useValidTypeof.js:15:16 lint/correctness/useValidTypeof ━━━━━━━━ ! not a string literal - ┌─ useValidTypeof.js:15:16 - │ - 15 │ typeof foo === baz - │ ^^^ + 13 │ typeof foo === undefined + 14 │ typeof bar == Object + > 15 │ typeof foo === baz + │ ^^^ + 16 │ typeof foo == 5 + 17 │ typeof foo == -5 ``` @@ -161,10 +173,12 @@ useValidTypeof.js:16:15 lint/correctness/useValidTypeof ━━━━━━━━ ! not a string literal - ┌─ useValidTypeof.js:16:15 - │ - 16 │ typeof foo == 5 - │ ^ + 14 │ typeof bar == Object + 15 │ typeof foo === baz + > 16 │ typeof foo == 5 + │ ^ + 17 │ typeof foo == -5 + 18 │ ``` @@ -176,10 +190,11 @@ useValidTypeof.js:17:15 lint/correctness/useValidTypeof ━━━━━━━━ ! not a string literal - ┌─ useValidTypeof.js:17:15 - │ - 17 │ typeof foo == -5 - │ ^^ + 15 │ typeof foo === baz + 16 │ typeof foo == 5 + > 17 │ typeof foo == -5 + │ ^^ + 18 │ ``` diff --git a/crates/rome_js_analyze/tests/specs/correctness/useWhile.js.snap b/crates/rome_js_analyze/tests/specs/correctness/useWhile.js.snap index 64fbbbeaee4..8d9eb373614 100644 --- a/crates/rome_js_analyze/tests/specs/correctness/useWhile.js.snap +++ b/crates/rome_js_analyze/tests/specs/correctness/useWhile.js.snap @@ -16,10 +16,11 @@ useWhile.js:3:1 lint/correctness/useWhile FIXABLE ━━━━━━━━━ ! Use while loops instead of for loops. - ┌─ useWhile.js:3:1 - │ - 3 │ for (; true; ) {} - │ ^^^^^^^^^^^^^^ + 1 │ for (let i = 0; i < 16; ++i) {} + 2 │ + > 3 │ for (; true; ) {} + │ ^^^^^^^^^^^^^^ + 4 │ i Suggested fix: Use a while loop diff --git a/crates/rome_js_analyze/tests/specs/nursery/noArrayIndexKey.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/noArrayIndexKey.jsx.snap index dbc6b87e397..9cec4b63648 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noArrayIndexKey.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noArrayIndexKey.jsx.snap @@ -72,17 +72,20 @@ noArrayIndexKey.jsx:3:21 lint/nursery/noArrayIndexKey ━━━━━━━━ ! Avoid using the index of an array as key property in an element. - ┌─ noArrayIndexKey.jsx:3:21 - │ - 3 │ foo - │ ^^^^^ + 1 │ // invalid + 2 │ something.forEach((Element, index) => { + > 3 │ foo + │ ^^^^^ + 4 │ }); + 5 │ something.forEach((element, index, array) => { i This is the source of the key value. - ┌─ noArrayIndexKey.jsx:2:29 - │ - 2 │ something.forEach((Element, index) => { - │ ^^^^^ + 1 │ // invalid + > 2 │ something.forEach((Element, index) => { + │ ^^^^^ + 3 │ foo + 4 │ }); i The order of the items may change, and this also affects performances and component state. @@ -96,17 +99,21 @@ noArrayIndexKey.jsx:6:21 lint/nursery/noArrayIndexKey ━━━━━━━━ ! Avoid using the index of an array as key property in an element. - ┌─ noArrayIndexKey.jsx:6:21 - │ - 6 │ foo - │ ^^^^^ + 4 │ }); + 5 │ something.forEach((element, index, array) => { + > 6 │ foo + │ ^^^^^ + 7 │ }); + 8 │ things.filter((thing, index) => { i This is the source of the key value. - ┌─ noArrayIndexKey.jsx:5:29 - │ - 5 │ something.forEach((element, index, array) => { - │ ^^^^^ + 3 │ foo + 4 │ }); + > 5 │ something.forEach((element, index, array) => { + │ ^^^^^ + 6 │ foo + 7 │ }); i The order of the items may change, and this also affects performances and component state. @@ -120,17 +127,21 @@ noArrayIndexKey.jsx:9:34 lint/nursery/noArrayIndexKey ━━━━━━━━ ! Avoid using the index of an array as key property in an element. - ┌─ noArrayIndexKey.jsx:9:34 - │ - 9 │ otherThings.push(foo); - │ ^^^^^ + 7 │ }); + 8 │ things.filter((thing, index) => { + > 9 │ otherThings.push(foo); + │ ^^^^^ + 10 │ }); + 11 │ i This is the source of the key value. - ┌─ noArrayIndexKey.jsx:8:23 - │ - 8 │ things.filter((thing, index) => { - │ ^^^^^ + 6 │ foo + 7 │ }); + > 8 │ things.filter((thing, index) => { + │ ^^^^^ + 9 │ otherThings.push(foo); + 10 │ }); i The order of the items may change, and this also affects performances and component state. @@ -144,17 +155,20 @@ noArrayIndexKey.jsx:13:21 lint/nursery/noArrayIndexKey ━━━━━━━━ ! Avoid using the index of an array as key property in an element. - ┌─ noArrayIndexKey.jsx:13:21 - │ - 13 │ - │ ^^^^^ + 12 │ something.forEach((Element, index) => { + > 13 │ + │ ^^^^^ + 14 │ }); + 15 │ something.forEach((element, index, array) => { i This is the source of the key value. - ┌─ noArrayIndexKey.jsx:12:29 - │ - 12 │ something.forEach((Element, index) => { - │ ^^^^^ + 10 │ }); + 11 │ + > 12 │ something.forEach((Element, index) => { + │ ^^^^^ + 13 │ + 14 │ }); i The order of the items may change, and this also affects performances and component state. @@ -168,17 +182,21 @@ noArrayIndexKey.jsx:16:21 lint/nursery/noArrayIndexKey ━━━━━━━━ ! Avoid using the index of an array as key property in an element. - ┌─ noArrayIndexKey.jsx:16:21 - │ - 16 │ - │ ^^^^^ + 14 │ }); + 15 │ something.forEach((element, index, array) => { + > 16 │ + │ ^^^^^ + 17 │ }); + 18 │ things.filter((thing, index) => { i This is the source of the key value. - ┌─ noArrayIndexKey.jsx:15:29 - │ - 15 │ something.forEach((element, index, array) => { - │ ^^^^^ + 13 │ + 14 │ }); + > 15 │ something.forEach((element, index, array) => { + │ ^^^^^ + 16 │ + 17 │ }); i The order of the items may change, and this also affects performances and component state. @@ -192,17 +210,21 @@ noArrayIndexKey.jsx:19:34 lint/nursery/noArrayIndexKey ━━━━━━━━ ! Avoid using the index of an array as key property in an element. - ┌─ noArrayIndexKey.jsx:19:34 - │ - 19 │ otherThings.push(); - │ ^^^^^ + 17 │ }); + 18 │ things.filter((thing, index) => { + > 19 │ otherThings.push(); + │ ^^^^^ + 20 │ }); + 21 │ things.reduce((collection, thing, index) => ( i This is the source of the key value. - ┌─ noArrayIndexKey.jsx:18:23 - │ - 18 │ things.filter((thing, index) => { - │ ^^^^^ + 16 │ + 17 │ }); + > 18 │ things.filter((thing, index) => { + │ ^^^^^ + 19 │ otherThings.push(); + 20 │ }); i The order of the items may change, and this also affects performances and component state. @@ -216,17 +238,21 @@ noArrayIndexKey.jsx:22:35 lint/nursery/noArrayIndexKey ━━━━━━━━ ! Avoid using the index of an array as key property in an element. - ┌─ noArrayIndexKey.jsx:22:35 - │ - 22 │ collection.concat() - │ ^^^^^ + 20 │ }); + 21 │ things.reduce((collection, thing, index) => ( + > 22 │ collection.concat() + │ ^^^^^ + 23 │ ), []); + 24 │ i This is the source of the key value. - ┌─ noArrayIndexKey.jsx:21:35 - │ - 21 │ things.reduce((collection, thing, index) => ( - │ ^^^^^ + 19 │ otherThings.push(); + 20 │ }); + > 21 │ things.reduce((collection, thing, index) => ( + │ ^^^^^ + 22 │ collection.concat() + 23 │ ), []); i The order of the items may change, and this also affects performances and component state. @@ -240,17 +266,20 @@ noArrayIndexKey.jsx:26:38 lint/nursery/noArrayIndexKey ━━━━━━━━ ! Avoid using the index of an array as key property in an element. - ┌─ noArrayIndexKey.jsx:26:38 - │ - 26 │ React.cloneElement(child, { key: index }) - │ ^^^^^ + 25 │ React.Children.map(this.props.children, (child, index) => ( + > 26 │ React.cloneElement(child, { key: index }) + │ ^^^^^ + 27 │ )) + 28 │ i This is the source of the key value. - ┌─ noArrayIndexKey.jsx:25:49 - │ - 25 │ React.Children.map(this.props.children, (child, index) => ( - │ ^^^^^ + 23 │ ), []); + 24 │ + > 25 │ React.Children.map(this.props.children, (child, index) => ( + │ ^^^^^ + 26 │ React.cloneElement(child, { key: index }) + 27 │ )) i The order of the items may change, and this also affects performances and component state. @@ -264,17 +293,20 @@ noArrayIndexKey.jsx:30:45 lint/nursery/noArrayIndexKey ━━━━━━━━ ! Avoid using the index of an array as key property in an element. - ┌─ noArrayIndexKey.jsx:30:45 - │ - 30 │ return React.cloneElement(child, { key: index }) - │ ^^^^^ + 29 │ React.Children.forEach(this.props.children, function (child, index) { + > 30 │ return React.cloneElement(child, { key: index }) + │ ^^^^^ + 31 │ }) + 32 │ i This is the source of the key value. - ┌─ noArrayIndexKey.jsx:29:62 - │ - 29 │ React.Children.forEach(this.props.children, function (child, index) { - │ ^^^^^ + 27 │ )) + 28 │ + > 29 │ React.Children.forEach(this.props.children, function (child, index) { + │ ^^^^^ + 30 │ return React.cloneElement(child, { key: index }) + 31 │ }) i The order of the items may change, and this also affects performances and component state. @@ -288,17 +320,18 @@ noArrayIndexKey.jsx:35:32 lint/nursery/noArrayIndexKey ━━━━━━━━ ! Avoid using the index of an array as key property in an element. - ┌─ noArrayIndexKey.jsx:35:32 - │ - 35 │ cloneElement(child, { key: index }) - │ ^^^^^ + 34 │ Children.map(this.props.children, (child, index) => ( + > 35 │ cloneElement(child, { key: index }) + │ ^^^^^ + 36 │ )) + 37 │ i This is the source of the key value. - ┌─ noArrayIndexKey.jsx:34:43 - │ - 34 │ Children.map(this.props.children, (child, index) => ( - │ ^^^^^ + > 34 │ Children.map(this.props.children, (child, index) => ( + │ ^^^^^ + 35 │ cloneElement(child, { key: index }) + 36 │ )) i The order of the items may change, and this also affects performances and component state. @@ -312,17 +345,20 @@ noArrayIndexKey.jsx:39:39 lint/nursery/noArrayIndexKey ━━━━━━━━ ! Avoid using the index of an array as key property in an element. - ┌─ noArrayIndexKey.jsx:39:39 - │ - 39 │ return cloneElement(child, { key: index }) - │ ^^^^^ + 38 │ Children.forEach(this.props.children, function (child, index) { + > 39 │ return cloneElement(child, { key: index }) + │ ^^^^^ + 40 │ }) + 41 │ i This is the source of the key value. - ┌─ noArrayIndexKey.jsx:38:56 - │ - 38 │ Children.forEach(this.props.children, function (child, index) { - │ ^^^^^ + 36 │ )) + 37 │ + > 38 │ Children.forEach(this.props.children, function (child, index) { + │ ^^^^^ + 39 │ return cloneElement(child, { key: index }) + 40 │ }) i The order of the items may change, and this also affects performances and component state. @@ -336,17 +372,20 @@ noArrayIndexKey.jsx:43:44 lint/nursery/noArrayIndexKey ━━━━━━━━ ! Avoid using the index of an array as key property in an element. - ┌─ noArrayIndexKey.jsx:43:44 - │ - 43 │ const foo = cloneElement(child, { key: index }) - │ ^^^^^ + 42 │ Children.forEach(this.props.children, function (child, index) { + > 43 │ const foo = cloneElement(child, { key: index }) + │ ^^^^^ + 44 │ return foo; + 45 │ }) i This is the source of the key value. - ┌─ noArrayIndexKey.jsx:42:56 - │ - 42 │ Children.forEach(this.props.children, function (child, index) { - │ ^^^^^ + 40 │ }) + 41 │ + > 42 │ Children.forEach(this.props.children, function (child, index) { + │ ^^^^^ + 43 │ const foo = cloneElement(child, { key: index }) + 44 │ return foo; i The order of the items may change, and this also affects performances and component state. @@ -360,17 +399,18 @@ noArrayIndexKey.jsx:49:38 lint/nursery/noArrayIndexKey ━━━━━━━━ ! Avoid using the index of an array as key property in an element. - ┌─ noArrayIndexKey.jsx:49:38 - │ - 49 │ React.cloneElement(thing, { key: index }) - │ ^^^^^ + 48 │ things.map((thing, index) => ( + > 49 │ React.cloneElement(thing, { key: index }) + │ ^^^^^ + 50 │ )); + 51 │ i This is the source of the key value. - ┌─ noArrayIndexKey.jsx:48:20 - │ - 48 │ things.map((thing, index) => ( - │ ^^^^^ + > 48 │ things.map((thing, index) => ( + │ ^^^^^ + 49 │ React.cloneElement(thing, { key: index }) + 50 │ )); i The order of the items may change, and this also affects performances and component state. diff --git a/crates/rome_js_analyze/tests/specs/nursery/noChildrenProp/noChildrenPropInvalid.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/noChildrenProp/noChildrenPropInvalid.jsx.snap index 57f4acd398a..d8d5d54b774 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noChildrenProp/noChildrenPropInvalid.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noChildrenProp/noChildrenPropInvalid.jsx.snap @@ -24,10 +24,11 @@ noChildrenPropInvalid.jsx:2:16 lint/nursery/noChildrenProp ━━━━━━━ ! Avoid passing children using a prop - ┌─ noChildrenPropInvalid.jsx:2:16 - │ - 2 │ - │ ^^^^^^^^ + 1 │ <> + > 2 │ + │ ^^^^^^^^ + 3 │ + 4 │ i The canonical way to pass children in React is to use JSX elements @@ -39,10 +40,11 @@ noChildrenPropInvalid.jsx:6:5 lint/nursery/noChildrenProp ━━━━━━━ ! Avoid passing children using a prop - ┌─ noChildrenPropInvalid.jsx:6:5 - │ - 6 │ children: 'foo' - │ ^^^^^^^^ + 5 │ createElement('div', { + > 6 │ children: 'foo' + │ ^^^^^^^^ + 7 │ }) + 8 │ i The canonical way to pass children in React is to use additional arguments to React.createElement @@ -54,10 +56,11 @@ noChildrenPropInvalid.jsx:10:5 lint/nursery/noChildrenProp ━━━━━━━ ! Avoid passing children using a prop - ┌─ noChildrenPropInvalid.jsx:10:5 - │ - 10 │ children: 'foo' - │ ^^^^^^^^ + 9 │ React.createElement('div', { + > 10 │ children: 'foo' + │ ^^^^^^^^ + 11 │ }) + 12 │ i The canonical way to pass children in React is to use additional arguments to React.createElement diff --git a/crates/rome_js_analyze/tests/specs/nursery/noDangerouslySetInnerHtml/createElementBindingInvalid.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noDangerouslySetInnerHtml/createElementBindingInvalid.js.snap index 5bfd61ca114..86ad5f86a98 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noDangerouslySetInnerHtml/createElementBindingInvalid.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noDangerouslySetInnerHtml/createElementBindingInvalid.js.snap @@ -21,10 +21,11 @@ createElementBindingInvalid.js:4:5 lint/nursery/noDangerouslySetInnerHtml ━━ ! Avoid passing content using the dangerouslySetInnerHTML prop. - ┌─ createElementBindingInvalid.js:4:5 - │ - 4 │ dangerouslySetInnerHTML: { __html: 'child' } - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ React.createElement('div', { + > 4 │ dangerouslySetInnerHTML: { __html: 'child' } + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ }); + 6 │ ! Setting content using code can expose users to cross-site scripting (XSS) attacks @@ -36,10 +37,10 @@ createElementBindingInvalid.js:8:5 lint/nursery/noDangerouslySetInnerHtml ━━ ! Avoid passing content using the dangerouslySetInnerHTML prop. - ┌─ createElementBindingInvalid.js:8:5 - │ - 8 │ dangerouslySetInnerHTML: { __html: 'child' } - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 7 │ createElement('div', { + > 8 │ dangerouslySetInnerHTML: { __html: 'child' } + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 9 │ }); ! Setting content using code can expose users to cross-site scripting (XSS) attacks diff --git a/crates/rome_js_analyze/tests/specs/nursery/noDangerouslySetInnerHtml/insideJsx.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/noDangerouslySetInnerHtml/insideJsx.jsx.snap index fa6190df77a..cfd4782f220 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noDangerouslySetInnerHtml/insideJsx.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noDangerouslySetInnerHtml/insideJsx.jsx.snap @@ -17,10 +17,11 @@ insideJsx.jsx:2:14 lint/nursery/noDangerouslySetInnerHtml ━━━━━━━ ! Avoid passing content using the dangerouslySetInnerHTML prop. - ┌─ insideJsx.jsx:2:14 - │ - 2 │ let a =
- │ ^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ // invalid + > 2 │ let a =
+ │ ^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ + 4 │ // valid ! Setting content using code can expose users to cross-site scripting (XSS) attacks diff --git a/crates/rome_js_analyze/tests/specs/nursery/noDangerouslySetInnerHtml/reactCreateElement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noDangerouslySetInnerHtml/reactCreateElement.js.snap index 5e3cb55948f..f640bb58d0c 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noDangerouslySetInnerHtml/reactCreateElement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noDangerouslySetInnerHtml/reactCreateElement.js.snap @@ -15,10 +15,10 @@ reactCreateElement.js:2:5 lint/nursery/noDangerouslySetInnerHtml ━━━━━ ! Avoid passing content using the dangerouslySetInnerHTML prop. - ┌─ reactCreateElement.js:2:5 - │ - 2 │ dangerouslySetInnerHTML: { __html: 'child' } - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ React.createElement('div', { + > 2 │ dangerouslySetInnerHTML: { __html: 'child' } + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ }); ! Setting content using code can expose users to cross-site scripting (XSS) attacks diff --git a/crates/rome_js_analyze/tests/specs/nursery/noNewSymbol.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noNewSymbol.js.snap index 3123adb6294..b62c033b36b 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noNewSymbol.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noNewSymbol.js.snap @@ -23,10 +23,12 @@ noNewSymbol.js:8:11 lint/nursery/noNewSymbol FIXABLE ━━━━━━━━ ! Symbol cannot be called as a constructor. - ┌─ noNewSymbol.js:8:11 - │ - 8 │ var foo = new Symbol('foo'); - │ ^^^^^^^^^^^^^^^^^ + 6 │ } + 7 │ // invalid + > 8 │ var foo = new Symbol('foo'); + │ ^^^^^^^^^^^^^^^^^ + 9 │ var foo2 = new Symbol(); + 10 │ var lorem = new Symbol() // comment i Suggested fix: Remove new. @@ -48,10 +50,12 @@ noNewSymbol.js:9:12 lint/nursery/noNewSymbol FIXABLE ━━━━━━━━ ! Symbol cannot be called as a constructor. - ┌─ noNewSymbol.js:9:12 - │ - 9 │ var foo2 = new Symbol(); - │ ^^^^^^^^^^^^ + 7 │ // invalid + 8 │ var foo = new Symbol('foo'); + > 9 │ var foo2 = new Symbol(); + │ ^^^^^^^^^^^^ + 10 │ var lorem = new Symbol() // comment + 11 │ var s = /* prefix_cmt */ new /* suffix_cmt */ Symbol() // comment i Suggested fix: Remove new. @@ -72,10 +76,11 @@ noNewSymbol.js:10:13 lint/nursery/noNewSymbol FIXABLE ━━━━━━━━ ! Symbol cannot be called as a constructor. - ┌─ noNewSymbol.js:10:13 - │ - 10 │ var lorem = new Symbol() // comment - │ ^^^^^^^^^^^^ + 8 │ var foo = new Symbol('foo'); + 9 │ var foo2 = new Symbol(); + > 10 │ var lorem = new Symbol() // comment + │ ^^^^^^^^^^^^ + 11 │ var s = /* prefix_cmt */ new /* suffix_cmt */ Symbol() // comment i Suggested fix: Remove new. @@ -95,10 +100,10 @@ noNewSymbol.js:11:26 lint/nursery/noNewSymbol FIXABLE ━━━━━━━━ ! Symbol cannot be called as a constructor. - ┌─ noNewSymbol.js:11:26 - │ - 11 │ var s = /* prefix_cmt */ new /* suffix_cmt */ Symbol() // comment - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 9 │ var foo2 = new Symbol(); + 10 │ var lorem = new Symbol() // comment + > 11 │ var s = /* prefix_cmt */ new /* suffix_cmt */ Symbol() // comment + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ i Suggested fix: Remove new. diff --git a/crates/rome_js_analyze/tests/specs/nursery/noRenderReturnValue.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/noRenderReturnValue.jsx.snap index 32c1a805846..f8f1644ac9e 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noRenderReturnValue.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noRenderReturnValue.jsx.snap @@ -36,10 +36,11 @@ noRenderReturnValue.jsx:2:11 lint/nursery/noRenderReturnValue ━━━━━━ ! Do not depend on the value returned by the function ReactDOM.render(). - ┌─ noRenderReturnValue.jsx:2:11 - │ - 2 │ const a = ReactDOM.render(
, document.body); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ // invalid + > 2 │ const a = ReactDOM.render(
, document.body); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ const foo = bar && ReactDOM.render(
, document.body); + 4 │ const foo = bar ? ReactDOM.render(
, document.body) : null i The returned value is legacy and future versions of react might return that value asynchronously. Check the React documentation for more information. @@ -52,10 +53,12 @@ noRenderReturnValue.jsx:3:20 lint/nursery/noRenderReturnValue ━━━━━━ ! Do not depend on the value returned by the function ReactDOM.render(). - ┌─ noRenderReturnValue.jsx:3:20 - │ - 3 │ const foo = bar && ReactDOM.render(
, document.body); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ // invalid + 2 │ const a = ReactDOM.render(
, document.body); + > 3 │ const foo = bar && ReactDOM.render(
, document.body); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ const foo = bar ? ReactDOM.render(
, document.body) : null + 5 │ const foo = () => ReactDOM.render(
, document.body); i The returned value is legacy and future versions of react might return that value asynchronously. Check the React documentation for more information. @@ -68,10 +71,12 @@ noRenderReturnValue.jsx:4:19 lint/nursery/noRenderReturnValue ━━━━━━ ! Do not depend on the value returned by the function ReactDOM.render(). - ┌─ noRenderReturnValue.jsx:4:19 - │ - 4 │ const foo = bar ? ReactDOM.render(
, document.body) : null - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ const a = ReactDOM.render(
, document.body); + 3 │ const foo = bar && ReactDOM.render(
, document.body); + > 4 │ const foo = bar ? ReactDOM.render(
, document.body) : null + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ const foo = () => ReactDOM.render(
, document.body); + 6 │ const foo = { i The returned value is legacy and future versions of react might return that value asynchronously. Check the React documentation for more information. @@ -84,10 +89,12 @@ noRenderReturnValue.jsx:5:19 lint/nursery/noRenderReturnValue ━━━━━━ ! Do not depend on the value returned by the function ReactDOM.render(). - ┌─ noRenderReturnValue.jsx:5:19 - │ - 5 │ const foo = () => ReactDOM.render(
, document.body); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ const foo = bar && ReactDOM.render(
, document.body); + 4 │ const foo = bar ? ReactDOM.render(
, document.body) : null + > 5 │ const foo = () => ReactDOM.render(
, document.body); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 6 │ const foo = { + 7 │ react: ReactDOM.render(
, document.body) i The returned value is legacy and future versions of react might return that value asynchronously. Check the React documentation for more information. @@ -100,10 +107,12 @@ noRenderReturnValue.jsx:7:12 lint/nursery/noRenderReturnValue ━━━━━━ ! Do not depend on the value returned by the function ReactDOM.render(). - ┌─ noRenderReturnValue.jsx:7:12 - │ - 7 │ react: ReactDOM.render(
, document.body) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ const foo = () => ReactDOM.render(
, document.body); + 6 │ const foo = { + > 7 │ react: ReactDOM.render(
, document.body) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 8 │ }; + 9 │ let lorem; i The returned value is legacy and future versions of react might return that value asynchronously. Check the React documentation for more information. @@ -116,10 +125,12 @@ noRenderReturnValue.jsx:10:9 lint/nursery/noRenderReturnValue ━━━━━━ ! Do not depend on the value returned by the function ReactDOM.render(). - ┌─ noRenderReturnValue.jsx:10:9 - │ - 10 │ lorem = ReactDOM.render(
, document.body); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 8 │ }; + 9 │ let lorem; + > 10 │ lorem = ReactDOM.render(
, document.body); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 │ function render () { + 12 │ return ReactDOM.render(
, document.body) i The returned value is legacy and future versions of react might return that value asynchronously. Check the React documentation for more information. @@ -132,10 +143,12 @@ noRenderReturnValue.jsx:12:12 lint/nursery/noRenderReturnValue ━━━━━ ! Do not depend on the value returned by the function ReactDOM.render(). - ┌─ noRenderReturnValue.jsx:12:12 - │ - 12 │ return ReactDOM.render(
, document.body) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 10 │ lorem = ReactDOM.render(
, document.body); + 11 │ function render () { + > 12 │ return ReactDOM.render(
, document.body) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 13 │ } + 14 │ i The returned value is legacy and future versions of react might return that value asynchronously. Check the React documentation for more information. diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUndeclaredVariables.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUndeclaredVariables.js.snap index 681a2fe4596..c3cf0a88b92 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUndeclaredVariables.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUndeclaredVariables.js.snap @@ -21,10 +21,11 @@ noUndeclaredVariables.js:2:1 lint/nursery/noUndeclaredVariables ━━━━━ ! The foobar variable is undeclared - ┌─ noUndeclaredVariables.js:2:1 - │ - 2 │ foobar; - │ ^^^^^^ + 1 │ // invalid + > 2 │ foobar; + │ ^^^^^^ + 3 │ function f() { + 4 │ lorem; ``` @@ -34,10 +35,12 @@ noUndeclaredVariables.js:4:5 lint/nursery/noUndeclaredVariables ━━━━━ ! The lorem variable is undeclared - ┌─ noUndeclaredVariables.js:4:5 - │ - 4 │ lorem; - │ ^^^^^ + 2 │ foobar; + 3 │ function f() { + > 4 │ lorem; + │ ^^^^^ + 5 │ } + 6 │ // valid ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/HighComplexity.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/HighComplexity.js.snap index ef4a7830c95..9ceda872fe4 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/HighComplexity.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/HighComplexity.js.snap @@ -254,10 +254,11 @@ HighComplexity.js:29:5 lint/nursery/noUnreachable ━━━━━━━━━━ ! This code is unreachable - ┌─ HighComplexity.js:29:5 - │ - 29 │ afterReturn(); - │ ^^^^^^^^^^^^^^ + 28 │ return; + > 29 │ afterReturn(); + │ ^^^^^^^^^^^^^^ + 30 │ } + 31 │ ``` @@ -267,10 +268,11 @@ HighComplexity.js:240:5 lint/nursery/noUnreachable ━━━━━━━━━ ! This code is unreachable - ┌─ HighComplexity.js:240:5 - │ - 240 │ afterReturn(); - │ ^^^^^^^^^^^^^^ + 239 │ return; + > 240 │ afterReturn(); + │ ^^^^^^^^^^^^^^ + 241 │ } + 242 │ ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsBreakStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsBreakStatement.js.snap index f6854a12a6e..47b1a449c8e 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsBreakStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsBreakStatement.js.snap @@ -28,17 +28,21 @@ JsBreakStatement.js:4:9 lint/nursery/noUnreachable ━━━━━━━━━ ! ... before it can reach this code - ┌─ JsBreakStatement.js:4:9 - │ - 4 │ break; // afterBreak - │ ^^^^^^ + 2 │ while (true) { + 3 │ break; + > 4 │ break; // afterBreak + │ ^^^^^^ + 5 │ } + 6 │ } i This statement will break the flow of the code ... - ┌─ JsBreakStatement.js:3:9 - │ - 3 │ break; - │ ^^^^^^ + 1 │ function JsBreakStatement1() { + 2 │ while (true) { + > 3 │ break; + │ ^^^^^^ + 4 │ break; // afterBreak + 5 │ } ``` @@ -50,17 +54,21 @@ JsBreakStatement.js:11:9 lint/nursery/noUnreachable ━━━━━━━━━ ! ... before it can reach this code - ┌─ JsBreakStatement.js:11:9 - │ - 11 │ continue; // afterBreak - │ ^^^^^^^^^ + 9 │ while (true) { + 10 │ break; + > 11 │ continue; // afterBreak + │ ^^^^^^^^^ + 12 │ } + 13 │ } i This statement will break the flow of the code ... - ┌─ JsBreakStatement.js:10:9 - │ - 10 │ break; - │ ^^^^^^ + 8 │ function JsBreakStatement2() { + 9 │ while (true) { + > 10 │ break; + │ ^^^^^^ + 11 │ continue; // afterBreak + 12 │ } ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsContinueStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsContinueStatement.js.snap index ec0664086aa..6c4c19f202c 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsContinueStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsContinueStatement.js.snap @@ -28,17 +28,21 @@ JsContinueStatement.js:4:9 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ JsContinueStatement.js:4:9 - │ - 4 │ continue; // afterContinue - │ ^^^^^^^^^ + 2 │ while (true) { + 3 │ continue; + > 4 │ continue; // afterContinue + │ ^^^^^^^^^ + 5 │ } + 6 │ } i This statement will continue the loop ... - ┌─ JsContinueStatement.js:3:9 - │ - 3 │ continue; - │ ^^^^^^^^^ + 1 │ function JsContinueStatement1() { + 2 │ while (true) { + > 3 │ continue; + │ ^^^^^^^^^ + 4 │ continue; // afterContinue + 5 │ } ``` @@ -50,17 +54,21 @@ JsContinueStatement.js:11:9 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ JsContinueStatement.js:11:9 - │ - 11 │ break; // afterContinue - │ ^^^^^^ + 9 │ while (true) { + 10 │ continue; + > 11 │ break; // afterContinue + │ ^^^^^^ + 12 │ } + 13 │ } i This statement will continue the loop ... - ┌─ JsContinueStatement.js:10:9 - │ - 10 │ continue; - │ ^^^^^^^^^ + 8 │ function JsContinueStatement2() { + 9 │ while (true) { + > 10 │ continue; + │ ^^^^^^^^^ + 11 │ break; // afterContinue + 12 │ } ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsDoWhileStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsDoWhileStatement.js.snap index 4b9a9463cf0..2c2bea478f0 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsDoWhileStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsDoWhileStatement.js.snap @@ -27,17 +27,21 @@ JsDoWhileStatement.js:4:14 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ JsDoWhileStatement.js:4:14 - │ - 4 │ } while (true); // afterBreak - │ ^^^^ + 2 │ do { + 3 │ break; + > 4 │ } while (true); // afterBreak + │ ^^^^ + 5 │ } + 6 │ i This statement will break the flow of the code ... - ┌─ JsDoWhileStatement.js:3:9 - │ - 3 │ break; - │ ^^^^^^ + 1 │ function JsDoWhileStatement1() { + 2 │ do { + > 3 │ break; + │ ^^^^^^ + 4 │ } while (true); // afterBreak + 5 │ } ``` @@ -49,17 +53,21 @@ JsDoWhileStatement.js:10:9 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ JsDoWhileStatement.js:10:9 - │ - 10 │ afterContinue(); - │ ^^^^^^^^^^^^^^^^ + 8 │ do { + 9 │ continue; + > 10 │ afterContinue(); + │ ^^^^^^^^^^^^^^^^ + 11 │ } while (true); + 12 │ } i This statement will continue the loop ... - ┌─ JsDoWhileStatement.js:9:9 - │ - 9 │ continue; - │ ^^^^^^^^^ + 7 │ function JsDoWhileStatement2() { + 8 │ do { + > 9 │ continue; + │ ^^^^^^^^^ + 10 │ afterContinue(); + 11 │ } while (true); ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsForInStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsForInStatement.js.snap index b7dce401f18..15a2c56bc8c 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsForInStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsForInStatement.js.snap @@ -28,17 +28,21 @@ JsForInStatement.js:4:9 lint/nursery/noUnreachable ━━━━━━━━━ ! ... before it can reach this code - ┌─ JsForInStatement.js:4:9 - │ - 4 │ afterBreak(); - │ ^^^^^^^^^^^^^ + 2 │ for (const key in value) { + 3 │ break; + > 4 │ afterBreak(); + │ ^^^^^^^^^^^^^ + 5 │ } + 6 │ } i This statement will break the flow of the code ... - ┌─ JsForInStatement.js:3:9 - │ - 3 │ break; - │ ^^^^^^ + 1 │ function JsForInStatement1() { + 2 │ for (const key in value) { + > 3 │ break; + │ ^^^^^^ + 4 │ afterBreak(); + 5 │ } ``` @@ -50,17 +54,21 @@ JsForInStatement.js:11:9 lint/nursery/noUnreachable ━━━━━━━━━ ! ... before it can reach this code - ┌─ JsForInStatement.js:11:9 - │ - 11 │ afterContinue(); - │ ^^^^^^^^^^^^^^^^ + 9 │ for (const key in value) { + 10 │ continue; + > 11 │ afterContinue(); + │ ^^^^^^^^^^^^^^^^ + 12 │ } + 13 │ } i This statement will continue the loop ... - ┌─ JsForInStatement.js:10:9 - │ - 10 │ continue; - │ ^^^^^^^^^ + 8 │ function JsForInStatement2() { + 9 │ for (const key in value) { + > 10 │ continue; + │ ^^^^^^^^^ + 11 │ afterContinue(); + 12 │ } ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsForOfStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsForOfStatement.js.snap index 926cc9f2597..0b2368bfc1f 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsForOfStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsForOfStatement.js.snap @@ -28,17 +28,21 @@ JsForOfStatement.js:4:9 lint/nursery/noUnreachable ━━━━━━━━━ ! ... before it can reach this code - ┌─ JsForOfStatement.js:4:9 - │ - 4 │ afterBreak(); - │ ^^^^^^^^^^^^^ + 2 │ for (const key of value) { + 3 │ break; + > 4 │ afterBreak(); + │ ^^^^^^^^^^^^^ + 5 │ } + 6 │ } i This statement will break the flow of the code ... - ┌─ JsForOfStatement.js:3:9 - │ - 3 │ break; - │ ^^^^^^ + 1 │ function JsForOfStatement1() { + 2 │ for (const key of value) { + > 3 │ break; + │ ^^^^^^ + 4 │ afterBreak(); + 5 │ } ``` @@ -50,17 +54,21 @@ JsForOfStatement.js:11:9 lint/nursery/noUnreachable ━━━━━━━━━ ! ... before it can reach this code - ┌─ JsForOfStatement.js:11:9 - │ - 11 │ afterContinue(); - │ ^^^^^^^^^^^^^^^^ + 9 │ for (const key of value) { + 10 │ continue; + > 11 │ afterContinue(); + │ ^^^^^^^^^^^^^^^^ + 12 │ } + 13 │ } i This statement will continue the loop ... - ┌─ JsForOfStatement.js:10:9 - │ - 10 │ continue; - │ ^^^^^^^^^ + 8 │ function JsForOfStatement2() { + 9 │ for (const key of value) { + > 10 │ continue; + │ ^^^^^^^^^ + 11 │ afterContinue(); + 12 │ } ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsForStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsForStatement.js.snap index 7c9b1f0efbd..4fbce3f2813 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsForStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsForStatement.js.snap @@ -20,17 +20,20 @@ JsForStatement.js:2:29 lint/nursery/noUnreachable ━━━━━━━━━━ ! This code will never be reached ... - ┌─ JsForStatement.js:2:29 - │ - 2 │ for (let i = 0; i < 10; ++i) { - │ ^^^ + 1 │ function JsForStatement1() { + > 2 │ for (let i = 0; i < 10; ++i) { + │ ^^^ + 3 │ break; + 4 │ } i ... because this statement will break the flow of the code beforehand - ┌─ JsForStatement.js:3:9 - │ - 3 │ break; - │ ^^^^^^ + 1 │ function JsForStatement1() { + 2 │ for (let i = 0; i < 10; ++i) { + > 3 │ break; + │ ^^^^^^ + 4 │ } + 5 │ } ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsIfStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsIfStatement.js.snap index 322de4bbe8d..6e9ebd071fd 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsIfStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsIfStatement.js.snap @@ -24,24 +24,30 @@ JsIfStatement.js:8:5 lint/nursery/noUnreachable ━━━━━━━━━━ ! ... before it can reach this code - ┌─ JsIfStatement.js:8:5 - │ - 8 │ afterIfElseReturn(); - │ ^^^^^^^^^^^^^^^^^^^^ + 6 │ } + 7 │ + > 8 │ afterIfElseReturn(); + │ ^^^^^^^^^^^^^^^^^^^^ + 9 │ } + 10 │ i Either this statement ... - ┌─ JsIfStatement.js:3:9 - │ - 3 │ return; - │ ^^^^^^^ + 1 │ function JsIfStatement1() { + 2 │ if (true) { + > 3 │ return; + │ ^^^^^^^ + 4 │ } else { + 5 │ return; i ... or this statement will return from the function ... - ┌─ JsIfStatement.js:5:9 - │ - 5 │ return; - │ ^^^^^^^ + 3 │ return; + 4 │ } else { + > 5 │ return; + │ ^^^^^^^ + 6 │ } + 7 │ ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsLabeledStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsLabeledStatement.js.snap index 9c5d9fb9467..5078ce52839 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsLabeledStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsLabeledStatement.js.snap @@ -36,24 +36,30 @@ JsLabeledStatement.js:9:9 lint/nursery/noUnreachable ━━━━━━━━━ ! ... before it can reach this code - ┌─ JsLabeledStatement.js:9:9 - │ - 9 │ afterLabelJump(); - │ ^^^^^^^^^^^^^^^^^ + 7 │ } + 8 │ + > 9 │ afterLabelJump(); + │ ^^^^^^^^^^^^^^^^^ + 10 │ } + 11 │ } i Either this statement will continue the loop ... - ┌─ JsLabeledStatement.js:4:13 - │ - 4 │ continue label; - │ ^^^^^^^^^^^^^^^ + 2 │ label: while (true) { + 3 │ if (true) { + > 4 │ continue label; + │ ^^^^^^^^^^^^^^^ + 5 │ } else { + 6 │ break label; i ... or this statement will break the flow of the code ... - ┌─ JsLabeledStatement.js:6:13 - │ - 6 │ break label; - │ ^^^^^^^^^^^^ + 4 │ continue label; + 5 │ } else { + > 6 │ break label; + │ ^^^^^^^^^^^^ + 7 │ } + 8 │ ``` @@ -65,17 +71,21 @@ JsLabeledStatement.js:17:9 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ JsLabeledStatement.js:17:9 - │ - 17 │ afterBreak(); - │ ^^^^^^^^^^^^^ + 15 │ beforeBreak(); + 16 │ break label; + > 17 │ afterBreak(); + │ ^^^^^^^^^^^^^ + 18 │ } + 19 │ i This statement will break the flow of the code ... - ┌─ JsLabeledStatement.js:16:9 - │ - 16 │ break label; - │ ^^^^^^^^^^^^ + 14 │ label: { + 15 │ beforeBreak(); + > 16 │ break label; + │ ^^^^^^^^^^^^ + 17 │ afterBreak(); + 18 │ } ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsReturnStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsReturnStatement.js.snap index 6d6f42b2d36..c39176add31 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsReturnStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsReturnStatement.js.snap @@ -24,17 +24,20 @@ JsReturnStatement.js:3:5 lint/nursery/noUnreachable ━━━━━━━━━ ! ... before it can reach this code - ┌─ JsReturnStatement.js:3:5 - │ - 3 │ afterReturn(); - │ ^^^^^^^^^^^^^^ + 1 │ function JsReturnStatement1() { + 2 │ return; + > 3 │ afterReturn(); + │ ^^^^^^^^^^^^^^ + 4 │ } + 5 │ i This statement will return from the function ... - ┌─ JsReturnStatement.js:2:5 - │ - 2 │ return; - │ ^^^^^^^ + 1 │ function JsReturnStatement1() { + > 2 │ return; + │ ^^^^^^^ + 3 │ afterReturn(); + 4 │ } ``` @@ -46,17 +49,20 @@ JsReturnStatement.js:8:5 lint/nursery/noUnreachable ━━━━━━━━━ ! ... before it can reach this code - ┌─ JsReturnStatement.js:8:5 - │ - 8 │ return; // afterReturn - │ ^^^^^^^ + 6 │ function JsReturnStatement2() { + 7 │ return; + > 8 │ return; // afterReturn + │ ^^^^^^^ + 9 │ } + 10 │ i This statement will return from the function ... - ┌─ JsReturnStatement.js:7:5 - │ - 7 │ return; - │ ^^^^^^^ + 6 │ function JsReturnStatement2() { + > 7 │ return; + │ ^^^^^^^ + 8 │ return; // afterReturn + 9 │ } ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsSwitchStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsSwitchStatement.js.snap index e62c35d2651..1f12ef0b26a 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsSwitchStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsSwitchStatement.js.snap @@ -35,17 +35,21 @@ JsSwitchStatement.js:18:13 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ JsSwitchStatement.js:18:13 - │ - 18 │ afterBreak(); - │ ^^^^^^^^^^^^^ + 16 │ case 0: + 17 │ break; + > 18 │ afterBreak(); + │ ^^^^^^^^^^^^^ + 19 │ } + 20 │ } i This statement will break the flow of the code ... - ┌─ JsSwitchStatement.js:17:13 - │ - 17 │ break; - │ ^^^^^^ + 15 │ switch (value) { + 16 │ case 0: + > 17 │ break; + │ ^^^^^^ + 18 │ afterBreak(); + 19 │ } ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsThrowStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsThrowStatement.js.snap index 849a58512d7..57543290edd 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsThrowStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsThrowStatement.js.snap @@ -19,17 +19,20 @@ JsThrowStatement.js:3:5 lint/nursery/noUnreachable ━━━━━━━━━ ! ... before it can reach this code - ┌─ JsThrowStatement.js:3:5 - │ - 3 │ afterThrow(); - │ ^^^^^^^^^^^^^ + 1 │ function JsThrowStatement1() { + 2 │ throw new Error(); + > 3 │ afterThrow(); + │ ^^^^^^^^^^^^^ + 4 │ } + 5 │ i This statement will throw an exception ... - ┌─ JsThrowStatement.js:2:5 - │ - 2 │ throw new Error(); - │ ^^^^^^^^^^^^^^^^^^ + 1 │ function JsThrowStatement1() { + > 2 │ throw new Error(); + │ ^^^^^^^^^^^^^^^^^^ + 3 │ afterThrow(); + 4 │ } ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsTryFinallyStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsTryFinallyStatement.js.snap index e6cfec5bfd2..75659c4187b 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsTryFinallyStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsTryFinallyStatement.js.snap @@ -75,17 +75,21 @@ JsTryFinallyStatement.js:11:5 lint/nursery/noUnreachable ━━━━━━━ ! ... before it can reach this code - ┌─ JsTryFinallyStatement.js:11:5 - │ - 11 │ afterFinallyReturn(); - │ ^^^^^^^^^^^^^^^^^^^^^ + 9 │ } + 10 │ + > 11 │ afterFinallyReturn(); + │ ^^^^^^^^^^^^^^^^^^^^^ + 12 │ } + 13 │ i This statement will return from the function ... - ┌─ JsTryFinallyStatement.js:8:9 - │ - 8 │ return; - │ ^^^^^^^ + 6 │ } finally { + 7 │ finallyClause(); + > 8 │ return; + │ ^^^^^^^ + 9 │ } + 10 │ ``` @@ -97,17 +101,19 @@ JsTryFinallyStatement.js:18:9 lint/nursery/noUnreachable ━━━━━━━ ! ... before it can reach this code - ┌─ JsTryFinallyStatement.js:18:9 - │ - 18 │ tryBlock(); - │ ^^^^^^^^^^^ + 17 │ try { + > 18 │ tryBlock(); + │ ^^^^^^^^^^^ + 19 │ } catch (err) { + 20 │ catchClause(); i This statement will return from the function ... - ┌─ JsTryFinallyStatement.js:15:5 - │ - 15 │ return; - │ ^^^^^^^ + 14 │ function JsTryFinallyStatement2() { + > 15 │ return; + │ ^^^^^^^ + 16 │ + 17 │ try { ``` @@ -119,17 +125,20 @@ JsTryFinallyStatement.js:20:9 lint/nursery/noUnreachable ━━━━━━━ ! ... before it can reach this code - ┌─ JsTryFinallyStatement.js:20:9 - │ - 20 │ catchClause(); - │ ^^^^^^^^^^^^^^ + 18 │ tryBlock(); + 19 │ } catch (err) { + > 20 │ catchClause(); + │ ^^^^^^^^^^^^^^ + 21 │ } finally { + 22 │ finallyClause(); i This statement will return from the function ... - ┌─ JsTryFinallyStatement.js:15:5 - │ - 15 │ return; - │ ^^^^^^^ + 14 │ function JsTryFinallyStatement2() { + > 15 │ return; + │ ^^^^^^^ + 16 │ + 17 │ try { ``` @@ -141,17 +150,20 @@ JsTryFinallyStatement.js:22:9 lint/nursery/noUnreachable ━━━━━━━ ! ... before it can reach this code - ┌─ JsTryFinallyStatement.js:22:9 - │ - 22 │ finallyClause(); - │ ^^^^^^^^^^^^^^^^ + 20 │ catchClause(); + 21 │ } finally { + > 22 │ finallyClause(); + │ ^^^^^^^^^^^^^^^^ + 23 │ } + 24 │ } i This statement will return from the function ... - ┌─ JsTryFinallyStatement.js:15:5 - │ - 15 │ return; - │ ^^^^^^^ + 14 │ function JsTryFinallyStatement2() { + > 15 │ return; + │ ^^^^^^^ + 16 │ + 17 │ try { ``` @@ -163,17 +175,21 @@ JsTryFinallyStatement.js:35:9 lint/nursery/noUnreachable ━━━━━━━ ! ... before it can reach this code - ┌─ JsTryFinallyStatement.js:35:9 - │ - 35 │ afterTryStatement1(); - │ ^^^^^^^^^^^^^^^^^^^^^ + 33 │ } + 34 │ + > 35 │ afterTryStatement1(); + │ ^^^^^^^^^^^^^^^^^^^^^ + 36 │ } catch (err) { + 37 │ catchClause2(); i This statement will return from the function ... - ┌─ JsTryFinallyStatement.js:32:13 - │ - 32 │ return; - │ ^^^^^^^ + 30 │ } catch { + 31 │ } finally { + > 32 │ return; + │ ^^^^^^^ + 33 │ } + 34 │ ``` @@ -185,17 +201,21 @@ JsTryFinallyStatement.js:37:9 lint/nursery/noUnreachable ━━━━━━━ ! ... before it can reach this code - ┌─ JsTryFinallyStatement.js:37:9 - │ - 37 │ catchClause2(); - │ ^^^^^^^^^^^^^^^ + 35 │ afterTryStatement1(); + 36 │ } catch (err) { + > 37 │ catchClause2(); + │ ^^^^^^^^^^^^^^^ + 38 │ } + 39 │ i This statement will return from the function ... - ┌─ JsTryFinallyStatement.js:32:13 - │ - 32 │ return; - │ ^^^^^^^ + 30 │ } catch { + 31 │ } finally { + > 32 │ return; + │ ^^^^^^^ + 33 │ } + 34 │ ``` @@ -207,17 +227,21 @@ JsTryFinallyStatement.js:40:5 lint/nursery/noUnreachable ━━━━━━━ ! ... before it can reach this code - ┌─ JsTryFinallyStatement.js:40:5 - │ - 40 │ afterTryStatement2(); - │ ^^^^^^^^^^^^^^^^^^^^^ + 38 │ } + 39 │ + > 40 │ afterTryStatement2(); + │ ^^^^^^^^^^^^^^^^^^^^^ + 41 │ } + 42 │ i This statement will return from the function ... - ┌─ JsTryFinallyStatement.js:32:13 - │ - 32 │ return; - │ ^^^^^^^ + 30 │ } catch { + 31 │ } finally { + > 32 │ return; + │ ^^^^^^^ + 33 │ } + 34 │ ``` @@ -229,17 +253,21 @@ JsTryFinallyStatement.js:59:5 lint/nursery/noUnreachable ━━━━━━━ ! ... before it can reach this code - ┌─ JsTryFinallyStatement.js:59:5 - │ - 59 │ afterTryStatement(); - │ ^^^^^^^^^^^^^^^^^^^^ + 57 │ } + 58 │ + > 59 │ afterTryStatement(); + │ ^^^^^^^^^^^^^^^^^^^^ + 60 │ } + 61 │ i This statement will return from the function ... - ┌─ JsTryFinallyStatement.js:46:9 - │ - 46 │ return; - │ ^^^^^^^ + 44 │ try { + 45 │ tryBlock1(); + > 46 │ return; + │ ^^^^^^^ + 47 │ } catch { + 48 │ return; ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsTryStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsTryStatement.js.snap index f4d7d2ead21..1108402e370 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsTryStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsTryStatement.js.snap @@ -54,24 +54,30 @@ JsTryStatement.js:10:5 lint/nursery/noUnreachable ━━━━━━━━━━ ! ... before it can reach this code - ┌─ JsTryStatement.js:10:5 - │ - 10 │ afterTryCatchReturn(); - │ ^^^^^^^^^^^^^^^^^^^^^^ + 8 │ } + 9 │ + > 10 │ afterTryCatchReturn(); + │ ^^^^^^^^^^^^^^^^^^^^^^ + 11 │ } + 12 │ i Either this statement ... - ┌─ JsTryStatement.js:4:9 - │ - 4 │ return; - │ ^^^^^^^ + 2 │ try { + 3 │ tryBlock(); + > 4 │ return; + │ ^^^^^^^ + 5 │ } catch (err) { + 6 │ catchClause(); i ... or this statement will return from the function ... - ┌─ JsTryStatement.js:7:9 - │ - 7 │ return; - │ ^^^^^^^ + 5 │ } catch (err) { + 6 │ catchClause(); + > 7 │ return; + │ ^^^^^^^ + 8 │ } + 9 │ ``` @@ -83,17 +89,19 @@ JsTryStatement.js:28:9 lint/nursery/noUnreachable ━━━━━━━━━━ ! ... before it can reach this code - ┌─ JsTryStatement.js:28:9 - │ - 28 │ tryBlock(); - │ ^^^^^^^^^^^ + 27 │ try { + > 28 │ tryBlock(); + │ ^^^^^^^^^^^ + 29 │ } catch (err) { + 30 │ catchClause(); i This statement will return from the function ... - ┌─ JsTryStatement.js:25:5 - │ - 25 │ return; - │ ^^^^^^^ + 24 │ function JsTryStatement3() { + > 25 │ return; + │ ^^^^^^^ + 26 │ + 27 │ try { ``` @@ -105,17 +113,20 @@ JsTryStatement.js:30:9 lint/nursery/noUnreachable ━━━━━━━━━━ ! ... before it can reach this code - ┌─ JsTryStatement.js:30:9 - │ - 30 │ catchClause(); - │ ^^^^^^^^^^^^^^ + 28 │ tryBlock(); + 29 │ } catch (err) { + > 30 │ catchClause(); + │ ^^^^^^^^^^^^^^ + 31 │ } + 32 │ } i This statement will return from the function ... - ┌─ JsTryStatement.js:25:5 - │ - 25 │ return; - │ ^^^^^^^ + 24 │ function JsTryStatement3() { + > 25 │ return; + │ ^^^^^^^ + 26 │ + 27 │ try { ``` @@ -125,10 +136,12 @@ JsTryStatement.js:37:9 lint/nursery/noUnreachable ━━━━━━━━━━ ! This code is unreachable - ┌─ JsTryStatement.js:37:9 - │ - 37 │ catchClause(); - │ ^^^^^^^^^^^^^^ + 35 │ try { + 36 │ } catch (err) { + > 37 │ catchClause(); + │ ^^^^^^^^^^^^^^ + 38 │ } + 39 │ } ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsVariableStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsVariableStatement.js.snap index 62bb160e3f8..b9afed50f4a 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsVariableStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsVariableStatement.js.snap @@ -45,17 +45,20 @@ JsVariableStatement.js:8:20 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ JsVariableStatement.js:8:20 - │ - 8 │ var variable = initializer(); - │ ^^^^^^^^^^^^^ + 6 │ function JsVariableStatement2() { + 7 │ return; + > 8 │ var variable = initializer(); + │ ^^^^^^^^^^^^^ + 9 │ } + 10 │ i This statement will return from the function ... - ┌─ JsVariableStatement.js:7:5 - │ - 7 │ return; - │ ^^^^^^^ + 6 │ function JsVariableStatement2() { + > 7 │ return; + │ ^^^^^^^ + 8 │ var variable = initializer(); + 9 │ } ``` @@ -67,17 +70,20 @@ JsVariableStatement.js:18:20 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ JsVariableStatement.js:18:20 - │ - 18 │ let variable = initializer(); - │ ^^^^^^^^^^^^^ + 16 │ function JsVariableStatement4() { + 17 │ return; + > 18 │ let variable = initializer(); + │ ^^^^^^^^^^^^^ + 19 │ } + 20 │ i This statement will return from the function ... - ┌─ JsVariableStatement.js:17:5 - │ - 17 │ return; - │ ^^^^^^^ + 16 │ function JsVariableStatement4() { + > 17 │ return; + │ ^^^^^^^ + 18 │ let variable = initializer(); + 19 │ } ``` @@ -89,17 +95,20 @@ JsVariableStatement.js:23:22 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ JsVariableStatement.js:23:22 - │ - 23 │ const variable = initializer(); - │ ^^^^^^^^^^^^^ + 21 │ function JsVariableStatement5() { + 22 │ return; + > 23 │ const variable = initializer(); + │ ^^^^^^^^^^^^^ + 24 │ } + 25 │ i This statement will return from the function ... - ┌─ JsVariableStatement.js:22:5 - │ - 22 │ return; - │ ^^^^^^^ + 21 │ function JsVariableStatement5() { + > 22 │ return; + │ ^^^^^^^ + 23 │ const variable = initializer(); + 24 │ } ``` @@ -111,17 +120,20 @@ JsVariableStatement.js:28:21 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ JsVariableStatement.js:28:21 - │ - 28 │ var variable1 = initializer(), - │ ^^^^^^^^^^^^^ + 26 │ function JsVariableStatement6() { + 27 │ return; + > 28 │ var variable1 = initializer(), + │ ^^^^^^^^^^^^^ + 29 │ variable2 = initializer(); + 30 │ } i This statement will return from the function ... - ┌─ JsVariableStatement.js:27:5 - │ - 27 │ return; - │ ^^^^^^^ + 26 │ function JsVariableStatement6() { + > 27 │ return; + │ ^^^^^^^ + 28 │ var variable1 = initializer(), + 29 │ variable2 = initializer(); ``` @@ -133,17 +145,20 @@ JsVariableStatement.js:29:21 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ JsVariableStatement.js:29:21 - │ - 29 │ variable2 = initializer(); - │ ^^^^^^^^^^^^^ + 27 │ return; + 28 │ var variable1 = initializer(), + > 29 │ variable2 = initializer(); + │ ^^^^^^^^^^^^^ + 30 │ } + 31 │ i This statement will return from the function ... - ┌─ JsVariableStatement.js:27:5 - │ - 27 │ return; - │ ^^^^^^^ + 26 │ function JsVariableStatement6() { + > 27 │ return; + │ ^^^^^^^ + 28 │ var variable1 = initializer(), + 29 │ variable2 = initializer(); ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsWhileStatement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsWhileStatement.js.snap index 732fdb97e67..7a4d886c1c2 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsWhileStatement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/JsWhileStatement.js.snap @@ -21,17 +21,21 @@ JsWhileStatement.js:4:9 lint/nursery/noUnreachable ━━━━━━━━━ ! ... before it can reach this code - ┌─ JsWhileStatement.js:4:9 - │ - 4 │ afterBreak(); - │ ^^^^^^^^^^^^^ + 2 │ while (true) { + 3 │ break; + > 4 │ afterBreak(); + │ ^^^^^^^^^^^^^ + 5 │ } + 6 │ } i This statement will break the flow of the code ... - ┌─ JsWhileStatement.js:3:9 - │ - 3 │ break; - │ ^^^^^^ + 1 │ function JsWhileStatement1() { + 2 │ while (true) { + > 3 │ break; + │ ^^^^^^ + 4 │ afterBreak(); + 5 │ } ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/SuppressionComments.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/SuppressionComments.js.snap index 2ba6c1ebb79..2799095f768 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/SuppressionComments.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/SuppressionComments.js.snap @@ -28,17 +28,21 @@ SuppressionComments.js:5:5 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ SuppressionComments.js:5:5 - │ - 5 │ afterReturn(); - │ ^^^^^^^^^^^^^^ + 3 │ beforeReturn(); + 4 │ return; + > 5 │ afterReturn(); + │ ^^^^^^^^^^^^^^ + 6 │ } + 7 │ i This statement will return from the function ... - ┌─ SuppressionComments.js:4:5 - │ - 4 │ return; - │ ^^^^^^^ + 2 │ function SuppressionComments1() { + 3 │ beforeReturn(); + > 4 │ return; + │ ^^^^^^^ + 5 │ afterReturn(); + 6 │ } ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/TerminatorsPlurals.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/TerminatorsPlurals.js.snap index 1b5b67cdcee..1afbcd97ec0 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/TerminatorsPlurals.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnreachable/TerminatorsPlurals.js.snap @@ -67,20 +67,24 @@ TerminatorsPlurals.js:3:5 lint/nursery/noUnreachable ━━━━━━━━━ ! ... before it can reach this code - ┌─ TerminatorsPlurals.js:3:5 - │ - 3 │ ┌ Statement1(); - 4 │ │ Statement2(); - 5 │ │ Statement3(); - 6 │ │ Statement4(); - │ └─────────────────^ + 1 │ function TerminatorsPlural1() { + 2 │ return; + > 3 │ Statement1(); + │ ^^^^^^^^^^^^^ + > 4 │ Statement2(); + > 5 │ Statement3(); + > 6 │ Statement4(); + │ ^^^^^^^^^^^^^ + 7 │ } + 8 │ i This statement will return from the function ... - ┌─ TerminatorsPlurals.js:2:5 - │ - 2 │ return; - │ ^^^^^^^ + 1 │ function TerminatorsPlural1() { + > 2 │ return; + │ ^^^^^^^ + 3 │ Statement1(); + 4 │ Statement2(); ``` @@ -92,27 +96,34 @@ TerminatorsPlurals.js:16:5 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ TerminatorsPlurals.js:16:5 - │ - 16 │ ┌ Statement1(); - 17 │ │ Statement2(); - 18 │ │ Statement3(); - 19 │ │ Statement4(); - │ └─────────────────^ + 14 │ } + 15 │ + > 16 │ Statement1(); + │ ^^^^^^^^^^^^^ + > 17 │ Statement2(); + > 18 │ Statement3(); + > 19 │ Statement4(); + │ ^^^^^^^^^^^^^ + 20 │ } + 21 │ i Either this statement ... - ┌─ TerminatorsPlurals.js:11:9 - │ - 11 │ return; - │ ^^^^^^^ + 9 │ function TerminatorsPlural2() { + 10 │ if (a) { + > 11 │ return; + │ ^^^^^^^ + 12 │ } else { + 13 │ return; i ... or this statement will return from the function ... - ┌─ TerminatorsPlurals.js:13:9 - │ - 13 │ return; - │ ^^^^^^^ + 11 │ return; + 12 │ } else { + > 13 │ return; + │ ^^^^^^^ + 14 │ } + 15 │ ``` @@ -124,34 +135,43 @@ TerminatorsPlurals.js:31:5 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ TerminatorsPlurals.js:31:5 - │ - 31 │ ┌ Statement1(); - 32 │ │ Statement2(); - 33 │ │ Statement3(); - 34 │ │ Statement4(); - │ └─────────────────^ + 29 │ } + 30 │ + > 31 │ Statement1(); + │ ^^^^^^^^^^^^^ + > 32 │ Statement2(); + > 33 │ Statement3(); + > 34 │ Statement4(); + │ ^^^^^^^^^^^^^ + 35 │ } + 36 │ i Either this statement, ... - ┌─ TerminatorsPlurals.js:24:9 - │ - 24 │ return; - │ ^^^^^^^ + 22 │ function TerminatorsPlural3() { + 23 │ if (a) { + > 24 │ return; + │ ^^^^^^^ + 25 │ } else if (b) { + 26 │ return; i ... this statement, ... - ┌─ TerminatorsPlurals.js:26:9 - │ - 26 │ return; - │ ^^^^^^^ + 24 │ return; + 25 │ } else if (b) { + > 26 │ return; + │ ^^^^^^^ + 27 │ } else { + 28 │ return; i ... or this statement will return from the function ... - ┌─ TerminatorsPlurals.js:28:9 - │ - 28 │ return; - │ ^^^^^^^ + 26 │ return; + 27 │ } else { + > 28 │ return; + │ ^^^^^^^ + 29 │ } + 30 │ ``` @@ -163,41 +183,52 @@ TerminatorsPlurals.js:48:5 lint/nursery/noUnreachable ━━━━━━━━ ! ... before it can reach this code - ┌─ TerminatorsPlurals.js:48:5 - │ - 48 │ ┌ Statement1(); - 49 │ │ Statement2(); - 50 │ │ Statement3(); - 51 │ │ Statement4(); - │ └─────────────────^ + 46 │ } + 47 │ + > 48 │ Statement1(); + │ ^^^^^^^^^^^^^ + > 49 │ Statement2(); + > 50 │ Statement3(); + > 51 │ Statement4(); + │ ^^^^^^^^^^^^^ + 52 │ } + 53 │ i Either this statement, ... - ┌─ TerminatorsPlurals.js:39:9 - │ - 39 │ return; - │ ^^^^^^^ + 37 │ function TerminatorsPlural4() { + 38 │ if (a) { + > 39 │ return; + │ ^^^^^^^ + 40 │ } else if (b) { + 41 │ return; i ... this statement, ... - ┌─ TerminatorsPlurals.js:41:9 - │ - 41 │ return; - │ ^^^^^^^ + 39 │ return; + 40 │ } else if (b) { + > 41 │ return; + │ ^^^^^^^ + 42 │ } else if (c) { + 43 │ return; i ... this statement, ... - ┌─ TerminatorsPlurals.js:43:9 - │ - 43 │ return; - │ ^^^^^^^ + 41 │ return; + 42 │ } else if (c) { + > 43 │ return; + │ ^^^^^^^ + 44 │ } else { + 45 │ return; i ... or this statement will return from the function ... - ┌─ TerminatorsPlurals.js:45:9 - │ - 45 │ return; - │ ^^^^^^^ + 43 │ return; + 44 │ } else { + > 45 │ return; + │ ^^^^^^^ + 46 │ } + 47 │ ``` diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnusedVariables/noUnusedVariables.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnusedVariables/noUnusedVariables.js.snap index d089f7666ec..417728c889f 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnusedVariables/noUnusedVariables.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnusedVariables/noUnusedVariables.js.snap @@ -68,10 +68,12 @@ noUnusedVariables.js:3:7 lint/nursery/noUnusedVariables ━━━━━━━━ ! This variable is unused. - ┌─ noUnusedVariables.js:3:7 - │ - 3 │ const a = 1; - │ ^ + 1 │ import React from 'react'; + 2 │ + > 3 │ const a = 1; + │ ^ + 4 │ const b = 2, + 5 │ c = 3; i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -83,10 +85,11 @@ noUnusedVariables.js:4:7 lint/nursery/noUnusedVariables ━━━━━━━━ ! This variable is unused. - ┌─ noUnusedVariables.js:4:7 - │ - 4 │ const b = 2, - │ ^ + 3 │ const a = 1; + > 4 │ const b = 2, + │ ^ + 5 │ c = 3; + 6 │ console.log(c); i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -98,10 +101,12 @@ noUnusedVariables.js:8:10 lint/nursery/noUnusedVariables ━━━━━━━ ! This function is unused. - ┌─ noUnusedVariables.js:8:10 - │ - 8 │ function f1() {} - │ ^^ + 6 │ console.log(c); + 7 │ + > 8 │ function f1() {} + │ ^^ + 9 │ + 10 │ function f2() { i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -113,10 +118,12 @@ noUnusedVariables.js:10:10 lint/nursery/noUnusedVariables ━━━━━━━ ! This function is unused. - ┌─ noUnusedVariables.js:10:10 - │ - 10 │ function f2() { - │ ^^ + 8 │ function f1() {} + 9 │ + > 10 │ function f2() { + │ ^^ + 11 │ f2(); + 12 │ } i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -128,10 +135,12 @@ noUnusedVariables.js:14:10 lint/nursery/noUnusedVariables ━━━━━━━ ! This function is unused. - ┌─ noUnusedVariables.js:14:10 - │ - 14 │ function f3() { - │ ^^ + 12 │ } + 13 │ + > 14 │ function f3() { + │ ^^ + 15 │ function g() { + 16 │ f3(); i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -143,10 +152,12 @@ noUnusedVariables.js:21:14 lint/nursery/noUnusedVariables ━━━━━━━ ! This parameter is unused. - ┌─ noUnusedVariables.js:21:14 - │ - 21 │ function f41(a) {} - │ ^ + 19 │ } + 20 │ + > 21 │ function f41(a) {} + │ ^ + 22 │ f41(); + 23 │ i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -158,10 +169,12 @@ noUnusedVariables.js:24:17 lint/nursery/noUnusedVariables ━━━━━━━ ! This parameter is unused. - ┌─ noUnusedVariables.js:24:17 - │ - 24 │ function f42(a, b) { - │ ^ + 22 │ f41(); + 23 │ + > 24 │ function f42(a, b) { + │ ^ + 25 │ console.log(a); + 26 │ } i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -173,10 +186,12 @@ noUnusedVariables.js:29:17 lint/nursery/noUnusedVariables ━━━━━━━ ! This parameter is unused. - ┌─ noUnusedVariables.js:29:17 - │ - 29 │ function f43(a, b) { - │ ^ + 27 │ f42(); + 28 │ + > 29 │ function f43(a, b) { + │ ^ + 30 │ console.log(a); + 31 │ } i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -188,10 +203,12 @@ noUnusedVariables.js:34:7 lint/nursery/noUnusedVariables ━━━━━━━ ! This variable is unused. - ┌─ noUnusedVariables.js:34:7 - │ - 34 │ const f5 = () => {}; - │ ^^ + 32 │ f43(); + 33 │ + > 34 │ const f5 = () => {}; + │ ^^ + 35 │ + 36 │ const f6 = () => { i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -203,10 +220,12 @@ noUnusedVariables.js:36:7 lint/nursery/noUnusedVariables ━━━━━━━ ! This variable is unused. - ┌─ noUnusedVariables.js:36:7 - │ - 36 │ const f6 = () => { - │ ^^ + 34 │ const f5 = () => {}; + 35 │ + > 36 │ const f6 = () => { + │ ^^ + 37 │ f6(); + 38 │ }; i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -218,10 +237,11 @@ noUnusedVariables.js:41:10 lint/nursery/noUnusedVariables ━━━━━━━ ! This variable is unused. - ┌─ noUnusedVariables.js:41:10 - │ - 41 │ } catch (e) {} - │ ^ + 40 │ try { + > 41 │ } catch (e) {} + │ ^ + 42 │ + 43 │ export function exported_function() {} i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUnusedVariables/noUnusedVariables.ts.snap b/crates/rome_js_analyze/tests/specs/nursery/noUnusedVariables/noUnusedVariables.ts.snap index 24635703a27..7f4e9404665 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUnusedVariables/noUnusedVariables.ts.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUnusedVariables/noUnusedVariables.ts.snap @@ -63,10 +63,11 @@ noUnusedVariables.ts:4:14 lint/nursery/noUnusedVariables ━━━━━━━ ! This parameter is unused. - ┌─ noUnusedVariables.ts:4:14 - │ - 4 │ constructor(a: number) {} - │ ^ + 3 │ class D { + > 4 │ constructor(a: number) {} + │ ^ + 5 │ f(a: number) {} + 6 │ set a(a: number) {} i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -78,10 +79,12 @@ noUnusedVariables.ts:5:4 lint/nursery/noUnusedVariables ━━━━━━━━ ! This parameter is unused. - ┌─ noUnusedVariables.ts:5:4 - │ - 5 │ f(a: number) {} - │ ^ + 3 │ class D { + 4 │ constructor(a: number) {} + > 5 │ f(a: number) {} + │ ^ + 6 │ set a(a: number) {} + 7 │ } i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -93,10 +96,12 @@ noUnusedVariables.ts:6:8 lint/nursery/noUnusedVariables ━━━━━━━━ ! This parameter is unused. - ┌─ noUnusedVariables.ts:6:8 - │ - 6 │ set a(a: number) {} - │ ^ + 4 │ constructor(a: number) {} + 5 │ f(a: number) {} + > 6 │ set a(a: number) {} + │ ^ + 7 │ } + 8 │ console.log(new D()); i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -108,10 +113,12 @@ noUnusedVariables.ts:12:10 lint/nursery/noUnusedVariables ━━━━━━━ ! This function is unused. - ┌─ noUnusedVariables.ts:12:10 - │ - 12 │ function unused_overloaded(s?: string) { - │ ^^^^^^^^^^^^^^^^^ + 10 │ function unused_overloaded(): number; + 11 │ function unused_overloaded(s: string): string; + > 12 │ function unused_overloaded(s?: string) { + │ ^^^^^^^^^^^^^^^^^ + 13 │ return s; + 14 │ } i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/fromImportInvalid.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/fromImportInvalid.jsx.snap index 6e3419a00c1..8de7818684a 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/fromImportInvalid.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/fromImportInvalid.jsx.snap @@ -19,10 +19,11 @@ fromImportInvalid.jsx:4:5 lint/nursery/noUselessFragments FIXABLE ━━━━ ! Avoid using unnecessary Fragment. - ┌─ fromImportInvalid.jsx:4:5 - │ - 4 │ - │ ^^^^^^^^^^^^^^^^^^^^^ + 3 │ <> + > 4 │ + │ ^^^^^^^^^^^^^^^^^^^^^ + 5 │ + 6 │ i Suggested fix: Remove the Fragment @@ -43,10 +44,12 @@ fromImportInvalid.jsx:5:5 lint/nursery/noUselessFragments FIXABLE ━━━━ ! Avoid using unnecessary Fragment. - ┌─ fromImportInvalid.jsx:5:5 - │ - 5 │ - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ <> + 4 │ + > 5 │ + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 6 │ + 7 │ i Suggested fix: Remove the Fragment diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/fromImportNamespaceInvalid.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/fromImportNamespaceInvalid.jsx.snap index f97513a2ac5..0606d0b92dc 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/fromImportNamespaceInvalid.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/fromImportNamespaceInvalid.jsx.snap @@ -18,10 +18,11 @@ fromImportNamespaceInvalid.jsx:4:5 lint/nursery/noUselessFragments FIXABLE ━ ! Avoid using unnecessary Fragment. - ┌─ fromImportNamespaceInvalid.jsx:4:5 - │ - 4 │ foo - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ <> + > 4 │ foo + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ + 6 │ i Suggested fix: Remove the Fragment diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/fromImportRenameInvalid.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/fromImportRenameInvalid.jsx.snap index 6966184f4eb..3672f0f09a0 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/fromImportRenameInvalid.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/fromImportRenameInvalid.jsx.snap @@ -19,10 +19,11 @@ fromImportRenameInvalid.jsx:4:5 lint/nursery/noUselessFragments FIXABLE ━━ ! Avoid using unnecessary Fragment. - ┌─ fromImportRenameInvalid.jsx:4:5 - │ - 4 │ - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ <> + > 4 │ + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ foo + 6 │ i Suggested fix: Remove the Fragment @@ -43,10 +44,12 @@ fromImportRenameInvalid.jsx:5:5 lint/nursery/noUselessFragments FIXABLE ━━ ! Avoid using unnecessary Fragment. - ┌─ fromImportRenameInvalid.jsx:5:5 - │ - 5 │ foo - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ <> + 4 │ + > 5 │ foo + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 6 │ + 7 │ i Suggested fix: Remove the Fragment diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/noChildren.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/noChildren.jsx.snap index 2ddb38e250f..4b246944778 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/noChildren.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/noChildren.jsx.snap @@ -19,10 +19,11 @@ noChildren.jsx:4:5 lint/nursery/noUselessFragments FIXABLE ━━━━━━ ! Avoid using unnecessary Fragment. - ┌─ noChildren.jsx:4:5 - │ - 4 │ <> - │ ^^^^^ + 3 │ <> + > 4 │ <> + │ ^^^^^ + 5 │ + 6 │ i Suggested fix: Remove the Fragment @@ -44,10 +45,12 @@ noChildren.jsx:5:5 lint/nursery/noUselessFragments FIXABLE ━━━━━━ ! Avoid using unnecessary Fragment. - ┌─ noChildren.jsx:5:5 - │ - 5 │ - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ <> + 4 │ <> + > 5 │ + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 6 │ + 7 │ i Suggested fix: Remove the Fragment @@ -68,10 +71,11 @@ noChildren.jsx:6:5 lint/nursery/noUselessFragments FIXABLE ━━━━━━ ! Avoid using unnecessary Fragment. - ┌─ noChildren.jsx:6:5 - │ - 6 │ - │ ^^^^^^^^^^^^^^^^^^^^^ + 4 │ <> + 5 │ + > 6 │ + │ ^^^^^^^^^^^^^^^^^^^^^ + 7 │ i Suggested fix: Remove the Fragment diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withChildren.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withChildren.jsx.snap index 6628475d793..b9fa4a83c2a 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withChildren.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withChildren.jsx.snap @@ -20,10 +20,11 @@ withChildren.jsx:2:5 lint/nursery/noUselessFragments FIXABLE ━━━━━ ! Avoid using unnecessary Fragment. - ┌─ withChildren.jsx:2:5 - │ - 2 │ <>foo - │ ^^^^^^^^ + 1 │ <> + > 2 │ <>foo + │ ^^^^^^^^ + 3 │ foo + 4 │ foo i Suggested fix: Remove the Fragment @@ -43,10 +44,12 @@ withChildren.jsx:3:5 lint/nursery/noUselessFragments FIXABLE ━━━━━ ! Avoid using unnecessary Fragment. - ┌─ withChildren.jsx:3:5 - │ - 3 │ foo - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ <> + 2 │ <>foo + > 3 │ foo + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ foo + 5 │ {/* valid */} i Suggested fix: Remove the Fragment @@ -67,10 +70,12 @@ withChildren.jsx:4:5 lint/nursery/noUselessFragments FIXABLE ━━━━━ ! Avoid using unnecessary Fragment. - ┌─ withChildren.jsx:4:5 - │ - 4 │ foo - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ <>foo + 3 │ foo + > 4 │ foo + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ {/* valid */} + 6 │ i Suggested fix: Remove the Fragment diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withCommentsInvalid.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withCommentsInvalid.jsx.snap index c062700dcbc..2917a0d828b 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withCommentsInvalid.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withCommentsInvalid.jsx.snap @@ -18,10 +18,11 @@ withCommentsInvalid.jsx:2:5 lint/nursery/noUselessFragments FIXABLE ━━━ ! Avoid using unnecessary Fragment. - ┌─ withCommentsInvalid.jsx:2:5 - │ - 2 │ empty - │ ^^^^^^^^^^^^^^^^^^^^ + 1 │ <> + > 2 │ empty + │ ^^^^^^^^^^^^^^^^^^^^ + 3 │ <>empty + 4 │ <>empty i Suggested fix: Remove the Fragment @@ -41,10 +42,12 @@ withCommentsInvalid.jsx:3:5 lint/nursery/noUselessFragments FIXABLE ━━━ ! Avoid using unnecessary Fragment. - ┌─ withCommentsInvalid.jsx:3:5 - │ - 3 │ <>empty - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ <> + 2 │ empty + > 3 │ <>empty + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ <>empty + 5 │ i Suggested fix: Remove the Fragment @@ -64,10 +67,12 @@ withCommentsInvalid.jsx:4:5 lint/nursery/noUselessFragments FIXABLE ━━━ ! Avoid using unnecessary Fragment. - ┌─ withCommentsInvalid.jsx:4:5 - │ - 4 │ <>empty - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ empty + 3 │ <>empty + > 4 │ <>empty + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ + 6 │ i Suggested fix: Remove the Fragment diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withJsxElementInvalid.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withJsxElementInvalid.jsx.snap index 920e6b9102f..df1035b2ee5 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withJsxElementInvalid.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withJsxElementInvalid.jsx.snap @@ -13,10 +13,8 @@ withJsxElementInvalid.jsx:1:1 lint/nursery/noUselessFragments FIXABLE ━━ ! Avoid using unnecessary Fragment. - ┌─ withJsxElementInvalid.jsx:1:1 - │ - 1 │ <> - │ ^^^^^^^^^^^^^^^^^^ + > 1 │ <> + │ ^^^^^^^^^^^^^^^^^^ i Suggested fix: Remove the Fragment diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withJsxExpressionChildInvalid.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withJsxExpressionChildInvalid.jsx.snap index 6c1cdf5d337..f3f0fdc0145 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withJsxExpressionChildInvalid.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withJsxExpressionChildInvalid.jsx.snap @@ -13,10 +13,8 @@ withJsxExpressionChildInvalid.jsx:1:1 lint/nursery/noUselessFragments FIXABLE ! Avoid using unnecessary Fragment. - ┌─ withJsxExpressionChildInvalid.jsx:1:1 - │ - 1 │ <>{foo} - │ ^^^^^^^^^^ + > 1 │ <>{foo} + │ ^^^^^^^^^^ i Suggested fix: Remove the Fragment diff --git a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withJsxTextInvalid.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withJsxTextInvalid.jsx.snap index 04a79a66aa6..f07bc1a94f7 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withJsxTextInvalid.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noUselessFragments/withJsxTextInvalid.jsx.snap @@ -13,10 +13,8 @@ withJsxTextInvalid.jsx:1:1 lint/nursery/noUselessFragments FIXABLE ━━━ ! Avoid using unnecessary Fragment. - ┌─ withJsxTextInvalid.jsx:1:1 - │ - 1 │ <>foo - │ ^^^^^^^^ + > 1 │ <>foo + │ ^^^^^^^^ i Suggested fix: Remove the Fragment diff --git a/crates/rome_js_analyze/tests/specs/nursery/noVoidElementsWithChildren/createElement.js.snap b/crates/rome_js_analyze/tests/specs/nursery/noVoidElementsWithChildren/createElement.js.snap index b8601d37a73..3063f013805 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noVoidElementsWithChildren/createElement.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noVoidElementsWithChildren/createElement.js.snap @@ -21,12 +21,13 @@ createElement.js:3:1 lint/nursery/noVoidElementsWithChildren FIXABLE ━━━ ! img is a void element tag and must not have children. - ┌─ createElement.js:3:1 - │ - 3 │ ┌ React.createElement('img', { - 4 │ │ someProp: "bar" - 5 │ │ }, 'child') - │ └───────────^ + > 3 │ React.createElement('img', { + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 4 │ someProp: "bar" + > 5 │ }, 'child') + │ ^^^^^^^^^^^ + 6 │ + 7 │ React.createElement('img', { i Suggested fix: Remove the children. @@ -48,12 +49,13 @@ createElement.js:7:1 lint/nursery/noVoidElementsWithChildren FIXABLE ━━━ ! img is a void element tag and must not have the dangerouslySetInnerHTML prop. - ┌─ createElement.js:7:1 - │ - 7 │ ┌ React.createElement('img', { - 8 │ │ dangerouslySetInnerHTML: "text" - 9 │ │ }) - │ └──^ + 5 │ }, 'child') + 6 │ + > 7 │ React.createElement('img', { + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 8 │ dangerouslySetInnerHTML: "text" + > 9 │ }) + │ ^^ i Suggested fix: Remove the dangerouslySetInnerHTML prop. diff --git a/crates/rome_js_analyze/tests/specs/nursery/noVoidElementsWithChildren/inJsx.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/noVoidElementsWithChildren/inJsx.jsx.snap index dd99ba633c3..306f93e1c7f 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/noVoidElementsWithChildren/inJsx.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/noVoidElementsWithChildren/inJsx.jsx.snap @@ -21,10 +21,11 @@ inJsx.jsx:2:5 lint/nursery/noVoidElementsWithChildren FIXABLE ━━━━━ ! br is a void element tag and must not have children. - ┌─ inJsx.jsx:2:5 - │ - 2 │
invalid child
- │ ^^^^^^^^^^^^^^^^^^^^^^ + 1 │ <> + > 2 │
invalid child
+ │ ^^^^^^^^^^^^^^^^^^^^^^ + 3 │ some textinvalid child + 4 │ some text i Suggested fix: Remove the children. @@ -44,10 +45,12 @@ inJsx.jsx:3:5 lint/nursery/noVoidElementsWithChildren FIXABLE ━━━━━ ! img is a void element tag and must not have children. - ┌─ inJsx.jsx:3:5 - │ - 3 │ some textinvalid child - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ <> + 2 │
invalid child
+ > 3 │ some textinvalid child + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ some text + 5 │ some text i Suggested fix: Remove the children. @@ -68,10 +71,12 @@ inJsx.jsx:4:5 lint/nursery/noVoidElementsWithChildren FIXABLE ━━━━━ ! img is a void element tag and must not have the dangerouslySetInnerHTML prop. - ┌─ inJsx.jsx:4:5 - │ - 4 │ some text - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │
invalid child
+ 3 │ some textinvalid child + > 4 │ some text + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ some text + 6 │ some text i Suggested fix: Remove the dangerouslySetInnerHTML prop. @@ -93,10 +98,12 @@ inJsx.jsx:5:5 lint/nursery/noVoidElementsWithChildren FIXABLE ━━━━━ ! img is a void element tag and must not have children. - ┌─ inJsx.jsx:5:5 - │ - 5 │ some text - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ some textinvalid child + 4 │ some text + > 5 │ some text + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 6 │ some text + 7 │ some textinvalid child i Suggested fix: Remove the children. @@ -118,10 +125,12 @@ inJsx.jsx:6:5 lint/nursery/noVoidElementsWithChildren FIXABLE ━━━━━ ! img is a void element tag and must not have children. - ┌─ inJsx.jsx:6:5 - │ - 6 │ some text - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ some text + 5 │ some text + > 6 │ some text + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 7 │ some textinvalid child + 8 │ i Suggested fix: Remove the children. @@ -142,10 +151,12 @@ inJsx.jsx:7:5 lint/nursery/noVoidElementsWithChildren FIXABLE ━━━━━ ! img is a void element tag and must not have children, or the dangerouslySetInnerHTML prop. - ┌─ inJsx.jsx:7:5 - │ - 7 │ some textinvalid child - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ some text + 6 │ some text + > 7 │ some textinvalid child + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 8 │ + 9 │ i Suggested fix: Remove the children and the dangerouslySetInnerHTML prop. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useButtonType/inJsx.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/useButtonType/inJsx.jsx.snap index 8ed4399feef..f75dd1a9a63 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useButtonType/inJsx.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/useButtonType/inJsx.jsx.snap @@ -24,10 +24,12 @@ inJsx.jsx:3:5 lint/nursery/useButtonType ━━━━━━━━━━━━━ ! Provide an explicit type prop for the button element. - ┌─ inJsx.jsx:3:5 - │ - 3 │ - │ ^^^^^^^^ + 1 │ // invalid + 2 │ <> + > 3 │ + │ ^^^^^^^^ + 4 │ + 5 │ i The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. @@ -41,10 +43,12 @@ inJsx.jsx:4:18 lint/nursery/useButtonType ━━━━━━━━━━━━ ! Provide a valid type prop for the button element. - ┌─ inJsx.jsx:4:18 - │ - 4 │ - │ ^^^^^ + 2 │ <> + 3 │ + > 4 │ + │ ^^^^^ + 5 │ + 6 │ i The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useButtonType/inObject.js.snap b/crates/rome_js_analyze/tests/specs/nursery/useButtonType/inObject.js.snap index 57dbc05c62d..6a92bff71d7 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useButtonType/inObject.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/useButtonType/inObject.js.snap @@ -27,10 +27,11 @@ inObject.js:2:21 lint/nursery/useButtonType ━━━━━━━━━━━━ ! Provide an explicit type prop for the button element. - ┌─ inObject.js:2:21 - │ - 2 │ React.createElement('button'); - │ ^^^^^^^^ + 1 │ // invalid + > 2 │ React.createElement('button'); + │ ^^^^^^^^ + 3 │ React.createElement('button', { + 4 │ "type": "bar" i The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. @@ -44,10 +45,12 @@ inObject.js:4:13 lint/nursery/useButtonType ━━━━━━━━━━━━ ! Provide a valid type prop for the button element. - ┌─ inObject.js:4:13 - │ - 4 │ "type": "bar" - │ ^^^^^ + 2 │ React.createElement('button'); + 3 │ React.createElement('button', { + > 4 │ "type": "bar" + │ ^^^^^ + 5 │ }); + 6 │ React.createElement('button', { i The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. @@ -61,13 +64,15 @@ inObject.js:6:31 lint/nursery/useButtonType ━━━━━━━━━━━━ ! Provide a valid type prop for the button element. - ┌─ inObject.js:6:31 - │ - 6 │ React.createElement('button', { - │ ┌───────────────────────────────^ - 7 │ │ "style": "background: red" - 8 │ │ }); - │ └─^ + 4 │ "type": "bar" + 5 │ }); + > 6 │ React.createElement('button', { + │ ^ + > 7 │ "style": "background: red" + > 8 │ }); + │ ^ + 9 │ React.createElement('button', {}); + 10 │ i The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. @@ -81,10 +86,12 @@ inObject.js:9:31 lint/nursery/useButtonType ━━━━━━━━━━━━ ! Provide a valid type prop for the button element. - ┌─ inObject.js:9:31 - │ - 9 │ React.createElement('button', {}); - │ ^^ + 7 │ "style": "background: red" + 8 │ }); + > 9 │ React.createElement('button', {}); + │ ^^ + 10 │ + 11 │ // valid i The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useButtonType/withBindingInvalid.js.snap b/crates/rome_js_analyze/tests/specs/nursery/useButtonType/withBindingInvalid.js.snap index 00fcedbf5d6..9b505d66bfb 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useButtonType/withBindingInvalid.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/useButtonType/withBindingInvalid.js.snap @@ -22,10 +22,12 @@ withBindingInvalid.js:3:21 lint/nursery/useButtonType ━━━━━━━━ ! Provide an explicit type prop for the button element. - ┌─ withBindingInvalid.js:3:21 - │ - 3 │ React.createElement('button'); - │ ^^^^^^^^ + 1 │ import React, { createElement } from "react"; + 2 │ + > 3 │ React.createElement('button'); + │ ^^^^^^^^ + 4 │ React.createElement('button', { + 5 │ "type": "bar" i The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. @@ -39,10 +41,12 @@ withBindingInvalid.js:5:13 lint/nursery/useButtonType ━━━━━━━━ ! Provide a valid type prop for the button element. - ┌─ withBindingInvalid.js:5:13 - │ - 5 │ "type": "bar" - │ ^^^^^ + 3 │ React.createElement('button'); + 4 │ React.createElement('button', { + > 5 │ "type": "bar" + │ ^^^^^ + 6 │ }); + 7 │ i The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. @@ -56,10 +60,10 @@ withBindingInvalid.js:9:13 lint/nursery/useButtonType ━━━━━━━━ ! Provide a valid type prop for the button element. - ┌─ withBindingInvalid.js:9:13 - │ - 9 │ "type": "bar" - │ ^^^^^ + 8 │ createElement('button', { + > 9 │ "type": "bar" + │ ^^^^^ + 10 │ }); i The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useButtonType/withDefaultNamespaceInvalid.js.snap b/crates/rome_js_analyze/tests/specs/nursery/useButtonType/withDefaultNamespaceInvalid.js.snap index 72db4fbe164..d7e27411310 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useButtonType/withDefaultNamespaceInvalid.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/useButtonType/withDefaultNamespaceInvalid.js.snap @@ -18,10 +18,12 @@ withDefaultNamespaceInvalid.js:3:32 lint/nursery/useButtonType ━━━━━ ! Provide an explicit type prop for the button element. - ┌─ withDefaultNamespaceInvalid.js:3:32 - │ - 3 │ DefaultNamespace.createElement('button'); - │ ^^^^^^^^ + 1 │ import * as DefaultNamespace from "react"; + 2 │ + > 3 │ DefaultNamespace.createElement('button'); + │ ^^^^^^^^ + 4 │ DefaultNamespace.createElement('button', { + 5 │ "type": "DefaultNamespace" i The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. @@ -35,10 +37,11 @@ withDefaultNamespaceInvalid.js:5:13 lint/nursery/useButtonType ━━━━━ ! Provide a valid type prop for the button element. - ┌─ withDefaultNamespaceInvalid.js:5:13 - │ - 5 │ "type": "DefaultNamespace" - │ ^^^^^^^^^^^^^^^^^^ + 3 │ DefaultNamespace.createElement('button'); + 4 │ DefaultNamespace.createElement('button', { + > 5 │ "type": "DefaultNamespace" + │ ^^^^^^^^^^^^^^^^^^ + 6 │ }); i The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useButtonType/withRenamedImportInvalid.js.snap b/crates/rome_js_analyze/tests/specs/nursery/useButtonType/withRenamedImportInvalid.js.snap index d1b6db9e4d7..12c12ea7597 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useButtonType/withRenamedImportInvalid.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/useButtonType/withRenamedImportInvalid.js.snap @@ -22,10 +22,12 @@ withRenamedImportInvalid.js:3:28 lint/nursery/useButtonType ━━━━━━ ! Provide an explicit type prop for the button element. - ┌─ withRenamedImportInvalid.js:3:28 - │ - 3 │ AwesomeReact.createElement('button'); - │ ^^^^^^^^ + 1 │ import AwesomeReact, { createElement as awesomeCreateElement } from "react"; + 2 │ + > 3 │ AwesomeReact.createElement('button'); + │ ^^^^^^^^ + 4 │ AwesomeReact.createElement('button', { + 5 │ "type": "AwesomeReact" i The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. @@ -39,10 +41,12 @@ withRenamedImportInvalid.js:5:13 lint/nursery/useButtonType ━━━━━━ ! Provide a valid type prop for the button element. - ┌─ withRenamedImportInvalid.js:5:13 - │ - 5 │ "type": "AwesomeReact" - │ ^^^^^^^^^^^^^^ + 3 │ AwesomeReact.createElement('button'); + 4 │ AwesomeReact.createElement('button', { + > 5 │ "type": "AwesomeReact" + │ ^^^^^^^^^^^^^^ + 6 │ }); + 7 │ i The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. @@ -56,10 +60,10 @@ withRenamedImportInvalid.js:9:13 lint/nursery/useButtonType ━━━━━━ ! Provide a valid type prop for the button element. - ┌─ withRenamedImportInvalid.js:9:13 - │ - 9 │ "type": "awesomeCreateElement" - │ ^^^^^^^^^^^^^^^^^^^^^^ + 8 │ awesomeCreateElement('button', { + > 9 │ "type": "awesomeCreateElement" + │ ^^^^^^^^^^^^^^^^^^^^^^ + 10 │ }); i The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.js.snap b/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.js.snap index 0c76d9294c0..b3e4f415e92 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/useCamelCase/useCamelCase.js.snap @@ -59,10 +59,10 @@ useCamelCase.js:1:5 lint/nursery/useCamelCase FIXABLE ━━━━━━━━ ! Prefer variables names in camel case. - ┌─ useCamelCase.js:1:5 - │ - 1 │ let snake_case; - │ ^^^^^^^^^^ + > 1 │ let snake_case; + │ ^^^^^^^^^^ + 2 │ snake_case = 1; + 3 │ let _snake_case; i Safe fix: Rename this symbol to camel case @@ -83,10 +83,12 @@ useCamelCase.js:6:10 lint/nursery/useCamelCase FIXABLE ━━━━━━━ ! Prefer functions names in camel case. - ┌─ useCamelCase.js:6:10 - │ - 6 │ function snake_function(snake_case, PascalCase) {} - │ ^^^^^^^^^^^^^^ + 4 │ console.log(_snake_case); + 5 │ + > 6 │ function snake_function(snake_case, PascalCase) {} + │ ^^^^^^^^^^^^^^ + 7 │ + 8 │ class PascalCase { i Safe fix: Rename this symbol to camel case @@ -108,10 +110,12 @@ useCamelCase.js:6:25 lint/nursery/useCamelCase FIXABLE ━━━━━━━ ! Prefer parameters names in camel case. - ┌─ useCamelCase.js:6:25 - │ - 6 │ function snake_function(snake_case, PascalCase) {} - │ ^^^^^^^^^^ + 4 │ console.log(_snake_case); + 5 │ + > 6 │ function snake_function(snake_case, PascalCase) {} + │ ^^^^^^^^^^ + 7 │ + 8 │ class PascalCase { i Safe fix: Rename this symbol to camel case @@ -133,10 +137,12 @@ useCamelCase.js:6:37 lint/nursery/useCamelCase FIXABLE ━━━━━━━ ! Prefer parameters names in camel case. - ┌─ useCamelCase.js:6:37 - │ - 6 │ function snake_function(snake_case, PascalCase) {} - │ ^^^^^^^^^^ + 4 │ console.log(_snake_case); + 5 │ + > 6 │ function snake_function(snake_case, PascalCase) {} + │ ^^^^^^^^^^ + 7 │ + 8 │ class PascalCase { i Safe fix: Rename this symbol to camel case @@ -158,10 +164,11 @@ useCamelCase.js:9:2 lint/nursery/useCamelCase ━━━━━━━━━━━ ! Prefer properties names in camel case. - ┌─ useCamelCase.js:9:2 - │ - 9 │ snake_property = 1; - │ ^^^^^^^^^^^^^^ + 8 │ class PascalCase { + > 9 │ snake_property = 1; + │ ^^^^^^^^^^^^^^ + 10 │ #private_snake_property = 2; + 11 │ ``` @@ -171,10 +178,12 @@ useCamelCase.js:10:2 lint/nursery/useCamelCase ━━━━━━━━━━━ ! Prefer properties names in camel case. - ┌─ useCamelCase.js:10:2 - │ - 10 │ #private_snake_property = 2; - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 8 │ class PascalCase { + 9 │ snake_property = 1; + > 10 │ #private_snake_property = 2; + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 11 │ + 12 │ snake_function() {} ``` @@ -184,10 +193,12 @@ useCamelCase.js:12:2 lint/nursery/useCamelCase ━━━━━━━━━━━ ! Prefer methods names in camel case. - ┌─ useCamelCase.js:12:2 - │ - 12 │ snake_function() {} - │ ^^^^^^^^^^^^^^ + 10 │ #private_snake_property = 2; + 11 │ + > 12 │ snake_function() {} + │ ^^^^^^^^^^^^^^ + 13 │ + 14 │ get snake_getter() {} ``` @@ -197,10 +208,12 @@ useCamelCase.js:14:6 lint/nursery/useCamelCase ━━━━━━━━━━━ ! Prefer methods names in camel case. - ┌─ useCamelCase.js:14:6 - │ - 14 │ get snake_getter() {} - │ ^^^^^^^^^^^^ + 12 │ snake_function() {} + 13 │ + > 14 │ get snake_getter() {} + │ ^^^^^^^^^^^^ + 15 │ set snake_setter(v) { + 16 │ console.log(v); ``` @@ -210,10 +223,11 @@ useCamelCase.js:15:6 lint/nursery/useCamelCase ━━━━━━━━━━━ ! Prefer methods names in camel case. - ┌─ useCamelCase.js:15:6 - │ - 15 │ set snake_setter(v) { - │ ^^^^^^^^^^^^ + 14 │ get snake_getter() {} + > 15 │ set snake_setter(v) { + │ ^^^^^^^^^^^^ + 16 │ console.log(v); + 17 │ } ``` @@ -223,10 +237,12 @@ useCamelCase.js:31:5 lint/nursery/useCamelCase FIXABLE ━━━━━━━ ! Prefer variables names in camel case. - ┌─ useCamelCase.js:31:5 - │ - 31 │ let UPPER_CASE = 1; - │ ^^^^^^^^^^ + 29 │ let longCamelCase; + 30 │ + > 31 │ let UPPER_CASE = 1; + │ ^^^^^^^^^^ + 32 │ let { UPPER_CASE } = env; + 33 │ let [ UPPER_CASE ] = env; i Safe fix: Rename this symbol to camel case @@ -248,10 +264,12 @@ useCamelCase.js:45:10 lint/nursery/useCamelCase FIXABLE ━━━━━━━ ! Prefer functions names in camel case. - ┌─ useCamelCase.js:45:10 - │ - 45 │ function PascalCaseNOk() { } - │ ^^^^^^^^^^^^^ + 43 │ export default PascalCaseOkBecauseExport; + 44 │ + > 45 │ function PascalCaseNOk() { } + │ ^^^^^^^^^^^^^ + 46 │ console.log(PascalCaseNOk()); + 47 │ i Safe fix: Rename this symbol to camel case diff --git a/crates/rome_js_analyze/tests/specs/nursery/useFragmentSyntax.jsx.snap b/crates/rome_js_analyze/tests/specs/nursery/useFragmentSyntax.jsx.snap index 47546943188..8564b83553f 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useFragmentSyntax.jsx.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/useFragmentSyntax.jsx.snap @@ -42,13 +42,16 @@ useFragmentSyntax.jsx:5:5 lint/nursery/useFragmentSyntax FIXABLE ━━━━ ! Use shorthand syntax for Fragment elements instead of standard syntax. - ┌─ useFragmentSyntax.jsx:5:5 - │ - 5 │ ┌ - 6 │ │

Lorem

- 7 │ │ Ipsum - 8 │ │
- │ └───────────────^ + 3 │
+ 4 │ {/* invalid */} + > 5 │ + │ ^^^^^^^^^^ + > 6 │

Lorem

+ > 7 │ Ipsum + > 8 │
+ │ ^^^^^^^^^^^ + 9 │ + 10 │ i Shorthand fragment syntax saves keystrokes and is only inapplicable when keys are required. @@ -76,13 +79,16 @@ useFragmentSyntax.jsx:10:5 lint/nursery/useFragmentSyntax FIXABLE ━━━━ ! Use shorthand syntax for Fragment elements instead of standard syntax. - ┌─ useFragmentSyntax.jsx:10:5 - │ - 10 │ ┌ - 11 │ │ Lorem - 12 │ │ - 13 │ │ - │ └─────────────────────^ + 8 │ + 9 │ + > 10 │ + │ ^^^^^^^^^^^^^^^^ + > 11 │ Lorem + > 12 │ + > 13 │ + │ ^^^^^^^^^^^^^^^^^ + 14 │ + 15 │ i Shorthand fragment syntax saves keystrokes and is only inapplicable when keys are required. @@ -110,13 +116,16 @@ useFragmentSyntax.jsx:15:5 lint/nursery/useFragmentSyntax FIXABLE ━━━━ ! Use shorthand syntax for Fragment elements instead of standard syntax. - ┌─ useFragmentSyntax.jsx:15:5 - │ - 15 │ ┌ - 16 │ │

Lorem

- 17 │ │ Ipsum - 18 │ │ - │ └───────────────────────────^ + 13 │
+ 14 │ + > 15 │ + │ ^^^^^^^^^^^^^^^^^^^^^ + > 16 │

Lorem

+ > 17 │ Ipsum + > 18 │ + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 19 │ + 20 │ {/* valid */} i Shorthand fragment syntax saves keystrokes and is only inapplicable when keys are required. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/complexLogicalAndCases.ts.snap b/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/complexLogicalAndCases.ts.snap index 26e7a6529ba..b32a211e09e 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/complexLogicalAndCases.ts.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/complexLogicalAndCases.ts.snap @@ -17,10 +17,11 @@ complexLogicalAndCases.ts:2:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ complexLogicalAndCases.ts:2:1 - │ - 2 │ foo && foo[bar as string] && foo[bar as string].baz; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ // currently do not handle complex computed properties + > 2 │ foo && foo[bar as string] && foo[bar as string].baz; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ foo && foo[1 + 2] && foo[1 + 2].baz; + 4 │ foo && foo[typeof bar] && foo[typeof bar].baz; i Suggested fix: Change to an optional chain. @@ -39,10 +40,12 @@ complexLogicalAndCases.ts:3:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ complexLogicalAndCases.ts:3:1 - │ - 3 │ foo && foo[1 + 2] && foo[1 + 2].baz; - │ ^^^^^^^^^^^^^^^^^ + 1 │ // currently do not handle complex computed properties + 2 │ foo && foo[bar as string] && foo[bar as string].baz; + > 3 │ foo && foo[1 + 2] && foo[1 + 2].baz; + │ ^^^^^^^^^^^^^^^^^ + 4 │ foo && foo[typeof bar] && foo[typeof bar].baz; + 5 │ i Suggested fix: Change to an optional chain. @@ -61,10 +64,11 @@ complexLogicalAndCases.ts:4:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ complexLogicalAndCases.ts:4:1 - │ - 4 │ foo && foo[typeof bar] && foo[typeof bar].baz; - │ ^^^^^^^^^^^^^^^^^^^^^^ + 2 │ foo && foo[bar as string] && foo[bar as string].baz; + 3 │ foo && foo[1 + 2] && foo[1 + 2].baz; + > 4 │ foo && foo[typeof bar] && foo[typeof bar].baz; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 5 │ i Suggested fix: Change to an optional chain. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/logicalAndCases.js.snap b/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/logicalAndCases.js.snap index ee86c39d653..7bbecb63a84 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/logicalAndCases.js.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/logicalAndCases.js.snap @@ -397,10 +397,11 @@ logicalAndCases.js:4:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:4:1 - │ - 4 │ foo && foo.bar - │ ^^^^^^^^^^^^^^ + 3 │ // chained members + > 4 │ foo && foo.bar + │ ^^^^^^^^^^^^^^ + 5 │ foo.bar && foo.bar.baz + 6 │ foo && foo() i Suggested fix: Change to an optional chain. @@ -422,10 +423,12 @@ logicalAndCases.js:5:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:5:1 - │ - 5 │ foo.bar && foo.bar.baz - │ ^^^^^^^^^^^^^^^^^^^^^^ + 3 │ // chained members + 4 │ foo && foo.bar + > 5 │ foo.bar && foo.bar.baz + │ ^^^^^^^^^^^^^^^^^^^^^^ + 6 │ foo && foo() + 7 │ foo.bar && foo.bar() i Suggested fix: Change to an optional chain. @@ -447,10 +450,12 @@ logicalAndCases.js:6:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:6:1 - │ - 6 │ foo && foo() - │ ^^^^^^^^^^^^ + 4 │ foo && foo.bar + 5 │ foo.bar && foo.bar.baz + > 6 │ foo && foo() + │ ^^^^^^^^^^^^ + 7 │ foo.bar && foo.bar() + 8 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz i Suggested fix: Change to an optional chain. @@ -472,10 +477,12 @@ logicalAndCases.js:7:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:7:1 - │ - 7 │ foo.bar && foo.bar() - │ ^^^^^^^^^^^^^^^^^^^^ + 5 │ foo.bar && foo.bar.baz + 6 │ foo && foo() + > 7 │ foo.bar && foo.bar() + │ ^^^^^^^^^^^^^^^^^^^^ + 8 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz + 9 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz i Suggested fix: Change to an optional chain. @@ -497,10 +504,12 @@ logicalAndCases.js:8:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:8:1 - │ - 8 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 6 │ foo && foo() + 7 │ foo.bar && foo.bar() + > 8 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 9 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz + 10 │ i Suggested fix: Change to an optional chain. @@ -522,10 +531,12 @@ logicalAndCases.js:9:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:9:1 - │ - 9 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 7 │ foo.bar && foo.bar() + 8 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz + > 9 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 10 │ + 11 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -547,10 +558,11 @@ logicalAndCases.js:12:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:12:1 - │ - 12 │ foo && foo.bar && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 │ // case with a jump (i.e. a non-nullish prop) + > 12 │ foo && foo.bar && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 13 │ foo.bar && foo.bar.baz.buzz + 14 │ i Suggested fix: Change to an optional chain. @@ -572,10 +584,12 @@ logicalAndCases.js:13:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:13:1 - │ - 13 │ foo.bar && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 │ // case with a jump (i.e. a non-nullish prop) + 12 │ foo && foo.bar && foo.bar.baz.buzz + > 13 │ foo.bar && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 14 │ + 15 │ // case where for some reason there is a doubled up expression i Suggested fix: Change to an optional chain. @@ -597,10 +611,11 @@ logicalAndCases.js:16:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:16:1 - │ - 16 │ foo && foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 15 │ // case where for some reason there is a doubled up expression + > 16 │ foo && foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 17 │ foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz + 18 │ i Suggested fix: Change to an optional chain. @@ -622,10 +637,12 @@ logicalAndCases.js:17:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:17:1 - │ - 17 │ foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 15 │ // case where for some reason there is a doubled up expression + 16 │ foo && foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz + > 17 │ foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 18 │ + 19 │ // chained members with element access i Suggested fix: Change to an optional chain. @@ -647,10 +664,11 @@ logicalAndCases.js:20:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:20:1 - │ - 20 │ foo && foo[bar] && foo[bar].baz && foo[bar].baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 19 │ // chained members with element access + > 20 │ foo && foo[bar] && foo[bar].baz && foo[bar].baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 21 │ + 22 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -672,10 +690,11 @@ logicalAndCases.js:23:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:23:1 - │ - 23 │ foo && foo[bar].baz && foo[bar].baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 22 │ // case with a jump (i.e. a non-nullish prop) + > 23 │ foo && foo[bar].baz && foo[bar].baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 24 │ + 25 │ // chained calls i Suggested fix: Change to an optional chain. @@ -697,10 +716,11 @@ logicalAndCases.js:26:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:26:1 - │ - 26 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 25 │ // chained calls + > 26 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 27 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() + 28 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() i Suggested fix: Change to an optional chain. @@ -722,10 +742,12 @@ logicalAndCases.js:27:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:27:1 - │ - 27 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 25 │ // chained calls + 26 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() + > 27 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 28 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() + 29 │ i Suggested fix: Change to an optional chain. @@ -747,10 +769,12 @@ logicalAndCases.js:28:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:28:1 - │ - 28 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 26 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() + 27 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() + > 28 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 29 │ + 30 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -772,10 +796,11 @@ logicalAndCases.js:31:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:31:1 - │ - 31 │ foo && foo.bar && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 30 │ // case with a jump (i.e. a non-nullish prop) + > 31 │ foo && foo.bar && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 32 │ foo.bar && foo.bar.baz.buzz() + 33 │ i Suggested fix: Change to an optional chain. @@ -797,10 +822,12 @@ logicalAndCases.js:32:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:32:1 - │ - 32 │ foo.bar && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 30 │ // case with a jump (i.e. a non-nullish prop) + 31 │ foo && foo.bar && foo.bar.baz.buzz() + > 32 │ foo.bar && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 33 │ + 34 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -822,10 +849,11 @@ logicalAndCases.js:35:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:35:1 - │ - 35 │ foo && foo.bar && foo.bar.baz.buzz && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 34 │ // case with a jump (i.e. a non-nullish prop) + > 35 │ foo && foo.bar && foo.bar.baz.buzz && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 36 │ + 37 │ // case with a call expr inside the chain for some inefficient reason i Suggested fix: Change to an optional chain. @@ -847,10 +875,11 @@ logicalAndCases.js:38:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:38:1 - │ - 38 │ foo && foo.bar() && foo.bar().baz && foo.bar().baz.buzz && foo.bar().baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 37 │ // case with a call expr inside the chain for some inefficient reason + > 38 │ foo && foo.bar() && foo.bar().baz && foo.bar().baz.buzz && foo.bar().baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 39 │ + 40 │ // chained calls with element access i Suggested fix: Change to an optional chain. @@ -872,10 +901,11 @@ logicalAndCases.js:41:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:41:1 - │ - 41 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 40 │ // chained calls with element access + > 41 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 42 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]() + 43 │ i Suggested fix: Change to an optional chain. @@ -897,10 +927,12 @@ logicalAndCases.js:42:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:42:1 - │ - 42 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 40 │ // chained calls with element access + 41 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz]() + > 42 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 43 │ + 44 │ // (partially) pre-optional chained i Suggested fix: Change to an optional chain. @@ -922,10 +954,11 @@ logicalAndCases.js:45:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:45:1 - │ - 45 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 44 │ // (partially) pre-optional chained + > 45 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 46 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] + 47 │ foo && foo?.() && foo?.().bar i Suggested fix: Change to an optional chain. @@ -947,10 +980,12 @@ logicalAndCases.js:46:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:46:1 - │ - 46 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 44 │ // (partially) pre-optional chained + 45 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() + > 46 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 47 │ foo && foo?.() && foo?.().bar + 48 │ foo.bar && foo.bar?.() && foo.bar?.().baz i Suggested fix: Change to an optional chain. @@ -972,10 +1007,12 @@ logicalAndCases.js:47:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:47:1 - │ - 47 │ foo && foo?.() && foo?.().bar - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 45 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() + 46 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] + > 47 │ foo && foo?.() && foo?.().bar + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 48 │ foo.bar && foo.bar?.() && foo.bar?.().baz + 49 │ i Suggested fix: Change to an optional chain. @@ -997,10 +1034,11 @@ logicalAndCases.js:48:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:48:1 - │ - 48 │ foo.bar && foo.bar?.() && foo.bar?.().baz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 46 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] + 47 │ foo && foo?.() && foo?.().bar + > 48 │ foo.bar && foo.bar?.() && foo.bar?.().baz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 49 │ i Suggested fix: Change to an optional chain. @@ -1022,10 +1060,11 @@ logicalAndCases.js:54:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:54:1 - │ - 54 │ foo && foo.bar && bing - │ ^^^^^^^^^^^^^^ + 53 │ // chained members + > 54 │ foo && foo.bar && bing + │ ^^^^^^^^^^^^^^ + 55 │ foo.bar && foo.bar.baz && bing + 56 │ foo && foo() && bing i Suggested fix: Change to an optional chain. @@ -1047,10 +1086,12 @@ logicalAndCases.js:55:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:55:1 - │ - 55 │ foo.bar && foo.bar.baz && bing - │ ^^^^^^^^^^^^^^^^^^^^^^ + 53 │ // chained members + 54 │ foo && foo.bar && bing + > 55 │ foo.bar && foo.bar.baz && bing + │ ^^^^^^^^^^^^^^^^^^^^^^ + 56 │ foo && foo() && bing + 57 │ foo.bar && foo.bar() && bing i Suggested fix: Change to an optional chain. @@ -1072,10 +1113,12 @@ logicalAndCases.js:56:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:56:1 - │ - 56 │ foo && foo() && bing - │ ^^^^^^^^^^^^ + 54 │ foo && foo.bar && bing + 55 │ foo.bar && foo.bar.baz && bing + > 56 │ foo && foo() && bing + │ ^^^^^^^^^^^^ + 57 │ foo.bar && foo.bar() && bing + 58 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing i Suggested fix: Change to an optional chain. @@ -1097,10 +1140,12 @@ logicalAndCases.js:57:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:57:1 - │ - 57 │ foo.bar && foo.bar() && bing - │ ^^^^^^^^^^^^^^^^^^^^ + 55 │ foo.bar && foo.bar.baz && bing + 56 │ foo && foo() && bing + > 57 │ foo.bar && foo.bar() && bing + │ ^^^^^^^^^^^^^^^^^^^^ + 58 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing + 59 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing i Suggested fix: Change to an optional chain. @@ -1122,10 +1167,12 @@ logicalAndCases.js:58:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:58:1 - │ - 58 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 56 │ foo && foo() && bing + 57 │ foo.bar && foo.bar() && bing + > 58 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 59 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing + 60 │ i Suggested fix: Change to an optional chain. @@ -1147,10 +1194,12 @@ logicalAndCases.js:59:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:59:1 - │ - 59 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 57 │ foo.bar && foo.bar() && bing + 58 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing + > 59 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 60 │ + 61 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -1172,10 +1221,11 @@ logicalAndCases.js:62:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:62:1 - │ - 62 │ foo && foo.bar && foo.bar.baz.buzz && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 61 │ // case with a jump (i.e. a non-nullish prop) + > 62 │ foo && foo.bar && foo.bar.baz.buzz && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 63 │ foo.bar && foo.bar.baz.buzz && bing + 64 │ i Suggested fix: Change to an optional chain. @@ -1197,10 +1247,12 @@ logicalAndCases.js:63:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:63:1 - │ - 63 │ foo.bar && foo.bar.baz.buzz && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 61 │ // case with a jump (i.e. a non-nullish prop) + 62 │ foo && foo.bar && foo.bar.baz.buzz && bing + > 63 │ foo.bar && foo.bar.baz.buzz && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 64 │ + 65 │ // case where for some reason there is a doubled up expression i Suggested fix: Change to an optional chain. @@ -1222,10 +1274,11 @@ logicalAndCases.js:66:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:66:1 - │ - 66 │ foo && foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 65 │ // case where for some reason there is a doubled up expression + > 66 │ foo && foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 67 │ foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz && bing + 68 │ i Suggested fix: Change to an optional chain. @@ -1247,10 +1300,12 @@ logicalAndCases.js:67:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:67:1 - │ - 67 │ foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 65 │ // case where for some reason there is a doubled up expression + 66 │ foo && foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz && bing + > 67 │ foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 68 │ + 69 │ // chained members with element access i Suggested fix: Change to an optional chain. @@ -1272,10 +1327,11 @@ logicalAndCases.js:70:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:70:1 - │ - 70 │ foo && foo[bar] && foo[bar].baz && foo[bar].baz.buzz && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 69 │ // chained members with element access + > 70 │ foo && foo[bar] && foo[bar].baz && foo[bar].baz.buzz && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 71 │ + 72 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -1297,10 +1353,11 @@ logicalAndCases.js:73:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:73:1 - │ - 73 │ foo && foo[bar].baz && foo[bar].baz.buzz && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 72 │ // case with a jump (i.e. a non-nullish prop) + > 73 │ foo && foo[bar].baz && foo[bar].baz.buzz && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 74 │ + 75 │ // chained calls i Suggested fix: Change to an optional chain. @@ -1322,10 +1379,11 @@ logicalAndCases.js:76:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:76:1 - │ - 76 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 75 │ // chained calls + > 76 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 77 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing + 78 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing i Suggested fix: Change to an optional chain. @@ -1347,10 +1405,12 @@ logicalAndCases.js:77:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:77:1 - │ - 77 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 75 │ // chained calls + 76 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() && bing + > 77 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 78 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing + 79 │ i Suggested fix: Change to an optional chain. @@ -1372,10 +1432,12 @@ logicalAndCases.js:78:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:78:1 - │ - 78 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 76 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() && bing + 77 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing + > 78 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 79 │ + 80 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -1397,10 +1459,11 @@ logicalAndCases.js:81:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:81:1 - │ - 81 │ foo && foo.bar && foo.bar.baz.buzz() && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 80 │ // case with a jump (i.e. a non-nullish prop) + > 81 │ foo && foo.bar && foo.bar.baz.buzz() && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 82 │ foo.bar && foo.bar.baz.buzz() && bing + 83 │ i Suggested fix: Change to an optional chain. @@ -1422,10 +1485,12 @@ logicalAndCases.js:82:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:82:1 - │ - 82 │ foo.bar && foo.bar.baz.buzz() && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 80 │ // case with a jump (i.e. a non-nullish prop) + 81 │ foo && foo.bar && foo.bar.baz.buzz() && bing + > 82 │ foo.bar && foo.bar.baz.buzz() && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 83 │ + 84 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -1447,10 +1512,11 @@ logicalAndCases.js:85:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:85:1 - │ - 85 │ foo && foo.bar && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 84 │ // case with a jump (i.e. a non-nullish prop) + > 85 │ foo && foo.bar && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 86 │ + 87 │ // case with a call expr inside the chain for some inefficient reason i Suggested fix: Change to an optional chain. @@ -1472,10 +1538,11 @@ logicalAndCases.js:88:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:88:1 - │ - 88 │ foo && foo.bar() && foo.bar().baz && foo.bar().baz.buzz && foo.bar().baz.buzz() && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 87 │ // case with a call expr inside the chain for some inefficient reason + > 88 │ foo && foo.bar() && foo.bar().baz && foo.bar().baz.buzz && foo.bar().baz.buzz() && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 89 │ + 90 │ // chained calls with element access i Suggested fix: Change to an optional chain. @@ -1497,10 +1564,11 @@ logicalAndCases.js:91:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:91:1 - │ - 91 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz]() && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 90 │ // chained calls with element access + > 91 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz]() && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 92 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]() && bing + 93 │ i Suggested fix: Change to an optional chain. @@ -1522,10 +1590,12 @@ logicalAndCases.js:92:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:92:1 - │ - 92 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]() && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 90 │ // chained calls with element access + 91 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz]() && bing + > 92 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]() && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 93 │ + 94 │ // (partially) pre-optional chained i Suggested fix: Change to an optional chain. @@ -1547,10 +1617,11 @@ logicalAndCases.js:95:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:95:1 - │ - 95 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 94 │ // (partially) pre-optional chained + > 95 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 96 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] && bing + 97 │ foo && foo?.() && foo?.().bar && bing i Suggested fix: Change to an optional chain. @@ -1572,10 +1643,12 @@ logicalAndCases.js:96:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:96:1 - │ - 96 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 94 │ // (partially) pre-optional chained + 95 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() && bing + > 96 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 97 │ foo && foo?.() && foo?.().bar && bing + 98 │ foo.bar && foo.bar?.() && foo.bar?.().baz && bing i Suggested fix: Change to an optional chain. @@ -1597,10 +1670,12 @@ logicalAndCases.js:97:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:97:1 - │ - 97 │ foo && foo?.() && foo?.().bar && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 95 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() && bing + 96 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] && bing + > 97 │ foo && foo?.() && foo?.().bar && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 98 │ foo.bar && foo.bar?.() && foo.bar?.().baz && bing + 99 │ i Suggested fix: Change to an optional chain. @@ -1622,10 +1697,12 @@ logicalAndCases.js:98:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:98:1 - │ - 98 │ foo.bar && foo.bar?.() && foo.bar?.().baz && bing - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 96 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] && bing + 97 │ foo && foo?.() && foo?.().bar && bing + > 98 │ foo.bar && foo.bar?.() && foo.bar?.().baz && bing + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 99 │ + 100 │ // chained members i Suggested fix: Change to an optional chain. @@ -1647,10 +1724,11 @@ logicalAndCases.js:101:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:101:1 - │ - 101 │ foo && foo.bar && bing.bong - │ ^^^^^^^^^^^^^^ + 100 │ // chained members + > 101 │ foo && foo.bar && bing.bong + │ ^^^^^^^^^^^^^^ + 102 │ foo.bar && foo.bar.baz && bing.bong + 103 │ foo && foo() && bing.bong i Suggested fix: Change to an optional chain. @@ -1672,10 +1750,12 @@ logicalAndCases.js:102:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:102:1 - │ - 102 │ foo.bar && foo.bar.baz && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^ + 100 │ // chained members + 101 │ foo && foo.bar && bing.bong + > 102 │ foo.bar && foo.bar.baz && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^ + 103 │ foo && foo() && bing.bong + 104 │ foo.bar && foo.bar() && bing.bong i Suggested fix: Change to an optional chain. @@ -1697,10 +1777,12 @@ logicalAndCases.js:103:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:103:1 - │ - 103 │ foo && foo() && bing.bong - │ ^^^^^^^^^^^^ + 101 │ foo && foo.bar && bing.bong + 102 │ foo.bar && foo.bar.baz && bing.bong + > 103 │ foo && foo() && bing.bong + │ ^^^^^^^^^^^^ + 104 │ foo.bar && foo.bar() && bing.bong + 105 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing.bong i Suggested fix: Change to an optional chain. @@ -1722,10 +1804,12 @@ logicalAndCases.js:104:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:104:1 - │ - 104 │ foo.bar && foo.bar() && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^ + 102 │ foo.bar && foo.bar.baz && bing.bong + 103 │ foo && foo() && bing.bong + > 104 │ foo.bar && foo.bar() && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^ + 105 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing.bong + 106 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing.bong i Suggested fix: Change to an optional chain. @@ -1747,10 +1831,12 @@ logicalAndCases.js:105:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:105:1 - │ - 105 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 103 │ foo && foo() && bing.bong + 104 │ foo.bar && foo.bar() && bing.bong + > 105 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 106 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing.bong + 107 │ i Suggested fix: Change to an optional chain. @@ -1772,10 +1858,12 @@ logicalAndCases.js:106:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:106:1 - │ - 106 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 104 │ foo.bar && foo.bar() && bing.bong + 105 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing.bong + > 106 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 107 │ + 108 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -1797,10 +1885,11 @@ logicalAndCases.js:109:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:109:1 - │ - 109 │ foo && foo.bar && foo.bar.baz.buzz && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 108 │ // case with a jump (i.e. a non-nullish prop) + > 109 │ foo && foo.bar && foo.bar.baz.buzz && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 110 │ foo.bar && foo.bar.baz.buzz && bing.bong + 111 │ i Suggested fix: Change to an optional chain. @@ -1822,10 +1911,12 @@ logicalAndCases.js:110:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:110:1 - │ - 110 │ foo.bar && foo.bar.baz.buzz && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 108 │ // case with a jump (i.e. a non-nullish prop) + 109 │ foo && foo.bar && foo.bar.baz.buzz && bing.bong + > 110 │ foo.bar && foo.bar.baz.buzz && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 111 │ + 112 │ // case where for some reason there is a doubled up expression i Suggested fix: Change to an optional chain. @@ -1847,10 +1938,11 @@ logicalAndCases.js:113:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:113:1 - │ - 113 │ foo && foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 112 │ // case where for some reason there is a doubled up expression + > 113 │ foo && foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 114 │ foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz && bing.bong + 115 │ i Suggested fix: Change to an optional chain. @@ -1872,10 +1964,12 @@ logicalAndCases.js:114:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:114:1 - │ - 114 │ foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 112 │ // case where for some reason there is a doubled up expression + 113 │ foo && foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz && bing.bong + > 114 │ foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 115 │ + 116 │ // chained members with element access i Suggested fix: Change to an optional chain. @@ -1897,10 +1991,11 @@ logicalAndCases.js:117:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:117:1 - │ - 117 │ foo && foo[bar] && foo[bar].baz && foo[bar].baz.buzz && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 116 │ // chained members with element access + > 117 │ foo && foo[bar] && foo[bar].baz && foo[bar].baz.buzz && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 118 │ + 119 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -1922,10 +2017,11 @@ logicalAndCases.js:120:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:120:1 - │ - 120 │ foo && foo[bar].baz && foo[bar].baz.buzz && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 119 │ // case with a jump (i.e. a non-nullish prop) + > 120 │ foo && foo[bar].baz && foo[bar].baz.buzz && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 121 │ + 122 │ // chained calls i Suggested fix: Change to an optional chain. @@ -1947,10 +2043,11 @@ logicalAndCases.js:123:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:123:1 - │ - 123 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 122 │ // chained calls + > 123 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 124 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing.bong + 125 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing.bong i Suggested fix: Change to an optional chain. @@ -1972,10 +2069,12 @@ logicalAndCases.js:124:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:124:1 - │ - 124 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 122 │ // chained calls + 123 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() && bing.bong + > 124 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 125 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing.bong + 126 │ i Suggested fix: Change to an optional chain. @@ -1997,10 +2096,12 @@ logicalAndCases.js:125:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:125:1 - │ - 125 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 123 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz() && bing.bong + 124 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing.bong + > 125 │ foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 126 │ + 127 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -2022,10 +2123,11 @@ logicalAndCases.js:128:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:128:1 - │ - 128 │ foo && foo.bar && foo.bar.baz.buzz() && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 127 │ // case with a jump (i.e. a non-nullish prop) + > 128 │ foo && foo.bar && foo.bar.baz.buzz() && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 129 │ foo.bar && foo.bar.baz.buzz() && bing.bong + 130 │ i Suggested fix: Change to an optional chain. @@ -2047,10 +2149,12 @@ logicalAndCases.js:129:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:129:1 - │ - 129 │ foo.bar && foo.bar.baz.buzz() && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 127 │ // case with a jump (i.e. a non-nullish prop) + 128 │ foo && foo.bar && foo.bar.baz.buzz() && bing.bong + > 129 │ foo.bar && foo.bar.baz.buzz() && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 130 │ + 131 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -2072,10 +2176,11 @@ logicalAndCases.js:132:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:132:1 - │ - 132 │ foo && foo.bar && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 131 │ // case with a jump (i.e. a non-nullish prop) + > 132 │ foo && foo.bar && foo.bar.baz.buzz && foo.bar.baz.buzz() && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 133 │ + 134 │ // case with a call expr inside the chain for some inefficient reason i Suggested fix: Change to an optional chain. @@ -2097,10 +2202,11 @@ logicalAndCases.js:135:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:135:1 - │ - 135 │ foo && foo.bar() && foo.bar().baz && foo.bar().baz.buzz && foo.bar().baz.buzz() && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 134 │ // case with a call expr inside the chain for some inefficient reason + > 135 │ foo && foo.bar() && foo.bar().baz && foo.bar().baz.buzz && foo.bar().baz.buzz() && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 136 │ + 137 │ // chained calls with element access i Suggested fix: Change to an optional chain. @@ -2122,10 +2228,11 @@ logicalAndCases.js:138:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:138:1 - │ - 138 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz]() && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 137 │ // chained calls with element access + > 138 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz]() && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 139 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]() && bing.bong + 140 │ i Suggested fix: Change to an optional chain. @@ -2147,10 +2254,12 @@ logicalAndCases.js:139:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:139:1 - │ - 139 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]() && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 137 │ // chained calls with element access + 138 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz]() && bing.bong + > 139 │ foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]() && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 140 │ + 141 │ // (partially) pre-optional chained i Suggested fix: Change to an optional chain. @@ -2172,10 +2281,11 @@ logicalAndCases.js:142:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:142:1 - │ - 142 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 141 │ // (partially) pre-optional chained + > 142 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 143 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] && bing.bong + 144 │ foo && foo?.() && foo?.().bar && bing.bong i Suggested fix: Change to an optional chain. @@ -2197,10 +2307,12 @@ logicalAndCases.js:143:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:143:1 - │ - 143 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 141 │ // (partially) pre-optional chained + 142 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() && bing.bong + > 143 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 144 │ foo && foo?.() && foo?.().bar && bing.bong + 145 │ foo.bar && foo.bar?.() && foo.bar?.().baz && bing.bong i Suggested fix: Change to an optional chain. @@ -2222,10 +2334,12 @@ logicalAndCases.js:144:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:144:1 - │ - 144 │ foo && foo?.() && foo?.().bar && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 142 │ foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]() && bing.bong + 143 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] && bing.bong + > 144 │ foo && foo?.() && foo?.().bar && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 145 │ foo.bar && foo.bar?.() && foo.bar?.().baz && bing.bong + 146 │ i Suggested fix: Change to an optional chain. @@ -2247,10 +2361,12 @@ logicalAndCases.js:145:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:145:1 - │ - 145 │ foo.bar && foo.bar?.() && foo.bar?.().baz && bing.bong - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 143 │ foo && foo?.bar.baz && foo?.bar.baz[buzz] && bing.bong + 144 │ foo && foo?.() && foo?.().bar && bing.bong + > 145 │ foo.bar && foo.bar?.() && foo.bar?.().baz && bing.bong + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 146 │ + 147 │ // strict nullish equality checks x !== null && x.y !== null i Suggested fix: Change to an optional chain. @@ -2272,10 +2388,12 @@ logicalAndCases.js:149:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:149:1 - │ - 149 │ foo !== null && foo.bar - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 147 │ // strict nullish equality checks x !== null && x.y !== null + 148 │ // chained members + > 149 │ foo !== null && foo.bar + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 150 │ foo.bar !== null && foo.bar.baz + 151 │ foo !== null && foo() i Suggested fix: Change to an optional chain. @@ -2297,10 +2415,12 @@ logicalAndCases.js:150:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:150:1 - │ - 150 │ foo.bar !== null && foo.bar.baz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 148 │ // chained members + 149 │ foo !== null && foo.bar + > 150 │ foo.bar !== null && foo.bar.baz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 151 │ foo !== null && foo() + 152 │ foo.bar !== null && foo.bar() i Suggested fix: Change to an optional chain. @@ -2322,10 +2442,12 @@ logicalAndCases.js:151:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:151:1 - │ - 151 │ foo !== null && foo() - │ ^^^^^^^^^^^^^^^^^^^^^ + 149 │ foo !== null && foo.bar + 150 │ foo.bar !== null && foo.bar.baz + > 151 │ foo !== null && foo() + │ ^^^^^^^^^^^^^^^^^^^^^ + 152 │ foo.bar !== null && foo.bar() + 153 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz i Suggested fix: Change to an optional chain. @@ -2347,10 +2469,12 @@ logicalAndCases.js:152:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:152:1 - │ - 152 │ foo.bar !== null && foo.bar() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 150 │ foo.bar !== null && foo.bar.baz + 151 │ foo !== null && foo() + > 152 │ foo.bar !== null && foo.bar() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 153 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz + 154 │ foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz i Suggested fix: Change to an optional chain. @@ -2372,10 +2496,12 @@ logicalAndCases.js:153:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:153:1 - │ - 153 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 151 │ foo !== null && foo() + 152 │ foo.bar !== null && foo.bar() + > 153 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 154 │ foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz + 155 │ i Suggested fix: Change to an optional chain. @@ -2397,10 +2523,12 @@ logicalAndCases.js:154:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:154:1 - │ - 154 │ foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 152 │ foo.bar !== null && foo.bar() + 153 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz + > 154 │ foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 155 │ + 156 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -2422,10 +2550,11 @@ logicalAndCases.js:157:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:157:1 - │ - 157 │ foo !== null && foo.bar !== null && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 156 │ // case with a jump (i.e. a non-nullish prop) + > 157 │ foo !== null && foo.bar !== null && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 158 │ foo.bar !== null && foo.bar.baz.buzz + 159 │ i Suggested fix: Change to an optional chain. @@ -2447,10 +2576,12 @@ logicalAndCases.js:158:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:158:1 - │ - 158 │ foo.bar !== null && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 156 │ // case with a jump (i.e. a non-nullish prop) + 157 │ foo !== null && foo.bar !== null && foo.bar.baz.buzz + > 158 │ foo.bar !== null && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 159 │ + 160 │ // case where for some reason there is a doubled up expression i Suggested fix: Change to an optional chain. @@ -2472,10 +2603,11 @@ logicalAndCases.js:161:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:161:1 - │ - 161 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz !== null && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 160 │ // case where for some reason there is a doubled up expression + > 161 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz !== null && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 162 │ foo.bar !== null && foo.bar.baz !== null && foo.bar.baz !== null && foo.bar.baz.buzz + 163 │ i Suggested fix: Change to an optional chain. @@ -2497,10 +2629,12 @@ logicalAndCases.js:162:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:162:1 - │ - 162 │ foo.bar !== null && foo.bar.baz !== null && foo.bar.baz !== null && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 160 │ // case where for some reason there is a doubled up expression + 161 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz !== null && foo.bar.baz.buzz + > 162 │ foo.bar !== null && foo.bar.baz !== null && foo.bar.baz !== null && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 163 │ + 164 │ // chained members with element access i Suggested fix: Change to an optional chain. @@ -2522,10 +2656,11 @@ logicalAndCases.js:165:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:165:1 - │ - 165 │ foo !== null && foo[bar] !== null && foo[bar].baz !== null && foo[bar].baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 164 │ // chained members with element access + > 165 │ foo !== null && foo[bar] !== null && foo[bar].baz !== null && foo[bar].baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 166 │ + 167 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -2547,10 +2682,11 @@ logicalAndCases.js:168:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:168:1 - │ - 168 │ foo !== null && foo[bar].baz !== null && foo[bar].baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 167 │ // case with a jump (i.e. a non-nullish prop) + > 168 │ foo !== null && foo[bar].baz !== null && foo[bar].baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 169 │ + 170 │ // chained calls i Suggested fix: Change to an optional chain. @@ -2572,10 +2708,11 @@ logicalAndCases.js:171:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:171:1 - │ - 171 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 170 │ // chained calls + > 171 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 172 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz !== null && foo.bar.baz.buzz() + 173 │ foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz !== null && foo.bar.baz.buzz() i Suggested fix: Change to an optional chain. @@ -2597,10 +2734,12 @@ logicalAndCases.js:172:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:172:1 - │ - 172 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz !== null && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 170 │ // chained calls + 171 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz() + > 172 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz !== null && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 173 │ foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz !== null && foo.bar.baz.buzz() + 174 │ i Suggested fix: Change to an optional chain. @@ -2622,10 +2761,12 @@ logicalAndCases.js:173:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:173:1 - │ - 173 │ foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz !== null && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 171 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz() + 172 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz !== null && foo.bar.baz.buzz() + > 173 │ foo.bar !== null && foo.bar.baz !== null && foo.bar.baz.buzz !== null && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 174 │ + 175 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -2647,10 +2788,11 @@ logicalAndCases.js:176:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:176:1 - │ - 176 │ foo !== null && foo.bar !== null && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 175 │ // case with a jump (i.e. a non-nullish prop) + > 176 │ foo !== null && foo.bar !== null && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 177 │ foo.bar !== null && foo.bar.baz.buzz() + 178 │ i Suggested fix: Change to an optional chain. @@ -2672,10 +2814,12 @@ logicalAndCases.js:177:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:177:1 - │ - 177 │ foo.bar !== null && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 175 │ // case with a jump (i.e. a non-nullish prop) + 176 │ foo !== null && foo.bar !== null && foo.bar.baz.buzz() + > 177 │ foo.bar !== null && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 178 │ + 179 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -2697,10 +2841,11 @@ logicalAndCases.js:180:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:180:1 - │ - 180 │ foo !== null && foo.bar !== null && foo.bar.baz.buzz !== null && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 179 │ // case with a jump (i.e. a non-nullish prop) + > 180 │ foo !== null && foo.bar !== null && foo.bar.baz.buzz !== null && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 181 │ + 182 │ // case with a call expr inside the chain for some inefficient reason i Suggested fix: Change to an optional chain. @@ -2722,10 +2867,11 @@ logicalAndCases.js:183:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:183:1 - │ - 183 │ foo !== null && foo.bar() !== null && foo.bar().baz !== null && foo.bar().baz.buzz !== null && foo.bar().baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 182 │ // case with a call expr inside the chain for some inefficient reason + > 183 │ foo !== null && foo.bar() !== null && foo.bar().baz !== null && foo.bar().baz.buzz !== null && foo.bar().baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 184 │ + 185 │ // chained calls with element access i Suggested fix: Change to an optional chain. @@ -2747,10 +2893,11 @@ logicalAndCases.js:186:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:186:1 - │ - 186 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 185 │ // chained calls with element access + > 186 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 187 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz[buzz] !== null && foo.bar.baz[buzz]() + 188 │ i Suggested fix: Change to an optional chain. @@ -2772,10 +2919,12 @@ logicalAndCases.js:187:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:187:1 - │ - 187 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz[buzz] !== null && foo.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 185 │ // chained calls with element access + 186 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz[buzz]() + > 187 │ foo !== null && foo.bar !== null && foo.bar.baz !== null && foo.bar.baz[buzz] !== null && foo.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 188 │ + 189 │ // (partially) pre-optional chained i Suggested fix: Change to an optional chain. @@ -2797,10 +2946,11 @@ logicalAndCases.js:190:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:190:1 - │ - 190 │ foo !== null && foo?.bar !== null && foo?.bar.baz !== null && foo?.bar.baz[buzz] !== null && foo?.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 189 │ // (partially) pre-optional chained + > 190 │ foo !== null && foo?.bar !== null && foo?.bar.baz !== null && foo?.bar.baz[buzz] !== null && foo?.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 191 │ foo !== null && foo?.bar.baz !== null && foo?.bar.baz[buzz] + 192 │ foo !== null && foo?.() !== null && foo?.().bar i Suggested fix: Change to an optional chain. @@ -2822,10 +2972,12 @@ logicalAndCases.js:191:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:191:1 - │ - 191 │ foo !== null && foo?.bar.baz !== null && foo?.bar.baz[buzz] - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 189 │ // (partially) pre-optional chained + 190 │ foo !== null && foo?.bar !== null && foo?.bar.baz !== null && foo?.bar.baz[buzz] !== null && foo?.bar.baz[buzz]() + > 191 │ foo !== null && foo?.bar.baz !== null && foo?.bar.baz[buzz] + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 192 │ foo !== null && foo?.() !== null && foo?.().bar + 193 │ foo.bar !== null && foo.bar?.() !== null && foo.bar?.().baz i Suggested fix: Change to an optional chain. @@ -2847,10 +2999,12 @@ logicalAndCases.js:192:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:192:1 - │ - 192 │ foo !== null && foo?.() !== null && foo?.().bar - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 190 │ foo !== null && foo?.bar !== null && foo?.bar.baz !== null && foo?.bar.baz[buzz] !== null && foo?.bar.baz[buzz]() + 191 │ foo !== null && foo?.bar.baz !== null && foo?.bar.baz[buzz] + > 192 │ foo !== null && foo?.() !== null && foo?.().bar + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 193 │ foo.bar !== null && foo.bar?.() !== null && foo.bar?.().baz + 194 │ i Suggested fix: Change to an optional chain. @@ -2872,10 +3026,12 @@ logicalAndCases.js:193:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:193:1 - │ - 193 │ foo.bar !== null && foo.bar?.() !== null && foo.bar?.().baz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 191 │ foo !== null && foo?.bar.baz !== null && foo?.bar.baz[buzz] + 192 │ foo !== null && foo?.() !== null && foo?.().bar + > 193 │ foo.bar !== null && foo.bar?.() !== null && foo.bar?.().baz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 194 │ + 195 │ // chained members i Suggested fix: Change to an optional chain. @@ -2897,10 +3053,11 @@ logicalAndCases.js:196:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:196:1 - │ - 196 │ foo !== undefined && foo.bar - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 195 │ // chained members + > 196 │ foo !== undefined && foo.bar + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 197 │ foo.bar !== undefined && foo.bar.baz + 198 │ foo !== undefined && foo() i Suggested fix: Change to an optional chain. @@ -2922,10 +3079,12 @@ logicalAndCases.js:197:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:197:1 - │ - 197 │ foo.bar !== undefined && foo.bar.baz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 195 │ // chained members + 196 │ foo !== undefined && foo.bar + > 197 │ foo.bar !== undefined && foo.bar.baz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 198 │ foo !== undefined && foo() + 199 │ foo.bar !== undefined && foo.bar() i Suggested fix: Change to an optional chain. @@ -2947,10 +3106,12 @@ logicalAndCases.js:198:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:198:1 - │ - 198 │ foo !== undefined && foo() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 196 │ foo !== undefined && foo.bar + 197 │ foo.bar !== undefined && foo.bar.baz + > 198 │ foo !== undefined && foo() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 199 │ foo.bar !== undefined && foo.bar() + 200 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz i Suggested fix: Change to an optional chain. @@ -2972,10 +3133,12 @@ logicalAndCases.js:199:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:199:1 - │ - 199 │ foo.bar !== undefined && foo.bar() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 197 │ foo.bar !== undefined && foo.bar.baz + 198 │ foo !== undefined && foo() + > 199 │ foo.bar !== undefined && foo.bar() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 200 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz + 201 │ foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz i Suggested fix: Change to an optional chain. @@ -2997,10 +3160,12 @@ logicalAndCases.js:200:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:200:1 - │ - 200 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 198 │ foo !== undefined && foo() + 199 │ foo.bar !== undefined && foo.bar() + > 200 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 201 │ foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz + 202 │ i Suggested fix: Change to an optional chain. @@ -3022,10 +3187,12 @@ logicalAndCases.js:201:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:201:1 - │ - 201 │ foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 199 │ foo.bar !== undefined && foo.bar() + 200 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz + > 201 │ foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 202 │ + 203 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -3047,10 +3214,11 @@ logicalAndCases.js:204:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:204:1 - │ - 204 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 203 │ // case with a jump (i.e. a non-nullish prop) + > 204 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 205 │ foo.bar !== undefined && foo.bar.baz.buzz + 206 │ i Suggested fix: Change to an optional chain. @@ -3072,10 +3240,12 @@ logicalAndCases.js:205:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:205:1 - │ - 205 │ foo.bar !== undefined && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 203 │ // case with a jump (i.e. a non-nullish prop) + 204 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz.buzz + > 205 │ foo.bar !== undefined && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 206 │ + 207 │ // case where for some reason there is a doubled up expression i Suggested fix: Change to an optional chain. @@ -3097,10 +3267,11 @@ logicalAndCases.js:208:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:208:1 - │ - 208 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 207 │ // case where for some reason there is a doubled up expression + > 208 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 209 │ foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz + 210 │ i Suggested fix: Change to an optional chain. @@ -3122,10 +3293,12 @@ logicalAndCases.js:209:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:209:1 - │ - 209 │ foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 207 │ // case where for some reason there is a doubled up expression + 208 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz + > 209 │ foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 210 │ + 211 │ // chained members with element access i Suggested fix: Change to an optional chain. @@ -3147,10 +3320,11 @@ logicalAndCases.js:212:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:212:1 - │ - 212 │ foo !== undefined && foo[bar] !== undefined && foo[bar].baz !== undefined && foo[bar].baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 211 │ // chained members with element access + > 212 │ foo !== undefined && foo[bar] !== undefined && foo[bar].baz !== undefined && foo[bar].baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 213 │ + 214 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -3172,10 +3346,11 @@ logicalAndCases.js:215:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:215:1 - │ - 215 │ foo !== undefined && foo[bar].baz !== undefined && foo[bar].baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 214 │ // case with a jump (i.e. a non-nullish prop) + > 215 │ foo !== undefined && foo[bar].baz !== undefined && foo[bar].baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 216 │ + 217 │ // chained calls i Suggested fix: Change to an optional chain. @@ -3197,10 +3372,11 @@ logicalAndCases.js:218:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:218:1 - │ - 218 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 217 │ // chained calls + > 218 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 219 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz !== undefined && foo.bar.baz.buzz() + 220 │ foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz !== undefined && foo.bar.baz.buzz() i Suggested fix: Change to an optional chain. @@ -3222,10 +3398,12 @@ logicalAndCases.js:219:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:219:1 - │ - 219 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz !== undefined && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 217 │ // chained calls + 218 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz() + > 219 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz !== undefined && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 220 │ foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz !== undefined && foo.bar.baz.buzz() + 221 │ i Suggested fix: Change to an optional chain. @@ -3247,10 +3425,12 @@ logicalAndCases.js:220:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:220:1 - │ - 220 │ foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz !== undefined && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 218 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz() + 219 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz !== undefined && foo.bar.baz.buzz() + > 220 │ foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz.buzz !== undefined && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 221 │ + 222 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -3272,10 +3452,11 @@ logicalAndCases.js:223:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:223:1 - │ - 223 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 222 │ // case with a jump (i.e. a non-nullish prop) + > 223 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 224 │ foo.bar !== undefined && foo.bar.baz.buzz() + 225 │ i Suggested fix: Change to an optional chain. @@ -3297,10 +3478,12 @@ logicalAndCases.js:224:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:224:1 - │ - 224 │ foo.bar !== undefined && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 222 │ // case with a jump (i.e. a non-nullish prop) + 223 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz.buzz() + > 224 │ foo.bar !== undefined && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 225 │ + 226 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -3322,10 +3505,11 @@ logicalAndCases.js:227:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:227:1 - │ - 227 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz.buzz !== undefined && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 226 │ // case with a jump (i.e. a non-nullish prop) + > 227 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz.buzz !== undefined && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 228 │ + 229 │ // case with a call expr inside the chain for some inefficient reason i Suggested fix: Change to an optional chain. @@ -3347,10 +3531,11 @@ logicalAndCases.js:230:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:230:1 - │ - 230 │ foo !== undefined && foo.bar() !== undefined && foo.bar().baz !== undefined && foo.bar().baz.buzz !== undefined && foo.bar().baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 229 │ // case with a call expr inside the chain for some inefficient reason + > 230 │ foo !== undefined && foo.bar() !== undefined && foo.bar().baz !== undefined && foo.bar().baz.buzz !== undefined && foo.bar().baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 231 │ + 232 │ // chained calls with element access i Suggested fix: Change to an optional chain. @@ -3372,10 +3557,11 @@ logicalAndCases.js:233:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:233:1 - │ - 233 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 232 │ // chained calls with element access + > 233 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 234 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz[buzz] !== undefined && foo.bar.baz[buzz]() + 235 │ i Suggested fix: Change to an optional chain. @@ -3397,10 +3583,12 @@ logicalAndCases.js:234:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:234:1 - │ - 234 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz[buzz] !== undefined && foo.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 232 │ // chained calls with element access + 233 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz[buzz]() + > 234 │ foo !== undefined && foo.bar !== undefined && foo.bar.baz !== undefined && foo.bar.baz[buzz] !== undefined && foo.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 235 │ + 236 │ // (partially) pre-optional chained i Suggested fix: Change to an optional chain. @@ -3422,10 +3610,11 @@ logicalAndCases.js:237:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:237:1 - │ - 237 │ foo !== undefined && foo?.bar !== undefined && foo?.bar.baz !== undefined && foo?.bar.baz[buzz] !== undefined && foo?.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 236 │ // (partially) pre-optional chained + > 237 │ foo !== undefined && foo?.bar !== undefined && foo?.bar.baz !== undefined && foo?.bar.baz[buzz] !== undefined && foo?.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 238 │ foo !== undefined && foo?.bar.baz !== undefined && foo?.bar.baz[buzz] + 239 │ foo !== undefined && foo?.() !== undefined && foo?.().bar i Suggested fix: Change to an optional chain. @@ -3447,10 +3636,12 @@ logicalAndCases.js:238:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:238:1 - │ - 238 │ foo !== undefined && foo?.bar.baz !== undefined && foo?.bar.baz[buzz] - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 236 │ // (partially) pre-optional chained + 237 │ foo !== undefined && foo?.bar !== undefined && foo?.bar.baz !== undefined && foo?.bar.baz[buzz] !== undefined && foo?.bar.baz[buzz]() + > 238 │ foo !== undefined && foo?.bar.baz !== undefined && foo?.bar.baz[buzz] + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 239 │ foo !== undefined && foo?.() !== undefined && foo?.().bar + 240 │ foo.bar !== undefined && foo.bar?.() !== undefined && foo.bar?.().baz i Suggested fix: Change to an optional chain. @@ -3472,10 +3663,12 @@ logicalAndCases.js:239:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:239:1 - │ - 239 │ foo !== undefined && foo?.() !== undefined && foo?.().bar - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 237 │ foo !== undefined && foo?.bar !== undefined && foo?.bar.baz !== undefined && foo?.bar.baz[buzz] !== undefined && foo?.bar.baz[buzz]() + 238 │ foo !== undefined && foo?.bar.baz !== undefined && foo?.bar.baz[buzz] + > 239 │ foo !== undefined && foo?.() !== undefined && foo?.().bar + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 240 │ foo.bar !== undefined && foo.bar?.() !== undefined && foo.bar?.().baz + 241 │ i Suggested fix: Change to an optional chain. @@ -3497,10 +3690,12 @@ logicalAndCases.js:240:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:240:1 - │ - 240 │ foo.bar !== undefined && foo.bar?.() !== undefined && foo.bar?.().baz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 238 │ foo !== undefined && foo?.bar.baz !== undefined && foo?.bar.baz[buzz] + 239 │ foo !== undefined && foo?.() !== undefined && foo?.().bar + > 240 │ foo.bar !== undefined && foo.bar?.() !== undefined && foo.bar?.().baz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 241 │ + 242 │ // chained members i Suggested fix: Change to an optional chain. @@ -3522,10 +3717,11 @@ logicalAndCases.js:243:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:243:1 - │ - 243 │ foo != null && foo.bar - │ ^^^^^^^^^^^^^^^^^^^^^^ + 242 │ // chained members + > 243 │ foo != null && foo.bar + │ ^^^^^^^^^^^^^^^^^^^^^^ + 244 │ foo.bar != null && foo.bar.baz + 245 │ foo != null && foo() i Suggested fix: Change to an optional chain. @@ -3547,10 +3743,12 @@ logicalAndCases.js:244:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:244:1 - │ - 244 │ foo.bar != null && foo.bar.baz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 242 │ // chained members + 243 │ foo != null && foo.bar + > 244 │ foo.bar != null && foo.bar.baz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 245 │ foo != null && foo() + 246 │ foo.bar != null && foo.bar() i Suggested fix: Change to an optional chain. @@ -3572,10 +3770,12 @@ logicalAndCases.js:245:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:245:1 - │ - 245 │ foo != null && foo() - │ ^^^^^^^^^^^^^^^^^^^^ + 243 │ foo != null && foo.bar + 244 │ foo.bar != null && foo.bar.baz + > 245 │ foo != null && foo() + │ ^^^^^^^^^^^^^^^^^^^^ + 246 │ foo.bar != null && foo.bar() + 247 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz i Suggested fix: Change to an optional chain. @@ -3597,10 +3797,12 @@ logicalAndCases.js:246:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:246:1 - │ - 246 │ foo.bar != null && foo.bar() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 244 │ foo.bar != null && foo.bar.baz + 245 │ foo != null && foo() + > 246 │ foo.bar != null && foo.bar() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 247 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz + 248 │ foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz i Suggested fix: Change to an optional chain. @@ -3622,10 +3824,12 @@ logicalAndCases.js:247:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:247:1 - │ - 247 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 245 │ foo != null && foo() + 246 │ foo.bar != null && foo.bar() + > 247 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 248 │ foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz + 249 │ i Suggested fix: Change to an optional chain. @@ -3647,10 +3851,12 @@ logicalAndCases.js:248:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:248:1 - │ - 248 │ foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 246 │ foo.bar != null && foo.bar() + 247 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz + > 248 │ foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 249 │ + 250 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -3672,10 +3878,11 @@ logicalAndCases.js:251:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:251:1 - │ - 251 │ foo != null && foo.bar != null && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 250 │ // case with a jump (i.e. a non-nullish prop) + > 251 │ foo != null && foo.bar != null && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 252 │ foo.bar != null && foo.bar.baz.buzz + 253 │ i Suggested fix: Change to an optional chain. @@ -3697,10 +3904,12 @@ logicalAndCases.js:252:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:252:1 - │ - 252 │ foo.bar != null && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 250 │ // case with a jump (i.e. a non-nullish prop) + 251 │ foo != null && foo.bar != null && foo.bar.baz.buzz + > 252 │ foo.bar != null && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 253 │ + 254 │ // case where for some reason there is a doubled up expression i Suggested fix: Change to an optional chain. @@ -3722,10 +3931,11 @@ logicalAndCases.js:255:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:255:1 - │ - 255 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz != null && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 254 │ // case where for some reason there is a doubled up expression + > 255 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz != null && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 256 │ foo.bar != null && foo.bar.baz != null && foo.bar.baz != null && foo.bar.baz.buzz + 257 │ i Suggested fix: Change to an optional chain. @@ -3747,10 +3957,12 @@ logicalAndCases.js:256:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:256:1 - │ - 256 │ foo.bar != null && foo.bar.baz != null && foo.bar.baz != null && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 254 │ // case where for some reason there is a doubled up expression + 255 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz != null && foo.bar.baz.buzz + > 256 │ foo.bar != null && foo.bar.baz != null && foo.bar.baz != null && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 257 │ + 258 │ // chained members with element access i Suggested fix: Change to an optional chain. @@ -3772,10 +3984,11 @@ logicalAndCases.js:259:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:259:1 - │ - 259 │ foo != null && foo[bar] != null && foo[bar].baz != null && foo[bar].baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 258 │ // chained members with element access + > 259 │ foo != null && foo[bar] != null && foo[bar].baz != null && foo[bar].baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 260 │ + 261 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -3797,10 +4010,11 @@ logicalAndCases.js:262:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:262:1 - │ - 262 │ foo != null && foo[bar].baz != null && foo[bar].baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 261 │ // case with a jump (i.e. a non-nullish prop) + > 262 │ foo != null && foo[bar].baz != null && foo[bar].baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 263 │ + 264 │ // chained calls i Suggested fix: Change to an optional chain. @@ -3822,10 +4036,11 @@ logicalAndCases.js:265:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:265:1 - │ - 265 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 264 │ // chained calls + > 265 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 266 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz != null && foo.bar.baz.buzz() + 267 │ foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz != null && foo.bar.baz.buzz() i Suggested fix: Change to an optional chain. @@ -3847,10 +4062,12 @@ logicalAndCases.js:266:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:266:1 - │ - 266 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz != null && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 264 │ // chained calls + 265 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz() + > 266 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz != null && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 267 │ foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz != null && foo.bar.baz.buzz() + 268 │ i Suggested fix: Change to an optional chain. @@ -3872,10 +4089,12 @@ logicalAndCases.js:267:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:267:1 - │ - 267 │ foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz != null && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 265 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz() + 266 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz != null && foo.bar.baz.buzz() + > 267 │ foo.bar != null && foo.bar.baz != null && foo.bar.baz.buzz != null && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 268 │ + 269 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -3897,10 +4116,11 @@ logicalAndCases.js:270:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:270:1 - │ - 270 │ foo != null && foo.bar != null && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 269 │ // case with a jump (i.e. a non-nullish prop) + > 270 │ foo != null && foo.bar != null && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 271 │ foo.bar != null && foo.bar.baz.buzz() + 272 │ i Suggested fix: Change to an optional chain. @@ -3922,10 +4142,12 @@ logicalAndCases.js:271:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:271:1 - │ - 271 │ foo.bar != null && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 269 │ // case with a jump (i.e. a non-nullish prop) + 270 │ foo != null && foo.bar != null && foo.bar.baz.buzz() + > 271 │ foo.bar != null && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 272 │ + 273 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -3947,10 +4169,11 @@ logicalAndCases.js:274:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:274:1 - │ - 274 │ foo != null && foo.bar != null && foo.bar.baz.buzz != null && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 273 │ // case with a jump (i.e. a non-nullish prop) + > 274 │ foo != null && foo.bar != null && foo.bar.baz.buzz != null && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 275 │ + 276 │ // case with a call expr inside the chain for some inefficient reason i Suggested fix: Change to an optional chain. @@ -3972,10 +4195,11 @@ logicalAndCases.js:277:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:277:1 - │ - 277 │ foo != null && foo.bar() != null && foo.bar().baz != null && foo.bar().baz.buzz != null && foo.bar().baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 276 │ // case with a call expr inside the chain for some inefficient reason + > 277 │ foo != null && foo.bar() != null && foo.bar().baz != null && foo.bar().baz.buzz != null && foo.bar().baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 278 │ + 279 │ // chained calls with element access i Suggested fix: Change to an optional chain. @@ -3997,10 +4221,11 @@ logicalAndCases.js:280:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:280:1 - │ - 280 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 279 │ // chained calls with element access + > 280 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 281 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz[buzz] != null && foo.bar.baz[buzz]() + 282 │ i Suggested fix: Change to an optional chain. @@ -4022,10 +4247,12 @@ logicalAndCases.js:281:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:281:1 - │ - 281 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz[buzz] != null && foo.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 279 │ // chained calls with element access + 280 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz[buzz]() + > 281 │ foo != null && foo.bar != null && foo.bar.baz != null && foo.bar.baz[buzz] != null && foo.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 282 │ + 283 │ // (partially) pre-optional chained i Suggested fix: Change to an optional chain. @@ -4047,10 +4274,11 @@ logicalAndCases.js:284:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:284:1 - │ - 284 │ foo != null && foo?.bar != null && foo?.bar.baz != null && foo?.bar.baz[buzz] != null && foo?.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 283 │ // (partially) pre-optional chained + > 284 │ foo != null && foo?.bar != null && foo?.bar.baz != null && foo?.bar.baz[buzz] != null && foo?.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 285 │ foo != null && foo?.bar.baz != null && foo?.bar.baz[buzz] + 286 │ foo != null && foo?.() != null && foo?.().bar i Suggested fix: Change to an optional chain. @@ -4072,10 +4300,12 @@ logicalAndCases.js:285:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:285:1 - │ - 285 │ foo != null && foo?.bar.baz != null && foo?.bar.baz[buzz] - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 283 │ // (partially) pre-optional chained + 284 │ foo != null && foo?.bar != null && foo?.bar.baz != null && foo?.bar.baz[buzz] != null && foo?.bar.baz[buzz]() + > 285 │ foo != null && foo?.bar.baz != null && foo?.bar.baz[buzz] + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 286 │ foo != null && foo?.() != null && foo?.().bar + 287 │ foo.bar != null && foo.bar?.() != null && foo.bar?.().baz i Suggested fix: Change to an optional chain. @@ -4097,10 +4327,12 @@ logicalAndCases.js:286:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:286:1 - │ - 286 │ foo != null && foo?.() != null && foo?.().bar - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 284 │ foo != null && foo?.bar != null && foo?.bar.baz != null && foo?.bar.baz[buzz] != null && foo?.bar.baz[buzz]() + 285 │ foo != null && foo?.bar.baz != null && foo?.bar.baz[buzz] + > 286 │ foo != null && foo?.() != null && foo?.().bar + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 287 │ foo.bar != null && foo.bar?.() != null && foo.bar?.().baz + 288 │ i Suggested fix: Change to an optional chain. @@ -4122,10 +4354,12 @@ logicalAndCases.js:287:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:287:1 - │ - 287 │ foo.bar != null && foo.bar?.() != null && foo.bar?.().baz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 285 │ foo != null && foo?.bar.baz != null && foo?.bar.baz[buzz] + 286 │ foo != null && foo?.() != null && foo?.().bar + > 287 │ foo.bar != null && foo.bar?.() != null && foo.bar?.().baz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 288 │ + 289 │ // chained members i Suggested fix: Change to an optional chain. @@ -4147,10 +4381,11 @@ logicalAndCases.js:290:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:290:1 - │ - 290 │ foo != undefined && foo.bar - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 289 │ // chained members + > 290 │ foo != undefined && foo.bar + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 291 │ foo.bar != undefined && foo.bar.baz + 292 │ foo != undefined && foo() i Suggested fix: Change to an optional chain. @@ -4172,10 +4407,12 @@ logicalAndCases.js:291:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:291:1 - │ - 291 │ foo.bar != undefined && foo.bar.baz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 289 │ // chained members + 290 │ foo != undefined && foo.bar + > 291 │ foo.bar != undefined && foo.bar.baz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 292 │ foo != undefined && foo() + 293 │ foo.bar != undefined && foo.bar() i Suggested fix: Change to an optional chain. @@ -4197,10 +4434,12 @@ logicalAndCases.js:292:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:292:1 - │ - 292 │ foo != undefined && foo() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 290 │ foo != undefined && foo.bar + 291 │ foo.bar != undefined && foo.bar.baz + > 292 │ foo != undefined && foo() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 293 │ foo.bar != undefined && foo.bar() + 294 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz i Suggested fix: Change to an optional chain. @@ -4222,10 +4461,12 @@ logicalAndCases.js:293:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:293:1 - │ - 293 │ foo.bar != undefined && foo.bar() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 291 │ foo.bar != undefined && foo.bar.baz + 292 │ foo != undefined && foo() + > 293 │ foo.bar != undefined && foo.bar() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 294 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz + 295 │ foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz i Suggested fix: Change to an optional chain. @@ -4247,10 +4488,12 @@ logicalAndCases.js:294:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:294:1 - │ - 294 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 292 │ foo != undefined && foo() + 293 │ foo.bar != undefined && foo.bar() + > 294 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 295 │ foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz + 296 │ i Suggested fix: Change to an optional chain. @@ -4272,10 +4515,12 @@ logicalAndCases.js:295:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:295:1 - │ - 295 │ foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 293 │ foo.bar != undefined && foo.bar() + 294 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz + > 295 │ foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 296 │ + 297 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -4297,10 +4542,11 @@ logicalAndCases.js:298:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:298:1 - │ - 298 │ foo != undefined && foo.bar != undefined && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 297 │ // case with a jump (i.e. a non-nullish prop) + > 298 │ foo != undefined && foo.bar != undefined && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 299 │ foo.bar != undefined && foo.bar.baz.buzz + 300 │ i Suggested fix: Change to an optional chain. @@ -4322,10 +4568,12 @@ logicalAndCases.js:299:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:299:1 - │ - 299 │ foo.bar != undefined && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 297 │ // case with a jump (i.e. a non-nullish prop) + 298 │ foo != undefined && foo.bar != undefined && foo.bar.baz.buzz + > 299 │ foo.bar != undefined && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 300 │ + 301 │ // case where for some reason there is a doubled up expression i Suggested fix: Change to an optional chain. @@ -4347,10 +4595,11 @@ logicalAndCases.js:302:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:302:1 - │ - 302 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 301 │ // case where for some reason there is a doubled up expression + > 302 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 303 │ foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz + 304 │ i Suggested fix: Change to an optional chain. @@ -4372,10 +4621,12 @@ logicalAndCases.js:303:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:303:1 - │ - 303 │ foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 301 │ // case where for some reason there is a doubled up expression + 302 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz + > 303 │ foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 304 │ + 305 │ // chained members with element access i Suggested fix: Change to an optional chain. @@ -4397,10 +4648,11 @@ logicalAndCases.js:306:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:306:1 - │ - 306 │ foo != undefined && foo[bar] != undefined && foo[bar].baz != undefined && foo[bar].baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 305 │ // chained members with element access + > 306 │ foo != undefined && foo[bar] != undefined && foo[bar].baz != undefined && foo[bar].baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 307 │ + 308 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -4422,10 +4674,11 @@ logicalAndCases.js:309:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:309:1 - │ - 309 │ foo != undefined && foo[bar].baz != undefined && foo[bar].baz.buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 308 │ // case with a jump (i.e. a non-nullish prop) + > 309 │ foo != undefined && foo[bar].baz != undefined && foo[bar].baz.buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 310 │ + 311 │ // chained calls i Suggested fix: Change to an optional chain. @@ -4447,10 +4700,11 @@ logicalAndCases.js:312:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:312:1 - │ - 312 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 311 │ // chained calls + > 312 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 313 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz != undefined && foo.bar.baz.buzz() + 314 │ foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz != undefined && foo.bar.baz.buzz() i Suggested fix: Change to an optional chain. @@ -4472,10 +4726,12 @@ logicalAndCases.js:313:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:313:1 - │ - 313 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz != undefined && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 311 │ // chained calls + 312 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz() + > 313 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz != undefined && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 314 │ foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz != undefined && foo.bar.baz.buzz() + 315 │ i Suggested fix: Change to an optional chain. @@ -4497,10 +4753,12 @@ logicalAndCases.js:314:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:314:1 - │ - 314 │ foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz != undefined && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 312 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz() + 313 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz != undefined && foo.bar.baz.buzz() + > 314 │ foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz.buzz != undefined && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 315 │ + 316 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -4522,10 +4780,11 @@ logicalAndCases.js:317:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:317:1 - │ - 317 │ foo != undefined && foo.bar != undefined && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 316 │ // case with a jump (i.e. a non-nullish prop) + > 317 │ foo != undefined && foo.bar != undefined && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 318 │ foo.bar != undefined && foo.bar.baz.buzz() + 319 │ i Suggested fix: Change to an optional chain. @@ -4547,10 +4806,12 @@ logicalAndCases.js:318:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:318:1 - │ - 318 │ foo.bar != undefined && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 316 │ // case with a jump (i.e. a non-nullish prop) + 317 │ foo != undefined && foo.bar != undefined && foo.bar.baz.buzz() + > 318 │ foo.bar != undefined && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 319 │ + 320 │ // case with a jump (i.e. a non-nullish prop) i Suggested fix: Change to an optional chain. @@ -4572,10 +4833,11 @@ logicalAndCases.js:321:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:321:1 - │ - 321 │ foo != undefined && foo.bar != undefined && foo.bar.baz.buzz != undefined && foo.bar.baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 320 │ // case with a jump (i.e. a non-nullish prop) + > 321 │ foo != undefined && foo.bar != undefined && foo.bar.baz.buzz != undefined && foo.bar.baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 322 │ + 323 │ // case with a call expr inside the chain for some inefficient reason i Suggested fix: Change to an optional chain. @@ -4597,10 +4859,11 @@ logicalAndCases.js:324:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:324:1 - │ - 324 │ foo != undefined && foo.bar() != undefined && foo.bar().baz != undefined && foo.bar().baz.buzz != undefined && foo.bar().baz.buzz() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 323 │ // case with a call expr inside the chain for some inefficient reason + > 324 │ foo != undefined && foo.bar() != undefined && foo.bar().baz != undefined && foo.bar().baz.buzz != undefined && foo.bar().baz.buzz() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 325 │ + 326 │ // chained calls with element access i Suggested fix: Change to an optional chain. @@ -4622,10 +4885,11 @@ logicalAndCases.js:327:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:327:1 - │ - 327 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 326 │ // chained calls with element access + > 327 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 328 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz[buzz] != undefined && foo.bar.baz[buzz]() + 329 │ i Suggested fix: Change to an optional chain. @@ -4647,10 +4911,12 @@ logicalAndCases.js:328:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:328:1 - │ - 328 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz[buzz] != undefined && foo.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 326 │ // chained calls with element access + 327 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz[buzz]() + > 328 │ foo != undefined && foo.bar != undefined && foo.bar.baz != undefined && foo.bar.baz[buzz] != undefined && foo.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 329 │ + 330 │ // (partially) pre-optional chained i Suggested fix: Change to an optional chain. @@ -4672,10 +4938,11 @@ logicalAndCases.js:331:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:331:1 - │ - 331 │ foo != undefined && foo?.bar != undefined && foo?.bar.baz != undefined && foo?.bar.baz[buzz] != undefined && foo?.bar.baz[buzz]() - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 330 │ // (partially) pre-optional chained + > 331 │ foo != undefined && foo?.bar != undefined && foo?.bar.baz != undefined && foo?.bar.baz[buzz] != undefined && foo?.bar.baz[buzz]() + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 332 │ foo != undefined && foo?.bar.baz != undefined && foo?.bar.baz[buzz] + 333 │ foo != undefined && foo?.() != undefined && foo?.().bar i Suggested fix: Change to an optional chain. @@ -4697,10 +4964,12 @@ logicalAndCases.js:332:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:332:1 - │ - 332 │ foo != undefined && foo?.bar.baz != undefined && foo?.bar.baz[buzz] - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 330 │ // (partially) pre-optional chained + 331 │ foo != undefined && foo?.bar != undefined && foo?.bar.baz != undefined && foo?.bar.baz[buzz] != undefined && foo?.bar.baz[buzz]() + > 332 │ foo != undefined && foo?.bar.baz != undefined && foo?.bar.baz[buzz] + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 333 │ foo != undefined && foo?.() != undefined && foo?.().bar + 334 │ foo.bar != undefined && foo.bar?.() != undefined && foo.bar?.().baz i Suggested fix: Change to an optional chain. @@ -4722,10 +4991,12 @@ logicalAndCases.js:333:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:333:1 - │ - 333 │ foo != undefined && foo?.() != undefined && foo?.().bar - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 331 │ foo != undefined && foo?.bar != undefined && foo?.bar.baz != undefined && foo?.bar.baz[buzz] != undefined && foo?.bar.baz[buzz]() + 332 │ foo != undefined && foo?.bar.baz != undefined && foo?.bar.baz[buzz] + > 333 │ foo != undefined && foo?.() != undefined && foo?.().bar + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 334 │ foo.bar != undefined && foo.bar?.() != undefined && foo.bar?.().baz + 335 │ i Suggested fix: Change to an optional chain. @@ -4747,10 +5018,12 @@ logicalAndCases.js:334:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:334:1 - │ - 334 │ foo.bar != undefined && foo.bar?.() != undefined && foo.bar?.().baz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 332 │ foo != undefined && foo?.bar.baz != undefined && foo?.bar.baz[buzz] + 333 │ foo != undefined && foo?.() != undefined && foo?.().bar + > 334 │ foo.bar != undefined && foo.bar?.() != undefined && foo.bar?.().baz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 335 │ + 336 │ //private static member name i Suggested fix: Change to an optional chain. @@ -4772,10 +5045,11 @@ logicalAndCases.js:337:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:337:1 - │ - 337 │ foo && foo.#bar - │ ^^^^^^^^^^^^^^^ + 336 │ //private static member name + > 337 │ foo && foo.#bar + │ ^^^^^^^^^^^^^^^ + 338 │ foo.#bar && foo.#bar.#baz + 339 │ foo.#bar && foo.#bar() i Suggested fix: Change to an optional chain. @@ -4797,10 +5071,12 @@ logicalAndCases.js:338:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:338:1 - │ - 338 │ foo.#bar && foo.#bar.#baz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 336 │ //private static member name + 337 │ foo && foo.#bar + > 338 │ foo.#bar && foo.#bar.#baz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 339 │ foo.#bar && foo.#bar() + 340 │ foo && foo.#bar && foo.#bar.#baz && foo.#bar.#baz.#buzz i Suggested fix: Change to an optional chain. @@ -4822,10 +5098,12 @@ logicalAndCases.js:339:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:339:1 - │ - 339 │ foo.#bar && foo.#bar() - │ ^^^^^^^^^^^^^^^^^^^^^^ + 337 │ foo && foo.#bar + 338 │ foo.#bar && foo.#bar.#baz + > 339 │ foo.#bar && foo.#bar() + │ ^^^^^^^^^^^^^^^^^^^^^^ + 340 │ foo && foo.#bar && foo.#bar.#baz && foo.#bar.#baz.#buzz + 341 │ foo.#bar && foo.#bar.#baz && foo.#bar.#baz.#buzz i Suggested fix: Change to an optional chain. @@ -4847,10 +5125,12 @@ logicalAndCases.js:340:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:340:1 - │ - 340 │ foo && foo.#bar && foo.#bar.#baz && foo.#bar.#baz.#buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 338 │ foo.#bar && foo.#bar.#baz + 339 │ foo.#bar && foo.#bar() + > 340 │ foo && foo.#bar && foo.#bar.#baz && foo.#bar.#baz.#buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 341 │ foo.#bar && foo.#bar.#baz && foo.#bar.#baz.#buzz + 342 │ i Suggested fix: Change to an optional chain. @@ -4872,10 +5152,12 @@ logicalAndCases.js:341:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:341:1 - │ - 341 │ foo.#bar && foo.#bar.#baz && foo.#bar.#baz.#buzz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 339 │ foo.#bar && foo.#bar() + 340 │ foo && foo.#bar && foo.#bar.#baz && foo.#bar.#baz.#buzz + > 341 │ foo.#bar && foo.#bar.#baz && foo.#bar.#baz.#buzz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 342 │ + 343 │ // two errors i Suggested fix: Change to an optional chain. @@ -4897,10 +5179,11 @@ logicalAndCases.js:344:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:344:1 - │ - 344 │ foo && foo.bar && foo.bar.baz || baz && baz.bar && baz.bar.foo - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 343 │ // two errors + > 344 │ foo && foo.bar && foo.bar.baz || baz && baz.bar && baz.bar.foo + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 345 │ + 346 │ // case with inconsistent checks i Suggested fix: Change to an optional chain. @@ -4922,10 +5205,11 @@ logicalAndCases.js:344:34 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:344:34 - │ - 344 │ foo && foo.bar && foo.bar.baz || baz && baz.bar && baz.bar.foo - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 343 │ // two errors + > 344 │ foo && foo.bar && foo.bar.baz || baz && baz.bar && baz.bar.foo + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 345 │ + 346 │ // case with inconsistent checks i Suggested fix: Change to an optional chain. @@ -4947,10 +5231,11 @@ logicalAndCases.js:347:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:347:1 - │ - 347 │ foo && foo.bar != null && foo.bar.baz !== undefined && foo.bar.baz.buzz; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 346 │ // case with inconsistent checks + > 347 │ foo && foo.bar != null && foo.bar.baz !== undefined && foo.bar.baz.buzz; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 348 │ + 349 │ foo.bar && foo.bar.baz != null && foo.bar.baz.qux !== undefined && foo.bar.baz.qux.buzz; i Suggested fix: Change to an optional chain. @@ -4972,10 +5257,12 @@ logicalAndCases.js:349:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:349:1 - │ - 349 │ foo.bar && foo.bar.baz != null && foo.bar.baz.qux !== undefined && foo.bar.baz.qux.buzz; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 347 │ foo && foo.bar != null && foo.bar.baz !== undefined && foo.bar.baz.buzz; + 348 │ + > 349 │ foo.bar && foo.bar.baz != null && foo.bar.baz.qux !== undefined && foo.bar.baz.qux.buzz; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 350 │ + 351 │ // ensure essential whitespace isn't removed i Suggested fix: Change to an optional chain. @@ -4997,10 +5284,11 @@ logicalAndCases.js:352:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:352:1 - │ - 352 │ foo && foo.bar(baz => ); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 351 │ // ensure essential whitespace isn't removed + > 352 │ foo && foo.bar(baz => ); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 353 │ foo && foo.bar(baz => typeof baz); + 354 │ foo && foo["some long string"] && foo["some long string"].baz i Suggested fix: Change to an optional chain. @@ -5022,10 +5310,12 @@ logicalAndCases.js:353:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:353:1 - │ - 353 │ foo && foo.bar(baz => typeof baz); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 351 │ // ensure essential whitespace isn't removed + 352 │ foo && foo.bar(baz => ); + > 353 │ foo && foo.bar(baz => typeof baz); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 354 │ foo && foo["some long string"] && foo["some long string"].baz + 355 │ foo && foo[`some long string`] && foo[`some long string`].baz i Suggested fix: Change to an optional chain. @@ -5047,10 +5337,12 @@ logicalAndCases.js:354:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:354:1 - │ - 354 │ foo && foo["some long string"] && foo["some long string"].baz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 352 │ foo && foo.bar(baz => ); + 353 │ foo && foo.bar(baz => typeof baz); + > 354 │ foo && foo["some long string"] && foo["some long string"].baz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 355 │ foo && foo[`some long string`] && foo[`some long string`].baz + 356 │ foo && foo['some long string'] && foo['some long string'].baz; i Suggested fix: Change to an optional chain. @@ -5072,10 +5364,12 @@ logicalAndCases.js:355:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:355:1 - │ - 355 │ foo && foo[`some long string`] && foo[`some long string`].baz - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 353 │ foo && foo.bar(baz => typeof baz); + 354 │ foo && foo["some long string"] && foo["some long string"].baz + > 355 │ foo && foo[`some long string`] && foo[`some long string`].baz + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 356 │ foo && foo['some long string'] && foo['some long string'].baz; + 357 │ i Suggested fix: Change to an optional chain. @@ -5097,10 +5391,12 @@ logicalAndCases.js:356:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:356:1 - │ - 356 │ foo && foo['some long string'] && foo['some long string'].baz; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 354 │ foo && foo["some long string"] && foo["some long string"].baz + 355 │ foo && foo[`some long string`] && foo[`some long string`].baz + > 356 │ foo && foo['some long string'] && foo['some long string'].baz; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 357 │ + 358 │ // other literal expressions i Suggested fix: Change to an optional chain. @@ -5122,10 +5418,11 @@ logicalAndCases.js:359:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:359:1 - │ - 359 │ foo && foo[123] && foo[123].baz; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 358 │ // other literal expressions + > 359 │ foo && foo[123] && foo[123].baz; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 360 │ foo && foo[true] && foo[true].baz; + 361 │ foo && foo[null] && foo[null].baz; i Suggested fix: Change to an optional chain. @@ -5147,10 +5444,12 @@ logicalAndCases.js:360:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:360:1 - │ - 360 │ foo && foo[true] && foo[true].baz; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 358 │ // other literal expressions + 359 │ foo && foo[123] && foo[123].baz; + > 360 │ foo && foo[true] && foo[true].baz; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 361 │ foo && foo[null] && foo[null].baz; + 362 │ foo && foo[12n] && foo[12n].baz; i Suggested fix: Change to an optional chain. @@ -5172,10 +5471,12 @@ logicalAndCases.js:361:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:361:1 - │ - 361 │ foo && foo[null] && foo[null].baz; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 359 │ foo && foo[123] && foo[123].baz; + 360 │ foo && foo[true] && foo[true].baz; + > 361 │ foo && foo[null] && foo[null].baz; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 362 │ foo && foo[12n] && foo[12n].baz; + 363 │ foo && foo[/\w+/] && foo[/\w+/].baz; i Suggested fix: Change to an optional chain. @@ -5197,10 +5498,12 @@ logicalAndCases.js:362:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:362:1 - │ - 362 │ foo && foo[12n] && foo[12n].baz; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 360 │ foo && foo[true] && foo[true].baz; + 361 │ foo && foo[null] && foo[null].baz; + > 362 │ foo && foo[12n] && foo[12n].baz; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 363 │ foo && foo[/\w+/] && foo[/\w+/].baz; + 364 │ i Suggested fix: Change to an optional chain. @@ -5222,10 +5525,11 @@ logicalAndCases.js:363:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:363:1 - │ - 363 │ foo && foo[/\w+/] && foo[/\w+/].baz; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 361 │ foo && foo[null] && foo[null].baz; + 362 │ foo && foo[12n] && foo[12n].baz; + > 363 │ foo && foo[/\w+/] && foo[/\w+/].baz; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 364 │ i Suggested fix: Change to an optional chain. @@ -5247,12 +5551,14 @@ logicalAndCases.js:367:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:367:1 - │ - 367 │ ┌ foo && foo.bar(/* comment */a, - 368 │ │ // comment2 - 369 │ │ b, ); - │ └────────^ + 366 │ // should preserve comments in a call expression + > 367 │ foo && foo.bar(/* comment */a, + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 368 │ // comment2 + > 369 │ b, ); + │ ^^^^ + 370 │ + 371 │ // ensure binary expressions that are the last expression do not get removed i Suggested fix: Change to an optional chain. @@ -5274,10 +5580,11 @@ logicalAndCases.js:372:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:372:1 - │ - 372 │ foo && foo.bar != null; - │ ^^^^^^^^^^^^^^^^^^^^^^ + 371 │ // ensure binary expressions that are the last expression do not get removed + > 372 │ foo && foo.bar != null; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 373 │ foo && foo.bar != undefined; + 374 │ foo && foo.bar != null && baz; i Suggested fix: Change to an optional chain. @@ -5299,10 +5606,12 @@ logicalAndCases.js:373:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:373:1 - │ - 373 │ foo && foo.bar != undefined; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 371 │ // ensure binary expressions that are the last expression do not get removed + 372 │ foo && foo.bar != null; + > 373 │ foo && foo.bar != undefined; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 374 │ foo && foo.bar != null && baz; + 375 │ i Suggested fix: Change to an optional chain. @@ -5324,10 +5633,12 @@ logicalAndCases.js:374:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:374:1 - │ - 374 │ foo && foo.bar != null && baz; - │ ^^^^^^^^^^^^^^^^^^^^^^ + 372 │ foo && foo.bar != null; + 373 │ foo && foo.bar != undefined; + > 374 │ foo && foo.bar != null && baz; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 375 │ + 376 │ // other weird cases i Suggested fix: Change to an optional chain. @@ -5349,10 +5660,11 @@ logicalAndCases.js:377:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:377:1 - │ - 377 │ foo && foo?.(); - │ ^^^^^^^^^^^^^^ + 376 │ // other weird cases + > 377 │ foo && foo?.(); + │ ^^^^^^^^^^^^^^ + 378 │ foo.bar && foo.bar?.(); + 379 │ i Suggested fix: Change to an optional chain. @@ -5374,10 +5686,12 @@ logicalAndCases.js:378:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:378:1 - │ - 378 │ foo.bar && foo.bar?.(); - │ ^^^^^^^^^^^^^^^^^^^^^^ + 376 │ // other weird cases + 377 │ foo && foo?.(); + > 378 │ foo.bar && foo.bar?.(); + │ ^^^^^^^^^^^^^^^^^^^^^^ + 379 │ + 380 │ // comments i Suggested fix: Change to an optional chain. @@ -5399,10 +5713,11 @@ logicalAndCases.js:381:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:381:1 - │ - 381 │ foo && foo.bar && /*0*/foo/*1*/./*2*/bar/*3*/./*4*/baz/*5*/; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 380 │ // comments + > 381 │ foo && foo.bar && /*0*/foo/*1*/./*2*/bar/*3*/./*4*/baz/*5*/; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 382 │ foo && foo[bar] && /*0*/foo/*1*/[/*2*/bar/*3*/]/*4*/[/*5*/baz/*6*/]/*7*/; + 383 │ i Suggested fix: Change to an optional chain. @@ -5424,10 +5739,12 @@ logicalAndCases.js:382:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:382:1 - │ - 382 │ foo && foo[bar] && /*0*/foo/*1*/[/*2*/bar/*3*/]/*4*/[/*5*/baz/*6*/]/*7*/; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 380 │ // comments + 381 │ foo && foo.bar && /*0*/foo/*1*/./*2*/bar/*3*/./*4*/baz/*5*/; + > 382 │ foo && foo[bar] && /*0*/foo/*1*/[/*2*/bar/*3*/]/*4*/[/*5*/baz/*6*/]/*7*/; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 383 │ + 384 │ foo && foo[bar] && /*0*/foo/*1*/?./*2*/[/*3*/bar/*4*/]/*5*/?./*6*/[/*7*/baz/*8*/]/*9*/; i Suggested fix: Change to an optional chain. @@ -5448,10 +5765,11 @@ logicalAndCases.js:384:1 lint/nursery/useOptionalChain FIXABLE ━━━━━ ! Change to an optional chain. - ┌─ logicalAndCases.js:384:1 - │ - 384 │ foo && foo[bar] && /*0*/foo/*1*/?./*2*/[/*3*/bar/*4*/]/*5*/?./*6*/[/*7*/baz/*8*/]/*9*/; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 382 │ foo && foo[bar] && /*0*/foo/*1*/[/*2*/bar/*3*/]/*4*/[/*5*/baz/*6*/]/*7*/; + 383 │ + > 384 │ foo && foo[bar] && /*0*/foo/*1*/?./*2*/[/*3*/bar/*4*/]/*5*/?./*6*/[/*7*/baz/*8*/]/*9*/; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 385 │ i Suggested fix: Change to an optional chain. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/nullishAndLogicalOr.ts.snap b/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/nullishAndLogicalOr.ts.snap index eda7a6f538c..4e4301b7502 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/nullishAndLogicalOr.ts.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/nullishAndLogicalOr.ts.snap @@ -165,10 +165,10 @@ nullishAndLogicalOr.ts:1:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:1:1 - │ - 1 │ (foo || {}).bar; - │ ^^^^^^^^^^^^^^^ + > 1 │ (foo || {}).bar; + │ ^^^^^^^^^^^^^^^ + 2 │ (foo || ({})).bar; + 3 │ (await foo || {}).bar; i Suggested fix: Change to an optional chain. @@ -187,10 +187,11 @@ nullishAndLogicalOr.ts:2:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:2:1 - │ - 2 │ (foo || ({})).bar; - │ ^^^^^^^^^^^^^^^^^ + 1 │ (foo || {}).bar; + > 2 │ (foo || ({})).bar; + │ ^^^^^^^^^^^^^^^^^ + 3 │ (await foo || {}).bar; + 4 │ (foo1?.foo2 || {}).foo3; i Suggested fix: Change to an optional chain. @@ -210,10 +211,12 @@ nullishAndLogicalOr.ts:3:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:3:1 - │ - 3 │ (await foo || {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^ + 1 │ (foo || {}).bar; + 2 │ (foo || ({})).bar; + > 3 │ (await foo || {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^ + 4 │ (foo1?.foo2 || {}).foo3; + 5 │ ((() => foo())() || {}).bar; i Suggested fix: Change to an optional chain. @@ -234,10 +237,12 @@ nullishAndLogicalOr.ts:4:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:4:1 - │ - 4 │ (foo1?.foo2 || {}).foo3; - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ (foo || ({})).bar; + 3 │ (await foo || {}).bar; + > 4 │ (foo1?.foo2 || {}).foo3; + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ ((() => foo())() || {}).bar; + 6 │ const foo = (bar || {}).baz; i Suggested fix: Change to an optional chain. @@ -259,10 +264,12 @@ nullishAndLogicalOr.ts:5:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:5:1 - │ - 5 │ ((() => foo())() || {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ (await foo || {}).bar; + 4 │ (foo1?.foo2 || {}).foo3; + > 5 │ ((() => foo())() || {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 6 │ const foo = (bar || {}).baz; + 7 │ (foo.bar || {})[baz]; i Suggested fix: Change to an optional chain. @@ -284,10 +291,12 @@ nullishAndLogicalOr.ts:6:13 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:6:13 - │ - 6 │ const foo = (bar || {}).baz; - │ ^^^^^^^^^^^^^^^ + 4 │ (foo1?.foo2 || {}).foo3; + 5 │ ((() => foo())() || {}).bar; + > 6 │ const foo = (bar || {}).baz; + │ ^^^^^^^^^^^^^^^ + 7 │ (foo.bar || {})[baz]; + 8 │ i Suggested fix: Change to an optional chain. @@ -309,10 +318,12 @@ nullishAndLogicalOr.ts:7:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:7:1 - │ - 7 │ (foo.bar || {})[baz]; - │ ^^^^^^^^^^^^^^^^^^^^ + 5 │ ((() => foo())() || {}).bar; + 6 │ const foo = (bar || {}).baz; + > 7 │ (foo.bar || {})[baz]; + │ ^^^^^^^^^^^^^^^^^^^^ + 8 │ + 9 │ ((foo1 || {}).foo2 || {}).foo3; i Suggested fix: Change to an optional chain. @@ -334,10 +345,12 @@ nullishAndLogicalOr.ts:9:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:9:1 - │ - 9 │ ((foo1 || {}).foo2 || {}).foo3; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 7 │ (foo.bar || {})[baz]; + 8 │ + > 9 │ ((foo1 || {}).foo2 || {}).foo3; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 10 │ (foo || undefined || {}).bar; + 11 │ i Suggested fix: Change to an optional chain. @@ -359,10 +372,11 @@ nullishAndLogicalOr.ts:10:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:10:1 - │ - 10 │ (foo || undefined || {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 9 │ ((foo1 || {}).foo2 || {}).foo3; + > 10 │ (foo || undefined || {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 │ + 12 │ (foo() || bar || {}).baz; i Suggested fix: Change to an optional chain. @@ -384,10 +398,12 @@ nullishAndLogicalOr.ts:12:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:12:1 - │ - 12 │ (foo() || bar || {}).baz; - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 10 │ (foo || undefined || {}).bar; + 11 │ + > 12 │ (foo() || bar || {}).baz; + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 13 │ ((foo1 ? foo2 : foo3) || {}).foo4; + 14 │ i Suggested fix: Change to an optional chain. @@ -409,10 +425,11 @@ nullishAndLogicalOr.ts:13:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:13:1 - │ - 13 │ ((foo1 ? foo2 : foo3) || {}).foo4; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 12 │ (foo() || bar || {}).baz; + > 13 │ ((foo1 ? foo2 : foo3) || {}).foo4; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 14 │ + 15 │ if (foo) { (foo || {}).bar; } i Suggested fix: Change to an optional chain. @@ -434,10 +451,12 @@ nullishAndLogicalOr.ts:15:12 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:15:12 - │ - 15 │ if (foo) { (foo || {}).bar; } - │ ^^^^^^^^^^^^^^^ + 13 │ ((foo1 ? foo2 : foo3) || {}).foo4; + 14 │ + > 15 │ if (foo) { (foo || {}).bar; } + │ ^^^^^^^^^^^^^^^ + 16 │ if ((foo || {}).bar) { foo.bar; } + 17 │ i Suggested fix: Change to an optional chain. @@ -459,10 +478,11 @@ nullishAndLogicalOr.ts:16:5 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:16:5 - │ - 16 │ if ((foo || {}).bar) { foo.bar; } - │ ^^^^^^^^^^^^^^^ + 15 │ if (foo) { (foo || {}).bar; } + > 16 │ if ((foo || {}).bar) { foo.bar; } + │ ^^^^^^^^^^^^^^^ + 17 │ + 18 │ (undefined && foo || {}).bar; i Suggested fix: Change to an optional chain. @@ -484,10 +504,12 @@ nullishAndLogicalOr.ts:18:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:18:1 - │ - 18 │ (undefined && foo || {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 16 │ if ((foo || {}).bar) { foo.bar; } + 17 │ + > 18 │ (undefined && foo || {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 19 │ (foo ?? {}).bar; + 20 │ (foo ?? ({})).bar; i Suggested fix: Change to an optional chain. @@ -509,10 +531,11 @@ nullishAndLogicalOr.ts:19:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:19:1 - │ - 19 │ (foo ?? {}).bar; - │ ^^^^^^^^^^^^^^^ + 18 │ (undefined && foo || {}).bar; + > 19 │ (foo ?? {}).bar; + │ ^^^^^^^^^^^^^^^ + 20 │ (foo ?? ({})).bar; + 21 │ (await foo ?? {}).bar; i Suggested fix: Change to an optional chain. @@ -534,10 +557,12 @@ nullishAndLogicalOr.ts:20:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:20:1 - │ - 20 │ (foo ?? ({})).bar; - │ ^^^^^^^^^^^^^^^^^ + 18 │ (undefined && foo || {}).bar; + 19 │ (foo ?? {}).bar; + > 20 │ (foo ?? ({})).bar; + │ ^^^^^^^^^^^^^^^^^ + 21 │ (await foo ?? {}).bar; + 22 │ i Suggested fix: Change to an optional chain. @@ -559,10 +584,12 @@ nullishAndLogicalOr.ts:21:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:21:1 - │ - 21 │ (await foo ?? {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^ + 19 │ (foo ?? {}).bar; + 20 │ (foo ?? ({})).bar; + > 21 │ (await foo ?? {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^ + 22 │ + 23 │ (foo1?.foo2 ?? {}).foo3; i Suggested fix: Change to an optional chain. @@ -584,10 +611,12 @@ nullishAndLogicalOr.ts:23:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:23:1 - │ - 23 │ (foo1?.foo2 ?? {}).foo3; - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 21 │ (await foo ?? {}).bar; + 22 │ + > 23 │ (foo1?.foo2 ?? {}).foo3; + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 24 │ ((() => foo())() ?? {}).bar; + 25 │ const foo = (bar ?? {}).baz; i Suggested fix: Change to an optional chain. @@ -609,10 +638,11 @@ nullishAndLogicalOr.ts:24:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:24:1 - │ - 24 │ ((() => foo())() ?? {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 23 │ (foo1?.foo2 ?? {}).foo3; + > 24 │ ((() => foo())() ?? {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 25 │ const foo = (bar ?? {}).baz; + 26 │ (foo.bar ?? {})[baz]; i Suggested fix: Change to an optional chain. @@ -634,10 +664,12 @@ nullishAndLogicalOr.ts:25:13 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:25:13 - │ - 25 │ const foo = (bar ?? {}).baz; - │ ^^^^^^^^^^^^^^^ + 23 │ (foo1?.foo2 ?? {}).foo3; + 24 │ ((() => foo())() ?? {}).bar; + > 25 │ const foo = (bar ?? {}).baz; + │ ^^^^^^^^^^^^^^^ + 26 │ (foo.bar ?? {})[baz]; + 27 │ ((foo1 ?? {}).foo2 ?? {}).foo3; i Suggested fix: Change to an optional chain. @@ -659,10 +691,12 @@ nullishAndLogicalOr.ts:26:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:26:1 - │ - 26 │ (foo.bar ?? {})[baz]; - │ ^^^^^^^^^^^^^^^^^^^^ + 24 │ ((() => foo())() ?? {}).bar; + 25 │ const foo = (bar ?? {}).baz; + > 26 │ (foo.bar ?? {})[baz]; + │ ^^^^^^^^^^^^^^^^^^^^ + 27 │ ((foo1 ?? {}).foo2 ?? {}).foo3; + 28 │ i Suggested fix: Change to an optional chain. @@ -684,10 +718,12 @@ nullishAndLogicalOr.ts:27:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:27:1 - │ - 27 │ ((foo1 ?? {}).foo2 ?? {}).foo3; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 25 │ const foo = (bar ?? {}).baz; + 26 │ (foo.bar ?? {})[baz]; + > 27 │ ((foo1 ?? {}).foo2 ?? {}).foo3; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 28 │ + 29 │ (foo ?? undefined ?? {}).bar; i Suggested fix: Change to an optional chain. @@ -709,10 +745,12 @@ nullishAndLogicalOr.ts:29:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:29:1 - │ - 29 │ (foo ?? undefined ?? {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 27 │ ((foo1 ?? {}).foo2 ?? {}).foo3; + 28 │ + > 29 │ (foo ?? undefined ?? {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 30 │ (foo() ?? bar ?? {}).baz; + 31 │ ((foo1 ? foo2 : foo3) ?? {}).foo4; i Suggested fix: Change to an optional chain. @@ -734,10 +772,11 @@ nullishAndLogicalOr.ts:30:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:30:1 - │ - 30 │ (foo() ?? bar ?? {}).baz; - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 29 │ (foo ?? undefined ?? {}).bar; + > 30 │ (foo() ?? bar ?? {}).baz; + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 31 │ ((foo1 ? foo2 : foo3) ?? {}).foo4; + 32 │ i Suggested fix: Change to an optional chain. @@ -759,10 +798,12 @@ nullishAndLogicalOr.ts:31:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:31:1 - │ - 31 │ ((foo1 ? foo2 : foo3) ?? {}).foo4; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 29 │ (foo ?? undefined ?? {}).bar; + 30 │ (foo() ?? bar ?? {}).baz; + > 31 │ ((foo1 ? foo2 : foo3) ?? {}).foo4; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 32 │ + 33 │ if (foo) { (foo ?? {}).bar; } i Suggested fix: Change to an optional chain. @@ -784,10 +825,12 @@ nullishAndLogicalOr.ts:33:12 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:33:12 - │ - 33 │ if (foo) { (foo ?? {}).bar; } - │ ^^^^^^^^^^^^^^^ + 31 │ ((foo1 ? foo2 : foo3) ?? {}).foo4; + 32 │ + > 33 │ if (foo) { (foo ?? {}).bar; } + │ ^^^^^^^^^^^^^^^ + 34 │ if ((foo ?? {}).bar) { foo.bar; } + 35 │ i Suggested fix: Change to an optional chain. @@ -809,10 +852,11 @@ nullishAndLogicalOr.ts:34:5 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:34:5 - │ - 34 │ if ((foo ?? {}).bar) { foo.bar; } - │ ^^^^^^^^^^^^^^^ + 33 │ if (foo) { (foo ?? {}).bar; } + > 34 │ if ((foo ?? {}).bar) { foo.bar; } + │ ^^^^^^^^^^^^^^^ + 35 │ + 36 │ (undefined && foo ?? {}).bar; i Suggested fix: Change to an optional chain. @@ -834,10 +878,12 @@ nullishAndLogicalOr.ts:36:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:36:1 - │ - 36 │ (undefined && foo ?? {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 34 │ if ((foo ?? {}).bar) { foo.bar; } + 35 │ + > 36 │ (undefined && foo ?? {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 37 │ (a > b || {}).bar; + 38 │ (((typeof x) as string) || {}).bar; i Suggested fix: Change to an optional chain. @@ -859,10 +905,11 @@ nullishAndLogicalOr.ts:37:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:37:1 - │ - 37 │ (a > b || {}).bar; - │ ^^^^^^^^^^^^^^^^^ + 36 │ (undefined && foo ?? {}).bar; + > 37 │ (a > b || {}).bar; + │ ^^^^^^^^^^^^^^^^^ + 38 │ (((typeof x) as string) || {}).bar; + 39 │ i Suggested fix: Change to an optional chain. @@ -884,10 +931,12 @@ nullishAndLogicalOr.ts:38:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:38:1 - │ - 38 │ (((typeof x) as string) || {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 36 │ (undefined && foo ?? {}).bar; + 37 │ (a > b || {}).bar; + > 38 │ (((typeof x) as string) || {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 39 │ + 40 │ (void foo() || {}).bar; i Suggested fix: Change to an optional chain. @@ -909,10 +958,12 @@ nullishAndLogicalOr.ts:40:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:40:1 - │ - 40 │ (void foo() || {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^ + 38 │ (((typeof x) as string) || {}).bar; + 39 │ + > 40 │ (void foo() || {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 41 │ ((a ? b : c) || {}).bar; + 42 │ i Suggested fix: Change to an optional chain. @@ -934,10 +985,11 @@ nullishAndLogicalOr.ts:41:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:41:1 - │ - 41 │ ((a ? b : c) || {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 40 │ (void foo() || {}).bar; + > 41 │ ((a ? b : c) || {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 42 │ + 43 │ ((a instanceof Error) || {}).bar; i Suggested fix: Change to an optional chain. @@ -959,10 +1011,12 @@ nullishAndLogicalOr.ts:43:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:43:1 - │ - 43 │ ((a instanceof Error) || {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 41 │ ((a ? b : c) || {}).bar; + 42 │ + > 43 │ ((a instanceof Error) || {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 44 │ ((a << b) || {}).bar; + 45 │ ((foo ** 2) || {}).bar; i Suggested fix: Change to an optional chain. @@ -984,10 +1038,11 @@ nullishAndLogicalOr.ts:44:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:44:1 - │ - 44 │ ((a << b) || {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^ + 43 │ ((a instanceof Error) || {}).bar; + > 44 │ ((a << b) || {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^ + 45 │ ((foo ** 2) || {}).bar; + 46 │ (foo ** 2 || {}).bar; i Suggested fix: Change to an optional chain. @@ -1009,10 +1064,12 @@ nullishAndLogicalOr.ts:45:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:45:1 - │ - 45 │ ((foo ** 2) || {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^ + 43 │ ((a instanceof Error) || {}).bar; + 44 │ ((a << b) || {}).bar; + > 45 │ ((foo ** 2) || {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 46 │ (foo ** 2 || {}).bar; + 47 │ (foo++ || {}).bar; i Suggested fix: Change to an optional chain. @@ -1034,10 +1091,12 @@ nullishAndLogicalOr.ts:46:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:46:1 - │ - 46 │ (foo ** 2 || {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^ + 44 │ ((a << b) || {}).bar; + 45 │ ((foo ** 2) || {}).bar; + > 46 │ (foo ** 2 || {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^ + 47 │ (foo++ || {}).bar; + 48 │ (+foo || {}).bar; i Suggested fix: Change to an optional chain. @@ -1059,10 +1118,12 @@ nullishAndLogicalOr.ts:47:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:47:1 - │ - 47 │ (foo++ || {}).bar; - │ ^^^^^^^^^^^^^^^^^ + 45 │ ((foo ** 2) || {}).bar; + 46 │ (foo ** 2 || {}).bar; + > 47 │ (foo++ || {}).bar; + │ ^^^^^^^^^^^^^^^^^ + 48 │ (+foo || {}).bar; + 49 │ i Suggested fix: Change to an optional chain. @@ -1084,10 +1145,12 @@ nullishAndLogicalOr.ts:48:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:48:1 - │ - 48 │ (+foo || {}).bar; - │ ^^^^^^^^^^^^^^^^ + 46 │ (foo ** 2 || {}).bar; + 47 │ (foo++ || {}).bar; + > 48 │ (+foo || {}).bar; + │ ^^^^^^^^^^^^^^^^ + 49 │ + 50 │ // private name i Suggested fix: Change to an optional chain. @@ -1109,10 +1172,11 @@ nullishAndLogicalOr.ts:51:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:51:1 - │ - 51 │ (foo || {}).#bar; - │ ^^^^^^^^^^^^^^^^ + 50 │ // private name + > 51 │ (foo || {}).#bar; + │ ^^^^^^^^^^^^^^^^ + 52 │ (foo || ({})).#bar; + 53 │ (await foo || {}).#bar; i Suggested fix: Change to an optional chain. @@ -1134,10 +1198,12 @@ nullishAndLogicalOr.ts:52:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:52:1 - │ - 52 │ (foo || ({})).#bar; - │ ^^^^^^^^^^^^^^^^^^ + 50 │ // private name + 51 │ (foo || {}).#bar; + > 52 │ (foo || ({})).#bar; + │ ^^^^^^^^^^^^^^^^^^ + 53 │ (await foo || {}).#bar; + 54 │ (foo1?.foo2 || {}).#foo3; i Suggested fix: Change to an optional chain. @@ -1159,10 +1225,12 @@ nullishAndLogicalOr.ts:53:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:53:1 - │ - 53 │ (await foo || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^ + 51 │ (foo || {}).#bar; + 52 │ (foo || ({})).#bar; + > 53 │ (await foo || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 54 │ (foo1?.foo2 || {}).#foo3; + 55 │ ((() => foo())() || {}).#bar; i Suggested fix: Change to an optional chain. @@ -1184,10 +1252,12 @@ nullishAndLogicalOr.ts:54:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:54:1 - │ - 54 │ (foo1?.foo2 || {}).#foo3; - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 52 │ (foo || ({})).#bar; + 53 │ (await foo || {}).#bar; + > 54 │ (foo1?.foo2 || {}).#foo3; + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 55 │ ((() => foo())() || {}).#bar; + 56 │ const foo = (bar || {}).#baz; i Suggested fix: Change to an optional chain. @@ -1209,10 +1279,12 @@ nullishAndLogicalOr.ts:55:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:55:1 - │ - 55 │ ((() => foo())() || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 53 │ (await foo || {}).#bar; + 54 │ (foo1?.foo2 || {}).#foo3; + > 55 │ ((() => foo())() || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 56 │ const foo = (bar || {}).#baz; + 57 │ (foo.bar || {})[baz]; i Suggested fix: Change to an optional chain. @@ -1234,10 +1306,12 @@ nullishAndLogicalOr.ts:56:13 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:56:13 - │ - 56 │ const foo = (bar || {}).#baz; - │ ^^^^^^^^^^^^^^^^ + 54 │ (foo1?.foo2 || {}).#foo3; + 55 │ ((() => foo())() || {}).#bar; + > 56 │ const foo = (bar || {}).#baz; + │ ^^^^^^^^^^^^^^^^ + 57 │ (foo.bar || {})[baz]; + 58 │ i Suggested fix: Change to an optional chain. @@ -1259,10 +1333,12 @@ nullishAndLogicalOr.ts:57:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:57:1 - │ - 57 │ (foo.bar || {})[baz]; - │ ^^^^^^^^^^^^^^^^^^^^ + 55 │ ((() => foo())() || {}).#bar; + 56 │ const foo = (bar || {}).#baz; + > 57 │ (foo.bar || {})[baz]; + │ ^^^^^^^^^^^^^^^^^^^^ + 58 │ + 59 │ ((foo1 || {}).#foo2 || {}).#foo3; i Suggested fix: Change to an optional chain. @@ -1284,10 +1360,12 @@ nullishAndLogicalOr.ts:59:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:59:1 - │ - 59 │ ((foo1 || {}).#foo2 || {}).#foo3; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 57 │ (foo.bar || {})[baz]; + 58 │ + > 59 │ ((foo1 || {}).#foo2 || {}).#foo3; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 60 │ (foo || undefined || {}).#bar; + 61 │ i Suggested fix: Change to an optional chain. @@ -1309,10 +1387,11 @@ nullishAndLogicalOr.ts:60:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:60:1 - │ - 60 │ (foo || undefined || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 59 │ ((foo1 || {}).#foo2 || {}).#foo3; + > 60 │ (foo || undefined || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 61 │ + 62 │ (foo() || bar || {}).#baz; i Suggested fix: Change to an optional chain. @@ -1334,10 +1413,12 @@ nullishAndLogicalOr.ts:62:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:62:1 - │ - 62 │ (foo() || bar || {}).#baz; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 60 │ (foo || undefined || {}).#bar; + 61 │ + > 62 │ (foo() || bar || {}).#baz; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 63 │ ((foo1 ? foo2 : foo3) || {}).#foo4; + 64 │ i Suggested fix: Change to an optional chain. @@ -1359,10 +1440,11 @@ nullishAndLogicalOr.ts:63:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:63:1 - │ - 63 │ ((foo1 ? foo2 : foo3) || {}).#foo4; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 62 │ (foo() || bar || {}).#baz; + > 63 │ ((foo1 ? foo2 : foo3) || {}).#foo4; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 64 │ + 65 │ if (foo) { (foo || {}).#bar; } i Suggested fix: Change to an optional chain. @@ -1384,10 +1466,12 @@ nullishAndLogicalOr.ts:65:12 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:65:12 - │ - 65 │ if (foo) { (foo || {}).#bar; } - │ ^^^^^^^^^^^^^^^^ + 63 │ ((foo1 ? foo2 : foo3) || {}).#foo4; + 64 │ + > 65 │ if (foo) { (foo || {}).#bar; } + │ ^^^^^^^^^^^^^^^^ + 66 │ if ((foo || {}).#bar) { foo.bar; } + 67 │ i Suggested fix: Change to an optional chain. @@ -1409,10 +1493,11 @@ nullishAndLogicalOr.ts:66:5 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:66:5 - │ - 66 │ if ((foo || {}).#bar) { foo.bar; } - │ ^^^^^^^^^^^^^^^^ + 65 │ if (foo) { (foo || {}).#bar; } + > 66 │ if ((foo || {}).#bar) { foo.bar; } + │ ^^^^^^^^^^^^^^^^ + 67 │ + 68 │ (undefined && foo || {}).#bar; i Suggested fix: Change to an optional chain. @@ -1434,10 +1519,12 @@ nullishAndLogicalOr.ts:68:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:68:1 - │ - 68 │ (undefined && foo || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 66 │ if ((foo || {}).#bar) { foo.bar; } + 67 │ + > 68 │ (undefined && foo || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 69 │ (foo ?? {}).#bar; + 70 │ (foo ?? ({})).#bar; i Suggested fix: Change to an optional chain. @@ -1459,10 +1546,11 @@ nullishAndLogicalOr.ts:69:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:69:1 - │ - 69 │ (foo ?? {}).#bar; - │ ^^^^^^^^^^^^^^^^ + 68 │ (undefined && foo || {}).#bar; + > 69 │ (foo ?? {}).#bar; + │ ^^^^^^^^^^^^^^^^ + 70 │ (foo ?? ({})).#bar; + 71 │ (await foo ?? {}).#bar; i Suggested fix: Change to an optional chain. @@ -1484,10 +1572,12 @@ nullishAndLogicalOr.ts:70:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:70:1 - │ - 70 │ (foo ?? ({})).#bar; - │ ^^^^^^^^^^^^^^^^^^ + 68 │ (undefined && foo || {}).#bar; + 69 │ (foo ?? {}).#bar; + > 70 │ (foo ?? ({})).#bar; + │ ^^^^^^^^^^^^^^^^^^ + 71 │ (await foo ?? {}).#bar; + 72 │ i Suggested fix: Change to an optional chain. @@ -1509,10 +1599,12 @@ nullishAndLogicalOr.ts:71:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:71:1 - │ - 71 │ (await foo ?? {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^ + 69 │ (foo ?? {}).#bar; + 70 │ (foo ?? ({})).#bar; + > 71 │ (await foo ?? {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 72 │ + 73 │ (foo1?.foo2 ?? {}).#foo3; i Suggested fix: Change to an optional chain. @@ -1534,10 +1626,12 @@ nullishAndLogicalOr.ts:73:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:73:1 - │ - 73 │ (foo1?.foo2 ?? {}).#foo3; - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 71 │ (await foo ?? {}).#bar; + 72 │ + > 73 │ (foo1?.foo2 ?? {}).#foo3; + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 74 │ ((() => foo())() ?? {}).#bar; + 75 │ const foo = (bar ?? {}).#baz; i Suggested fix: Change to an optional chain. @@ -1559,10 +1653,11 @@ nullishAndLogicalOr.ts:74:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:74:1 - │ - 74 │ ((() => foo())() ?? {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 73 │ (foo1?.foo2 ?? {}).#foo3; + > 74 │ ((() => foo())() ?? {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 75 │ const foo = (bar ?? {}).#baz; + 76 │ (foo.bar ?? {})[baz]; i Suggested fix: Change to an optional chain. @@ -1584,10 +1679,12 @@ nullishAndLogicalOr.ts:75:13 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:75:13 - │ - 75 │ const foo = (bar ?? {}).#baz; - │ ^^^^^^^^^^^^^^^^ + 73 │ (foo1?.foo2 ?? {}).#foo3; + 74 │ ((() => foo())() ?? {}).#bar; + > 75 │ const foo = (bar ?? {}).#baz; + │ ^^^^^^^^^^^^^^^^ + 76 │ (foo.bar ?? {})[baz]; + 77 │ ((foo1 ?? {}).#foo2 ?? {}).#foo3; i Suggested fix: Change to an optional chain. @@ -1609,10 +1706,12 @@ nullishAndLogicalOr.ts:76:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:76:1 - │ - 76 │ (foo.bar ?? {})[baz]; - │ ^^^^^^^^^^^^^^^^^^^^ + 74 │ ((() => foo())() ?? {}).#bar; + 75 │ const foo = (bar ?? {}).#baz; + > 76 │ (foo.bar ?? {})[baz]; + │ ^^^^^^^^^^^^^^^^^^^^ + 77 │ ((foo1 ?? {}).#foo2 ?? {}).#foo3; + 78 │ i Suggested fix: Change to an optional chain. @@ -1634,10 +1733,12 @@ nullishAndLogicalOr.ts:77:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:77:1 - │ - 77 │ ((foo1 ?? {}).#foo2 ?? {}).#foo3; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 75 │ const foo = (bar ?? {}).#baz; + 76 │ (foo.bar ?? {})[baz]; + > 77 │ ((foo1 ?? {}).#foo2 ?? {}).#foo3; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 78 │ + 79 │ (foo ?? undefined ?? {}).#bar; i Suggested fix: Change to an optional chain. @@ -1659,10 +1760,12 @@ nullishAndLogicalOr.ts:79:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:79:1 - │ - 79 │ (foo ?? undefined ?? {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 77 │ ((foo1 ?? {}).#foo2 ?? {}).#foo3; + 78 │ + > 79 │ (foo ?? undefined ?? {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 80 │ (foo() ?? bar ?? {}).#baz; + 81 │ ((foo1 ? foo2 : foo3) ?? {}).#foo4; i Suggested fix: Change to an optional chain. @@ -1684,10 +1787,11 @@ nullishAndLogicalOr.ts:80:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:80:1 - │ - 80 │ (foo() ?? bar ?? {}).#baz; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 79 │ (foo ?? undefined ?? {}).#bar; + > 80 │ (foo() ?? bar ?? {}).#baz; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 81 │ ((foo1 ? foo2 : foo3) ?? {}).#foo4; + 82 │ i Suggested fix: Change to an optional chain. @@ -1709,10 +1813,12 @@ nullishAndLogicalOr.ts:81:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:81:1 - │ - 81 │ ((foo1 ? foo2 : foo3) ?? {}).#foo4; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 79 │ (foo ?? undefined ?? {}).#bar; + 80 │ (foo() ?? bar ?? {}).#baz; + > 81 │ ((foo1 ? foo2 : foo3) ?? {}).#foo4; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 82 │ + 83 │ if (foo) { (foo ?? {}).#bar; } i Suggested fix: Change to an optional chain. @@ -1734,10 +1840,12 @@ nullishAndLogicalOr.ts:83:12 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:83:12 - │ - 83 │ if (foo) { (foo ?? {}).#bar; } - │ ^^^^^^^^^^^^^^^^ + 81 │ ((foo1 ? foo2 : foo3) ?? {}).#foo4; + 82 │ + > 83 │ if (foo) { (foo ?? {}).#bar; } + │ ^^^^^^^^^^^^^^^^ + 84 │ if ((foo ?? {}).#bar) { foo.bar; } + 85 │ i Suggested fix: Change to an optional chain. @@ -1759,10 +1867,11 @@ nullishAndLogicalOr.ts:84:5 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:84:5 - │ - 84 │ if ((foo ?? {}).#bar) { foo.bar; } - │ ^^^^^^^^^^^^^^^^ + 83 │ if (foo) { (foo ?? {}).#bar; } + > 84 │ if ((foo ?? {}).#bar) { foo.bar; } + │ ^^^^^^^^^^^^^^^^ + 85 │ + 86 │ (undefined && foo ?? {}).#bar; i Suggested fix: Change to an optional chain. @@ -1784,10 +1893,12 @@ nullishAndLogicalOr.ts:86:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:86:1 - │ - 86 │ (undefined && foo ?? {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 84 │ if ((foo ?? {}).#bar) { foo.bar; } + 85 │ + > 86 │ (undefined && foo ?? {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 87 │ (a > b || {}).#bar; + 88 │ (((typeof x) as string) || {}).#bar; i Suggested fix: Change to an optional chain. @@ -1809,10 +1920,11 @@ nullishAndLogicalOr.ts:87:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:87:1 - │ - 87 │ (a > b || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^ + 86 │ (undefined && foo ?? {}).#bar; + > 87 │ (a > b || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^ + 88 │ (((typeof x) as string) || {}).#bar; + 89 │ i Suggested fix: Change to an optional chain. @@ -1834,10 +1946,12 @@ nullishAndLogicalOr.ts:88:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:88:1 - │ - 88 │ (((typeof x) as string) || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 86 │ (undefined && foo ?? {}).#bar; + 87 │ (a > b || {}).#bar; + > 88 │ (((typeof x) as string) || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 89 │ + 90 │ (void foo() || {}).#bar; i Suggested fix: Change to an optional chain. @@ -1859,10 +1973,12 @@ nullishAndLogicalOr.ts:90:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:90:1 - │ - 90 │ (void foo() || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 88 │ (((typeof x) as string) || {}).#bar; + 89 │ + > 90 │ (void foo() || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 91 │ ((a ? b : c) || {}).#bar; + 92 │ i Suggested fix: Change to an optional chain. @@ -1884,10 +2000,11 @@ nullishAndLogicalOr.ts:91:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:91:1 - │ - 91 │ ((a ? b : c) || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 90 │ (void foo() || {}).#bar; + > 91 │ ((a ? b : c) || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 92 │ + 93 │ ((a instanceof Error) || {}).#bar; i Suggested fix: Change to an optional chain. @@ -1909,10 +2026,12 @@ nullishAndLogicalOr.ts:93:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:93:1 - │ - 93 │ ((a instanceof Error) || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 91 │ ((a ? b : c) || {}).#bar; + 92 │ + > 93 │ ((a instanceof Error) || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 94 │ ((a << b) || {}).#bar; + 95 │ ((foo ** 2) || {}).#bar; i Suggested fix: Change to an optional chain. @@ -1934,10 +2053,11 @@ nullishAndLogicalOr.ts:94:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:94:1 - │ - 94 │ ((a << b) || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^ + 93 │ ((a instanceof Error) || {}).#bar; + > 94 │ ((a << b) || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^ + 95 │ ((foo ** 2) || {}).#bar; + 96 │ (foo ** 2 || {}).#bar; i Suggested fix: Change to an optional chain. @@ -1959,10 +2079,12 @@ nullishAndLogicalOr.ts:95:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:95:1 - │ - 95 │ ((foo ** 2) || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 93 │ ((a instanceof Error) || {}).#bar; + 94 │ ((a << b) || {}).#bar; + > 95 │ ((foo ** 2) || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 96 │ (foo ** 2 || {}).#bar; + 97 │ (foo++ || {}).#bar; i Suggested fix: Change to an optional chain. @@ -1984,10 +2106,12 @@ nullishAndLogicalOr.ts:96:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:96:1 - │ - 96 │ (foo ** 2 || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^ + 94 │ ((a << b) || {}).#bar; + 95 │ ((foo ** 2) || {}).#bar; + > 96 │ (foo ** 2 || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^ + 97 │ (foo++ || {}).#bar; + 98 │ (+foo || {}).#bar; i Suggested fix: Change to an optional chain. @@ -2009,10 +2133,12 @@ nullishAndLogicalOr.ts:97:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:97:1 - │ - 97 │ (foo++ || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^ + 95 │ ((foo ** 2) || {}).#bar; + 96 │ (foo ** 2 || {}).#bar; + > 97 │ (foo++ || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^ + 98 │ (+foo || {}).#bar; + 99 │ i Suggested fix: Change to an optional chain. @@ -2034,10 +2160,11 @@ nullishAndLogicalOr.ts:98:1 lint/nursery/useOptionalChain FIXABLE ━━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:98:1 - │ - 98 │ (+foo || {}).#bar; - │ ^^^^^^^^^^^^^^^^^ + 96 │ (foo ** 2 || {}).#bar; + 97 │ (foo++ || {}).#bar; + > 98 │ (+foo || {}).#bar; + │ ^^^^^^^^^^^^^^^^^ + 99 │ i Suggested fix: Change to an optional chain. @@ -2059,10 +2186,11 @@ nullishAndLogicalOr.ts:102:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:102:1 - │ - 102 │ (this || {}).bar; - │ ^^^^^^^^^^^^^^^^ + 101 │ //this expression + > 102 │ (this || {}).bar; + │ ^^^^^^^^^^^^^^^^ + 103 │ (this || ({})).bar; + 104 │ (await this || {}).bar; i Suggested fix: Change to an optional chain. @@ -2084,10 +2212,12 @@ nullishAndLogicalOr.ts:103:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:103:1 - │ - 103 │ (this || ({})).bar; - │ ^^^^^^^^^^^^^^^^^^ + 101 │ //this expression + 102 │ (this || {}).bar; + > 103 │ (this || ({})).bar; + │ ^^^^^^^^^^^^^^^^^^ + 104 │ (await this || {}).bar; + 105 │ const foo = (this || {}).baz; i Suggested fix: Change to an optional chain. @@ -2109,10 +2239,12 @@ nullishAndLogicalOr.ts:104:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:104:1 - │ - 104 │ (await this || {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^ + 102 │ (this || {}).bar; + 103 │ (this || ({})).bar; + > 104 │ (await this || {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 105 │ const foo = (this || {}).baz; + 106 │ i Suggested fix: Change to an optional chain. @@ -2134,10 +2266,12 @@ nullishAndLogicalOr.ts:105:13 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:105:13 - │ - 105 │ const foo = (this || {}).baz; - │ ^^^^^^^^^^^^^^^^ + 103 │ (this || ({})).bar; + 104 │ (await this || {}).bar; + > 105 │ const foo = (this || {}).baz; + │ ^^^^^^^^^^^^^^^^ + 106 │ + 107 │ ((this || {}).foo2 || {}).foo3; i Suggested fix: Change to an optional chain. @@ -2159,10 +2293,12 @@ nullishAndLogicalOr.ts:107:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:107:1 - │ - 107 │ ((this || {}).foo2 || {}).foo3; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 105 │ const foo = (this || {}).baz; + 106 │ + > 107 │ ((this || {}).foo2 || {}).foo3; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 108 │ + 109 │ if (foo) { (this || {}).bar; } i Suggested fix: Change to an optional chain. @@ -2184,10 +2320,12 @@ nullishAndLogicalOr.ts:109:12 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:109:12 - │ - 109 │ if (foo) { (this || {}).bar; } - │ ^^^^^^^^^^^^^^^^ + 107 │ ((this || {}).foo2 || {}).foo3; + 108 │ + > 109 │ if (foo) { (this || {}).bar; } + │ ^^^^^^^^^^^^^^^^ + 110 │ if ((this || {}).bar) { foo.bar; } + 111 │ i Suggested fix: Change to an optional chain. @@ -2209,10 +2347,11 @@ nullishAndLogicalOr.ts:110:5 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:110:5 - │ - 110 │ if ((this || {}).bar) { foo.bar; } - │ ^^^^^^^^^^^^^^^^ + 109 │ if (foo) { (this || {}).bar; } + > 110 │ if ((this || {}).bar) { foo.bar; } + │ ^^^^^^^^^^^^^^^^ + 111 │ + 112 │ (undefined && this || {}).bar; i Suggested fix: Change to an optional chain. @@ -2234,10 +2373,12 @@ nullishAndLogicalOr.ts:112:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:112:1 - │ - 112 │ (undefined && this || {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 110 │ if ((this || {}).bar) { foo.bar; } + 111 │ + > 112 │ (undefined && this || {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 113 │ (this ?? {}).bar; + 114 │ (this ?? ({})).bar; i Suggested fix: Change to an optional chain. @@ -2259,10 +2400,11 @@ nullishAndLogicalOr.ts:113:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:113:1 - │ - 113 │ (this ?? {}).bar; - │ ^^^^^^^^^^^^^^^^ + 112 │ (undefined && this || {}).bar; + > 113 │ (this ?? {}).bar; + │ ^^^^^^^^^^^^^^^^ + 114 │ (this ?? ({})).bar; + 115 │ (await this ?? {}).bar; i Suggested fix: Change to an optional chain. @@ -2284,10 +2426,12 @@ nullishAndLogicalOr.ts:114:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:114:1 - │ - 114 │ (this ?? ({})).bar; - │ ^^^^^^^^^^^^^^^^^^ + 112 │ (undefined && this || {}).bar; + 113 │ (this ?? {}).bar; + > 114 │ (this ?? ({})).bar; + │ ^^^^^^^^^^^^^^^^^^ + 115 │ (await this ?? {}).bar; + 116 │ i Suggested fix: Change to an optional chain. @@ -2309,10 +2453,12 @@ nullishAndLogicalOr.ts:115:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:115:1 - │ - 115 │ (await this ?? {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^ + 113 │ (this ?? {}).bar; + 114 │ (this ?? ({})).bar; + > 115 │ (await this ?? {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 116 │ + 117 │ const foo = (this ?? {}).baz; i Suggested fix: Change to an optional chain. @@ -2334,10 +2480,12 @@ nullishAndLogicalOr.ts:117:13 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:117:13 - │ - 117 │ const foo = (this ?? {}).baz; - │ ^^^^^^^^^^^^^^^^ + 115 │ (await this ?? {}).bar; + 116 │ + > 117 │ const foo = (this ?? {}).baz; + │ ^^^^^^^^^^^^^^^^ + 118 │ ((this ?? {}).foo2 ?? {}).foo3; + 119 │ i Suggested fix: Change to an optional chain. @@ -2359,10 +2507,11 @@ nullishAndLogicalOr.ts:118:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:118:1 - │ - 118 │ ((this ?? {}).foo2 ?? {}).foo3; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 117 │ const foo = (this ?? {}).baz; + > 118 │ ((this ?? {}).foo2 ?? {}).foo3; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 119 │ + 120 │ if (foo) { (this ?? {}).bar; } i Suggested fix: Change to an optional chain. @@ -2384,10 +2533,12 @@ nullishAndLogicalOr.ts:120:12 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:120:12 - │ - 120 │ if (foo) { (this ?? {}).bar; } - │ ^^^^^^^^^^^^^^^^ + 118 │ ((this ?? {}).foo2 ?? {}).foo3; + 119 │ + > 120 │ if (foo) { (this ?? {}).bar; } + │ ^^^^^^^^^^^^^^^^ + 121 │ if ((this ?? {}).bar) { foo.bar; } + 122 │ i Suggested fix: Change to an optional chain. @@ -2409,10 +2560,11 @@ nullishAndLogicalOr.ts:121:5 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:121:5 - │ - 121 │ if ((this ?? {}).bar) { foo.bar; } - │ ^^^^^^^^^^^^^^^^ + 120 │ if (foo) { (this ?? {}).bar; } + > 121 │ if ((this ?? {}).bar) { foo.bar; } + │ ^^^^^^^^^^^^^^^^ + 122 │ + 123 │ (undefined && this ?? {}).bar; i Suggested fix: Change to an optional chain. @@ -2434,10 +2586,12 @@ nullishAndLogicalOr.ts:123:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:123:1 - │ - 123 │ (undefined && this ?? {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 121 │ if ((this ?? {}).bar) { foo.bar; } + 122 │ + > 123 │ (undefined && this ?? {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 124 │ (((typeof this) as string) || {}).bar; + 125 │ i Suggested fix: Change to an optional chain. @@ -2459,10 +2613,11 @@ nullishAndLogicalOr.ts:124:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:124:1 - │ - 124 │ (((typeof this) as string) || {}).bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 123 │ (undefined && this ?? {}).bar; + > 124 │ (((typeof this) as string) || {}).bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 125 │ + 126 │ // this expression with private name i Suggested fix: Change to an optional chain. @@ -2484,10 +2639,11 @@ nullishAndLogicalOr.ts:127:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:127:1 - │ - 127 │ (this || {}).#bar; - │ ^^^^^^^^^^^^^^^^^ + 126 │ // this expression with private name + > 127 │ (this || {}).#bar; + │ ^^^^^^^^^^^^^^^^^ + 128 │ (this || ({})).#bar; + 129 │ (await this || {}).#bar; i Suggested fix: Change to an optional chain. @@ -2509,10 +2665,12 @@ nullishAndLogicalOr.ts:128:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:128:1 - │ - 128 │ (this || ({})).#bar; - │ ^^^^^^^^^^^^^^^^^^^ + 126 │ // this expression with private name + 127 │ (this || {}).#bar; + > 128 │ (this || ({})).#bar; + │ ^^^^^^^^^^^^^^^^^^^ + 129 │ (await this || {}).#bar; + 130 │ const foo = (this || {}).#baz; i Suggested fix: Change to an optional chain. @@ -2534,10 +2692,12 @@ nullishAndLogicalOr.ts:129:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:129:1 - │ - 129 │ (await this || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 127 │ (this || {}).#bar; + 128 │ (this || ({})).#bar; + > 129 │ (await this || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 130 │ const foo = (this || {}).#baz; + 131 │ i Suggested fix: Change to an optional chain. @@ -2559,10 +2719,12 @@ nullishAndLogicalOr.ts:130:13 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:130:13 - │ - 130 │ const foo = (this || {}).#baz; - │ ^^^^^^^^^^^^^^^^^ + 128 │ (this || ({})).#bar; + 129 │ (await this || {}).#bar; + > 130 │ const foo = (this || {}).#baz; + │ ^^^^^^^^^^^^^^^^^ + 131 │ + 132 │ ((this || {}).#foo2 || {}).#foo3; i Suggested fix: Change to an optional chain. @@ -2584,10 +2746,12 @@ nullishAndLogicalOr.ts:132:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:132:1 - │ - 132 │ ((this || {}).#foo2 || {}).#foo3; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 130 │ const foo = (this || {}).#baz; + 131 │ + > 132 │ ((this || {}).#foo2 || {}).#foo3; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 133 │ + 134 │ if (foo) { (this || {}).#bar; } i Suggested fix: Change to an optional chain. @@ -2609,10 +2773,12 @@ nullishAndLogicalOr.ts:134:12 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:134:12 - │ - 134 │ if (foo) { (this || {}).#bar; } - │ ^^^^^^^^^^^^^^^^^ + 132 │ ((this || {}).#foo2 || {}).#foo3; + 133 │ + > 134 │ if (foo) { (this || {}).#bar; } + │ ^^^^^^^^^^^^^^^^^ + 135 │ if ((this || {}).#bar) { foo.bar; } + 136 │ i Suggested fix: Change to an optional chain. @@ -2634,10 +2800,11 @@ nullishAndLogicalOr.ts:135:5 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:135:5 - │ - 135 │ if ((this || {}).#bar) { foo.bar; } - │ ^^^^^^^^^^^^^^^^^ + 134 │ if (foo) { (this || {}).#bar; } + > 135 │ if ((this || {}).#bar) { foo.bar; } + │ ^^^^^^^^^^^^^^^^^ + 136 │ + 137 │ (undefined && this || {}).#bar; i Suggested fix: Change to an optional chain. @@ -2659,10 +2826,12 @@ nullishAndLogicalOr.ts:137:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:137:1 - │ - 137 │ (undefined && this || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 135 │ if ((this || {}).#bar) { foo.bar; } + 136 │ + > 137 │ (undefined && this || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 138 │ (this ?? {}).#bar; + 139 │ (this ?? ({})).#bar; i Suggested fix: Change to an optional chain. @@ -2684,10 +2853,11 @@ nullishAndLogicalOr.ts:138:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:138:1 - │ - 138 │ (this ?? {}).#bar; - │ ^^^^^^^^^^^^^^^^^ + 137 │ (undefined && this || {}).#bar; + > 138 │ (this ?? {}).#bar; + │ ^^^^^^^^^^^^^^^^^ + 139 │ (this ?? ({})).#bar; + 140 │ (await this ?? {}).#bar; i Suggested fix: Change to an optional chain. @@ -2709,10 +2879,12 @@ nullishAndLogicalOr.ts:139:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:139:1 - │ - 139 │ (this ?? ({})).#bar; - │ ^^^^^^^^^^^^^^^^^^^ + 137 │ (undefined && this || {}).#bar; + 138 │ (this ?? {}).#bar; + > 139 │ (this ?? ({})).#bar; + │ ^^^^^^^^^^^^^^^^^^^ + 140 │ (await this ?? {}).#bar; + 141 │ i Suggested fix: Change to an optional chain. @@ -2734,10 +2906,12 @@ nullishAndLogicalOr.ts:140:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:140:1 - │ - 140 │ (await this ?? {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 138 │ (this ?? {}).#bar; + 139 │ (this ?? ({})).#bar; + > 140 │ (await this ?? {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 141 │ + 142 │ const foo = (this ?? {}).#baz; i Suggested fix: Change to an optional chain. @@ -2759,10 +2933,12 @@ nullishAndLogicalOr.ts:142:13 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:142:13 - │ - 142 │ const foo = (this ?? {}).#baz; - │ ^^^^^^^^^^^^^^^^^ + 140 │ (await this ?? {}).#bar; + 141 │ + > 142 │ const foo = (this ?? {}).#baz; + │ ^^^^^^^^^^^^^^^^^ + 143 │ ((this ?? {}).#foo2 ?? {}).#foo3; + 144 │ i Suggested fix: Change to an optional chain. @@ -2784,10 +2960,11 @@ nullishAndLogicalOr.ts:143:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:143:1 - │ - 143 │ ((this ?? {}).#foo2 ?? {}).#foo3; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 142 │ const foo = (this ?? {}).#baz; + > 143 │ ((this ?? {}).#foo2 ?? {}).#foo3; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 144 │ + 145 │ if (foo) { (this ?? {}).#bar; } i Suggested fix: Change to an optional chain. @@ -2809,10 +2986,12 @@ nullishAndLogicalOr.ts:145:12 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:145:12 - │ - 145 │ if (foo) { (this ?? {}).#bar; } - │ ^^^^^^^^^^^^^^^^^ + 143 │ ((this ?? {}).#foo2 ?? {}).#foo3; + 144 │ + > 145 │ if (foo) { (this ?? {}).#bar; } + │ ^^^^^^^^^^^^^^^^^ + 146 │ if ((this ?? {}).#bar) { foo.bar; } + 147 │ i Suggested fix: Change to an optional chain. @@ -2834,10 +3013,11 @@ nullishAndLogicalOr.ts:146:5 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:146:5 - │ - 146 │ if ((this ?? {}).#bar) { foo.bar; } - │ ^^^^^^^^^^^^^^^^^ + 145 │ if (foo) { (this ?? {}).#bar; } + > 146 │ if ((this ?? {}).#bar) { foo.bar; } + │ ^^^^^^^^^^^^^^^^^ + 147 │ + 148 │ (undefined && this ?? {}).#bar; i Suggested fix: Change to an optional chain. @@ -2859,10 +3039,12 @@ nullishAndLogicalOr.ts:148:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:148:1 - │ - 148 │ (undefined && this ?? {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 146 │ if ((this ?? {}).#bar) { foo.bar; } + 147 │ + > 148 │ (undefined && this ?? {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 149 │ (((typeof this) as string) || {}).#bar; + 150 │ // (new foo || {}).bar; // tracked here https://github.com/rome/tools/issues/3257 i Suggested fix: Change to an optional chain. @@ -2884,10 +3066,11 @@ nullishAndLogicalOr.ts:149:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:149:1 - │ - 149 │ (((typeof this) as string) || {}).#bar; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 148 │ (undefined && this ?? {}).#bar; + > 149 │ (((typeof this) as string) || {}).#bar; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 150 │ // (new foo || {}).bar; // tracked here https://github.com/rome/tools/issues/3257 + 151 │ (foo() || {}).bar; i Suggested fix: Change to an optional chain. @@ -2909,10 +3092,12 @@ nullishAndLogicalOr.ts:151:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:151:1 - │ - 151 │ (foo() || {}).bar; - │ ^^^^^^^^^^^^^^^^^ + 149 │ (((typeof this) as string) || {}).#bar; + 150 │ // (new foo || {}).bar; // tracked here https://github.com/rome/tools/issues/3257 + > 151 │ (foo() || {}).bar; + │ ^^^^^^^^^^^^^^^^^ + 152 │ ((foo || {}).bar() || {}).baz; + 153 │ i Suggested fix: Change to an optional chain. @@ -2932,10 +3117,11 @@ nullishAndLogicalOr.ts:152:1 lint/nursery/useOptionalChain FIXABLE ━━━ ! Change to an optional chain. - ┌─ nullishAndLogicalOr.ts:152:1 - │ - 152 │ ((foo || {}).bar() || {}).baz; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 150 │ // (new foo || {}).bar; // tracked here https://github.com/rome/tools/issues/3257 + 151 │ (foo() || {}).bar; + > 152 │ ((foo || {}).bar() || {}).baz; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 153 │ i Suggested fix: Change to an optional chain. diff --git a/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/validCases.ts.snap b/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/validCases.ts.snap index 53c24dde8b3..986e3ffaff4 100644 --- a/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/validCases.ts.snap +++ b/crates/rome_js_analyze/tests/specs/nursery/useOptionalChain/validCases.ts.snap @@ -53,10 +53,11 @@ validCases.ts:40:1 lint/nursery/useOptionalChain FIXABLE ━━━━━━━ ! Change to an optional chain. - ┌─ validCases.ts:40:1 - │ - 40 │ (new foo || {}).bar - │ ^^^^^^^^^^^^^^^^^^^ + 38 │ ((foo || {})()).bar; + 39 │ + > 40 │ (new foo || {}).bar + │ ^^^^^^^^^^^^^^^^^^^ + 41 │ i Suggested fix: Change to an optional chain. diff --git a/crates/rome_js_analyze/tests/specs/style/noNegationElse/default.js.snap b/crates/rome_js_analyze/tests/specs/style/noNegationElse/default.js.snap index eccc95f44a5..3ef18ffd532 100644 --- a/crates/rome_js_analyze/tests/specs/style/noNegationElse/default.js.snap +++ b/crates/rome_js_analyze/tests/specs/style/noNegationElse/default.js.snap @@ -26,14 +26,17 @@ default.js:7:1 lint/style/noNegationElse FIXABLE ━━━━━━━━━ ! Invert blocks when performing a negation test. - ┌─ default.js:7:1 - │ - 7 │ ┌ if (!true) { - 8 │ │ consequent; - 9 │ │ } else { - 10 │ │ alternate; - 11 │ │ } - │ └─^ + 5 │ true ? consequent : alternate; + 6 │ // invalid + > 7 │ if (!true) { + │ ^^^^^^^^^^^^ + > 8 │ consequent; + > 9 │ } else { + > 10 │ alternate; + > 11 │ } + │ ^ + 12 │ !condition ? consequent : alternate; + 13 │ i Suggested fix: Exchange alternate and consequent of the node @@ -60,10 +63,12 @@ default.js:12:1 lint/style/noNegationElse FIXABLE ━━━━━━━━━ ! Invert blocks when performing a negation test. - ┌─ default.js:12:1 - │ - 12 │ !condition ? consequent : alternate; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 10 │ alternate; + 11 │ } + > 12 │ !condition ? consequent : alternate; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 13 │ + 14 │ let a = !test ? c : d; i Suggested fix: Exchange alternate and consequent of the node @@ -84,10 +89,10 @@ default.js:14:9 lint/style/noNegationElse FIXABLE ━━━━━━━━━ ! Invert blocks when performing a negation test. - ┌─ default.js:14:9 - │ - 14 │ let a = !test ? c : d; - │ ^^^^^^^^^^^^^ + 12 │ !condition ? consequent : alternate; + 13 │ + > 14 │ let a = !test ? c : d; + │ ^^^^^^^^^^^^^ i Suggested fix: Exchange alternate and consequent of the node diff --git a/crates/rome_js_analyze/tests/specs/style/noNegationElse/issue_2999.js.snap b/crates/rome_js_analyze/tests/specs/style/noNegationElse/issue_2999.js.snap index 8ddce9d3e93..53781ee10ed 100644 --- a/crates/rome_js_analyze/tests/specs/style/noNegationElse/issue_2999.js.snap +++ b/crates/rome_js_analyze/tests/specs/style/noNegationElse/issue_2999.js.snap @@ -21,12 +21,13 @@ issue_2999.js:1:1 lint/style/noNegationElse FIXABLE ━━━━━━━━ ! Invert blocks when performing a negation test. - ┌─ issue_2999.js:1:1 - │ - 1 │ ┌ if (!true) { - 2 │ │ consequent; - 3 │ │ } else something(); - │ └───────────────────^ + > 1 │ if (!true) { + │ ^^^^^^^^^^^^ + > 2 │ consequent; + > 3 │ } else something(); + │ ^^^^^^^^^^^^^^^^^^^ + 4 │ //valid https://github.com/rome/tools/issues/2999· + 5 │ if (!/^NCT/.test(input)) { i Suggested fix: Exchange alternate and consequent of the node diff --git a/crates/rome_js_analyze/tests/specs/style/noShoutyConstants.js.snap b/crates/rome_js_analyze/tests/specs/style/noShoutyConstants.js.snap index d9213416617..49d29593a05 100644 --- a/crates/rome_js_analyze/tests/specs/style/noShoutyConstants.js.snap +++ b/crates/rome_js_analyze/tests/specs/style/noShoutyConstants.js.snap @@ -23,24 +23,27 @@ noShoutyConstants.js:1:7 lint/style/noShoutyConstants FIXABLE ━━━━━ ! Redundant constant declaration. - ┌─ noShoutyConstants.js:1:7 - │ - 1 │ const FOO = "FOO"; - │ ^^^^^^^^^^^ + > 1 │ const FOO = "FOO"; + │ ^^^^^^^^^^^ + 2 │ console.log(FOO, FOO2); + 3 │ i Used here. - ┌─ noShoutyConstants.js:2:13 - │ - 2 │ console.log(FOO, FOO2); - │ ^^^ + 1 │ const FOO = "FOO"; + > 2 │ console.log(FOO, FOO2); + │ ^^^ + 3 │ + 4 │ const FOO2 = "FOO2", a = "FOO3", FOO4 = "FOO4"; i Used here. - ┌─ noShoutyConstants.js:6:13 - │ - 6 │ console.log(FOO, FOO4); - │ ^^^ + 4 │ const FOO2 = "FOO2", a = "FOO3", FOO4 = "FOO4"; + 5 │ + > 6 │ console.log(FOO, FOO4); + │ ^^^ + 7 │ + 8 │ let foo = "foo"; i You should avoid declaring constants with a string that's the same value as the variable name. It introduces a level of unnecessary @@ -70,17 +73,20 @@ noShoutyConstants.js:4:7 lint/style/noShoutyConstants FIXABLE ━━━━━ ! Redundant constant declaration. - ┌─ noShoutyConstants.js:4:7 - │ - 4 │ const FOO2 = "FOO2", a = "FOO3", FOO4 = "FOO4"; - │ ^^^^^^^^^^^^^ + 2 │ console.log(FOO, FOO2); + 3 │ + > 4 │ const FOO2 = "FOO2", a = "FOO3", FOO4 = "FOO4"; + │ ^^^^^^^^^^^^^ + 5 │ + 6 │ console.log(FOO, FOO4); i Used here. - ┌─ noShoutyConstants.js:2:18 - │ - 2 │ console.log(FOO, FOO2); - │ ^^^^ + 1 │ const FOO = "FOO"; + > 2 │ console.log(FOO, FOO2); + │ ^^^^ + 3 │ + 4 │ const FOO2 = "FOO2", a = "FOO3", FOO4 = "FOO4"; i You should avoid declaring constants with a string that's the same value as the variable name. It introduces a level of unnecessary @@ -107,17 +113,21 @@ noShoutyConstants.js:4:34 lint/style/noShoutyConstants FIXABLE ━━━━━ ! Redundant constant declaration. - ┌─ noShoutyConstants.js:4:34 - │ - 4 │ const FOO2 = "FOO2", a = "FOO3", FOO4 = "FOO4"; - │ ^^^^^^^^^^^^^ + 2 │ console.log(FOO, FOO2); + 3 │ + > 4 │ const FOO2 = "FOO2", a = "FOO3", FOO4 = "FOO4"; + │ ^^^^^^^^^^^^^ + 5 │ + 6 │ console.log(FOO, FOO4); i Used here. - ┌─ noShoutyConstants.js:6:18 - │ - 6 │ console.log(FOO, FOO4); - │ ^^^^ + 4 │ const FOO2 = "FOO2", a = "FOO3", FOO4 = "FOO4"; + 5 │ + > 6 │ console.log(FOO, FOO4); + │ ^^^^ + 7 │ + 8 │ let foo = "foo"; i You should avoid declaring constants with a string that's the same value as the variable name. It introduces a level of unnecessary diff --git a/crates/rome_js_analyze/tests/specs/style/useSelfClosingElements.tsx.snap b/crates/rome_js_analyze/tests/specs/style/useSelfClosingElements.tsx.snap index 2f845771fe4..0060a6316bf 100644 --- a/crates/rome_js_analyze/tests/specs/style/useSelfClosingElements.tsx.snap +++ b/crates/rome_js_analyze/tests/specs/style/useSelfClosingElements.tsx.snap @@ -31,10 +31,11 @@ useSelfClosingElements.tsx:10:1 lint/style/useSelfClosingElements FIXABLE ━ ! JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing. - ┌─ useSelfClosingElements.tsx:10:1 - │ - 10 │
; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 9 │ // invalid + > 10 │
; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 │ ; + 12 │ ; i Suggested fix: Use a SelfClosingElement instead @@ -56,10 +57,12 @@ useSelfClosingElements.tsx:11:1 lint/style/useSelfClosingElements FIXABLE ━ ! JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing. - ┌─ useSelfClosingElements.tsx:11:1 - │ - 11 │ ; - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 9 │ // invalid + 10 │
; + > 11 │ ; + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 12 │ ; + 13 │
; - │ ^^^^^^^^^^^^^^^^^^^ + 10 │
; + 11 │ ; + > 12 │ ; + │ ^^^^^^^^^^^^^^^^^^^ + 13 │
; - │ └───────^ + 11 │ ; + 12 │ ; + > 13 │
14 │ + > 15 │ >
; + │ ^^^^^^^ + 16 │ + 17 │
/* comment */; i Suggested fix: Use a SelfClosingElement instead @@ -133,10 +141,12 @@ useSelfClosingElements.tsx:17:1 lint/style/useSelfClosingElements FIXABLE ━ ! JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing. - ┌─ useSelfClosingElements.tsx:17:1 - │ - 17 │
/* comment */; - │ ^^^^^^^^^^^^ + 15 │ >
; + 16 │ + > 17 │
/* comment */; + │ ^^^^^^^^^^^^ + 18 │ /* comment */
; + 19 │ >; i Suggested fix: Use a SelfClosingElement instead @@ -157,10 +167,10 @@ useSelfClosingElements.tsx:18:15 lint/style/useSelfClosingElements FIXABLE ━ ! JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing. - ┌─ useSelfClosingElements.tsx:18:15 - │ - 18 │ /* comment */
; - │ ^^^^^^^^^^^^ + 17 │
/* comment */; + > 18 │ /* comment */
; + │ ^^^^^^^^^^^^ + 19 │ >; i Suggested fix: Use a SelfClosingElement instead @@ -180,10 +190,10 @@ useSelfClosingElements.tsx:19:1 lint/style/useSelfClosingElements FIXABLE ━ ! JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing. - ┌─ useSelfClosingElements.tsx:19:1 - │ - 19 │ >; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 17 │
/* comment */; + 18 │ /* comment */
; + > 19 │ >; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ i Suggested fix: Use a SelfClosingElement instead diff --git a/crates/rome_js_analyze/tests/specs/style/useShorthandArrayType.ts.snap b/crates/rome_js_analyze/tests/specs/style/useShorthandArrayType.ts.snap index 08958a9cb12..3e1560f342b 100644 --- a/crates/rome_js_analyze/tests/specs/style/useShorthandArrayType.ts.snap +++ b/crates/rome_js_analyze/tests/specs/style/useShorthandArrayType.ts.snap @@ -37,10 +37,12 @@ useShorthandArrayType.ts:6:12 lint/style/useShorthandArrayType FIXABLE ━━ ! Use shorthand T[] syntax instead of Array syntax. - ┌─ useShorthandArrayType.ts:6:12 - │ - 6 │ let valid: Array; - │ ^^^^^^^^^^ + 4 │ let valid: Array; + 5 │ // invalid + > 6 │ let valid: Array; + │ ^^^^^^^^^^ + 7 │ let invalid1: Array>; + 8 │ let invalid2: Promise>; i Suggested fix: Use shorthand T[] syntax to replace @@ -62,10 +64,12 @@ useShorthandArrayType.ts:7:15 lint/style/useShorthandArrayType FIXABLE ━━ ! Use shorthand T[] syntax instead of Array syntax. - ┌─ useShorthandArrayType.ts:7:15 - │ - 7 │ let invalid1: Array>; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ // invalid + 6 │ let valid: Array; + > 7 │ let invalid1: Array>; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 8 │ let invalid2: Promise>; + 9 │ let invalid3: Array>; i Suggested fix: Use shorthand T[] syntax to replace @@ -87,10 +91,12 @@ useShorthandArrayType.ts:7:26 lint/style/useShorthandArrayType FIXABLE ━━ ! Use shorthand T[] syntax instead of Array syntax. - ┌─ useShorthandArrayType.ts:7:26 - │ - 7 │ let invalid1: Array>; - │ ^^^^^^^^^^^^^ + 5 │ // invalid + 6 │ let valid: Array; + > 7 │ let invalid1: Array>; + │ ^^^^^^^^^^^^^ + 8 │ let invalid2: Promise>; + 9 │ let invalid3: Array>; i Suggested fix: Use shorthand T[] syntax to replace @@ -112,10 +118,12 @@ useShorthandArrayType.ts:8:23 lint/style/useShorthandArrayType FIXABLE ━━ ! Use shorthand T[] syntax instead of Array syntax. - ┌─ useShorthandArrayType.ts:8:23 - │ - 8 │ let invalid2: Promise>; - │ ^^^^^^^^^^^^^ + 6 │ let valid: Array; + 7 │ let invalid1: Array>; + > 8 │ let invalid2: Promise>; + │ ^^^^^^^^^^^^^ + 9 │ let invalid3: Array>; + 10 │ let invalid4: Array<[number, number]>; i Suggested fix: Use shorthand T[] syntax to replace @@ -137,10 +145,12 @@ useShorthandArrayType.ts:9:15 lint/style/useShorthandArrayType FIXABLE ━━ ! Use shorthand T[] syntax instead of Array syntax. - ┌─ useShorthandArrayType.ts:9:15 - │ - 9 │ let invalid3: Array>; - │ ^^^^^^^^^^^^^^^ + 7 │ let invalid1: Array>; + 8 │ let invalid2: Promise>; + > 9 │ let invalid3: Array>; + │ ^^^^^^^^^^^^^^^ + 10 │ let invalid4: Array<[number, number]>; + 11 │ i Suggested fix: Use shorthand T[] syntax to replace @@ -162,10 +172,12 @@ useShorthandArrayType.ts:10:15 lint/style/useShorthandArrayType FIXABLE ━━ ! Use shorthand T[] syntax instead of Array syntax. - ┌─ useShorthandArrayType.ts:10:15 - │ - 10 │ let invalid4: Array<[number, number]>; - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 8 │ let invalid2: Promise>; + 9 │ let invalid3: Array>; + > 10 │ let invalid4: Array<[number, number]>; + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 11 │ + 12 │ // valid i Suggested fix: Use shorthand T[] syntax to replace @@ -187,10 +199,11 @@ useShorthandArrayType.ts:20:13 lint/style/useShorthandArrayType FIXABLE ━━ ! Use shorthand T[] syntax instead of Array syntax. - ┌─ useShorthandArrayType.ts:20:13 - │ - 20 │ let valid8: Array<(string & number)>; - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 19 │ //parenthesized type + > 20 │ let valid8: Array<(string & number)>; + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 21 │ // infer type + 22 │ type valid9 = T extends Array ? R : any; i Suggested fix: Use shorthand T[] syntax to replace diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/arrows-bind/arrows-bind.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/arrows-bind/arrows-bind.js.snap index a9d315858cb..d375ea25f94 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/arrows-bind/arrows-bind.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/arrows-bind/arrows-bind.js.snap @@ -50,10 +50,10 @@ arrows-bind.js:1:9 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ arrows-bind.js:1:9 - │ - 1 │ a => ({}::b()``[''].c++ && 0 ? 0 : 0); - │ ^ + > 1 │ a => ({}::b()``[''].c++ && 0 ? 0 : 0); + │ ^ + 2 │ (a => b)::c; + 3 │ a::(b => c); arrows-bind.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -61,17 +61,19 @@ arrows-bind.js:2:9 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ arrows-bind.js:2:9 - │ - 2 │ (a => b)::c; - │ ^ + 1 │ a => ({}::b()``[''].c++ && 0 ? 0 : 0); + > 2 │ (a => b)::c; + │ ^ + 3 │ a::(b => c); + 4 │ i ...Which is required to end this statement - ┌─ arrows-bind.js:2:1 - │ - 2 │ (a => b)::c; - │ ^^^^^^^^^ + 1 │ a => ({}::b()``[''].c++ && 0 ? 0 : 0); + > 2 │ (a => b)::c; + │ ^^^^^^^^^ + 3 │ a::(b => c); + 4 │ arrows-bind.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -79,10 +81,11 @@ arrows-bind.js:3:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ arrows-bind.js:3:3 - │ - 3 │ a::(b => c); - │ ^ + 1 │ a => ({}::b()``[''].c++ && 0 ? 0 : 0); + 2 │ (a => b)::c; + > 3 │ a::(b => c); + │ ^ + 4 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/arrows/newline-before-arrow/newline-before-arrow.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/arrows/newline-before-arrow/newline-before-arrow.js.snap index 922c0ec6e4a..fbe5953f847 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/arrows/newline-before-arrow/newline-before-arrow.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/arrows/newline-before-arrow/newline-before-arrow.js.snap @@ -41,17 +41,17 @@ newline-before-arrow.js:1:7 parse ━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ newline-before-arrow.js:1:7 - │ - 1 │ async x - │ ^ + > 1 │ async x + │ ^ + 2 │ => x + 3 │ i ...Which is required to end this statement - ┌─ newline-before-arrow.js:1:1 - │ - 1 │ async x - │ ^^^^^^^ + > 1 │ async x + │ ^^^^^^^ + 2 │ => x + 3 │ newline-before-arrow.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -59,10 +59,10 @@ newline-before-arrow.js:2:1 parse ━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ newline-before-arrow.js:2:1 - │ - 2 │ => x - │ ^^^^ + 1 │ async x + > 2 │ => x + │ ^^^^ + 3 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/async-do-expressions/async-do-expressions.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/async-do-expressions/async-do-expressions.js.snap index 06595660ba2..fd50c412ce6 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/async-do-expressions/async-do-expressions.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/async-do-expressions/async-do-expressions.js.snap @@ -138,17 +138,17 @@ async-do-expressions.js:1:7 parse ━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ async-do-expressions.js:1:7 - │ - 1 │ async do { - │ ^^ + > 1 │ async do { + │ ^^ + 2 │ 1; + 3 │ }; i ...Which is required to end this statement - ┌─ async-do-expressions.js:1:1 - │ - 1 │ async do { - │ ^^^^^^^^ + > 1 │ async do { + │ ^^^^^^^^ + 2 │ 1; + 3 │ }; async-do-expressions.js:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -156,10 +156,12 @@ async-do-expressions.js:3:2 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ async-do-expressions.js:3:2 - │ - 3 │ }; - │ ^ + 1 │ async do { + 2 │ 1; + > 3 │ }; + │ ^ + 4 │ + 5 │ (async do {}); async-do-expressions.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -167,10 +169,12 @@ async-do-expressions.js:5:8 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ async-do-expressions.js:5:8 - │ - 5 │ (async do {}); - │ ^^ + 3 │ }; + 4 │ + > 5 │ (async do {}); + │ ^^ + 6 │ + 7 │ let x = async do { async-do-expressions.js:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -178,10 +182,12 @@ async-do-expressions.js:5:13 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ async-do-expressions.js:5:13 - │ - 5 │ (async do {}); - │ ^ + 3 │ }; + 4 │ + > 5 │ (async do {}); + │ ^ + 6 │ + 7 │ let x = async do { async-do-expressions.js:7:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -189,17 +195,21 @@ async-do-expressions.js:7:15 parse ━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ async-do-expressions.js:7:15 - │ - 7 │ let x = async do { - │ ^^ + 5 │ (async do {}); + 6 │ + > 7 │ let x = async do { + │ ^^ + 8 │ if (foo()) { f() } + 9 │ else if (bar()) { g() } i ...Which is required to end this statement - ┌─ async-do-expressions.js:7:1 - │ - 7 │ let x = async do { - │ ^^^^^^^^^^^^^^ + 5 │ (async do {}); + 6 │ + > 7 │ let x = async do { + │ ^^^^^^^^^^^^^^ + 8 │ if (foo()) { f() } + 9 │ else if (bar()) { g() } async-do-expressions.js:11:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -207,10 +217,12 @@ async-do-expressions.js:11:2 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ async-do-expressions.js:11:2 - │ - 11 │ }; - │ ^ + 9 │ else if (bar()) { g() } + 10 │ else { h() } + > 11 │ }; + │ ^ + 12 │ + 13 │ async do { async-do-expressions.js:13:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -218,17 +230,21 @@ async-do-expressions.js:13:7 parse ━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ async-do-expressions.js:13:7 - │ - 13 │ async do { - │ ^^ + 11 │ }; + 12 │ + > 13 │ async do { + │ ^^ + 14 │ await 42 + 15 │ } i ...Which is required to end this statement - ┌─ async-do-expressions.js:13:1 - │ - 13 │ async do { - │ ^^^^^^^^ + 11 │ }; + 12 │ + > 13 │ async do { + │ ^^^^^^^^ + 14 │ await 42 + 15 │ } async-do-expressions.js:17:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -236,10 +252,12 @@ async-do-expressions.js:17:1 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ async-do-expressions.js:17:1 - │ - 17 │ function iter() { - │ ^^^^^^^^ + 15 │ } + 16 │ + > 17 │ function iter() { + │ ^^^^^^^^ + 18 │ return async do { + 19 │ return 1; async-do-expressions.js:18:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -247,17 +265,19 @@ async-do-expressions.js:18:16 parse ━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ async-do-expressions.js:18:16 - │ - 18 │ return async do { - │ ^^ + 17 │ function iter() { + > 18 │ return async do { + │ ^^ + 19 │ return 1; + 20 │ } i ...Which is required to end this statement - ┌─ async-do-expressions.js:18:3 - │ - 18 │ return async do { - │ ^^^^^^^^^^^^^^^ + 17 │ function iter() { + > 18 │ return async do { + │ ^^^^^^^^^^^^^^^ + 19 │ return 1; + 20 │ } async-do-expressions.js:21:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -265,10 +285,12 @@ async-do-expressions.js:21:1 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ async-do-expressions.js:21:1 - │ - 21 │ }; - │ ^ + 19 │ return 1; + 20 │ } + > 21 │ }; + │ ^ + 22 │ + 23 │ let x = async do { async-do-expressions.js:21:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -276,10 +298,12 @@ async-do-expressions.js:21:2 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ async-do-expressions.js:21:2 - │ - 21 │ }; - │ ^ + 19 │ return 1; + 20 │ } + > 21 │ }; + │ ^ + 22 │ + 23 │ let x = async do { async-do-expressions.js:23:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -287,17 +311,21 @@ async-do-expressions.js:23:15 parse ━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ async-do-expressions.js:23:15 - │ - 23 │ let x = async do { - │ ^^ + 21 │ }; + 22 │ + > 23 │ let x = async do { + │ ^^ + 24 │ let tmp = f(); + 25 │ tmp * tmp + 1 i ...Which is required to end this statement - ┌─ async-do-expressions.js:23:1 - │ - 23 │ let x = async do { - │ ^^^^^^^^^^^^^^ + 21 │ }; + 22 │ + > 23 │ let x = async do { + │ ^^^^^^^^^^^^^^ + 24 │ let tmp = f(); + 25 │ tmp * tmp + 1 async-do-expressions.js:26:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -305,10 +333,11 @@ async-do-expressions.js:26:2 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ async-do-expressions.js:26:2 - │ - 26 │ }; - │ ^ + 24 │ let tmp = f(); + 25 │ tmp * tmp + 1 + > 26 │ }; + │ ^ + 27 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/async-do-expressions.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/async-do-expressions.js.snap index af8c04716fb..65cd029de85 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/async-do-expressions.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/async-do-expressions.js.snap @@ -40,17 +40,15 @@ async-do-expressions.js:1:7 parse ━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ async-do-expressions.js:1:7 - │ - 1 │ async do { await requestAPI().json() }; - │ ^^ + > 1 │ async do { await requestAPI().json() }; + │ ^^ + 2 │ i ...Which is required to end this statement - ┌─ async-do-expressions.js:1:1 - │ - 1 │ async do { await requestAPI().json() }; - │ ^^^^^^^^ + > 1 │ async do { await requestAPI().json() }; + │ ^^^^^^^^ + 2 │ async-do-expressions.js:1:39 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -58,10 +56,9 @@ async-do-expressions.js:1:39 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ async-do-expressions.js:1:39 - │ - 1 │ async do { await requestAPI().json() }; - │ ^ + > 1 │ async do { await requestAPI().json() }; + │ ^ + 2 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/decimal.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/decimal.js.snap index f7241db11e5..54eb7a57d01 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/decimal.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/decimal.js.snap @@ -150,10 +150,12 @@ decimal.js:3:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:3:1 - │ - 3 │ 100m; - │ ^^^^ + 1 │ // https://github.com/babel/babel/pull/11640 + 2 │ + > 3 │ 100m; + │ ^^^^ + 4 │ 9223372036854775807m; + 5 │ 0.m; decimal.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -161,10 +163,11 @@ decimal.js:4:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:4:1 - │ - 4 │ 9223372036854775807m; - │ ^^^^^^^^^^^^^^^^^^^^ + 3 │ 100m; + > 4 │ 9223372036854775807m; + │ ^^^^^^^^^^^^^^^^^^^^ + 5 │ 0.m; + 6 │ 3.1415926535897932m; decimal.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -172,10 +175,12 @@ decimal.js:5:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:5:1 - │ - 5 │ 0.m; - │ ^^^ + 3 │ 100m; + 4 │ 9223372036854775807m; + > 5 │ 0.m; + │ ^^^ + 6 │ 3.1415926535897932m; + 7 │ 100.000m; decimal.js:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -183,10 +188,12 @@ decimal.js:6:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:6:1 - │ - 6 │ 3.1415926535897932m; - │ ^^^^^^^^^^^^^^^^^^^ + 4 │ 9223372036854775807m; + 5 │ 0.m; + > 6 │ 3.1415926535897932m; + │ ^^^^^^^^^^^^^^^^^^^ + 7 │ 100.000m; + 8 │ .1m; decimal.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -194,10 +201,12 @@ decimal.js:7:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:7:1 - │ - 7 │ 100.000m; - │ ^^^^^^^^ + 5 │ 0.m; + 6 │ 3.1415926535897932m; + > 7 │ 100.000m; + │ ^^^^^^^^ + 8 │ .1m; + 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); decimal.js:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -205,10 +214,12 @@ decimal.js:8:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:8:1 - │ - 8 │ .1m; - │ ^^^ + 6 │ 3.1415926535897932m; + 7 │ 100.000m; + > 8 │ .1m; + │ ^^^ + 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + 10 │ 1.m; decimal.js:9:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -216,10 +227,12 @@ decimal.js:9:4 parse ━━━━━━━━━━━━━━━━━━━ × Expected a property, a shorthand property, a getter, a setter, or a method here - ┌─ decimal.js:9:4 - │ - 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); - │ ^^ + 7 │ 100.000m; + 8 │ .1m; + > 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + │ ^^ + 10 │ 1.m; + 11 │ 100m; decimal.js:9:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -227,10 +240,12 @@ decimal.js:9:11 parse ━━━━━━━━━━━━━━━━━━━ × Expected a property, a shorthand property, a getter, a setter, or a method here - ┌─ decimal.js:9:11 - │ - 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); - │ ^^^^^^^ + 7 │ 100.000m; + 8 │ .1m; + > 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + │ ^^^^^^^ + 10 │ 1.m; + 11 │ 100m; decimal.js:9:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -238,10 +253,12 @@ decimal.js:9:25 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ decimal.js:9:25 - │ - 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); - │ ^^^^ + 7 │ 100.000m; + 8 │ .1m; + > 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + │ ^^^^ + 10 │ 1.m; + 11 │ 100m; decimal.js:9:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -249,10 +266,12 @@ decimal.js:9:33 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:9:33 - │ - 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); - │ ^^^^^^^^^^^ + 7 │ 100.000m; + 8 │ .1m; + > 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + │ ^^^^^^^^^^^ + 10 │ 1.m; + 11 │ 100m; decimal.js:9:46 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -260,10 +279,12 @@ decimal.js:9:46 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:9:46 - │ - 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); - │ ^^^^^^^^^^^^ + 7 │ 100.000m; + 8 │ .1m; + > 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + │ ^^^^^^^^^^^^ + 10 │ 1.m; + 11 │ 100m; decimal.js:9:61 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -271,10 +292,12 @@ decimal.js:9:61 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:9:61 - │ - 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); - │ ^^^^^^^^ + 7 │ 100.000m; + 8 │ .1m; + > 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + │ ^^^^^^^^ + 10 │ 1.m; + 11 │ 100m; decimal.js:9:73 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -282,10 +305,12 @@ decimal.js:9:73 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:9:73 - │ - 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); - │ ^^ + 7 │ 100.000m; + 8 │ .1m; + > 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + │ ^^ + 10 │ 1.m; + 11 │ 100m; decimal.js:10:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -293,10 +318,12 @@ decimal.js:10:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:10:1 - │ - 10 │ 1.m; - │ ^^^ + 8 │ .1m; + 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + > 10 │ 1.m; + │ ^^^ + 11 │ 100m; + 12 │ 9223372036854775807m; decimal.js:11:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -304,10 +331,12 @@ decimal.js:11:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:11:1 - │ - 11 │ 100m; - │ ^^^^ + 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + 10 │ 1.m; + > 11 │ 100m; + │ ^^^^ + 12 │ 9223372036854775807m; + 13 │ 100.m; decimal.js:12:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -315,10 +344,12 @@ decimal.js:12:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:12:1 - │ - 12 │ 9223372036854775807m; - │ ^^^^^^^^^^^^^^^^^^^^ + 10 │ 1.m; + 11 │ 100m; + > 12 │ 9223372036854775807m; + │ ^^^^^^^^^^^^^^^^^^^^ + 13 │ 100.m; + 14 │ decimal.js:13:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -326,10 +357,12 @@ decimal.js:13:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:13:1 - │ - 13 │ 100.m; - │ ^^^^^ + 11 │ 100m; + 12 │ 9223372036854775807m; + > 13 │ 100.m; + │ ^^^^^ + 14 │ + 15 │ // Invalid decimal decimal.js:16:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -337,10 +370,11 @@ decimal.js:16:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:16:1 - │ - 16 │ 2e9m; - │ ^^^^ + 15 │ // Invalid decimal + > 16 │ 2e9m; + │ ^^^^ + 17 │ 016432m; + 18 │ 089m; decimal.js:17:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -348,10 +382,12 @@ decimal.js:17:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:17:1 - │ - 17 │ 016432m; - │ ^^^^^^^ + 15 │ // Invalid decimal + 16 │ 2e9m; + > 17 │ 016432m; + │ ^^^^^^^ + 18 │ 089m; + 19 │ decimal.js:18:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -359,10 +395,12 @@ decimal.js:18:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:18:1 - │ - 18 │ 089m; - │ ^^^^ + 16 │ 2e9m; + 17 │ 016432m; + > 18 │ 089m; + │ ^^^^ + 19 │ + 20 │ // https://github.com/tc39/proposal-decimal decimal.js:21:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -370,10 +408,11 @@ decimal.js:21:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:21:1 - │ - 21 │ .1m + .2m === .3m; - │ ^^^^^^^^^^^^^^^^^ + 20 │ // https://github.com/tc39/proposal-decimal + > 21 │ .1m + .2m === .3m; + │ ^^^^^^^^^^^^^^^^^ + 22 │ 2.00m; + 23 │ -0m; decimal.js:22:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -381,10 +420,12 @@ decimal.js:22:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ decimal.js:22:1 - │ - 22 │ 2.00m; - │ ^^^^^ + 20 │ // https://github.com/tc39/proposal-decimal + 21 │ .1m + .2m === .3m; + > 22 │ 2.00m; + │ ^^^^^ + 23 │ -0m; + 24 │ typeof 1m === "bigdecimal"; decimal.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -392,10 +433,12 @@ decimal.js:3:4 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:3:4 - │ - 3 │ 100m; - │ ^ + 1 │ // https://github.com/babel/babel/pull/11640 + 2 │ + > 3 │ 100m; + │ ^ + 4 │ 9223372036854775807m; + 5 │ 0.m; decimal.js:4:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -403,10 +446,11 @@ decimal.js:4:20 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:4:20 - │ - 4 │ 9223372036854775807m; - │ ^ + 3 │ 100m; + > 4 │ 9223372036854775807m; + │ ^ + 5 │ 0.m; + 6 │ 3.1415926535897932m; decimal.js:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -414,10 +458,12 @@ decimal.js:5:3 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:5:3 - │ - 5 │ 0.m; - │ ^ + 3 │ 100m; + 4 │ 9223372036854775807m; + > 5 │ 0.m; + │ ^ + 6 │ 3.1415926535897932m; + 7 │ 100.000m; decimal.js:6:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -425,10 +471,12 @@ decimal.js:6:19 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:6:19 - │ - 6 │ 3.1415926535897932m; - │ ^ + 4 │ 9223372036854775807m; + 5 │ 0.m; + > 6 │ 3.1415926535897932m; + │ ^ + 7 │ 100.000m; + 8 │ .1m; decimal.js:7:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -436,10 +484,12 @@ decimal.js:7:8 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:7:8 - │ - 7 │ 100.000m; - │ ^ + 5 │ 0.m; + 6 │ 3.1415926535897932m; + > 7 │ 100.000m; + │ ^ + 8 │ .1m; + 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); decimal.js:8:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -447,10 +497,12 @@ decimal.js:8:3 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:8:3 - │ - 8 │ .1m; - │ ^ + 6 │ 3.1415926535897932m; + 7 │ 100.000m; + > 8 │ .1m; + │ ^ + 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + 10 │ 1.m; decimal.js:9:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -458,10 +510,12 @@ decimal.js:9:5 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:9:5 - │ - 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); - │ ^ + 7 │ 100.000m; + 8 │ .1m; + > 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + │ ^ + 10 │ 1.m; + 11 │ 100m; decimal.js:9:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -469,10 +523,12 @@ decimal.js:9:13 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:9:13 - │ - 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); - │ ^ + 7 │ 100.000m; + 8 │ .1m; + > 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + │ ^ + 10 │ 1.m; + 11 │ 100m; decimal.js:9:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -480,10 +536,12 @@ decimal.js:9:28 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:9:28 - │ - 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); - │ ^ + 7 │ 100.000m; + 8 │ .1m; + > 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + │ ^ + 10 │ 1.m; + 11 │ 100m; decimal.js:9:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -491,10 +549,12 @@ decimal.js:9:40 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:9:40 - │ - 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); - │ ^ + 7 │ 100.000m; + 8 │ .1m; + > 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + │ ^ + 10 │ 1.m; + 11 │ 100m; decimal.js:9:55 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -502,10 +562,12 @@ decimal.js:9:55 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:9:55 - │ - 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); - │ ^ + 7 │ 100.000m; + 8 │ .1m; + > 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + │ ^ + 10 │ 1.m; + 11 │ 100m; decimal.js:9:66 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -513,10 +575,12 @@ decimal.js:9:66 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:9:66 - │ - 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); - │ ^ + 7 │ 100.000m; + 8 │ .1m; + > 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + │ ^ + 10 │ 1.m; + 11 │ 100m; decimal.js:10:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -524,10 +588,12 @@ decimal.js:10:3 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:10:3 - │ - 10 │ 1.m; - │ ^ + 8 │ .1m; + 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + > 10 │ 1.m; + │ ^ + 11 │ 100m; + 12 │ 9223372036854775807m; decimal.js:11:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -535,10 +601,12 @@ decimal.js:11:4 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:11:4 - │ - 11 │ 100m; - │ ^ + 9 │ ({ 0m: 0, .1m() {}, get 0.2m(){}, set 3m(_){}, async 4m() {}, *.5m() {} }); + 10 │ 1.m; + > 11 │ 100m; + │ ^ + 12 │ 9223372036854775807m; + 13 │ 100.m; decimal.js:12:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -546,10 +614,12 @@ decimal.js:12:20 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:12:20 - │ - 12 │ 9223372036854775807m; - │ ^ + 10 │ 1.m; + 11 │ 100m; + > 12 │ 9223372036854775807m; + │ ^ + 13 │ 100.m; + 14 │ decimal.js:13:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -557,10 +627,12 @@ decimal.js:13:5 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:13:5 - │ - 13 │ 100.m; - │ ^ + 11 │ 100m; + 12 │ 9223372036854775807m; + > 13 │ 100.m; + │ ^ + 14 │ + 15 │ // Invalid decimal decimal.js:16:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -568,10 +640,11 @@ decimal.js:16:4 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:16:4 - │ - 16 │ 2e9m; - │ ^ + 15 │ // Invalid decimal + > 16 │ 2e9m; + │ ^ + 17 │ 016432m; + 18 │ 089m; decimal.js:17:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -579,10 +652,12 @@ decimal.js:17:7 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:17:7 - │ - 17 │ 016432m; - │ ^ + 15 │ // Invalid decimal + 16 │ 2e9m; + > 17 │ 016432m; + │ ^ + 18 │ 089m; + 19 │ decimal.js:18:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -590,10 +665,12 @@ decimal.js:18:4 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:18:4 - │ - 18 │ 089m; - │ ^ + 16 │ 2e9m; + 17 │ 016432m; + > 18 │ 089m; + │ ^ + 19 │ + 20 │ // https://github.com/tc39/proposal-decimal decimal.js:21:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -601,10 +678,11 @@ decimal.js:21:3 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:21:3 - │ - 21 │ .1m + .2m === .3m; - │ ^ + 20 │ // https://github.com/tc39/proposal-decimal + > 21 │ .1m + .2m === .3m; + │ ^ + 22 │ 2.00m; + 23 │ -0m; decimal.js:21:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -612,10 +690,11 @@ decimal.js:21:9 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:21:9 - │ - 21 │ .1m + .2m === .3m; - │ ^ + 20 │ // https://github.com/tc39/proposal-decimal + > 21 │ .1m + .2m === .3m; + │ ^ + 22 │ 2.00m; + 23 │ -0m; decimal.js:21:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -623,10 +702,11 @@ decimal.js:21:17 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:21:17 - │ - 21 │ .1m + .2m === .3m; - │ ^ + 20 │ // https://github.com/tc39/proposal-decimal + > 21 │ .1m + .2m === .3m; + │ ^ + 22 │ 2.00m; + 23 │ -0m; decimal.js:22:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -634,10 +714,12 @@ decimal.js:22:5 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:22:5 - │ - 22 │ 2.00m; - │ ^ + 20 │ // https://github.com/tc39/proposal-decimal + 21 │ .1m + .2m === .3m; + > 22 │ 2.00m; + │ ^ + 23 │ -0m; + 24 │ typeof 1m === "bigdecimal"; decimal.js:23:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -645,10 +727,12 @@ decimal.js:23:3 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:23:3 - │ - 23 │ -0m; - │ ^ + 21 │ .1m + .2m === .3m; + 22 │ 2.00m; + > 23 │ -0m; + │ ^ + 24 │ typeof 1m === "bigdecimal"; + 25 │ typeof 1m === "decimal128"; decimal.js:24:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -656,10 +740,12 @@ decimal.js:24:9 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:24:9 - │ - 24 │ typeof 1m === "bigdecimal"; - │ ^ + 22 │ 2.00m; + 23 │ -0m; + > 24 │ typeof 1m === "bigdecimal"; + │ ^ + 25 │ typeof 1m === "decimal128"; + 26 │ decimal.js:25:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -667,10 +753,11 @@ decimal.js:25:9 parse ━━━━━━━━━━━━━━━━━━━ × an identifier cannot appear here - ┌─ decimal.js:25:9 - │ - 25 │ typeof 1m === "decimal128"; - │ ^ + 23 │ -0m; + 24 │ typeof 1m === "bigdecimal"; + > 25 │ typeof 1m === "decimal128"; + │ ^ + 26 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/decorator-auto-accessors.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/decorator-auto-accessors.js.snap index c51464698df..c8dfd161e92 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/decorator-auto-accessors.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/decorator-auto-accessors.js.snap @@ -42,10 +42,11 @@ decorator-auto-accessors.js:2:3 parse ━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ decorator-auto-accessors.js:2:3 - │ - 2 │ accessor clicked = false; - │ ^^^^^^^^ + 1 │ class C extends HTMLElement { + > 2 │ accessor clicked = false; + │ ^^^^^^^^ + 3 │ } + 4 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/do-expressions.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/do-expressions.js.snap index 984e4d853ae..be135dd04fc 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/do-expressions.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/do-expressions.js.snap @@ -70,10 +70,12 @@ do-expressions.js:3:9 parse ━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ do-expressions.js:3:9 - │ - 3 │ let a = do { - │ ^^ + 1 │ // https://babeljs.io/docs/en/babel-plugin-proposal-do-expressions + 2 │ + > 3 │ let a = do { + │ ^^ + 4 │ if(x > 10) { + 5 │ 'big'; do-expressions.js:9:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -81,10 +83,12 @@ do-expressions.js:9:2 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do-expressions.js:9:2 - │ - 9 │ }; - │ ^ + 7 │ 'small'; + 8 │ } + > 9 │ }; + │ ^ + 10 │ // is equivalent to: + 11 │ let a = x > 10 ? 'big' : 'small'; ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/export-default-from.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/export-default-from.js.snap index da0618ea215..e2979b795fe 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/export-default-from.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/export-default-from.js.snap @@ -49,10 +49,9 @@ export-default-from.js:4:8 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ export-default-from.js:4:8 - │ - 4 │ export v from 'mod'; - │ ^ + > 4 │ export v from 'mod'; + │ ^ + 5 │ export-default-from.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -60,17 +59,15 @@ export-default-from.js:4:10 parse ━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ export-default-from.js:4:10 - │ - 4 │ export v from 'mod'; - │ ^^^^ + > 4 │ export v from 'mod'; + │ ^^^^ + 5 │ i ...Which is required to end this statement - ┌─ export-default-from.js:4:8 - │ - 4 │ export v from 'mod'; - │ ^^^^^^ + > 4 │ export v from 'mod'; + │ ^^^^^^ + 5 │ export-default-from.js:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -78,17 +75,15 @@ export-default-from.js:4:15 parse ━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ export-default-from.js:4:15 - │ - 4 │ export v from 'mod'; - │ ^^^^^ + > 4 │ export v from 'mod'; + │ ^^^^^ + 5 │ i ...Which is required to end this statement - ┌─ export-default-from.js:4:10 - │ - 4 │ export v from 'mod'; - │ ^^^^^^^^^^ + > 4 │ export v from 'mod'; + │ ^^^^^^^^^^ + 5 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/function-bind.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/function-bind.js.snap index 1122f543942..8bd4022c1e6 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/function-bind.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/function-bind.js.snap @@ -93,10 +93,12 @@ function-bind.js:3:5 parse ━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ function-bind.js:3:5 - │ - 3 │ obj::func - │ ^ + 1 │ // https://babeljs.io/docs/en/babel-plugin-proposal-function-bind + 2 │ + > 3 │ obj::func + │ ^ + 4 │ // is equivalent to: + 5 │ func.bind(obj) ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/module-blocks.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/module-blocks.js.snap index 3f6414c9427..faec9f1de82 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/module-blocks.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/module-blocks.js.snap @@ -48,17 +48,17 @@ module-blocks.js:1:16 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module-blocks.js:1:16 - │ - 1 │ let m = module { - │ ^ + > 1 │ let m = module { + │ ^ + 2 │ export let m = 2; + 3 │ export let n = 3; i ...Which is required to end this statement - ┌─ module-blocks.js:1:1 - │ - 1 │ let m = module { - │ ^^^^^^^^^^^^^^^ + > 1 │ let m = module { + │ ^^^^^^^^^^^^^^^ + 2 │ export let m = 2; + 3 │ export let n = 3; module-blocks.js:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -66,10 +66,11 @@ module-blocks.js:2:3 parse ━━━━━━━━━━━━━━━━━ × move this declaration to the top level - ┌─ module-blocks.js:2:3 - │ - 2 │ export let m = 2; - │ ^^^^^^^^^^^^^^^^^ + 1 │ let m = module { + > 2 │ export let m = 2; + │ ^^^^^^^^^^^^^^^^^ + 3 │ export let n = 3; + 4 │ }; module-blocks.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -77,10 +78,12 @@ module-blocks.js:3:3 parse ━━━━━━━━━━━━━━━━━ × move this declaration to the top level - ┌─ module-blocks.js:3:3 - │ - 3 │ export let n = 3; - │ ^^^^^^^^^^^^^^^^^ + 1 │ let m = module { + 2 │ export let m = 2; + > 3 │ export let n = 3; + │ ^^^^^^^^^^^^^^^^^ + 4 │ }; + 5 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/partial-application.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/partial-application.js.snap index 8ded45bdfbd..70511e42041 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/partial-application.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/partial-application.js.snap @@ -86,10 +86,12 @@ partial-application.js:5:23 parse ━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ partial-application.js:5:23 - │ - 5 │ const addOne = add(1, ?); // apply from the left - │ ^ + 3 │ function add(x, y) { return x + y; } + 4 │ + > 5 │ const addOne = add(1, ?); // apply from the left + │ ^ + 6 │ addOne(2); // 3 + 7 │ partial-application.js:8:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -97,10 +99,12 @@ partial-application.js:8:20 parse ━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ partial-application.js:8:20 - │ - 8 │ const addTen = add(?, 10); // apply from the right - │ ^^^^^ + 6 │ addOne(2); // 3 + 7 │ + > 8 │ const addTen = add(?, 10); // apply from the right + │ ^^^^^ + 9 │ addTen(2); // 12 + 10 │ partial-application.js:12:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -108,10 +112,11 @@ partial-application.js:12:4 parse ━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ partial-application.js:12:4 - │ - 12 │ |> add(7, ?) - │ ^ + 11 │ let newScore = player.score + > 12 │ |> add(7, ?) + │ ^ + 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. + 14 │ partial-application.js:12:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -119,10 +124,11 @@ partial-application.js:12:13 parse ━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ partial-application.js:12:13 - │ - 12 │ |> add(7, ?) - │ ^ + 11 │ let newScore = player.score + > 12 │ |> add(7, ?) + │ ^ + 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. + 14 │ partial-application.js:13:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -130,10 +136,12 @@ partial-application.js:13:4 parse ━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ partial-application.js:13:4 - │ - 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. - │ ^ + 11 │ let newScore = player.score + 12 │ |> add(7, ?) + > 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. + │ ^ + 14 │ + 15 │ f(x, ?) // partial application from left partial-application.js:13:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -141,10 +149,12 @@ partial-application.js:13:20 parse ━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ partial-application.js:13:20 - │ - 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. - │ ^ + 11 │ let newScore = player.score + 12 │ |> add(7, ?) + > 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. + │ ^ + 14 │ + 15 │ f(x, ?) // partial application from left partial-application.js:15:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -152,10 +162,12 @@ partial-application.js:15:6 parse ━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ partial-application.js:15:6 - │ - 15 │ f(x, ?) // partial application from left - │ ^ + 13 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. + 14 │ + > 15 │ f(x, ?) // partial application from left + │ ^ + 16 │ f(?, x) // partial application from right + 17 │ f(?, x, ?) // partial application for any arg partial-application.js:16:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -163,10 +175,11 @@ partial-application.js:16:3 parse ━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ partial-application.js:16:3 - │ - 16 │ f(?, x) // partial application from right - │ ^^^^ + 15 │ f(x, ?) // partial application from left + > 16 │ f(?, x) // partial application from right + │ ^^^^ + 17 │ f(?, x, ?) // partial application for any arg + 18 │ o.f(x, ?) // partial application from left partial-application.js:17:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -174,10 +187,12 @@ partial-application.js:17:3 parse ━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ partial-application.js:17:3 - │ - 17 │ f(?, x, ?) // partial application for any arg - │ ^^^^^^^ + 15 │ f(x, ?) // partial application from left + 16 │ f(?, x) // partial application from right + > 17 │ f(?, x, ?) // partial application for any arg + │ ^^^^^^^ + 18 │ o.f(x, ?) // partial application from left + 19 │ o.f(?, x) // partial application from right partial-application.js:18:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -185,10 +200,12 @@ partial-application.js:18:8 parse ━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ partial-application.js:18:8 - │ - 18 │ o.f(x, ?) // partial application from left - │ ^ + 16 │ f(?, x) // partial application from right + 17 │ f(?, x, ?) // partial application for any arg + > 18 │ o.f(x, ?) // partial application from left + │ ^ + 19 │ o.f(?, x) // partial application from right + 20 │ o.f(?, x, ?) // partial application for any arg partial-application.js:19:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -196,10 +213,12 @@ partial-application.js:19:5 parse ━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ partial-application.js:19:5 - │ - 19 │ o.f(?, x) // partial application from right - │ ^^^^ + 17 │ f(?, x, ?) // partial application for any arg + 18 │ o.f(x, ?) // partial application from left + > 19 │ o.f(?, x) // partial application from right + │ ^^^^ + 20 │ o.f(?, x, ?) // partial application for any arg + 21 │ super.f(?) // partial application allowed for call on |SuperProperty| partial-application.js:20:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -207,10 +226,12 @@ partial-application.js:20:5 parse ━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ partial-application.js:20:5 - │ - 20 │ o.f(?, x, ?) // partial application for any arg - │ ^^^^^^^ + 18 │ o.f(x, ?) // partial application from left + 19 │ o.f(?, x) // partial application from right + > 20 │ o.f(?, x, ?) // partial application for any arg + │ ^^^^^^^ + 21 │ super.f(?) // partial application allowed for call on |SuperProperty| + 22 │ partial-application.js:21:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -218,10 +239,11 @@ partial-application.js:21:9 parse ━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ partial-application.js:21:9 - │ - 21 │ super.f(?) // partial application allowed for call on |SuperProperty| - │ ^ + 19 │ o.f(?, x) // partial application from right + 20 │ o.f(?, x, ?) // partial application for any arg + > 21 │ super.f(?) // partial application allowed for call on |SuperProperty| + │ ^ + 22 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-fsharp.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-fsharp.js.snap index e3dbd5c198f..2ed5358c1dc 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-fsharp.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-fsharp.js.snap @@ -142,10 +142,11 @@ pipeline-operator-fsharp.js:5:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline-operator-fsharp.js:5:4 - │ - 5 │ |> await - │ ^ + 4 │ promise + > 5 │ |> await + │ ^ + 6 │ |> x => doubleSay(x, ', ') + 7 │ |> capitalize pipeline-operator-fsharp.js:6:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -153,10 +154,12 @@ pipeline-operator-fsharp.js:6:3 parse ━━━━━━━━━━━━━━ × Expected an unary expression here - ┌─ pipeline-operator-fsharp.js:6:3 - │ - 6 │ |> x => doubleSay(x, ', ') - │ ^ + 4 │ promise + 5 │ |> await + > 6 │ |> x => doubleSay(x, ', ') + │ ^ + 7 │ |> capitalize + 8 │ |> x => x + '!' pipeline-operator-fsharp.js:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -164,10 +167,12 @@ pipeline-operator-fsharp.js:6:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline-operator-fsharp.js:6:4 - │ - 6 │ |> x => doubleSay(x, ', ') - │ ^ + 4 │ promise + 5 │ |> await + > 6 │ |> x => doubleSay(x, ', ') + │ ^ + 7 │ |> capitalize + 8 │ |> x => x + '!' pipeline-operator-fsharp.js:6:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -175,19 +180,24 @@ pipeline-operator-fsharp.js:6:8 parse ━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ pipeline-operator-fsharp.js:6:8 - │ - 6 │ |> x => doubleSay(x, ', ') - │ ^^ + 4 │ promise + 5 │ |> await + > 6 │ |> x => doubleSay(x, ', ') + │ ^^ + 7 │ |> capitalize + 8 │ |> x => x + '!' i ...Which is required to end this statement - ┌─ pipeline-operator-fsharp.js:4:1 - │ - 4 │ ┌ promise - 5 │ │ |> await - 6 │ │ |> x => doubleSay(x, ', ') - │ └─────────^ + 2 │ // https://github.com/valtech-nyc/proposal-fsharp-pipelines + 3 │ + > 4 │ promise + │ ^^^^^^^ + > 5 │ |> await + > 6 │ |> x => doubleSay(x, ', ') + │ ^^^^^^^ + 7 │ |> capitalize + 8 │ |> x => x + '!' pipeline-operator-fsharp.js:18:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -195,10 +205,11 @@ pipeline-operator-fsharp.js:18:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline-operator-fsharp.js:18:4 - │ - 18 │ |> doubleSay - │ ^ + 17 │ const result = "hello" + > 18 │ |> doubleSay + │ ^ + 19 │ |> capitalize + 20 │ |> exclaim; pipeline-operator-fsharp.js:19:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -206,10 +217,12 @@ pipeline-operator-fsharp.js:19:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline-operator-fsharp.js:19:4 - │ - 19 │ |> capitalize - │ ^ + 17 │ const result = "hello" + 18 │ |> doubleSay + > 19 │ |> capitalize + │ ^ + 20 │ |> exclaim; + 21 │ pipeline-operator-fsharp.js:20:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -217,10 +230,12 @@ pipeline-operator-fsharp.js:20:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline-operator-fsharp.js:20:4 - │ - 20 │ |> exclaim; - │ ^ + 18 │ |> doubleSay + 19 │ |> capitalize + > 20 │ |> exclaim; + │ ^ + 21 │ + 22 │ result //=> "Hello, hello!" pipeline-operator-fsharp.js:27:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -228,10 +243,11 @@ pipeline-operator-fsharp.js:27:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline-operator-fsharp.js:27:4 - │ - 27 │ |> double - │ ^ + 26 │ const newScore = person.score + > 27 │ |> double + │ ^ + 28 │ |> n => add(7, n) + 29 │ |> n => boundScore(0, 100, n); pipeline-operator-fsharp.js:28:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -239,10 +255,12 @@ pipeline-operator-fsharp.js:28:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline-operator-fsharp.js:28:4 - │ - 28 │ |> n => add(7, n) - │ ^ + 26 │ const newScore = person.score + 27 │ |> double + > 28 │ |> n => add(7, n) + │ ^ + 29 │ |> n => boundScore(0, 100, n); + 30 │ pipeline-operator-fsharp.js:28:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -250,19 +268,24 @@ pipeline-operator-fsharp.js:28:8 parse ━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ pipeline-operator-fsharp.js:28:8 - │ - 28 │ |> n => add(7, n) - │ ^^ + 26 │ const newScore = person.score + 27 │ |> double + > 28 │ |> n => add(7, n) + │ ^^ + 29 │ |> n => boundScore(0, 100, n); + 30 │ i ...Which is required to end this statement - ┌─ pipeline-operator-fsharp.js:26:1 - │ - 26 │ ┌ const newScore = person.score - 27 │ │ |> double - 28 │ │ |> n => add(7, n) - │ └───────^ + 24 │ const person = { score: 25 }; + 25 │ + > 26 │ const newScore = person.score + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 27 │ |> double + > 28 │ |> n => add(7, n) + │ ^^^^^ + 29 │ |> n => boundScore(0, 100, n); + 30 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-hack.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-hack.js.snap index 9abc9da0b84..eae71cb56bc 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-hack.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-hack.js.snap @@ -57,10 +57,11 @@ pipeline-operator-hack.js:5:3 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline-operator-hack.js:5:3 - │ - 5 │ |> take(prefix.length, %) - │ ^ + 4 │ return list + > 5 │ |> take(prefix.length, %) + │ ^ + 6 │ |> equals(%, prefix); + 7 │ pipeline-operator-hack.js:5:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -68,10 +69,11 @@ pipeline-operator-hack.js:5:25 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline-operator-hack.js:5:25 - │ - 5 │ |> take(prefix.length, %) - │ ^ + 4 │ return list + > 5 │ |> take(prefix.length, %) + │ ^ + 6 │ |> equals(%, prefix); + 7 │ pipeline-operator-hack.js:5:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -79,10 +81,11 @@ pipeline-operator-hack.js:5:26 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ pipeline-operator-hack.js:5:26 - │ - 5 │ |> take(prefix.length, %) - │ ^ + 4 │ return list + > 5 │ |> take(prefix.length, %) + │ ^ + 6 │ |> equals(%, prefix); + 7 │ pipeline-operator-hack.js:6:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -90,10 +93,12 @@ pipeline-operator-hack.js:6:3 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline-operator-hack.js:6:3 - │ - 6 │ |> equals(%, prefix); - │ ^ + 4 │ return list + 5 │ |> take(prefix.length, %) + > 6 │ |> equals(%, prefix); + │ ^ + 7 │ + 8 │ // (The % token isn't final; it might instead be @ or ? or #.) pipeline-operator-hack.js:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -101,10 +106,12 @@ pipeline-operator-hack.js:6:12 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline-operator-hack.js:6:12 - │ - 6 │ |> equals(%, prefix); - │ ^ + 4 │ return list + 5 │ |> take(prefix.length, %) + > 6 │ |> equals(%, prefix); + │ ^ + 7 │ + 8 │ // (The % token isn't final; it might instead be @ or ? or #.) pipeline-operator-hack.js:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -112,21 +119,26 @@ pipeline-operator-hack.js:6:13 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ pipeline-operator-hack.js:6:13 - │ - 6 │ |> equals(%, prefix); - │ ^ + 4 │ return list + 5 │ |> take(prefix.length, %) + > 6 │ |> equals(%, prefix); + │ ^ + 7 │ + 8 │ // (The % token isn't final; it might instead be @ or ? or #.) pipeline-operator-hack.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal return statement outside of a function - ┌─ pipeline-operator-hack.js:4:1 - │ - 4 │ ┌ return list - 5 │ │ |> take(prefix.length, %) - 6 │ │ |> equals(%, prefix); - │ └──────────────────────^ + 2 │ // https://github.com/js-choi/proposal-hack-pipes + 3 │ + > 4 │ return list + │ ^^^^^^^^^^^ + > 5 │ |> take(prefix.length, %) + > 6 │ |> equals(%, prefix); + │ ^^^^^^^^^^^^^^^^^^^^^ + 7 │ + 8 │ // (The % token isn't final; it might instead be @ or ? or #.) ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-minimal.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-minimal.js.snap index e255e603a04..efd7568c7a5 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-minimal.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-minimal.js.snap @@ -66,10 +66,11 @@ pipeline-operator-minimal.js:8:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline-operator-minimal.js:8:4 - │ - 8 │ |> doubleSay - │ ^ + 7 │ let result = "hello" + > 8 │ |> doubleSay + │ ^ + 9 │ |> capitalize + 10 │ |> exclaim; pipeline-operator-minimal.js:9:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -77,10 +78,12 @@ pipeline-operator-minimal.js:9:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline-operator-minimal.js:9:4 - │ - 9 │ |> capitalize - │ ^ + 7 │ let result = "hello" + 8 │ |> doubleSay + > 9 │ |> capitalize + │ ^ + 10 │ |> exclaim; + 11 │ pipeline-operator-minimal.js:10:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -88,10 +91,12 @@ pipeline-operator-minimal.js:10:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline-operator-minimal.js:10:4 - │ - 10 │ |> exclaim; - │ ^ + 8 │ |> doubleSay + 9 │ |> capitalize + > 10 │ |> exclaim; + │ ^ + 11 │ + 12 │ result //=> "Hello, hello!" ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-record.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-record.js.snap index 8cdebe07f4c..4191003673c 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-record.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-record.js.snap @@ -67,19 +67,19 @@ record-tuple-record.js:1:18 parse ━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ record-tuple-record.js:1:18 - │ - 1 │ const record1 = #{ - │ ^ + > 1 │ const record1 = #{ + │ ^ + 2 │ a: 1, + 3 │ b: 2, record-tuple-record.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ record-tuple-record.js:1:17 - │ - 1 │ const record1 = #{ - │ ^ + > 1 │ const record1 = #{ + │ ^ + 2 │ a: 1, + 3 │ b: 2, record-tuple-record.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -87,17 +87,17 @@ record-tuple-record.js:1:18 parse ━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ record-tuple-record.js:1:18 - │ - 1 │ const record1 = #{ - │ ^ + > 1 │ const record1 = #{ + │ ^ + 2 │ a: 1, + 3 │ b: 2, i ...Which is required to end this statement - ┌─ record-tuple-record.js:1:1 - │ - 1 │ const record1 = #{ - │ ^^^^^^^^^^^^^^^^^ + > 1 │ const record1 = #{ + │ ^^^^^^^^^^^^^^^^^ + 2 │ a: 1, + 3 │ b: 2, record-tuple-record.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -105,19 +105,22 @@ record-tuple-record.js:3:6 parse ━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ record-tuple-record.js:3:6 - │ - 3 │ b: 2, - │ ^ + 1 │ const record1 = #{ + 2 │ a: 1, + > 3 │ b: 2, + │ ^ + 4 │ c: 3, + 5 │ }; i ...Which is required to end this statement - ┌─ record-tuple-record.js:2:8 - │ - 2 │ a: 1, - │ ┌────────^ - 3 │ │ b: 2, - │ └──────^ + 1 │ const record1 = #{ + > 2 │ a: 1, + │ ^^ + > 3 │ b: 2, + │ ^^ + 4 │ c: 3, + 5 │ }; record-tuple-record.js:7:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -125,19 +128,21 @@ record-tuple-record.js:7:18 parse ━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ record-tuple-record.js:7:18 - │ - 7 │ const record2 = #{...record1, b: 5}; - │ ^ + 5 │ }; + 6 │ + > 7 │ const record2 = #{...record1, b: 5}; + │ ^ + 8 │ record-tuple-record.js:7:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ record-tuple-record.js:7:17 - │ - 7 │ const record2 = #{...record1, b: 5}; - │ ^ + 5 │ }; + 6 │ + > 7 │ const record2 = #{...record1, b: 5}; + │ ^ + 8 │ record-tuple-record.js:7:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -145,17 +150,19 @@ record-tuple-record.js:7:18 parse ━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ record-tuple-record.js:7:18 - │ - 7 │ const record2 = #{...record1, b: 5}; - │ ^ + 5 │ }; + 6 │ + > 7 │ const record2 = #{...record1, b: 5}; + │ ^ + 8 │ i ...Which is required to end this statement - ┌─ record-tuple-record.js:7:1 - │ - 7 │ const record2 = #{...record1, b: 5}; - │ ^^^^^^^^^^^^^^^^^ + 5 │ }; + 6 │ + > 7 │ const record2 = #{...record1, b: 5}; + │ ^^^^^^^^^^^^^^^^^ + 8 │ record-tuple-record.js:7:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -163,10 +170,11 @@ record-tuple-record.js:7:19 parse ━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ record-tuple-record.js:7:19 - │ - 7 │ const record2 = #{...record1, b: 5}; - │ ^^^^^^^^^^^^^^^^ + 5 │ }; + 6 │ + > 7 │ const record2 = #{...record1, b: 5}; + │ ^^^^^^^^^^^^^^^^ + 8 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-tuple.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-tuple.js.snap index 0d5dce1cf66..dac5815931a 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-tuple.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-tuple.js.snap @@ -38,19 +38,17 @@ record-tuple-tuple.js:1:17 parse ━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ record-tuple-tuple.js:1:17 - │ - 1 │ const tuple1 = #[1, 2, 3]; - │ ^ + > 1 │ const tuple1 = #[1, 2, 3]; + │ ^ + 2 │ record-tuple-tuple.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ record-tuple-tuple.js:1:16 - │ - 1 │ const tuple1 = #[1, 2, 3]; - │ ^ + > 1 │ const tuple1 = #[1, 2, 3]; + │ ^ + 2 │ record-tuple-tuple.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -58,17 +56,15 @@ record-tuple-tuple.js:1:17 parse ━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ record-tuple-tuple.js:1:17 - │ - 1 │ const tuple1 = #[1, 2, 3]; - │ ^ + > 1 │ const tuple1 = #[1, 2, 3]; + │ ^ + 2 │ i ...Which is required to end this statement - ┌─ record-tuple-tuple.js:1:1 - │ - 1 │ const tuple1 = #[1, 2, 3]; - │ ^^^^^^^^^^^^^^^^ + > 1 │ const tuple1 = #[1, 2, 3]; + │ ^^^^^^^^^^^^^^^^ + 2 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/throw-expressions.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/throw-expressions.js.snap index e25116f1d54..8caa878df03 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/throw-expressions.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/throw-expressions.js.snap @@ -55,10 +55,12 @@ throw-expressions.js:3:23 parse ━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ throw-expressions.js:3:23 - │ - 3 │ function test(param = throw new Error('required!')) { - │ ^^^^^ + 1 │ // https://babeljs.io/docs/en/babel-plugin-proposal-throw-expressions + 2 │ + > 3 │ function test(param = throw new Error('required!')) { + │ ^^^^^ + 4 │ const test = param === true || throw new Error('Falsy!'); + 5 │ } throw-expressions.js:3:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -66,10 +68,12 @@ throw-expressions.js:3:33 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ throw-expressions.js:3:33 - │ - 3 │ function test(param = throw new Error('required!')) { - │ ^^^^^ + 1 │ // https://babeljs.io/docs/en/babel-plugin-proposal-throw-expressions + 2 │ + > 3 │ function test(param = throw new Error('required!')) { + │ ^^^^^ + 4 │ const test = param === true || throw new Error('Falsy!'); + 5 │ } throw-expressions.js:3:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -77,10 +81,12 @@ throw-expressions.js:3:38 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ throw-expressions.js:3:38 - │ - 3 │ function test(param = throw new Error('required!')) { - │ ^ + 1 │ // https://babeljs.io/docs/en/babel-plugin-proposal-throw-expressions + 2 │ + > 3 │ function test(param = throw new Error('required!')) { + │ ^ + 4 │ const test = param === true || throw new Error('Falsy!'); + 5 │ } throw-expressions.js:3:51 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -88,10 +94,12 @@ throw-expressions.js:3:51 parse ━━━━━━━━━━━━━━━━ × Expected a function body here - ┌─ throw-expressions.js:3:51 - │ - 3 │ function test(param = throw new Error('required!')) { - │ ^ + 1 │ // https://babeljs.io/docs/en/babel-plugin-proposal-throw-expressions + 2 │ + > 3 │ function test(param = throw new Error('required!')) { + │ ^ + 4 │ const test = param === true || throw new Error('Falsy!'); + 5 │ } throw-expressions.js:4:34 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -99,10 +107,11 @@ throw-expressions.js:4:34 parse ━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ throw-expressions.js:4:34 - │ - 4 │ const test = param === true || throw new Error('Falsy!'); - │ ^^^^^ + 3 │ function test(param = throw new Error('required!')) { + > 4 │ const test = param === true || throw new Error('Falsy!'); + │ ^^^^^ + 5 │ } + 6 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/v8intrinsic.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/v8intrinsic.js.snap index 4579e20d6f5..d051b7cbc72 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/v8intrinsic.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/v8intrinsic.js.snap @@ -99,10 +99,11 @@ v8intrinsic.js:3:1 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ v8intrinsic.js:3:1 - │ - 3 │ %DebugPrint(foo); - │ ^^^^^^^^^^^^^^^^ + 1 │ // https://github.com/babel/babel/pull/10148 + 2 │ + > 3 │ %DebugPrint(foo); + │ ^^^^^^^^^^^^^^^^ + 4 │ v8intrinsic.js:19:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -110,10 +111,12 @@ v8intrinsic.js:19:5 parse ━━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ v8intrinsic.js:19:5 - │ - 19 │ new %DebugPrint(null); - │ ^ + 17 │ // %DebugPrint?.(null) + 18 │ + > 19 │ new %DebugPrint(null); + │ ^ + 20 │ + 21 │ function *foo() { v8intrinsic.js:22:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -121,17 +124,19 @@ v8intrinsic.js:22:9 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ v8intrinsic.js:22:9 - │ - 22 │ yield %StringParseInt("42", 10) - │ ^ + 21 │ function *foo() { + > 22 │ yield %StringParseInt("42", 10) + │ ^ + 23 │ } + 24 │ i ...Which is required to end this statement - ┌─ v8intrinsic.js:22:3 - │ - 22 │ yield %StringParseInt("42", 10) - │ ^^^^^^^ + 21 │ function *foo() { + > 22 │ yield %StringParseInt("42", 10) + │ ^^^^^^^ + 23 │ } + 24 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/await.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/await.js.snap index f6ff42bc3c9..984204ddb9e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/await.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/await.js.snap @@ -47,17 +47,21 @@ await.js:3:27 parse ━━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ await.js:3:27 - │ - 3 │ return (await request)::doSyncThing(); - │ ^ + 1 │ const doBothThings = async () => { + 2 │ const request = doAsyncThing(); + > 3 │ return (await request)::doSyncThing(); + │ ^ + 4 │ }; + 5 │ i ...Which is required to end this statement - ┌─ await.js:3:5 - │ - 3 │ return (await request)::doSyncThing(); - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ const doBothThings = async () => { + 2 │ const request = doAsyncThing(); + > 3 │ return (await request)::doSyncThing(); + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ }; + 5 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/bind_parens.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/bind_parens.js.snap index 82023a563b5..74ebebb820c 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/bind_parens.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/bind_parens.js.snap @@ -231,17 +231,17 @@ bind_parens.js:1:9 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ bind_parens.js:1:9 - │ - 1 │ (a || b)::c; - │ ^ + > 1 │ (a || b)::c; + │ ^ + 2 │ a || (b::c); + 3 │ ::obj.prop; i ...Which is required to end this statement - ┌─ bind_parens.js:1:1 - │ - 1 │ (a || b)::c; - │ ^^^^^^^^^ + > 1 │ (a || b)::c; + │ ^^^^^^^^^ + 2 │ a || (b::c); + 3 │ ::obj.prop; bind_parens.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -249,10 +249,11 @@ bind_parens.js:2:8 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ bind_parens.js:2:8 - │ - 2 │ a || (b::c); - │ ^ + 1 │ (a || b)::c; + > 2 │ a || (b::c); + │ ^ + 3 │ ::obj.prop; + 4 │ (void 0)::func(); bind_parens.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -260,10 +261,12 @@ bind_parens.js:3:1 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:3:1 - │ - 3 │ ::obj.prop; - │ ^^^^^^^^^^ + 1 │ (a || b)::c; + 2 │ a || (b::c); + > 3 │ ::obj.prop; + │ ^^^^^^^^^^ + 4 │ (void 0)::func(); + 5 │ (+0)::is(-0); bind_parens.js:4:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -271,17 +274,21 @@ bind_parens.js:4:9 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ bind_parens.js:4:9 - │ - 4 │ (void 0)::func(); - │ ^ + 2 │ a || (b::c); + 3 │ ::obj.prop; + > 4 │ (void 0)::func(); + │ ^ + 5 │ (+0)::is(-0); + 6 │ a::(b.c); i ...Which is required to end this statement - ┌─ bind_parens.js:4:1 - │ - 4 │ (void 0)::func(); - │ ^^^^^^^^^ + 2 │ a || (b::c); + 3 │ ::obj.prop; + > 4 │ (void 0)::func(); + │ ^^^^^^^^^ + 5 │ (+0)::is(-0); + 6 │ a::(b.c); bind_parens.js:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -289,17 +296,21 @@ bind_parens.js:5:5 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ bind_parens.js:5:5 - │ - 5 │ (+0)::is(-0); - │ ^ + 3 │ ::obj.prop; + 4 │ (void 0)::func(); + > 5 │ (+0)::is(-0); + │ ^ + 6 │ a::(b.c); + 7 │ a::(b.c()); i ...Which is required to end this statement - ┌─ bind_parens.js:5:1 - │ - 5 │ (+0)::is(-0); - │ ^^^^^ + 3 │ ::obj.prop; + 4 │ (void 0)::func(); + > 5 │ (+0)::is(-0); + │ ^^^^^ + 6 │ a::(b.c); + 7 │ a::(b.c()); bind_parens.js:6:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -307,10 +318,12 @@ bind_parens.js:6:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:6:3 - │ - 6 │ a::(b.c); - │ ^ + 4 │ (void 0)::func(); + 5 │ (+0)::is(-0); + > 6 │ a::(b.c); + │ ^ + 7 │ a::(b.c()); + 8 │ a::b.c(); bind_parens.js:7:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -318,10 +331,12 @@ bind_parens.js:7:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:7:3 - │ - 7 │ a::(b.c()); - │ ^ + 5 │ (+0)::is(-0); + 6 │ a::(b.c); + > 7 │ a::(b.c()); + │ ^ + 8 │ a::b.c(); + 9 │ a::(b.c()()); bind_parens.js:8:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -329,10 +344,12 @@ bind_parens.js:8:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:8:3 - │ - 8 │ a::b.c(); - │ ^ + 6 │ a::(b.c); + 7 │ a::(b.c()); + > 8 │ a::b.c(); + │ ^ + 9 │ a::(b.c()()); + 10 │ a::((b.c())()); bind_parens.js:9:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -340,10 +357,12 @@ bind_parens.js:9:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:9:3 - │ - 9 │ a::(b.c()()); - │ ^ + 7 │ a::(b.c()); + 8 │ a::b.c(); + > 9 │ a::(b.c()()); + │ ^ + 10 │ a::((b.c())()); + 11 │ a::(b.c())(); bind_parens.js:10:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -351,10 +370,12 @@ bind_parens.js:10:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:10:3 - │ - 10 │ a::((b.c())()); - │ ^ + 8 │ a::b.c(); + 9 │ a::(b.c()()); + > 10 │ a::((b.c())()); + │ ^ + 11 │ a::(b.c())(); + 12 │ a::(b.c().d); bind_parens.js:11:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -362,10 +383,12 @@ bind_parens.js:11:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:11:3 - │ - 11 │ a::(b.c())(); - │ ^ + 9 │ a::(b.c()()); + 10 │ a::((b.c())()); + > 11 │ a::(b.c())(); + │ ^ + 12 │ a::(b.c().d); + 13 │ a::(c().d.e); bind_parens.js:12:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -373,10 +396,12 @@ bind_parens.js:12:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:12:3 - │ - 12 │ a::(b.c().d); - │ ^ + 10 │ a::((b.c())()); + 11 │ a::(b.c())(); + > 12 │ a::(b.c().d); + │ ^ + 13 │ a::(c().d.e); + 14 │ a::(b()); bind_parens.js:13:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -384,10 +409,12 @@ bind_parens.js:13:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:13:3 - │ - 13 │ a::(c().d.e); - │ ^ + 11 │ a::(b.c())(); + 12 │ a::(b.c().d); + > 13 │ a::(c().d.e); + │ ^ + 14 │ a::(b()); + 15 │ a::(b::c()); bind_parens.js:14:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -395,10 +422,12 @@ bind_parens.js:14:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:14:3 - │ - 14 │ a::(b()); - │ ^ + 12 │ a::(b.c().d); + 13 │ a::(c().d.e); + > 14 │ a::(b()); + │ ^ + 15 │ a::(b::c()); + 16 │ a::(b()::c); bind_parens.js:15:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -406,10 +435,12 @@ bind_parens.js:15:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:15:3 - │ - 15 │ a::(b::c()); - │ ^ + 13 │ a::(c().d.e); + 14 │ a::(b()); + > 15 │ a::(b::c()); + │ ^ + 16 │ a::(b()::c); + 17 │ a::(b().c::d); bind_parens.js:16:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -417,10 +448,12 @@ bind_parens.js:16:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:16:3 - │ - 16 │ a::(b()::c); - │ ^ + 14 │ a::(b()); + 15 │ a::(b::c()); + > 16 │ a::(b()::c); + │ ^ + 17 │ a::(b().c::d); + 18 │ a::(b.c::d); bind_parens.js:17:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -428,10 +461,12 @@ bind_parens.js:17:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:17:3 - │ - 17 │ a::(b().c::d); - │ ^ + 15 │ a::(b::c()); + 16 │ a::(b()::c); + > 17 │ a::(b().c::d); + │ ^ + 18 │ a::(b.c::d); + 19 │ a::(b::c.d); bind_parens.js:18:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -439,10 +474,12 @@ bind_parens.js:18:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:18:3 - │ - 18 │ a::(b.c::d); - │ ^ + 16 │ a::(b()::c); + 17 │ a::(b().c::d); + > 18 │ a::(b.c::d); + │ ^ + 19 │ a::(b::c.d); + 20 │ a::(b.c::d::e); bind_parens.js:19:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -450,10 +487,12 @@ bind_parens.js:19:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:19:3 - │ - 19 │ a::(b::c.d); - │ ^ + 17 │ a::(b().c::d); + 18 │ a::(b.c::d); + > 19 │ a::(b::c.d); + │ ^ + 20 │ a::(b.c::d::e); + 21 │ a::(b::c::d); bind_parens.js:20:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -461,10 +500,12 @@ bind_parens.js:20:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:20:3 - │ - 20 │ a::(b.c::d::e); - │ ^ + 18 │ a::(b.c::d); + 19 │ a::(b::c.d); + > 20 │ a::(b.c::d::e); + │ ^ + 21 │ a::(b::c::d); + 22 │ a::(b::c::d.e); bind_parens.js:21:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -472,10 +513,12 @@ bind_parens.js:21:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:21:3 - │ - 21 │ a::(b::c::d); - │ ^ + 19 │ a::(b::c.d); + 20 │ a::(b.c::d::e); + > 21 │ a::(b::c::d); + │ ^ + 22 │ a::(b::c::d.e); + 23 │ a::((b::c::d).e); bind_parens.js:22:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -483,10 +526,12 @@ bind_parens.js:22:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:22:3 - │ - 22 │ a::(b::c::d.e); - │ ^ + 20 │ a::(b.c::d::e); + 21 │ a::(b::c::d); + > 22 │ a::(b::c::d.e); + │ ^ + 23 │ a::((b::c::d).e); + 24 │ a::(void 0); bind_parens.js:23:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -494,10 +539,12 @@ bind_parens.js:23:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:23:3 - │ - 23 │ a::((b::c::d).e); - │ ^ + 21 │ a::(b::c::d); + 22 │ a::(b::c::d.e); + > 23 │ a::((b::c::d).e); + │ ^ + 24 │ a::(void 0); + 25 │ a::(b.c()::d.e); bind_parens.js:24:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -505,10 +552,12 @@ bind_parens.js:24:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:24:3 - │ - 24 │ a::(void 0); - │ ^ + 22 │ a::(b::c::d.e); + 23 │ a::((b::c::d).e); + > 24 │ a::(void 0); + │ ^ + 25 │ a::(b.c()::d.e); + 26 │ a::(b.c::d.e); bind_parens.js:25:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -516,10 +565,12 @@ bind_parens.js:25:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:25:3 - │ - 25 │ a::(b.c()::d.e); - │ ^ + 23 │ a::((b::c::d).e); + 24 │ a::(void 0); + > 25 │ a::(b.c()::d.e); + │ ^ + 26 │ a::(b.c::d.e); + 27 │ a::(b.c::d.e)::f.g; bind_parens.js:26:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -527,10 +578,12 @@ bind_parens.js:26:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:26:3 - │ - 26 │ a::(b.c::d.e); - │ ^ + 24 │ a::(void 0); + 25 │ a::(b.c()::d.e); + > 26 │ a::(b.c::d.e); + │ ^ + 27 │ a::(b.c::d.e)::f.g; + 28 │ b.c::d.e; bind_parens.js:27:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -538,10 +591,12 @@ bind_parens.js:27:3 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ bind_parens.js:27:3 - │ - 27 │ a::(b.c::d.e)::f.g; - │ ^ + 25 │ a::(b.c()::d.e); + 26 │ a::(b.c::d.e); + > 27 │ a::(b.c::d.e)::f.g; + │ ^ + 28 │ b.c::d.e; + 29 │ (b.c::d).e; bind_parens.js:28:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -549,17 +604,21 @@ bind_parens.js:28:4 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ bind_parens.js:28:4 - │ - 28 │ b.c::d.e; - │ ^ + 26 │ a::(b.c::d.e); + 27 │ a::(b.c::d.e)::f.g; + > 28 │ b.c::d.e; + │ ^ + 29 │ (b.c::d).e; + 30 │ (b::c::d).e; i ...Which is required to end this statement - ┌─ bind_parens.js:28:1 - │ - 28 │ b.c::d.e; - │ ^^^^ + 26 │ a::(b.c::d.e); + 27 │ a::(b.c::d.e)::f.g; + > 28 │ b.c::d.e; + │ ^^^^ + 29 │ (b.c::d).e; + 30 │ (b::c::d).e; bind_parens.js:29:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -567,10 +626,12 @@ bind_parens.js:29:5 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ bind_parens.js:29:5 - │ - 29 │ (b.c::d).e; - │ ^ + 27 │ a::(b.c::d.e)::f.g; + 28 │ b.c::d.e; + > 29 │ (b.c::d).e; + │ ^ + 30 │ (b::c::d).e; + 31 │ new (a::b)(); bind_parens.js:30:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -578,10 +639,12 @@ bind_parens.js:30:3 parse ━━━━━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ bind_parens.js:30:3 - │ - 30 │ (b::c::d).e; - │ ^ + 28 │ b.c::d.e; + 29 │ (b.c::d).e; + > 30 │ (b::c::d).e; + │ ^ + 31 │ new (a::b)(); + 32 │ new f(a::b); bind_parens.js:30:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -589,10 +652,12 @@ bind_parens.js:30:4 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ bind_parens.js:30:4 - │ - 30 │ (b::c::d).e; - │ ^ + 28 │ b.c::d.e; + 29 │ (b.c::d).e; + > 30 │ (b::c::d).e; + │ ^ + 31 │ new (a::b)(); + 32 │ new f(a::b); bind_parens.js:30:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -600,10 +665,12 @@ bind_parens.js:30:5 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ bind_parens.js:30:5 - │ - 30 │ (b::c::d).e; - │ ^ + 28 │ b.c::d.e; + 29 │ (b.c::d).e; + > 30 │ (b::c::d).e; + │ ^ + 31 │ new (a::b)(); + 32 │ new f(a::b); bind_parens.js:30:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -611,10 +678,12 @@ bind_parens.js:30:6 parse ━━━━━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ bind_parens.js:30:6 - │ - 30 │ (b::c::d).e; - │ ^ + 28 │ b.c::d.e; + 29 │ (b.c::d).e; + > 30 │ (b::c::d).e; + │ ^ + 31 │ new (a::b)(); + 32 │ new f(a::b); bind_parens.js:30:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -622,10 +691,12 @@ bind_parens.js:30:7 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ bind_parens.js:30:7 - │ - 30 │ (b::c::d).e; - │ ^ + 28 │ b.c::d.e; + 29 │ (b.c::d).e; + > 30 │ (b::c::d).e; + │ ^ + 31 │ new (a::b)(); + 32 │ new f(a::b); bind_parens.js:30:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -633,10 +704,12 @@ bind_parens.js:30:8 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ bind_parens.js:30:8 - │ - 30 │ (b::c::d).e; - │ ^ + 28 │ b.c::d.e; + 29 │ (b.c::d).e; + > 30 │ (b::c::d).e; + │ ^ + 31 │ new (a::b)(); + 32 │ new f(a::b); bind_parens.js:30:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -644,10 +717,12 @@ bind_parens.js:30:10 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ bind_parens.js:30:10 - │ - 30 │ (b::c::d).e; - │ ^ + 28 │ b.c::d.e; + 29 │ (b.c::d).e; + > 30 │ (b::c::d).e; + │ ^ + 31 │ new (a::b)(); + 32 │ new f(a::b); bind_parens.js:31:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -655,10 +730,12 @@ bind_parens.js:31:7 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ bind_parens.js:31:7 - │ - 31 │ new (a::b)(); - │ ^ + 29 │ (b.c::d).e; + 30 │ (b::c::d).e; + > 31 │ new (a::b)(); + │ ^ + 32 │ new f(a::b); + 33 │ f[a::b]; bind_parens.js:32:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -666,10 +743,12 @@ bind_parens.js:32:8 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ bind_parens.js:32:8 - │ - 32 │ new f(a::b); - │ ^ + 30 │ (b::c::d).e; + 31 │ new (a::b)(); + > 32 │ new f(a::b); + │ ^ + 33 │ f[a::b]; + 34 │ f[a::b()]; bind_parens.js:33:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -677,10 +756,12 @@ bind_parens.js:33:4 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ bind_parens.js:33:4 - │ - 33 │ f[a::b]; - │ ^ + 31 │ new (a::b)(); + 32 │ new f(a::b); + > 33 │ f[a::b]; + │ ^ + 34 │ f[a::b()]; + 35 │ bind_parens.js:34:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -688,10 +769,11 @@ bind_parens.js:34:4 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ bind_parens.js:34:4 - │ - 34 │ f[a::b()]; - │ ^ + 32 │ new f(a::b); + 33 │ f[a::b]; + > 34 │ f[a::b()]; + │ ^ + 35 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/long_name_method.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/long_name_method.js.snap index 418f2226213..a6b88108944 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/long_name_method.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/long_name_method.js.snap @@ -58,10 +58,12 @@ long_name_method.js:3:54 parse ━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ long_name_method.js:3:54 - │ - 3 │ this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala; - │ ^ + 1 │ class X { + 2 │ constructor() { + > 3 │ this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala; + │ ^ + 4 │ } + 5 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/method_chain.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/method_chain.js.snap index 16f95fe4e42..29f62be5c0a 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/method_chain.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/method_chain.js.snap @@ -92,16 +92,17 @@ method_chain.js:10:9 parse ━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ method_chain.js:10:9 - │ - 10 │ ┌ ::filter(data => data.someTest) - 11 │ │ ::throttle(() => - 12 │ │ interval(10) - 13 │ │ ::take(1) - 14 │ │ ::takeUntil(observable::filter(data => someOtherTest)) - 15 │ │ ) - 16 │ │ ::map(someFunction); - │ └───────────────────────────^ + 8 │ function test(observable) { + 9 │ return observable + > 10 │ ::filter(data => data.someTest) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 11 │ ::throttle(() => + ... + > 15 │ ) + > 16 │ ::map(someFunction); + │ ^^^^^^^^^^^^^^^^^^^ + 17 │ } + 18 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/short_name_method.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/short_name_method.js.snap index cbda65aa05e..954398b7f92 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/short_name_method.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/short_name_method.js.snap @@ -58,10 +58,12 @@ short_name_method.js:3:24 parse ━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ short_name_method.js:3:24 - │ - 3 │ this.shortMethod = ::this.shortMethod; - │ ^ + 1 │ class X { + 2 │ constructor() { + > 3 │ this.shortMethod = ::this.shortMethod; + │ ^ + 4 │ } + 5 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/unary.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/unary.js.snap index b3ece4217bd..23eeaccb2e5 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/unary.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/unary.js.snap @@ -95,17 +95,17 @@ unary.js:1:3 parse ━━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ unary.js:1:3 - │ - 1 │ !x::y; - │ ^ + > 1 │ !x::y; + │ ^ + 2 │ !(x::y /* foo */); + 3 │ !(/* foo */ x::y); i ...Which is required to end this statement - ┌─ unary.js:1:1 - │ - 1 │ !x::y; - │ ^^^ + > 1 │ !x::y; + │ ^^^ + 2 │ !(x::y /* foo */); + 3 │ !(/* foo */ x::y); unary.js:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -113,10 +113,11 @@ unary.js:2:4 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ unary.js:2:4 - │ - 2 │ !(x::y /* foo */); - │ ^ + 1 │ !x::y; + > 2 │ !(x::y /* foo */); + │ ^ + 3 │ !(/* foo */ x::y); + 4 │ !( unary.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -124,10 +125,12 @@ unary.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ unary.js:3:14 - │ - 3 │ !(/* foo */ x::y); - │ ^ + 1 │ !x::y; + 2 │ !(x::y /* foo */); + > 3 │ !(/* foo */ x::y); + │ ^ + 4 │ !( + 5 │ /* foo */ unary.js:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -135,10 +138,12 @@ unary.js:6:4 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ unary.js:6:4 - │ - 6 │ x::y - │ ^ + 4 │ !( + 5 │ /* foo */ + > 6 │ x::y + │ ^ + 7 │ ); + 8 │ !( unary.js:9:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -146,10 +151,12 @@ unary.js:9:4 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ unary.js:9:4 - │ - 9 │ x::y - │ ^ + 7 │ ); + 8 │ !( + > 9 │ x::y + │ ^ + 10 │ /* foo */ + 11 │ ); unary.js:13:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -157,10 +164,12 @@ unary.js:13:4 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ unary.js:13:4 - │ - 13 │ x::y // foo - │ ^ + 11 │ ); + 12 │ !( + > 13 │ x::y // foo + │ ^ + 14 │ ); + 15 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments-pipeline-own-line/pipeline_own_line.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments-pipeline-own-line/pipeline_own_line.js.snap index 39f50222760..bd4a07c4b01 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments-pipeline-own-line/pipeline_own_line.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments-pipeline-own-line/pipeline_own_line.js.snap @@ -165,10 +165,12 @@ pipeline_own_line.js:4:3 parse ━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline_own_line.js:4:3 - │ - 4 │ |> x - │ ^ + 2 │ 0 + 3 │ // Comment + > 4 │ |> x + │ ^ + 5 │ } + 6 │ pipeline_own_line.js:12:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -176,10 +178,12 @@ pipeline_own_line.js:12:2 parse ━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline_own_line.js:12:2 - │ - 12 │ |> kochabCooieGameOnOboleUnweave - │ ^ + 10 │ averredBathersBoxroomBuggyNurl + 11 │ ) // comment + > 12 │ |> kochabCooieGameOnOboleUnweave + │ ^ + 13 │ |> glimseGlyphsHazardNoopsTieTie; + 14 │ pipeline_own_line.js:13:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -187,10 +191,12 @@ pipeline_own_line.js:13:2 parse ━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline_own_line.js:13:2 - │ - 13 │ |> glimseGlyphsHazardNoopsTieTie; - │ ^ + 11 │ ) // comment + 12 │ |> kochabCooieGameOnOboleUnweave + > 13 │ |> glimseGlyphsHazardNoopsTieTie; + │ ^ + 14 │ + 15 │ bifornCringerMoshedPerplexSawder( pipeline_own_line.js:19:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -198,10 +204,12 @@ pipeline_own_line.js:19:2 parse ━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline_own_line.js:19:2 - │ - 19 │ |> foo // comment - │ ^ + 17 │ glimseGlyphsHazardNoopsTieTie + 18 │ ) + > 19 │ |> foo // comment + │ ^ + 20 │ |> kochabCooieGameOnOboleUnweave + 21 │ |> glimseGlyphsHazardNoopsTieTie; pipeline_own_line.js:20:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -209,10 +217,12 @@ pipeline_own_line.js:20:2 parse ━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline_own_line.js:20:2 - │ - 20 │ |> kochabCooieGameOnOboleUnweave - │ ^ + 18 │ ) + 19 │ |> foo // comment + > 20 │ |> kochabCooieGameOnOboleUnweave + │ ^ + 21 │ |> glimseGlyphsHazardNoopsTieTie; + 22 │ pipeline_own_line.js:21:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -220,10 +230,12 @@ pipeline_own_line.js:21:2 parse ━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline_own_line.js:21:2 - │ - 21 │ |> glimseGlyphsHazardNoopsTieTie; - │ ^ + 19 │ |> foo // comment + 20 │ |> kochabCooieGameOnOboleUnweave + > 21 │ |> glimseGlyphsHazardNoopsTieTie; + │ ^ + 22 │ + 23 │ bifornCringerMoshedPerplexSawder[ pipeline_own_line.js:28:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -231,10 +243,12 @@ pipeline_own_line.js:28:2 parse ━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline_own_line.js:28:2 - │ - 28 │ |> kochabCooieGameOnOboleUnweave - │ ^ + 26 │ averredBathersBoxroomBuggyNurl + 27 │ ] // comment + > 28 │ |> kochabCooieGameOnOboleUnweave + │ ^ + 29 │ |> glimseGlyphsHazardNoopsTieTie; + 30 │ pipeline_own_line.js:29:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -242,10 +256,12 @@ pipeline_own_line.js:29:2 parse ━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline_own_line.js:29:2 - │ - 29 │ |> glimseGlyphsHazardNoopsTieTie; - │ ^ + 27 │ ] // comment + 28 │ |> kochabCooieGameOnOboleUnweave + > 29 │ |> glimseGlyphsHazardNoopsTieTie; + │ ^ + 30 │ + 31 │ bifornCringerMoshedPerplexSawder[ pipeline_own_line.js:36:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -253,10 +269,12 @@ pipeline_own_line.js:36:2 parse ━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline_own_line.js:36:2 - │ - 36 │ |> foo // comment - │ ^ + 34 │ averredBathersBoxroomBuggyNurl + 35 │ ] + > 36 │ |> foo // comment + │ ^ + 37 │ |> kochabCooieGameOnOboleUnweave + 38 │ |> glimseGlyphsHazardNoopsTieTie; pipeline_own_line.js:37:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -264,10 +282,12 @@ pipeline_own_line.js:37:2 parse ━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline_own_line.js:37:2 - │ - 37 │ |> kochabCooieGameOnOboleUnweave - │ ^ + 35 │ ] + 36 │ |> foo // comment + > 37 │ |> kochabCooieGameOnOboleUnweave + │ ^ + 38 │ |> glimseGlyphsHazardNoopsTieTie; + 39 │ pipeline_own_line.js:38:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -275,10 +295,11 @@ pipeline_own_line.js:38:2 parse ━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ pipeline_own_line.js:38:2 - │ - 38 │ |> glimseGlyphsHazardNoopsTieTie; - │ ^ + 36 │ |> foo // comment + 37 │ |> kochabCooieGameOnOboleUnweave + > 38 │ |> glimseGlyphsHazardNoopsTieTie; + │ ^ + 39 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments/html-like/comment.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments/html-like/comment.js.snap index 40b07b39257..2ba02cbef06 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments/html-like/comment.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments/html-like/comment.js.snap @@ -41,10 +41,10 @@ comment.js:1:1 parse ━━━━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ comment.js:1:1 - │ - 1 │ comment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -52,10 +52,10 @@ comment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ comment.js:2:1 - │ - 2 │ alert(1) - │ ^^^^^^^^ + 1 │ comment.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -63,10 +63,10 @@ comment.js:3:3 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier, or a member expression here - ┌─ comment.js:3:3 - │ - 3 │ --> - │ ^ + 1 │ + │ ^ comment.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -74,10 +74,10 @@ comment.js:3:4 parse ━━━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ comment.js:3:4 - │ - 3 │ --> - │ ^ + 1 │ + │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/basic.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/basic.js.snap index ec2e9af8327..9b2ca8557a3 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/basic.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/basic.js.snap @@ -42,10 +42,11 @@ basic.js:2:3 parse ━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ basic.js:2:3 - │ - 2 │ accessor bar; - │ ^^^^^^^^ + 1 │ class Foo { + > 2 │ accessor bar; + │ ^^^^^^^^ + 3 │ } + 4 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/computed.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/computed.js.snap index 9298250e2ef..46bb9a04313 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/computed.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/computed.js.snap @@ -42,10 +42,11 @@ computed.js:2:3 parse ━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ computed.js:2:3 - │ - 2 │ accessor ["bar"]; - │ ^^^^^^^^ + 1 │ class Foo { + > 2 │ accessor ["bar"]; + │ ^^^^^^^^ + 3 │ } + 4 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/private.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/private.js.snap index 1c612079619..0c29b88d8cf 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/private.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/private.js.snap @@ -42,10 +42,11 @@ private.js:2:3 parse ━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ private.js:2:3 - │ - 2 │ accessor #bar; - │ ^^^^^^^^ + 1 │ class Foo { + > 2 │ accessor #bar; + │ ^^^^^^^^ + 3 │ } + 4 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static-computed.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static-computed.js.snap index 8f91b70731c..89966ddec65 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static-computed.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static-computed.js.snap @@ -42,10 +42,11 @@ static-computed.js:2:3 parse ━━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ static-computed.js:2:3 - │ - 2 │ static accessor ["bar"]; - │ ^^^^^^^^^^^^^^^ + 1 │ class Foo { + > 2 │ static accessor ["bar"]; + │ ^^^^^^^^^^^^^^^ + 3 │ } + 4 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static-private.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static-private.js.snap index 2116a78fe57..96a8937402b 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static-private.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static-private.js.snap @@ -42,10 +42,11 @@ static-private.js:2:3 parse ━━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ static-private.js:2:3 - │ - 2 │ static accessor #bar; - │ ^^^^^^^^^^^^^^^ + 1 │ class Foo { + > 2 │ static accessor #bar; + │ ^^^^^^^^^^^^^^^ + 3 │ } + 4 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static.js.snap index e01cfd64ddb..7ab3f18e91d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static.js.snap @@ -42,10 +42,11 @@ static.js:2:3 parse ━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ static.js:2:3 - │ - 2 │ static accessor bar; - │ ^^^^^^^^^^^^^^^ + 1 │ class Foo { + > 2 │ static accessor bar; + │ ^^^^^^^^^^^^^^^ + 3 │ } + 4 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/with-semicolon-1.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/with-semicolon-1.js.snap index fad6d9f00ef..a17604c7e08 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/with-semicolon-1.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/with-semicolon-1.js.snap @@ -45,10 +45,11 @@ with-semicolon-1.js:2:3 parse ━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ with-semicolon-1.js:2:3 - │ - 2 │ accessor clicked = "value"; - │ ^^^^^^^^ + 1 │ class C { + > 2 │ accessor clicked = "value"; + │ ^^^^^^^^ + 3 │ [foo]() {} + 4 │ } ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/with-semicolon-2.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/with-semicolon-2.js.snap index 2c16803f204..9be8ad41a20 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/with-semicolon-2.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/with-semicolon-2.js.snap @@ -45,10 +45,11 @@ with-semicolon-2.js:2:3 parse ━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ with-semicolon-2.js:2:3 - │ - 2 │ accessor clicked = "value"; - │ ^^^^^^^^ + 1 │ class C { + > 2 │ accessor clicked = "value"; + │ ^^^^^^^^ + 3 │ *foo() {} + 4 │ } ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-comments/comments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-comments/comments.js.snap index 6ddc4f6a4f8..5909c2d7757 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-comments/comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-comments/comments.js.snap @@ -49,10 +49,12 @@ comments.js:4:20 parse ━━━━━━━━━━━━━━━━━━━ × remove this type annotation - ┌─ comments.js:4:20 - │ - 4 │ static property: Array; - │ ^^^^^^^^^^^^^^^ + 2 │ @Annotateme() + 3 │ // comment + > 4 │ static property: Array; + │ ^^^^^^^^^^^^^^^ + 5 │ } + 6 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators-export/after_export.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators-export/after_export.js.snap index 631512fc11c..6dbe78b3172 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators-export/after_export.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators-export/after_export.js.snap @@ -49,10 +49,10 @@ after_export.js:1:8 parse ━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration here - ┌─ after_export.js:1:8 - │ - 1 │ export @decorator class Foo {} - │ ^ + > 1 │ export @decorator class Foo {} + │ ^ + 2 │ + 3 │ export default @decorator class {} after_export.js:3:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -60,19 +60,21 @@ after_export.js:3:16 parse ━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ after_export.js:3:16 - │ - 3 │ export default @decorator class {} - │ ^ + 1 │ export @decorator class Foo {} + 2 │ + > 3 │ export default @decorator class {} + │ ^ + 4 │ after_export.js:3:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name - ┌─ after_export.js:3:27 - │ - 3 │ export default @decorator class {} - │ ^^^^^^ + 1 │ export @decorator class Foo {} + 2 │ + > 3 │ export default @decorator class {} + │ ^^^^^^ + 4 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/arguments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/arguments.js.snap index 7f58744c637..fee3a67b7da 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/arguments.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/arguments.js.snap @@ -50,10 +50,10 @@ arguments.js:1:13 parse ━━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ arguments.js:1:13 - │ - 1 │ console.log(@deco class Foo {}) - │ ^^^^^^^^^^^^^^^^^^ + > 1 │ console.log(@deco class Foo {}) + │ ^^^^^^^^^^^^^^^^^^ + 2 │ console.log(@deco class {}) + 3 │ arguments.js:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -61,10 +61,10 @@ arguments.js:2:13 parse ━━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ arguments.js:2:13 - │ - 2 │ console.log(@deco class {}) - │ ^^^^^^^^^^^^^^ + 1 │ console.log(@deco class Foo {}) + > 2 │ console.log(@deco class {}) + │ ^^^^^^^^^^^^^^ + 3 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/class-expression.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/class-expression.js.snap index 15d30dd4542..eb6e0437fe1 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/class-expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/class-expression.js.snap @@ -122,10 +122,10 @@ class-expression.js:1:13 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ class-expression.js:1:13 - │ - 1 │ const a1 = (@deco class Foo {}); - │ ^ + > 1 │ const a1 = (@deco class Foo {}); + │ ^ + 2 │ const a2 = (@deco class {}); + 3 │ class-expression.js:1:31 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -133,10 +133,10 @@ class-expression.js:1:31 parse ━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ class-expression.js:1:31 - │ - 1 │ const a1 = (@deco class Foo {}); - │ ^ + > 1 │ const a1 = (@deco class Foo {}); + │ ^ + 2 │ const a2 = (@deco class {}); + 3 │ class-expression.js:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -144,19 +144,21 @@ class-expression.js:2:13 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ class-expression.js:2:13 - │ - 2 │ const a2 = (@deco class {}); - │ ^ + 1 │ const a1 = (@deco class Foo {}); + > 2 │ const a2 = (@deco class {}); + │ ^ + 3 │ + 4 │ (@deco class Foo {}); class-expression.js:2:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name - ┌─ class-expression.js:2:19 - │ - 2 │ const a2 = (@deco class {}); - │ ^^^^^^ + 1 │ const a1 = (@deco class Foo {}); + > 2 │ const a2 = (@deco class {}); + │ ^^^^^^ + 3 │ + 4 │ (@deco class Foo {}); class-expression.js:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -164,10 +166,11 @@ class-expression.js:2:27 parse ━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ class-expression.js:2:27 - │ - 2 │ const a2 = (@deco class {}); - │ ^ + 1 │ const a1 = (@deco class Foo {}); + > 2 │ const a2 = (@deco class {}); + │ ^ + 3 │ + 4 │ (@deco class Foo {}); class-expression.js:4:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -175,10 +178,12 @@ class-expression.js:4:2 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ class-expression.js:4:2 - │ - 4 │ (@deco class Foo {}); - │ ^ + 2 │ const a2 = (@deco class {}); + 3 │ + > 4 │ (@deco class Foo {}); + │ ^ + 5 │ (@deco class {}); + 6 │ class-expression.js:4:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -186,10 +191,12 @@ class-expression.js:4:20 parse ━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ class-expression.js:4:20 - │ - 4 │ (@deco class Foo {}); - │ ^ + 2 │ const a2 = (@deco class {}); + 3 │ + > 4 │ (@deco class Foo {}); + │ ^ + 5 │ (@deco class {}); + 6 │ class-expression.js:5:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -197,19 +204,21 @@ class-expression.js:5:2 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ class-expression.js:5:2 - │ - 5 │ (@deco class {}); - │ ^ + 4 │ (@deco class Foo {}); + > 5 │ (@deco class {}); + │ ^ + 6 │ + 7 │ const b1 = [] class-expression.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name - ┌─ class-expression.js:5:8 - │ - 5 │ (@deco class {}); - │ ^^^^^^ + 4 │ (@deco class Foo {}); + > 5 │ (@deco class {}); + │ ^^^^^^ + 6 │ + 7 │ const b1 = [] class-expression.js:5:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -217,10 +226,11 @@ class-expression.js:5:16 parse ━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ class-expression.js:5:16 - │ - 5 │ (@deco class {}); - │ ^ + 4 │ (@deco class Foo {}); + > 5 │ (@deco class {}); + │ ^ + 6 │ + 7 │ const b1 = [] class-expression.js:8:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -228,10 +238,11 @@ class-expression.js:8:3 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ class-expression.js:8:3 - │ - 8 │ ;(@deco class Foo {}) - │ ^ + 7 │ const b1 = [] + > 8 │ ;(@deco class Foo {}) + │ ^ + 9 │ + 10 │ const b2 = [] class-expression.js:8:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -239,10 +250,11 @@ class-expression.js:8:21 parse ━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ class-expression.js:8:21 - │ - 8 │ ;(@deco class Foo {}) - │ ^ + 7 │ const b1 = [] + > 8 │ ;(@deco class Foo {}) + │ ^ + 9 │ + 10 │ const b2 = [] class-expression.js:11:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -250,19 +262,21 @@ class-expression.js:11:3 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ class-expression.js:11:3 - │ - 11 │ ;(@deco class {}) - │ ^ + 10 │ const b2 = [] + > 11 │ ;(@deco class {}) + │ ^ + 12 │ + 13 │ // This is not a `ClassExpression` but `ClassDeclaration` class-expression.js:11:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name - ┌─ class-expression.js:11:9 - │ - 11 │ ;(@deco class {}) - │ ^^^^^^ + 10 │ const b2 = [] + > 11 │ ;(@deco class {}) + │ ^^^^^^ + 12 │ + 13 │ // This is not a `ClassExpression` but `ClassDeclaration` class-expression.js:11:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -270,10 +284,11 @@ class-expression.js:11:17 parse ━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ class-expression.js:11:17 - │ - 11 │ ;(@deco class {}) - │ ^ + 10 │ const b2 = [] + > 11 │ ;(@deco class {}) + │ ^ + 12 │ + 13 │ // This is not a `ClassExpression` but `ClassDeclaration` ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/member-expression.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/member-expression.js.snap index 38afe9a7ce9..dab6cf7179e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/member-expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/member-expression.js.snap @@ -54,10 +54,10 @@ member-expression.js:1:2 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ member-expression.js:1:2 - │ - 1 │ (@deco class Foo {}).name; - │ ^ + > 1 │ (@deco class Foo {}).name; + │ ^ + 2 │ (@deco class {}).name; + 3 │ member-expression.js:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -65,10 +65,10 @@ member-expression.js:1:20 parse ━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ member-expression.js:1:20 - │ - 1 │ (@deco class Foo {}).name; - │ ^^^^^^ + > 1 │ (@deco class Foo {}).name; + │ ^^^^^^ + 2 │ (@deco class {}).name; + 3 │ member-expression.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -76,19 +76,19 @@ member-expression.js:2:2 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ member-expression.js:2:2 - │ - 2 │ (@deco class {}).name; - │ ^ + 1 │ (@deco class Foo {}).name; + > 2 │ (@deco class {}).name; + │ ^ + 3 │ member-expression.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name - ┌─ member-expression.js:2:8 - │ - 2 │ (@deco class {}).name; - │ ^^^^^^ + 1 │ (@deco class Foo {}).name; + > 2 │ (@deco class {}).name; + │ ^^^^^^ + 3 │ member-expression.js:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -96,10 +96,10 @@ member-expression.js:2:16 parse ━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ member-expression.js:2:16 - │ - 2 │ (@deco class {}).name; - │ ^^^^^^ + 1 │ (@deco class Foo {}).name; + > 2 │ (@deco class {}).name; + │ ^^^^^^ + 3 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/super-class.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/super-class.js.snap index ea71499cc5b..3448b6ff84a 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/super-class.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/super-class.js.snap @@ -61,19 +61,19 @@ super-class.js:1:20 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ super-class.js:1:20 - │ - 1 │ class Foo extends (@deco class Foo {}){} - │ ^ + > 1 │ class Foo extends (@deco class Foo {}){} + │ ^ + 2 │ + 3 │ class Foo extends (@deco class {}){} super-class.js:1:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ super-class.js:1:32 - │ - 1 │ class Foo extends (@deco class Foo {}){} - │ ^^^ + > 1 │ class Foo extends (@deco class Foo {}){} + │ ^^^ + 2 │ + 3 │ class Foo extends (@deco class {}){} super-class.js:1:36 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -81,10 +81,10 @@ super-class.js:1:36 parse ━━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, a private field name, or a computed name here - ┌─ super-class.js:1:36 - │ - 1 │ class Foo extends (@deco class Foo {}){} - │ ^ + > 1 │ class Foo extends (@deco class Foo {}){} + │ ^ + 2 │ + 3 │ class Foo extends (@deco class {}){} super-class.js:1:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -92,10 +92,10 @@ super-class.js:1:38 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ super-class.js:1:38 - │ - 1 │ class Foo extends (@deco class Foo {}){} - │ ^ + > 1 │ class Foo extends (@deco class Foo {}){} + │ ^ + 2 │ + 3 │ class Foo extends (@deco class {}){} super-class.js:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -103,10 +103,11 @@ super-class.js:3:20 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ super-class.js:3:20 - │ - 3 │ class Foo extends (@deco class {}){} - │ ^ + 1 │ class Foo extends (@deco class Foo {}){} + 2 │ + > 3 │ class Foo extends (@deco class {}){} + │ ^ + 4 │ super-class.js:3:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -114,10 +115,11 @@ super-class.js:3:32 parse ━━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, a private field name, or a computed name here - ┌─ super-class.js:3:32 - │ - 3 │ class Foo extends (@deco class {}){} - │ ^ + 1 │ class Foo extends (@deco class Foo {}){} + 2 │ + > 3 │ class Foo extends (@deco class {}){} + │ ^ + 4 │ super-class.js:3:34 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -125,10 +127,11 @@ super-class.js:3:34 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ super-class.js:3:34 - │ - 3 │ class Foo extends (@deco class {}){} - │ ^ + 1 │ class Foo extends (@deco class Foo {}){} + 2 │ + > 3 │ class Foo extends (@deco class {}){} + │ ^ + 4 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/classes.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/classes.js.snap index 7260b42d76d..336c25c726b 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/classes.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/classes.js.snap @@ -97,19 +97,23 @@ classes.js:7:13 parse ━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ classes.js:7:13 - │ - 7 │ const foo = @deco class { - │ ^ + 5 │ @deco export default class Baz {} + 6 │ + > 7 │ const foo = @deco class { + │ ^ + 8 │ // + 9 │ }; classes.js:7:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name - ┌─ classes.js:7:19 - │ - 7 │ const foo = @deco class { - │ ^^^^^^ + 5 │ @deco export default class Baz {} + 6 │ + > 7 │ const foo = @deco class { + │ ^^^^^^ + 8 │ // + 9 │ }; classes.js:12:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -117,19 +121,22 @@ classes.js:12:3 parse ━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ classes.js:12:3 - │ - 12 │ @deco - │ ^ + 11 │ const bar = + > 12 │ @deco + │ ^ + 13 │ class { + 14 │ // classes.js:13:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name - ┌─ classes.js:13:3 - │ - 13 │ class { - │ ^^^^^^ + 11 │ const bar = + 12 │ @deco + > 13 │ class { + │ ^^^^^^ + 14 │ // + 15 │ }; ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/mobx.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/mobx.js.snap index f0fda0c096e..3faa381747e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/mobx.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/mobx.js.snap @@ -140,10 +140,11 @@ mobx.js:4:20 parse ━━━━━━━━━━━━━━━━━━━━ × remove this type annotation - ┌─ mobx.js:4:20 - │ - 4 │ @observable price:number = 0; - │ ^^^^^^^ + 3 │ @observer class OrderLine { + > 4 │ @observable price:number = 0; + │ ^^^^^^^ + 5 │ @observable amount:number = 1; + 6 │ mobx.js:5:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -151,10 +152,12 @@ mobx.js:5:21 parse ━━━━━━━━━━━━━━━━━━━━ × remove this type annotation - ┌─ mobx.js:5:21 - │ - 5 │ @observable amount:number = 1; - │ ^^^^^^^ + 3 │ @observer class OrderLine { + 4 │ @observable price:number = 0; + > 5 │ @observable amount:number = 1; + │ ^^^^^^^ + 6 │ + 7 │ constructor(price) { mobx.js:33:34 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -162,10 +165,12 @@ mobx.js:33:34 parse ━━━━━━━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ mobx.js:33:34 - │ - 33 │ @action handleDecrease = (event: React.ChangeEvent) => this.count--; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 31 │ } + 32 │ + > 33 │ @action handleDecrease = (event: React.ChangeEvent) => this.count--; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 34 │ + 35 │ @action handleSomething = (event: React.ChangeEvent) => doSomething(); mobx.js:35:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -173,10 +178,12 @@ mobx.js:35:35 parse ━━━━━━━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ mobx.js:35:35 - │ - 35 │ @action handleSomething = (event: React.ChangeEvent) => doSomething(); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 33 │ @action handleDecrease = (event: React.ChangeEvent) => this.count--; + 34 │ + > 35 │ @action handleSomething = (event: React.ChangeEvent) => doSomething(); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 36 │ } + 37 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/multiple.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/multiple.js.snap index a29532be21e..d0f044e9991 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/multiple.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/multiple.js.snap @@ -86,10 +86,11 @@ multiple.js:2:3 parse ━━━━━━━━━━━━━━━━━━━ × Expected a property, a shorthand property, a getter, a setter, or a method here - ┌─ multiple.js:2:3 - │ - 2 │ @readonly - │ ^ + 1 │ const dog = { + > 2 │ @readonly + │ ^ + 3 │ @nonenumerable + 4 │ @doubledValue multiple.js:7:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -97,10 +98,12 @@ multiple.js:7:3 parse ━━━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ multiple.js:7:3 - │ - 7 │ @readonly - │ ^ + 5 │ legs: 4, + 6 │ + > 7 │ @readonly + │ ^ + 8 │ @nonenumerable + 9 │ @doubledValue multiple.js:11:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -108,10 +111,12 @@ multiple.js:11:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ multiple.js:11:1 - │ - 11 │ }; - │ ^ + 9 │ @doubledValue + 10 │ eyes: 2 + > 11 │ }; + │ ^ + 12 │ + 13 │ const foo = { multiple.js:14:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -119,10 +124,11 @@ multiple.js:14:3 parse ━━━━━━━━━━━━━━━━━━━ × Expected a property, a shorthand property, a getter, a setter, or a method here - ┌─ multiple.js:14:3 - │ - 14 │ @multipleDecorators @inline @theyWontAllFitInOneline aVeryLongPropName: "A very long string as value" - │ ^ + 13 │ const foo = { + > 14 │ @multipleDecorators @inline @theyWontAllFitInOneline aVeryLongPropName: "A very long string as value" + │ ^ + 15 │ }; + 16 │ multiple.js:15:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -130,10 +136,11 @@ multiple.js:15:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ multiple.js:15:1 - │ - 15 │ }; - │ ^ + 13 │ const foo = { + 14 │ @multipleDecorators @inline @theyWontAllFitInOneline aVeryLongPropName: "A very long string as value" + > 15 │ }; + │ ^ + 16 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/arrow-params.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/arrow-params.js.snap index e95d6b972ee..3f25bd3207c 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/arrow-params.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/arrow-params.js.snap @@ -49,10 +49,12 @@ arrow-params.js:3:11 parse ━━━━━━━━━━━━━━━━━ × Expected a property, a shorthand property, a getter, a setter, or a method here - ┌─ arrow-params.js:3:11 - │ - 3 │ #p = ({ #x: x }) => {} - │ ^^ + 1 │ class C { + 2 │ #x = 1; + > 3 │ #p = ({ #x: x }) => {} + │ ^^ + 4 │ } + 5 │ arrow-params.js:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -60,19 +62,23 @@ arrow-params.js:3:13 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ arrow-params.js:3:13 - │ - 3 │ #p = ({ #x: x }) => {} - │ ^ + 1 │ class C { + 2 │ #x = 1; + > 3 │ #p = ({ #x: x }) => {} + │ ^ + 4 │ } + 5 │ arrow-params.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ arrow-params.js:3:3 - │ - 3 │ #p = ({ #x: x }) => {} - │ ^^^^^^^^^^^^^^^^ + 1 │ class C { + 2 │ #x = 1; + > 3 │ #p = ({ #x: x }) => {} + │ ^^^^^^^^^^^^^^^^ + 4 │ } + 5 │ arrow-params.js:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -80,10 +86,12 @@ arrow-params.js:3:20 parse ━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, a private field name, or a computed name here - ┌─ arrow-params.js:3:20 - │ - 3 │ #p = ({ #x: x }) => {} - │ ^^ + 1 │ class C { + 2 │ #x = 1; + > 3 │ #p = ({ #x: x }) => {} + │ ^^ + 4 │ } + 5 │ arrow-params.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -91,10 +99,11 @@ arrow-params.js:4:1 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ arrow-params.js:4:1 - │ - 4 │ } - │ ^ + 2 │ #x = 1; + 3 │ #p = ({ #x: x }) => {} + > 4 │ } + │ ^ + 5 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/async-arrow-params.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/async-arrow-params.js.snap index 5cc30a74f87..ce884e59640 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/async-arrow-params.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/async-arrow-params.js.snap @@ -49,10 +49,12 @@ async-arrow-params.js:3:17 parse ━━━━━━━━━━━━━━━ × Expected a property, a shorthand property, a getter, a setter, or a method here - ┌─ async-arrow-params.js:3:17 - │ - 3 │ #p = async ({ #x: x }) => {} - │ ^^ + 1 │ class C { + 2 │ #x = 1; + > 3 │ #p = async ({ #x: x }) => {} + │ ^^ + 4 │ } + 5 │ async-arrow-params.js:3:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -60,19 +62,23 @@ async-arrow-params.js:3:19 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ async-arrow-params.js:3:19 - │ - 3 │ #p = async ({ #x: x }) => {} - │ ^ + 1 │ class C { + 2 │ #x = 1; + > 3 │ #p = async ({ #x: x }) => {} + │ ^ + 4 │ } + 5 │ async-arrow-params.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ async-arrow-params.js:3:3 - │ - 3 │ #p = async ({ #x: x }) => {} - │ ^^^^^^^^^^^^^^^^^^^^^^ + 1 │ class C { + 2 │ #x = 1; + > 3 │ #p = async ({ #x: x }) => {} + │ ^^^^^^^^^^^^^^^^^^^^^^ + 4 │ } + 5 │ async-arrow-params.js:3:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -80,10 +86,12 @@ async-arrow-params.js:3:26 parse ━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, a private field name, or a computed name here - ┌─ async-arrow-params.js:3:26 - │ - 3 │ #p = async ({ #x: x }) => {} - │ ^^ + 1 │ class C { + 2 │ #x = 1; + > 3 │ #p = async ({ #x: x }) => {} + │ ^^ + 4 │ } + 5 │ async-arrow-params.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -91,10 +99,11 @@ async-arrow-params.js:4:1 parse ━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ async-arrow-params.js:4:1 - │ - 4 │ } - │ ^ + 2 │ #x = 1; + 3 │ #p = async ({ #x: x }) => {} + > 4 │ } + │ ^ + 5 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/nested-bindings.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/nested-bindings.js.snap index 361cfe54c51..85f97309d05 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/nested-bindings.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/nested-bindings.js.snap @@ -57,10 +57,12 @@ nested-bindings.js:4:17 parse ━━━━━━━━━━━━━━━━ × Expected an identifier, a member name, or a rest pattern here - ┌─ nested-bindings.js:4:17 - │ - 4 │ const {x: { #x: [x] }, y: [...{ #x: y }]} = this; - │ ^^^^^^^ + 2 │ #x = 1; + 3 │ m() { + > 4 │ const {x: { #x: [x] }, y: [...{ #x: y }]} = this; + │ ^^^^^^^ + 5 │ } + 6 │ } nested-bindings.js:4:37 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -68,10 +70,12 @@ nested-bindings.js:4:37 parse ━━━━━━━━━━━━━━━━ × Expected an identifier, a member name, or a rest pattern here - ┌─ nested-bindings.js:4:37 - │ - 4 │ const {x: { #x: [x] }, y: [...{ #x: y }]} = this; - │ ^^^^^ + 2 │ #x = 1; + 3 │ m() { + > 4 │ const {x: { #x: [x] }, y: [...{ #x: y }]} = this; + │ ^^^^^ + 5 │ } + 6 │ } ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/valid-multiple-bindings.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/valid-multiple-bindings.js.snap index 7e103fb1537..c359e2118a4 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/valid-multiple-bindings.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/valid-multiple-bindings.js.snap @@ -51,10 +51,12 @@ valid-multiple-bindings.js:4:12 parse ━━━━━━━━━━━━━━ × Expected an identifier, a member name, or a rest pattern here - ┌─ valid-multiple-bindings.js:4:12 - │ - 4 │ const {#x: x1, #x: x2 = x1 } = this; - │ ^^^^^^ + 2 │ #x = 1; + 3 │ m() { + > 4 │ const {#x: x1, #x: x2 = x1 } = this; + │ ^^^^^^ + 5 │ } + 6 │ } valid-multiple-bindings.js:4:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -62,10 +64,12 @@ valid-multiple-bindings.js:4:20 parse ━━━━━━━━━━━━━━ × Expected an identifier, a member name, or a rest pattern here - ┌─ valid-multiple-bindings.js:4:20 - │ - 4 │ const {#x: x1, #x: x2 = x1 } = this; - │ ^^^^^^ + 2 │ #x = 1; + 3 │ m() { + > 4 │ const {#x: x1, #x: x2 = x1 } = this; + │ ^^^^^^ + 5 │ } + 6 │ } valid-multiple-bindings.js:4:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -73,10 +77,12 @@ valid-multiple-bindings.js:4:27 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ valid-multiple-bindings.js:4:27 - │ - 4 │ const {#x: x1, #x: x2 = x1 } = this; - │ ^ + 2 │ #x = 1; + 3 │ m() { + > 4 │ const {#x: x1, #x: x2 = x1 } = this; + │ ^ + 5 │ } + 6 │ } ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/do/call-arguments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/do/call-arguments.js.snap index 802aeecbb48..4378414c9cc 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/do/call-arguments.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/do/call-arguments.js.snap @@ -176,10 +176,12 @@ call-arguments.js:3:3 parse ━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ call-arguments.js:3:3 - │ - 3 │ do { - │ ^^ + 1 │ // from https://github.com/babel/babel/pull/13122/ + 2 │ expect( + > 3 │ do { + │ ^^ + 4 │ var bar = "foo"; + 5 │ if (!bar) throw new Error( call-arguments.js:10:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -187,10 +189,12 @@ call-arguments.js:10:1 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ call-arguments.js:10:1 - │ - 10 │ ).toBe("foo"); - │ ^ + 8 │ bar; + 9 │ } + > 10 │ ).toBe("foo"); + │ ^ + 11 │ expect(bar).toBe("foo"); + 12 │ call-arguments.js:10:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -198,10 +202,12 @@ call-arguments.js:10:2 parse ━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ call-arguments.js:10:2 - │ - 10 │ ).toBe("foo"); - │ ^^^^^^^^^^^^ + 8 │ bar; + 9 │ } + > 10 │ ).toBe("foo"); + │ ^^^^^^^^^^^^ + 11 │ expect(bar).toBe("foo"); + 12 │ call-arguments.js:13:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -209,10 +215,12 @@ call-arguments.js:13:9 parse ━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ call-arguments.js:13:9 - │ - 13 │ var x = do { - │ ^^ + 11 │ expect(bar).toBe("foo"); + 12 │ + > 13 │ var x = do { + │ ^^ + 14 │ var bar = "foo"; + 15 │ if (!bar) throw new Error( call-arguments.js:19:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -220,10 +228,12 @@ call-arguments.js:19:2 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ call-arguments.js:19:2 - │ - 19 │ }; - │ ^ + 17 │ ) + 18 │ bar; + > 19 │ }; + │ ^ + 20 │ + 21 │ expect( call-arguments.js:22:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -231,10 +241,11 @@ call-arguments.js:22:3 parse ━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ call-arguments.js:22:3 - │ - 22 │ do { - │ ^^ + 21 │ expect( + > 22 │ do { + │ ^^ + 23 │ var bar = "foo"; + 24 │ bar; call-arguments.js:26:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -242,10 +253,12 @@ call-arguments.js:26:1 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ call-arguments.js:26:1 - │ - 26 │ ).toBe("foo"); - │ ^ + 24 │ bar; + 25 │ } + > 26 │ ).toBe("foo"); + │ ^ + 27 │ expect(bar).toBe("foo"); + 28 │ call-arguments.js:26:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -253,10 +266,12 @@ call-arguments.js:26:2 parse ━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ call-arguments.js:26:2 - │ - 26 │ ).toBe("foo"); - │ ^^^^^^^^^^^^ + 24 │ bar; + 25 │ } + > 26 │ ).toBe("foo"); + │ ^^^^^^^^^^^^ + 27 │ expect(bar).toBe("foo"); + 28 │ call-arguments.js:29:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -264,10 +279,12 @@ call-arguments.js:29:9 parse ━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ call-arguments.js:29:9 - │ - 29 │ var x = do { - │ ^^ + 27 │ expect(bar).toBe("foo"); + 28 │ + > 29 │ var x = do { + │ ^^ + 30 │ var bar = "foo"; + 31 │ bar; call-arguments.js:32:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -275,10 +292,12 @@ call-arguments.js:32:2 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ call-arguments.js:32:2 - │ - 32 │ }; - │ ^ + 30 │ var bar = "foo"; + 31 │ bar; + > 32 │ }; + │ ^ + 33 │ + 34 │ expect( call-arguments.js:35:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -286,10 +305,11 @@ call-arguments.js:35:9 parse ━━━━━━━━━━━━━━━━━ × Expected a function body, or an expression here - ┌─ call-arguments.js:35:9 - │ - 35 │ () => do { - │ ^^ + 34 │ expect( + > 35 │ () => do { + │ ^^ + 36 │ () => { + 37 │ var bar = "foo"; call-arguments.js:36:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -297,10 +317,12 @@ call-arguments.js:36:5 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ call-arguments.js:36:5 - │ - 36 │ () => { - │ ^ + 34 │ expect( + 35 │ () => do { + > 36 │ () => { + │ ^ + 37 │ var bar = "foo"; + 38 │ }; call-arguments.js:38:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -308,10 +330,12 @@ call-arguments.js:38:6 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ call-arguments.js:38:6 - │ - 38 │ }; - │ ^ + 36 │ () => { + 37 │ var bar = "foo"; + > 38 │ }; + │ ^ + 39 │ bar; + 40 │ } call-arguments.js:40:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -320,11 +344,13 @@ call-arguments.js:40:3 parse ━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ call-arguments.js:40:3 - │ - 40 │ ┌ } - 41 │ │ ).toThrow(ReferenceError); - │ └─────────────────────────^ + 38 │ }; + 39 │ bar; + > 40 │ } + │ ^ + > 41 │ ).toThrow(ReferenceError); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 42 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/do/do.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/do/do.js.snap index d14405274b5..d9655f969a0 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/do/do.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/do/do.js.snap @@ -242,10 +242,12 @@ do.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ do.js:3:5 - │ - 3 │ do { - │ ^^ + 1 │ const envSpecific = { + 2 │ domain: + > 3 │ do { + │ ^^ + 4 │ if(env === 'production') 'https://abc.mno.com/'; + 5 │ else if(env === 'development') 'http://localhost:4000'; do.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -253,10 +255,12 @@ do.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:3:8 - │ - 3 │ do { - │ ^ + 1 │ const envSpecific = { + 2 │ domain: + > 3 │ do { + │ ^ + 4 │ if(env === 'production') 'https://abc.mno.com/'; + 5 │ else if(env === 'development') 'http://localhost:4000'; do.js:4:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -264,10 +268,12 @@ do.js:4:14 parse ━━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:4:14 - │ - 4 │ if(env === 'production') 'https://abc.mno.com/'; - │ ^^^ + 2 │ domain: + 3 │ do { + > 4 │ if(env === 'production') 'https://abc.mno.com/'; + │ ^^^ + 5 │ else if(env === 'development') 'http://localhost:4000'; + 6 │ } do.js:4:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -275,10 +281,12 @@ do.js:4:32 parse ━━━━━━━━━━━━━━━━━━━━━ × Expected a function body here - ┌─ do.js:4:32 - │ - 4 │ if(env === 'production') 'https://abc.mno.com/'; - │ ^^^^^^^^^^^^^^^^^^^^^^ + 2 │ domain: + 3 │ do { + > 4 │ if(env === 'production') 'https://abc.mno.com/'; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 5 │ else if(env === 'development') 'http://localhost:4000'; + 6 │ } do.js:4:54 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -286,10 +294,12 @@ do.js:4:54 parse ━━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:4:54 - │ - 4 │ if(env === 'production') 'https://abc.mno.com/'; - │ ^ + 2 │ domain: + 3 │ do { + > 4 │ if(env === 'production') 'https://abc.mno.com/'; + │ ^ + 5 │ else if(env === 'development') 'http://localhost:4000'; + 6 │ } do.js:5:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -297,10 +307,12 @@ do.js:5:7 parse ━━━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ do.js:5:7 - │ - 5 │ else if(env === 'development') 'http://localhost:4000'; - │ ^^^^ + 3 │ do { + 4 │ if(env === 'production') 'https://abc.mno.com/'; + > 5 │ else if(env === 'development') 'http://localhost:4000'; + │ ^^^^ + 6 │ } + 7 │ }; do.js:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -309,11 +321,14 @@ do.js:6:5 parse ━━━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ do.js:6:5 - │ - 6 │ ┌ } - 7 │ │ }; - │ └─^ + 4 │ if(env === 'production') 'https://abc.mno.com/'; + 5 │ else if(env === 'development') 'http://localhost:4000'; + > 6 │ } + │ ^ + > 7 │ }; + │ ^ + 8 │ + 9 │ let x = do { do.js:9:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -321,10 +336,12 @@ do.js:9:9 parse ━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ do.js:9:9 - │ - 9 │ let x = do { - │ ^^ + 7 │ }; + 8 │ + > 9 │ let x = do { + │ ^^ + 10 │ let tmp = f(); + 11 │ tmp * tmp + 1 do.js:12:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -332,10 +349,12 @@ do.js:12:2 parse ━━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:12:2 - │ - 12 │ }; - │ ^ + 10 │ let tmp = f(); + 11 │ tmp * tmp + 1 + > 12 │ }; + │ ^ + 13 │ + 14 │ let y = do { do.js:14:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -343,10 +362,12 @@ do.js:14:9 parse ━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ do.js:14:9 - │ - 14 │ let y = do { - │ ^^ + 12 │ }; + 13 │ + > 14 │ let y = do { + │ ^^ + 15 │ if (foo()) { f() } + 16 │ else if (bar()) { g() } do.js:18:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -354,10 +375,12 @@ do.js:18:2 parse ━━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:18:2 - │ - 18 │ }; - │ ^ + 16 │ else if (bar()) { g() } + 17 │ else { h() } + > 18 │ }; + │ ^ + 19 │ + 20 │ function foo() { do.js:25:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -365,10 +388,12 @@ do.js:25:9 parse ━━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:25:9 - │ - 25 │ do { - │ ^^ + 23 │ + 24 │ { + > 25 │ do { + │ ^^ + 26 │ if (loggedIn) { + 27 │ do.js:26:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -376,10 +401,12 @@ do.js:26:11 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:26:11 - │ - 26 │ if (loggedIn) { - │ ^^ + 24 │ { + 25 │ do { + > 26 │ if (loggedIn) { + │ ^^ + 27 │ + 28 │ } else { do.js:37:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -387,10 +414,12 @@ do.js:37:2 parse ━━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:37:2 - │ - 37 │ (do {}); - │ ^^ + 35 │ } + 36 │ + > 37 │ (do {}); + │ ^^ + 38 │ (do {} + 1); + 39 │ (1 + do {}); do.js:37:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -398,10 +427,12 @@ do.js:37:7 parse ━━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:37:7 - │ - 37 │ (do {}); - │ ^ + 35 │ } + 36 │ + > 37 │ (do {}); + │ ^ + 38 │ (do {} + 1); + 39 │ (1 + do {}); do.js:38:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -409,10 +440,11 @@ do.js:38:2 parse ━━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:38:2 - │ - 38 │ (do {} + 1); - │ ^^ + 37 │ (do {}); + > 38 │ (do {} + 1); + │ ^^ + 39 │ (1 + do {}); + 40 │ () => do {}; do.js:38:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -420,10 +452,11 @@ do.js:38:8 parse ━━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:38:8 - │ - 38 │ (do {} + 1); - │ ^ + 37 │ (do {}); + > 38 │ (do {} + 1); + │ ^ + 39 │ (1 + do {}); + 40 │ () => do {}; do.js:39:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -431,10 +464,12 @@ do.js:39:6 parse ━━━━━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ do.js:39:6 - │ - 39 │ (1 + do {}); - │ ^^ + 37 │ (do {}); + 38 │ (do {} + 1); + > 39 │ (1 + do {}); + │ ^^ + 40 │ () => do {}; + 41 │ do.js:39:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -442,10 +477,12 @@ do.js:39:11 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:39:11 - │ - 39 │ (1 + do {}); - │ ^ + 37 │ (do {}); + 38 │ (do {} + 1); + > 39 │ (1 + do {}); + │ ^ + 40 │ () => do {}; + 41 │ do.js:40:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -453,10 +490,12 @@ do.js:40:7 parse ━━━━━━━━━━━━━━━━━━━━━ × Expected a function body, or an expression here - ┌─ do.js:40:7 - │ - 40 │ () => do {}; - │ ^^ + 38 │ (do {} + 1); + 39 │ (1 + do {}); + > 40 │ () => do {}; + │ ^^ + 41 │ + 42 │ (do { do.js:40:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -464,10 +503,12 @@ do.js:40:12 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:40:12 - │ - 40 │ () => do {}; - │ ^ + 38 │ (do {} + 1); + 39 │ (1 + do {}); + > 40 │ () => do {}; + │ ^ + 41 │ + 42 │ (do { do.js:42:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -475,10 +516,12 @@ do.js:42:2 parse ━━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:42:2 - │ - 42 │ (do { - │ ^^ + 40 │ () => do {}; + 41 │ + > 42 │ (do { + │ ^^ + 43 │ switch(0) { + 44 │ case 0: "foo"; do.js:47:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -486,10 +529,12 @@ do.js:47:2 parse ━━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:47:2 - │ - 47 │ }); - │ ^ + 45 │ case 1: break; + 46 │ } + > 47 │ }); + │ ^ + 48 │ + 49 │ () => do { do.js:49:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -497,10 +542,12 @@ do.js:49:7 parse ━━━━━━━━━━━━━━━━━━━━━ × Expected a function body, or an expression here - ┌─ do.js:49:7 - │ - 49 │ () => do { - │ ^^ + 47 │ }); + 48 │ + > 49 │ () => do { + │ ^^ + 50 │ var obj = { foo: "bar", bar: "foo" }; + 51 │ for (var key in obj) { do.js:54:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -508,28 +555,33 @@ do.js:54:2 parse ━━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:54:2 - │ - 54 │ }; - │ ^ + 52 │ obj[key]; + 53 │ } + > 54 │ }; + │ ^ + 55 │ do.js:31:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Unexpected token. Did you mean `{'}'}` or `}`? - ┌─ do.js:31:9 - │ - 31 │ } - │ ^ + 29 │ + 30 │ } + > 31 │ } + │ ^ + 32 │ } + 33 │ do.js:32:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Unexpected token. Did you mean `{'}'}` or `}`? - ┌─ do.js:32:7 - │ - 32 │ } - │ ^ + 30 │ } + 31 │ } + > 32 │ } + │ ^ + 33 │ + 34 │ ); ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/export-default/escaped/default-escaped.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/export-default/escaped/default-escaped.js.snap index d243892a482..78c7c9ee208 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/export-default/escaped/default-escaped.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/export-default/escaped/default-escaped.js.snap @@ -44,10 +44,9 @@ default-escaped.js:2:8 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ default-escaped.js:2:8 - │ - 2 │ export n\u{63} from "async"; - │ ^^^^^^^ + 1 │ // export asyn\u{63} from "async"; + > 2 │ export n\u{63} from "async"; + │ ^^^^^^^ default-escaped.js:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -55,17 +54,15 @@ default-escaped.js:2:16 parse ━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ default-escaped.js:2:16 - │ - 2 │ export n\u{63} from "async"; - │ ^^^^ + 1 │ // export asyn\u{63} from "async"; + > 2 │ export n\u{63} from "async"; + │ ^^^^ i ...Which is required to end this statement - ┌─ default-escaped.js:2:8 - │ - 2 │ export n\u{63} from "async"; - │ ^^^^^^^^^^^^ + 1 │ // export asyn\u{63} from "async"; + > 2 │ export n\u{63} from "async"; + │ ^^^^^^^^^^^^ default-escaped.js:2:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -73,17 +70,15 @@ default-escaped.js:2:21 parse ━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ default-escaped.js:2:21 - │ - 2 │ export n\u{63} from "async"; - │ ^^^^^^^ + 1 │ // export asyn\u{63} from "async"; + > 2 │ export n\u{63} from "async"; + │ ^^^^^^^ i ...Which is required to end this statement - ┌─ default-escaped.js:2:16 - │ - 2 │ export n\u{63} from "async"; - │ ^^^^^^^^^^^^ + 1 │ // export asyn\u{63} from "async"; + > 2 │ export n\u{63} from "async"; + │ ^^^^^^^^^^^^ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/export-extension/export.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/export-extension/export.js.snap index 2e416ca91a3..b184cd09c25 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/export-extension/export.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/export-extension/export.js.snap @@ -111,10 +111,11 @@ export.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ export.js:2:8 - │ - 2 │ export v from 'mod'; - │ ^ + 1 │ export * as ns from 'mod'; + > 2 │ export v from 'mod'; + │ ^ + 3 │ export a, * as b from 'mod'; + 4 │ export c, { foo } from 'mod'; export.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -122,17 +123,19 @@ export.js:2:10 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ export.js:2:10 - │ - 2 │ export v from 'mod'; - │ ^^^^ + 1 │ export * as ns from 'mod'; + > 2 │ export v from 'mod'; + │ ^^^^ + 3 │ export a, * as b from 'mod'; + 4 │ export c, { foo } from 'mod'; i ...Which is required to end this statement - ┌─ export.js:2:8 - │ - 2 │ export v from 'mod'; - │ ^^^^^^ + 1 │ export * as ns from 'mod'; + > 2 │ export v from 'mod'; + │ ^^^^^^ + 3 │ export a, * as b from 'mod'; + 4 │ export c, { foo } from 'mod'; export.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -140,17 +143,19 @@ export.js:2:15 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ export.js:2:15 - │ - 2 │ export v from 'mod'; - │ ^^^^^ + 1 │ export * as ns from 'mod'; + > 2 │ export v from 'mod'; + │ ^^^^^ + 3 │ export a, * as b from 'mod'; + 4 │ export c, { foo } from 'mod'; i ...Which is required to end this statement - ┌─ export.js:2:10 - │ - 2 │ export v from 'mod'; - │ ^^^^^^^^^^ + 1 │ export * as ns from 'mod'; + > 2 │ export v from 'mod'; + │ ^^^^^^^^^^ + 3 │ export a, * as b from 'mod'; + 4 │ export c, { foo } from 'mod'; export.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -158,10 +163,12 @@ export.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration here - ┌─ export.js:3:8 - │ - 3 │ export a, * as b from 'mod'; - │ ^ + 1 │ export * as ns from 'mod'; + 2 │ export v from 'mod'; + > 3 │ export a, * as b from 'mod'; + │ ^ + 4 │ export c, { foo } from 'mod'; + 5 │ export * as d, { bar } from 'mod'; export.js:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -169,10 +176,12 @@ export.js:3:11 parse ━━━━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ export.js:3:11 - │ - 3 │ export a, * as b from 'mod'; - │ ^ + 1 │ export * as ns from 'mod'; + 2 │ export v from 'mod'; + > 3 │ export a, * as b from 'mod'; + │ ^ + 4 │ export c, { foo } from 'mod'; + 5 │ export * as d, { bar } from 'mod'; export.js:3:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -180,17 +189,21 @@ export.js:3:16 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ export.js:3:16 - │ - 3 │ export a, * as b from 'mod'; - │ ^ + 1 │ export * as ns from 'mod'; + 2 │ export v from 'mod'; + > 3 │ export a, * as b from 'mod'; + │ ^ + 4 │ export c, { foo } from 'mod'; + 5 │ export * as d, { bar } from 'mod'; i ...Which is required to end this statement - ┌─ export.js:3:8 - │ - 3 │ export a, * as b from 'mod'; - │ ^^^^^^^^^ + 1 │ export * as ns from 'mod'; + 2 │ export v from 'mod'; + > 3 │ export a, * as b from 'mod'; + │ ^^^^^^^^^ + 4 │ export c, { foo } from 'mod'; + 5 │ export * as d, { bar } from 'mod'; export.js:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -198,17 +211,21 @@ export.js:3:18 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ export.js:3:18 - │ - 3 │ export a, * as b from 'mod'; - │ ^^^^ + 1 │ export * as ns from 'mod'; + 2 │ export v from 'mod'; + > 3 │ export a, * as b from 'mod'; + │ ^^^^ + 4 │ export c, { foo } from 'mod'; + 5 │ export * as d, { bar } from 'mod'; i ...Which is required to end this statement - ┌─ export.js:3:16 - │ - 3 │ export a, * as b from 'mod'; - │ ^^^^^^ + 1 │ export * as ns from 'mod'; + 2 │ export v from 'mod'; + > 3 │ export a, * as b from 'mod'; + │ ^^^^^^ + 4 │ export c, { foo } from 'mod'; + 5 │ export * as d, { bar } from 'mod'; export.js:3:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -216,17 +233,21 @@ export.js:3:23 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ export.js:3:23 - │ - 3 │ export a, * as b from 'mod'; - │ ^^^^^ + 1 │ export * as ns from 'mod'; + 2 │ export v from 'mod'; + > 3 │ export a, * as b from 'mod'; + │ ^^^^^ + 4 │ export c, { foo } from 'mod'; + 5 │ export * as d, { bar } from 'mod'; i ...Which is required to end this statement - ┌─ export.js:3:18 - │ - 3 │ export a, * as b from 'mod'; - │ ^^^^^^^^^^ + 1 │ export * as ns from 'mod'; + 2 │ export v from 'mod'; + > 3 │ export a, * as b from 'mod'; + │ ^^^^^^^^^^ + 4 │ export c, { foo } from 'mod'; + 5 │ export * as d, { bar } from 'mod'; export.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -234,10 +255,12 @@ export.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration here - ┌─ export.js:4:8 - │ - 4 │ export c, { foo } from 'mod'; - │ ^ + 2 │ export v from 'mod'; + 3 │ export a, * as b from 'mod'; + > 4 │ export c, { foo } from 'mod'; + │ ^ + 5 │ export * as d, { bar } from 'mod'; + 6 │ export { fooooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; export.js:4:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -245,17 +268,21 @@ export.js:4:19 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ export.js:4:19 - │ - 4 │ export c, { foo } from 'mod'; - │ ^^^^ + 2 │ export v from 'mod'; + 3 │ export a, * as b from 'mod'; + > 4 │ export c, { foo } from 'mod'; + │ ^^^^ + 5 │ export * as d, { bar } from 'mod'; + 6 │ export { fooooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; i ...Which is required to end this statement - ┌─ export.js:4:8 - │ - 4 │ export c, { foo } from 'mod'; - │ ^^^^^^^^^^^^^^^ + 2 │ export v from 'mod'; + 3 │ export a, * as b from 'mod'; + > 4 │ export c, { foo } from 'mod'; + │ ^^^^^^^^^^^^^^^ + 5 │ export * as d, { bar } from 'mod'; + 6 │ export { fooooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; export.js:4:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -263,17 +290,21 @@ export.js:4:24 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ export.js:4:24 - │ - 4 │ export c, { foo } from 'mod'; - │ ^^^^^ + 2 │ export v from 'mod'; + 3 │ export a, * as b from 'mod'; + > 4 │ export c, { foo } from 'mod'; + │ ^^^^^ + 5 │ export * as d, { bar } from 'mod'; + 6 │ export { fooooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; i ...Which is required to end this statement - ┌─ export.js:4:19 - │ - 4 │ export c, { foo } from 'mod'; - │ ^^^^^^^^^^ + 2 │ export v from 'mod'; + 3 │ export a, * as b from 'mod'; + > 4 │ export c, { foo } from 'mod'; + │ ^^^^^^^^^^ + 5 │ export * as d, { bar } from 'mod'; + 6 │ export { fooooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; export.js:5:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -281,10 +312,12 @@ export.js:5:14 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ export.js:5:14 - │ - 5 │ export * as d, { bar } from 'mod'; - │ ^ + 3 │ export a, * as b from 'mod'; + 4 │ export c, { foo } from 'mod'; + > 5 │ export * as d, { bar } from 'mod'; + │ ^ + 6 │ export { fooooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; + 7 │ export Bar, { barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr } from "barrrrrrrrrrrrrrrrrrrrrrrrrrrr"; export.js:5:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -292,17 +325,21 @@ export.js:5:29 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ export.js:5:29 - │ - 5 │ export * as d, { bar } from 'mod'; - │ ^^^^^ + 3 │ export a, * as b from 'mod'; + 4 │ export c, { foo } from 'mod'; + > 5 │ export * as d, { bar } from 'mod'; + │ ^^^^^ + 6 │ export { fooooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; + 7 │ export Bar, { barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr } from "barrrrrrrrrrrrrrrrrrrrrrrrrrrr"; i ...Which is required to end this statement - ┌─ export.js:5:24 - │ - 5 │ export * as d, { bar } from 'mod'; - │ ^^^^^^^^^^ + 3 │ export a, * as b from 'mod'; + 4 │ export c, { foo } from 'mod'; + > 5 │ export * as d, { bar } from 'mod'; + │ ^^^^^^^^^^ + 6 │ export { fooooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; + 7 │ export Bar, { barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr } from "barrrrrrrrrrrrrrrrrrrrrrrrrrrr"; export.js:7:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -310,10 +347,12 @@ export.js:7:8 parse ━━━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration here - ┌─ export.js:7:8 - │ - 7 │ export Bar, { barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr } from "barrrrrrrrrrrrrrrrrrrrrrrrrrrr"; - │ ^^^ + 5 │ export * as d, { bar } from 'mod'; + 6 │ export { fooooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; + > 7 │ export Bar, { barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr } from "barrrrrrrrrrrrrrrrrrrrrrrrrrrr"; + │ ^^^ + 8 │ export { foooooooooooooooooooooooooooooooooooooooooooooo, fooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; + 9 │ export.js:7:63 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -321,17 +360,21 @@ export.js:7:63 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ export.js:7:63 - │ - 7 │ export Bar, { barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr } from "barrrrrrrrrrrrrrrrrrrrrrrrrrrr"; - │ ^^^^ + 5 │ export * as d, { bar } from 'mod'; + 6 │ export { fooooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; + > 7 │ export Bar, { barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr } from "barrrrrrrrrrrrrrrrrrrrrrrrrrrr"; + │ ^^^^ + 8 │ export { foooooooooooooooooooooooooooooooooooooooooooooo, fooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; + 9 │ i ...Which is required to end this statement - ┌─ export.js:7:8 - │ - 7 │ export Bar, { barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr } from "barrrrrrrrrrrrrrrrrrrrrrrrrrrr"; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ export * as d, { bar } from 'mod'; + 6 │ export { fooooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; + > 7 │ export Bar, { barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr } from "barrrrrrrrrrrrrrrrrrrrrrrrrrrr"; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 8 │ export { foooooooooooooooooooooooooooooooooooooooooooooo, fooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; + 9 │ export.js:7:68 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -339,17 +382,21 @@ export.js:7:68 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ export.js:7:68 - │ - 7 │ export Bar, { barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr } from "barrrrrrrrrrrrrrrrrrrrrrrrrrrr"; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ export * as d, { bar } from 'mod'; + 6 │ export { fooooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; + > 7 │ export Bar, { barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr } from "barrrrrrrrrrrrrrrrrrrrrrrrrrrr"; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 8 │ export { foooooooooooooooooooooooooooooooooooooooooooooo, fooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; + 9 │ i ...Which is required to end this statement - ┌─ export.js:7:63 - │ - 7 │ export Bar, { barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr } from "barrrrrrrrrrrrrrrrrrrrrrrrrrrr"; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ export * as d, { bar } from 'mod'; + 6 │ export { fooooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; + > 7 │ export Bar, { barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr } from "barrrrrrrrrrrrrrrrrrrrrrrrrrrr"; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 8 │ export { foooooooooooooooooooooooooooooooooooooooooooooo, fooooooooooooooooooooooooooooooooooooooooooooooo } from "fooooooooooooooooooooooooooooo"; + 9 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/exports/test.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/exports/test.js.snap index 11fd2666370..acd6896b380 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/exports/test.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/exports/test.js.snap @@ -86,10 +86,12 @@ test.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration here - ┌─ test.js:3:8 - │ - 3 │ export a,{b} from "./baz"; - │ ^ + 1 │ export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from "exports"; + 2 │ + > 3 │ export a,{b} from "./baz"; + │ ^ + 4 │ + 5 │ export * as ns from "mod"; test.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -97,17 +99,21 @@ test.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ test.js:3:14 - │ - 3 │ export a,{b} from "./baz"; - │ ^^^^ + 1 │ export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from "exports"; + 2 │ + > 3 │ export a,{b} from "./baz"; + │ ^^^^ + 4 │ + 5 │ export * as ns from "mod"; i ...Which is required to end this statement - ┌─ test.js:3:8 - │ - 3 │ export a,{b} from "./baz"; - │ ^^^^^^^^^^ + 1 │ export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from "exports"; + 2 │ + > 3 │ export a,{b} from "./baz"; + │ ^^^^^^^^^^ + 4 │ + 5 │ export * as ns from "mod"; test.js:3:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -115,17 +121,21 @@ test.js:3:19 parse ━━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ test.js:3:19 - │ - 3 │ export a,{b} from "./baz"; - │ ^^^^^^^ + 1 │ export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from "exports"; + 2 │ + > 3 │ export a,{b} from "./baz"; + │ ^^^^^^^ + 4 │ + 5 │ export * as ns from "mod"; i ...Which is required to end this statement - ┌─ test.js:3:14 - │ - 3 │ export a,{b} from "./baz"; - │ ^^^^^^^^^^^^ + 1 │ export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from "exports"; + 2 │ + > 3 │ export a,{b} from "./baz"; + │ ^^^^^^^^^^^^ + 4 │ + 5 │ export * as ns from "mod"; test.js:7:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -133,10 +143,12 @@ test.js:7:16 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ test.js:7:16 - │ - 7 │ export * as foo,{bar} from "./baz"; - │ ^ + 5 │ export * as ns from "mod"; + 6 │ + > 7 │ export * as foo,{bar} from "./baz"; + │ ^ + 8 │ + 9 │ export { undefinedExport }; test.js:7:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -144,17 +156,21 @@ test.js:7:28 parse ━━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ test.js:7:28 - │ - 7 │ export * as foo,{bar} from "./baz"; - │ ^^^^^^^ + 5 │ export * as ns from "mod"; + 6 │ + > 7 │ export * as foo,{bar} from "./baz"; + │ ^^^^^^^ + 8 │ + 9 │ export { undefinedExport }; i ...Which is required to end this statement - ┌─ test.js:7:23 - │ - 7 │ export * as foo,{bar} from "./baz"; - │ ^^^^^^^^^^^^ + 5 │ export * as ns from "mod"; + 6 │ + > 7 │ export * as foo,{bar} from "./baz"; + │ ^^^^^^^^^^^^ + 8 │ + 9 │ export { undefinedExport }; ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/comments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/comments.js.snap index 0e77573d6c1..e9cc848b3fc 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/comments.js.snap @@ -74,17 +74,17 @@ comments.js:1:32 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ comments.js:1:32 - │ - 1 │ const m = /*A1*/ module /*A2*/ { /*A3*/ - │ ^ + > 1 │ const m = /*A1*/ module /*A2*/ { /*A3*/ + │ ^ + 2 │ /*A4*/ + 3 │ export const foo = "foo"; i ...Which is required to end this statement - ┌─ comments.js:1:1 - │ - 1 │ const m = /*A1*/ module /*A2*/ { /*A3*/ - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ const m = /*A1*/ module /*A2*/ { /*A3*/ + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ /*A4*/ + 3 │ export const foo = "foo"; comments.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -92,10 +92,12 @@ comments.js:3:3 parse ━━━━━━━━━━━━━━━━━━━ × move this declaration to the top level - ┌─ comments.js:3:3 - │ - 3 │ export const foo = "foo"; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ const m = /*A1*/ module /*A2*/ { /*A3*/ + 2 │ /*A4*/ + > 3 │ export const foo = "foo"; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ export { foo }; /*A5*/ + 5 │ /*A6*/ comments.js:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -103,10 +105,12 @@ comments.js:4:3 parse ━━━━━━━━━━━━━━━━━━━ × move this declaration to the top level - ┌─ comments.js:4:3 - │ - 4 │ export { foo }; /*A5*/ - │ ^^^^^^^^^^^^^^^ + 2 │ /*A4*/ + 3 │ export const foo = "foo"; + > 4 │ export { foo }; /*A5*/ + │ ^^^^^^^^^^^^^^^ + 5 │ /*A6*/ + 6 │ }/*A7*/;/*A8*/ comments.js:8:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -114,17 +118,21 @@ comments.js:8:26 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ comments.js:8:26 - │ - 8 │ const m2 = module/* B1 */{ - │ ^ + 6 │ }/*A7*/;/*A8*/ + 7 │ + > 8 │ const m2 = module/* B1 */{ + │ ^ + 9 │ /* B2 */ + 10 │ }; i ...Which is required to end this statement - ┌─ comments.js:8:1 - │ - 8 │ const m2 = module/* B1 */{ - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 6 │ }/*A7*/;/*A8*/ + 7 │ + > 8 │ const m2 = module/* B1 */{ + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 9 │ /* B2 */ + 10 │ }; ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/module-blocks.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/module-blocks.js.snap index dbede28ad50..9a98fcc0728 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/module-blocks.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/module-blocks.js.snap @@ -215,17 +215,17 @@ module-blocks.js:1:8 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module-blocks.js:1:8 - │ - 1 │ module { await 3 }; - │ ^ + > 1 │ module { await 3 }; + │ ^ + 2 │ + 3 │ class B { i ...Which is required to end this statement - ┌─ module-blocks.js:1:1 - │ - 1 │ module { await 3 }; - │ ^^^^^^^^ + > 1 │ module { await 3 }; + │ ^^^^^^^^ + 2 │ + 3 │ class B { module-blocks.js:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -233,17 +233,21 @@ module-blocks.js:5:12 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module-blocks.js:5:12 - │ - 5 │ module { - │ ^ + 3 │ class B { + 4 │ #p() { + > 5 │ module { + │ ^ + 6 │ class C { [this.#p]; } + 7 │ }; i ...Which is required to end this statement - ┌─ module-blocks.js:5:5 - │ - 5 │ module { - │ ^^^^^^^^ + 3 │ class B { + 4 │ #p() { + > 5 │ module { + │ ^^^^^^^^ + 6 │ class C { [this.#p]; } + 7 │ }; module-blocks.js:11:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -251,17 +255,21 @@ module-blocks.js:11:18 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module-blocks.js:11:18 - │ - 11 │ const m = module { - │ ^ + 9 │ } + 10 │ + > 11 │ const m = module { + │ ^ + 12 │ export const foo = "foo"; + 13 │ export { foo }; i ...Which is required to end this statement - ┌─ module-blocks.js:11:1 - │ - 11 │ const m = module { - │ ^^^^^^^^^^^^^^^^^ + 9 │ } + 10 │ + > 11 │ const m = module { + │ ^^^^^^^^^^^^^^^^^ + 12 │ export const foo = "foo"; + 13 │ export { foo }; module-blocks.js:12:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -269,10 +277,11 @@ module-blocks.js:12:3 parse ━━━━━━━━━━━━━━━━━ × move this declaration to the top level - ┌─ module-blocks.js:12:3 - │ - 12 │ export const foo = "foo"; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 11 │ const m = module { + > 12 │ export const foo = "foo"; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 13 │ export { foo }; + 14 │ }; module-blocks.js:13:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -280,10 +289,12 @@ module-blocks.js:13:3 parse ━━━━━━━━━━━━━━━━━ × move this declaration to the top level - ┌─ module-blocks.js:13:3 - │ - 13 │ export { foo }; - │ ^^^^^^^^^^^^^^^ + 11 │ const m = module { + 12 │ export const foo = "foo"; + > 13 │ export { foo }; + │ ^^^^^^^^^^^^^^^ + 14 │ }; + 15 │ module-blocks.js:16:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -291,17 +302,21 @@ module-blocks.js:16:8 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module-blocks.js:16:8 - │ - 16 │ module { - │ ^ + 14 │ }; + 15 │ + > 16 │ module { + │ ^ + 17 │ export { foo } + 18 │ }; i ...Which is required to end this statement - ┌─ module-blocks.js:16:1 - │ - 16 │ module { - │ ^^^^^^^^ + 14 │ }; + 15 │ + > 16 │ module { + │ ^^^^^^^^ + 17 │ export { foo } + 18 │ }; module-blocks.js:17:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -309,10 +324,11 @@ module-blocks.js:17:3 parse ━━━━━━━━━━━━━━━━━ × move this declaration to the top level - ┌─ module-blocks.js:17:3 - │ - 17 │ export { foo } - │ ^^^^^^^^^^^^^^ + 16 │ module { + > 17 │ export { foo } + │ ^^^^^^^^^^^^^^ + 18 │ }; + 19 │ module-blocks.js:20:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -320,17 +336,21 @@ module-blocks.js:20:24 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module-blocks.js:20:24 - │ - 20 │ const m = module {}; - │ ^ + 18 │ }; + 19 │ + > 20 │ const m = module {}; + │ ^ + 21 │ + 22 │ const worker = new Worker(module { i ...Which is required to end this statement - ┌─ module-blocks.js:20:1 - │ - 20 │ const m = module {}; - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 18 │ }; + 19 │ + > 20 │ const m = module {}; + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 21 │ + 22 │ const worker = new Worker(module { module-blocks.js:22:34 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -338,10 +358,12 @@ module-blocks.js:22:34 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ module-blocks.js:22:34 - │ - 22 │ const worker = new Worker(module { - │ ^ + 20 │ const m = module {}; + 21 │ + > 22 │ const worker = new Worker(module { + │ ^ + 23 │ export const foo = "foo"; + 24 │ }); module-blocks.js:23:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -349,10 +371,11 @@ module-blocks.js:23:10 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ module-blocks.js:23:10 - │ - 23 │ export const foo = "foo"; - │ ^^^^^ + 22 │ const worker = new Worker(module { + > 23 │ export const foo = "foo"; + │ ^^^^^ + 24 │ }); + 25 │ module-blocks.js:23:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -360,10 +383,11 @@ module-blocks.js:23:16 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ module-blocks.js:23:16 - │ - 23 │ export const foo = "foo"; - │ ^^^ + 22 │ const worker = new Worker(module { + > 23 │ export const foo = "foo"; + │ ^^^ + 24 │ }); + 25 │ module-blocks.js:23:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -371,10 +395,11 @@ module-blocks.js:23:27 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ module-blocks.js:23:27 - │ - 23 │ export const foo = "foo"; - │ ^ + 22 │ const worker = new Worker(module { + > 23 │ export const foo = "foo"; + │ ^ + 24 │ }); + 25 │ module-blocks.js:24:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -382,10 +407,12 @@ module-blocks.js:24:1 parse ━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ module-blocks.js:24:1 - │ - 24 │ }); - │ ^^ + 22 │ const worker = new Worker(module { + 23 │ export const foo = "foo"; + > 24 │ }); + │ ^^ + 25 │ + 26 │ let m = module { module-blocks.js:26:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -393,17 +420,21 @@ module-blocks.js:26:16 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module-blocks.js:26:16 - │ - 26 │ let m = module { - │ ^ + 24 │ }); + 25 │ + > 26 │ let m = module { + │ ^ + 27 │ module { + 28 │ export let foo = "foo"; i ...Which is required to end this statement - ┌─ module-blocks.js:26:1 - │ - 26 │ let m = module { - │ ^^^^^^^^^^^^^^^ + 24 │ }); + 25 │ + > 26 │ let m = module { + │ ^^^^^^^^^^^^^^^ + 27 │ module { + 28 │ export let foo = "foo"; module-blocks.js:27:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -411,17 +442,19 @@ module-blocks.js:27:10 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module-blocks.js:27:10 - │ - 27 │ module { - │ ^ + 26 │ let m = module { + > 27 │ module { + │ ^ + 28 │ export let foo = "foo"; + 29 │ }; i ...Which is required to end this statement - ┌─ module-blocks.js:27:3 - │ - 27 │ module { - │ ^^^^^^^^ + 26 │ let m = module { + > 27 │ module { + │ ^^^^^^^^ + 28 │ export let foo = "foo"; + 29 │ }; module-blocks.js:28:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -429,10 +462,12 @@ module-blocks.js:28:5 parse ━━━━━━━━━━━━━━━━━ × move this declaration to the top level - ┌─ module-blocks.js:28:5 - │ - 28 │ export let foo = "foo"; - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 26 │ let m = module { + 27 │ module { + > 28 │ export let foo = "foo"; + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 29 │ }; + 30 │ }; module-blocks.js:32:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -440,17 +475,21 @@ module-blocks.js:32:18 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module-blocks.js:32:18 - │ - 32 │ const m = module { export const foo = "foo" }; - │ ^ + 30 │ }; + 31 │ + > 32 │ const m = module { export const foo = "foo" }; + │ ^ + 33 │ + 34 │ let moduleBlock = module { export let y = 1; }; i ...Which is required to end this statement - ┌─ module-blocks.js:32:1 - │ - 32 │ const m = module { export const foo = "foo" }; - │ ^^^^^^^^^^^^^^^^^ + 30 │ }; + 31 │ + > 32 │ const m = module { export const foo = "foo" }; + │ ^^^^^^^^^^^^^^^^^ + 33 │ + 34 │ let moduleBlock = module { export let y = 1; }; module-blocks.js:32:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -458,10 +497,12 @@ module-blocks.js:32:20 parse ━━━━━━━━━━━━━━━━━ × move this declaration to the top level - ┌─ module-blocks.js:32:20 - │ - 32 │ const m = module { export const foo = "foo" }; - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 30 │ }; + 31 │ + > 32 │ const m = module { export const foo = "foo" }; + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 33 │ + 34 │ let moduleBlock = module { export let y = 1; }; module-blocks.js:34:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -469,17 +510,21 @@ module-blocks.js:34:26 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module-blocks.js:34:26 - │ - 34 │ let moduleBlock = module { export let y = 1; }; - │ ^ + 32 │ const m = module { export const foo = "foo" }; + 33 │ + > 34 │ let moduleBlock = module { export let y = 1; }; + │ ^ + 35 │ + 36 │ foo(module { export let foo = "foo"; }); i ...Which is required to end this statement - ┌─ module-blocks.js:34:1 - │ - 34 │ let moduleBlock = module { export let y = 1; }; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 32 │ const m = module { export const foo = "foo" }; + 33 │ + > 34 │ let moduleBlock = module { export let y = 1; }; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 35 │ + 36 │ foo(module { export let foo = "foo"; }); module-blocks.js:34:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -487,10 +532,12 @@ module-blocks.js:34:28 parse ━━━━━━━━━━━━━━━━━ × move this declaration to the top level - ┌─ module-blocks.js:34:28 - │ - 34 │ let moduleBlock = module { export let y = 1; }; - │ ^^^^^^^^^^^^^^^^^ + 32 │ const m = module { export const foo = "foo" }; + 33 │ + > 34 │ let moduleBlock = module { export let y = 1; }; + │ ^^^^^^^^^^^^^^^^^ + 35 │ + 36 │ foo(module { export let foo = "foo"; }); module-blocks.js:36:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -498,10 +545,12 @@ module-blocks.js:36:12 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ module-blocks.js:36:12 - │ - 36 │ foo(module { export let foo = "foo"; }); - │ ^ + 34 │ let moduleBlock = module { export let y = 1; }; + 35 │ + > 36 │ foo(module { export let foo = "foo"; }); + │ ^ + 37 │ + 38 │ let m = module { /* foo */ }; module-blocks.js:36:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -509,10 +558,12 @@ module-blocks.js:36:21 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ module-blocks.js:36:21 - │ - 36 │ foo(module { export let foo = "foo"; }); - │ ^^^ + 34 │ let moduleBlock = module { export let y = 1; }; + 35 │ + > 36 │ foo(module { export let foo = "foo"; }); + │ ^^^ + 37 │ + 38 │ let m = module { /* foo */ }; module-blocks.js:36:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -520,19 +571,23 @@ module-blocks.js:36:25 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ module-blocks.js:36:25 - │ - 36 │ foo(module { export let foo = "foo"; }); - │ ^^^ + 34 │ let moduleBlock = module { export let y = 1; }; + 35 │ + > 36 │ foo(module { export let foo = "foo"; }); + │ ^^^ + 37 │ + 38 │ let m = module { /* foo */ }; module-blocks.js:36:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Did you mean to use a `:`? An `=` can only follow a property name when the containing object literal is part of a destructuring pattern. - ┌─ module-blocks.js:36:29 - │ - 36 │ foo(module { export let foo = "foo"; }); - │ ^ + 34 │ let moduleBlock = module { export let y = 1; }; + 35 │ + > 36 │ foo(module { export let foo = "foo"; }); + │ ^ + 37 │ + 38 │ let m = module { /* foo */ }; module-blocks.js:36:36 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -540,10 +595,12 @@ module-blocks.js:36:36 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ module-blocks.js:36:36 - │ - 36 │ foo(module { export let foo = "foo"; }); - │ ^ + 34 │ let moduleBlock = module { export let y = 1; }; + 35 │ + > 36 │ foo(module { export let foo = "foo"; }); + │ ^ + 37 │ + 38 │ let m = module { /* foo */ }; module-blocks.js:36:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -551,10 +608,12 @@ module-blocks.js:36:38 parse ━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ module-blocks.js:36:38 - │ - 36 │ foo(module { export let foo = "foo"; }); - │ ^^ + 34 │ let moduleBlock = module { export let y = 1; }; + 35 │ + > 36 │ foo(module { export let foo = "foo"; }); + │ ^^ + 37 │ + 38 │ let m = module { /* foo */ }; module-blocks.js:38:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -562,17 +621,19 @@ module-blocks.js:38:16 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module-blocks.js:38:16 - │ - 38 │ let m = module { /* foo */ }; - │ ^ + 36 │ foo(module { export let foo = "foo"; }); + 37 │ + > 38 │ let m = module { /* foo */ }; + │ ^ + 39 │ i ...Which is required to end this statement - ┌─ module-blocks.js:38:1 - │ - 38 │ let m = module { /* foo */ }; - │ ^^^^^^^^^^^^^^^ + 36 │ foo(module { export let foo = "foo"; }); + 37 │ + > 38 │ let m = module { /* foo */ }; + │ ^^^^^^^^^^^^^^^ + 39 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/range.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/range.js.snap index 96a0fd26d6b..7a54afeb602 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/range.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/range.js.snap @@ -50,17 +50,17 @@ range.js:1:26 parse ━━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ range.js:1:26 - │ - 1 │ let moduleBlock = module { export let y = 1; - │ ^ + > 1 │ let moduleBlock = module { export let y = 1; + │ ^ + 2 │ }; + 3 │ i ...Which is required to end this statement - ┌─ range.js:1:1 - │ - 1 │ let moduleBlock = module { export let y = 1; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ let moduleBlock = module { export let y = 1; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ }; + 3 │ range.js:1:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -68,10 +68,10 @@ range.js:1:29 parse ━━━━━━━━━━━━━━━━━━━━ × move this declaration to the top level - ┌─ range.js:1:29 - │ - 1 │ let moduleBlock = module { export let y = 1; - │ ^^^^^^^^^^^^^^^^^ + > 1 │ let moduleBlock = module { export let y = 1; + │ ^^^^^^^^^^^^^^^^^ + 2 │ }; + 3 │ range.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -79,10 +79,11 @@ range.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ range.js:4:12 - │ - 4 │ foo(module { export let foo = "foo"; }) - │ ^ + 2 │ }; + 3 │ + > 4 │ foo(module { export let foo = "foo"; }) + │ ^ + 5 │ range.js:4:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -90,10 +91,11 @@ range.js:4:21 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ range.js:4:21 - │ - 4 │ foo(module { export let foo = "foo"; }) - │ ^^^ + 2 │ }; + 3 │ + > 4 │ foo(module { export let foo = "foo"; }) + │ ^^^ + 5 │ range.js:4:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -101,19 +103,21 @@ range.js:4:25 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ range.js:4:25 - │ - 4 │ foo(module { export let foo = "foo"; }) - │ ^^^ + 2 │ }; + 3 │ + > 4 │ foo(module { export let foo = "foo"; }) + │ ^^^ + 5 │ range.js:4:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Did you mean to use a `:`? An `=` can only follow a property name when the containing object literal is part of a destructuring pattern. - ┌─ range.js:4:29 - │ - 4 │ foo(module { export let foo = "foo"; }) - │ ^ + 2 │ }; + 3 │ + > 4 │ foo(module { export let foo = "foo"; }) + │ ^ + 5 │ range.js:4:36 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -121,10 +125,11 @@ range.js:4:36 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ range.js:4:36 - │ - 4 │ foo(module { export let foo = "foo"; }) - │ ^ + 2 │ }; + 3 │ + > 4 │ foo(module { export let foo = "foo"; }) + │ ^ + 5 │ range.js:4:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -132,10 +137,11 @@ range.js:4:38 parse ━━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ range.js:4:38 - │ - 4 │ foo(module { export let foo = "foo"; }) - │ ^^ + 2 │ }; + 3 │ + > 4 │ foo(module { export let foo = "foo"; }) + │ ^^ + 5 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/worker.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/worker.js.snap index 2891fa984b5..0273eddef87 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/worker.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/worker.js.snap @@ -94,19 +94,20 @@ worker.js:1:32 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ worker.js:1:32 - │ - 1 │ let worker = new Worker(module { - │ ^ + > 1 │ let worker = new Worker(module { + │ ^ + 2 │ onmessage = function({data}) { + 3 │ let mod = import(data); worker.js:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Did you mean to use a `:`? An `=` can only follow a property name when the containing object literal is part of a destructuring pattern. - ┌─ worker.js:2:13 - │ - 2 │ onmessage = function({data}) { - │ ^ + 1 │ let worker = new Worker(module { + > 2 │ onmessage = function({data}) { + │ ^ + 3 │ let mod = import(data); + 4 │ postMessage(mod.fn()); worker.js:8:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -114,19 +115,22 @@ worker.js:8:32 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ worker.js:8:32 - │ - 8 │ let worker = new Worker(module { - │ ^ + 6 │ }, {type: "module"}); + 7 │ + > 8 │ let worker = new Worker(module { + │ ^ + 9 │ onmessage = function({data}) { + 10 │ let mod = import(data); worker.js:9:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Did you mean to use a `:`? An `=` can only follow a property name when the containing object literal is part of a destructuring pattern. - ┌─ worker.js:9:13 - │ - 9 │ onmessage = function({data}) { - │ ^ + 8 │ let worker = new Worker(module { + > 9 │ onmessage = function({data}) { + │ ^ + 10 │ let mod = import(data); + 11 │ postMessage(mod.fn()); worker.js:15:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -134,10 +138,11 @@ worker.js:15:27 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ worker.js:15:27 - │ - 15 │ worker.postMessage(module { export function fn() { return "hello!" } }); - │ ^ + 13 │ }, {type: "module", foo: "bar" }); + 14 │ + > 15 │ worker.postMessage(module { export function fn() { return "hello!" } }); + │ ^ + 16 │ worker.js:15:36 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -145,10 +150,11 @@ worker.js:15:36 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ worker.js:15:36 - │ - 15 │ worker.postMessage(module { export function fn() { return "hello!" } }); - │ ^^^^^^^^ + 13 │ }, {type: "module", foo: "bar" }); + 14 │ + > 15 │ worker.postMessage(module { export function fn() { return "hello!" } }); + │ ^^^^^^^^ + 16 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/no-semi-babylon-extensions/no-semi.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/no-semi-babylon-extensions/no-semi.js.snap index 79eb886be98..191673a711a 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/no-semi-babylon-extensions/no-semi.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/no-semi-babylon-extensions/no-semi.js.snap @@ -60,10 +60,11 @@ no-semi.js:2:2 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ no-semi.js:2:2 - │ - 2 │ ;::b.c - │ ^^^^^ + 1 │ a + > 2 │ ;::b.c + │ ^^^^^ + 3 │ + 4 │ class A { ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.snap index 6b563196ec1..57ae94b2c03 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.snap @@ -102,10 +102,12 @@ expression.js:5:4 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ expression.js:5:4 - │ - 5 │ ({}::b, 0); - │ ^ + 3 │ a = () => ({}).x; + 4 │ ({} && a, b); + > 5 │ ({}::b, 0); + │ ^ + 6 │ ({}::b()``[''].c++ && 0 ? 0 : 0, 0); + 7 │ ({}(), 0); expression.js:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -113,10 +115,12 @@ expression.js:6:4 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ expression.js:6:4 - │ - 6 │ ({}::b()``[''].c++ && 0 ? 0 : 0, 0); - │ ^ + 4 │ ({} && a, b); + 5 │ ({}::b, 0); + > 6 │ ({}::b()``[''].c++ && 0 ? 0 : 0, 0); + │ ^ + 7 │ ({}(), 0); + 8 │ ({} = 0); ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/partial-application/test.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/partial-application/test.js.snap index e86b5efefba..5fc1da96aef 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/partial-application/test.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/partial-application/test.js.snap @@ -59,10 +59,10 @@ test.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ test.js:1:23 - │ - 1 │ const addOne = add(1, ?); // apply from the left - │ ^ + > 1 │ const addOne = add(1, ?); // apply from the left + │ ^ + 2 │ addOne(2); // 3 + 3 │ test.js:4:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -70,10 +70,12 @@ test.js:4:20 parse ━━━━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ test.js:4:20 - │ - 4 │ const addTen = add(?, 10); // apply from the right - │ ^^^^^ + 2 │ addOne(2); // 3 + 3 │ + > 4 │ const addTen = add(?, 10); // apply from the right + │ ^^^^^ + 5 │ addTen(2); // 12 + 6 │ test.js:9:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -81,10 +83,12 @@ test.js:9:4 parse ━━━━━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ test.js:9:4 - │ - 9 │ |> add(7, ?) - │ ^ + 7 │ // with pipeline + 8 │ let newScore = player.score + > 9 │ |> add(7, ?) + │ ^ + 10 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. + 11 │ test.js:9:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -92,10 +96,12 @@ test.js:9:13 parse ━━━━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ test.js:9:13 - │ - 9 │ |> add(7, ?) - │ ^ + 7 │ // with pipeline + 8 │ let newScore = player.score + > 9 │ |> add(7, ?) + │ ^ + 10 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. + 11 │ test.js:10:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -103,10 +109,11 @@ test.js:10:4 parse ━━━━━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ test.js:10:4 - │ - 10 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. - │ ^ + 8 │ let newScore = player.score + 9 │ |> add(7, ?) + > 10 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. + │ ^ + 11 │ test.js:10:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -114,10 +121,11 @@ test.js:10:20 parse ━━━━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ test.js:10:20 - │ - 10 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. - │ ^ + 8 │ let newScore = player.score + 9 │ |> add(7, ?) + > 10 │ |> clamp(0, 100, ?); // shallow stack, the pipe to `clamp` is the same frame as the pipe to `add`. + │ ^ + 11 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/block-comments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/block-comments.js.snap index e41a82a5301..b3e4a31f299 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/block-comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/block-comments.js.snap @@ -55,10 +55,11 @@ block-comments.js:2:2 parse ━━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ block-comments.js:2:2 - │ - 2 │ |> foo1 - │ ^ + 1 │ bifornCringerMoshedPerplexSawder + > 2 │ |> foo1 + │ ^ + 3 │ |> foo2 /* comment1 */ + 4 │ |> foo3 /* comment2 */ block-comments.js:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -66,10 +67,12 @@ block-comments.js:3:2 parse ━━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ block-comments.js:3:2 - │ - 3 │ |> foo2 /* comment1 */ - │ ^ + 1 │ bifornCringerMoshedPerplexSawder + 2 │ |> foo1 + > 3 │ |> foo2 /* comment1 */ + │ ^ + 4 │ |> foo3 /* comment2 */ + 5 │ |> kochabCooieGameOnOboleUnweave block-comments.js:4:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -77,10 +80,12 @@ block-comments.js:4:2 parse ━━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ block-comments.js:4:2 - │ - 4 │ |> foo3 /* comment2 */ - │ ^ + 2 │ |> foo1 + 3 │ |> foo2 /* comment1 */ + > 4 │ |> foo3 /* comment2 */ + │ ^ + 5 │ |> kochabCooieGameOnOboleUnweave + 6 │ |> glimseGlyphsHazardNoopsTieTie; block-comments.js:5:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -88,10 +93,12 @@ block-comments.js:5:2 parse ━━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ block-comments.js:5:2 - │ - 5 │ |> kochabCooieGameOnOboleUnweave - │ ^ + 3 │ |> foo2 /* comment1 */ + 4 │ |> foo3 /* comment2 */ + > 5 │ |> kochabCooieGameOnOboleUnweave + │ ^ + 6 │ |> glimseGlyphsHazardNoopsTieTie; + 7 │ block-comments.js:6:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -99,10 +106,11 @@ block-comments.js:6:2 parse ━━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ block-comments.js:6:2 - │ - 6 │ |> glimseGlyphsHazardNoopsTieTie; - │ ^ + 4 │ |> foo3 /* comment2 */ + 5 │ |> kochabCooieGameOnOboleUnweave + > 6 │ |> glimseGlyphsHazardNoopsTieTie; + │ ^ + 7 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/fsharp_style_pipeline_operator.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/fsharp_style_pipeline_operator.js.snap index 5948a92c3e0..a1e9f71486a 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/fsharp_style_pipeline_operator.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/fsharp_style_pipeline_operator.js.snap @@ -216,10 +216,11 @@ fsharp_style_pipeline_operator.js:2:4 parse ━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:2:4 - │ - 2 │ |> await - │ ^ + 1 │ promise + > 2 │ |> await + │ ^ + 3 │ |> x => doubleSay(x, ', ') + 4 │ |> capitalize fsharp_style_pipeline_operator.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -227,10 +228,12 @@ fsharp_style_pipeline_operator.js:3:3 parse ━━━━━━━━━━━━ × Expected an unary expression here - ┌─ fsharp_style_pipeline_operator.js:3:3 - │ - 3 │ |> x => doubleSay(x, ', ') - │ ^ + 1 │ promise + 2 │ |> await + > 3 │ |> x => doubleSay(x, ', ') + │ ^ + 4 │ |> capitalize + 5 │ |> x => x + '!' fsharp_style_pipeline_operator.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -238,10 +241,12 @@ fsharp_style_pipeline_operator.js:3:4 parse ━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:3:4 - │ - 3 │ |> x => doubleSay(x, ', ') - │ ^ + 1 │ promise + 2 │ |> await + > 3 │ |> x => doubleSay(x, ', ') + │ ^ + 4 │ |> capitalize + 5 │ |> x => x + '!' fsharp_style_pipeline_operator.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -249,19 +254,22 @@ fsharp_style_pipeline_operator.js:3:8 parse ━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ fsharp_style_pipeline_operator.js:3:8 - │ - 3 │ |> x => doubleSay(x, ', ') - │ ^^ + 1 │ promise + 2 │ |> await + > 3 │ |> x => doubleSay(x, ', ') + │ ^^ + 4 │ |> capitalize + 5 │ |> x => x + '!' i ...Which is required to end this statement - ┌─ fsharp_style_pipeline_operator.js:1:1 - │ - 1 │ ┌ promise - 2 │ │ |> await - 3 │ │ |> x => doubleSay(x, ', ') - │ └─────────^ + > 1 │ promise + │ ^^^^^^^ + > 2 │ |> await + > 3 │ |> x => doubleSay(x, ', ') + │ ^^^^^^^ + 4 │ |> capitalize + 5 │ |> x => x + '!' fsharp_style_pipeline_operator.js:12:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -269,10 +277,11 @@ fsharp_style_pipeline_operator.js:12:4 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:12:4 - │ - 12 │ |> doubleSay - │ ^ + 11 │ const result = "hello" + > 12 │ |> doubleSay + │ ^ + 13 │ |> capitalize + 14 │ |> exclaim; fsharp_style_pipeline_operator.js:13:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -280,10 +289,12 @@ fsharp_style_pipeline_operator.js:13:4 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:13:4 - │ - 13 │ |> capitalize - │ ^ + 11 │ const result = "hello" + 12 │ |> doubleSay + > 13 │ |> capitalize + │ ^ + 14 │ |> exclaim; + 15 │ fsharp_style_pipeline_operator.js:14:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -291,10 +302,12 @@ fsharp_style_pipeline_operator.js:14:4 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:14:4 - │ - 14 │ |> exclaim; - │ ^ + 12 │ |> doubleSay + 13 │ |> capitalize + > 14 │ |> exclaim; + │ ^ + 15 │ + 16 │ const newScore = person.score fsharp_style_pipeline_operator.js:17:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -302,10 +315,11 @@ fsharp_style_pipeline_operator.js:17:4 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:17:4 - │ - 17 │ |> double - │ ^ + 16 │ const newScore = person.score + > 17 │ |> double + │ ^ + 18 │ |> n => add(7, n) + 19 │ |> n => boundScore(0, 100, n); fsharp_style_pipeline_operator.js:18:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -313,10 +327,12 @@ fsharp_style_pipeline_operator.js:18:4 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:18:4 - │ - 18 │ |> n => add(7, n) - │ ^ + 16 │ const newScore = person.score + 17 │ |> double + > 18 │ |> n => add(7, n) + │ ^ + 19 │ |> n => boundScore(0, 100, n); + 20 │ fsharp_style_pipeline_operator.js:18:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -324,19 +340,24 @@ fsharp_style_pipeline_operator.js:18:8 parse ━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ fsharp_style_pipeline_operator.js:18:8 - │ - 18 │ |> n => add(7, n) - │ ^^ + 16 │ const newScore = person.score + 17 │ |> double + > 18 │ |> n => add(7, n) + │ ^^ + 19 │ |> n => boundScore(0, 100, n); + 20 │ i ...Which is required to end this statement - ┌─ fsharp_style_pipeline_operator.js:16:1 - │ - 16 │ ┌ const newScore = person.score - 17 │ │ |> double - 18 │ │ |> n => add(7, n) - │ └───────^ + 14 │ |> exclaim; + 15 │ + > 16 │ const newScore = person.score + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 17 │ |> double + > 18 │ |> n => add(7, n) + │ ^^^^^ + 19 │ |> n => boundScore(0, 100, n); + 20 │ fsharp_style_pipeline_operator.js:22:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -344,10 +365,11 @@ fsharp_style_pipeline_operator.js:22:4 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:22:4 - │ - 22 │ |> api.get - │ ^ + 21 │ const user = url + > 22 │ |> api.get + │ ^ + 23 │ |> await + 24 │ |> r => r.json() fsharp_style_pipeline_operator.js:23:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -355,10 +377,12 @@ fsharp_style_pipeline_operator.js:23:4 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:23:4 - │ - 23 │ |> await - │ ^ + 21 │ const user = url + 22 │ |> api.get + > 23 │ |> await + │ ^ + 24 │ |> r => r.json() + 25 │ |> await fsharp_style_pipeline_operator.js:24:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -366,10 +390,12 @@ fsharp_style_pipeline_operator.js:24:3 parse ━━━━━━━━━━━ × Expected an unary expression here - ┌─ fsharp_style_pipeline_operator.js:24:3 - │ - 24 │ |> r => r.json() - │ ^ + 22 │ |> api.get + 23 │ |> await + > 24 │ |> r => r.json() + │ ^ + 25 │ |> await + 26 │ |> j => j.data.user; fsharp_style_pipeline_operator.js:24:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -377,10 +403,12 @@ fsharp_style_pipeline_operator.js:24:4 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:24:4 - │ - 24 │ |> r => r.json() - │ ^ + 22 │ |> api.get + 23 │ |> await + > 24 │ |> r => r.json() + │ ^ + 25 │ |> await + 26 │ |> j => j.data.user; fsharp_style_pipeline_operator.js:24:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -388,20 +416,25 @@ fsharp_style_pipeline_operator.js:24:8 parse ━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ fsharp_style_pipeline_operator.js:24:8 - │ - 24 │ |> r => r.json() - │ ^^ + 22 │ |> api.get + 23 │ |> await + > 24 │ |> r => r.json() + │ ^^ + 25 │ |> await + 26 │ |> j => j.data.user; i ...Which is required to end this statement - ┌─ fsharp_style_pipeline_operator.js:21:1 - │ - 21 │ ┌ const user = url - 22 │ │ |> api.get - 23 │ │ |> await - 24 │ │ |> r => r.json() - │ └───────^ + 19 │ |> n => boundScore(0, 100, n); + 20 │ + > 21 │ const user = url + │ ^^^^^^^^^^^^^^^^ + > 22 │ |> api.get + > 23 │ |> await + > 24 │ |> r => r.json() + │ ^^^^^ + 25 │ |> await + 26 │ |> j => j.data.user; fsharp_style_pipeline_operator.js:28:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -409,10 +442,12 @@ fsharp_style_pipeline_operator.js:28:22 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:28:22 - │ - 28 │ const f = (x) => (x |> (y) => y + 1) - │ ^ + 26 │ |> j => j.data.user; + 27 │ + > 28 │ const f = (x) => (x |> (y) => y + 1) + │ ^ + 29 │ |> (z) => z * y + 30 │ fsharp_style_pipeline_operator.js:28:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -420,10 +455,12 @@ fsharp_style_pipeline_operator.js:28:28 parse ━━━━━━━━━━━ × unexpected - ┌─ fsharp_style_pipeline_operator.js:28:28 - │ - 28 │ const f = (x) => (x |> (y) => y + 1) - │ ^^ + 26 │ |> j => j.data.user; + 27 │ + > 28 │ const f = (x) => (x |> (y) => y + 1) + │ ^^ + 29 │ |> (z) => z * y + 30 │ fsharp_style_pipeline_operator.js:32:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -431,10 +468,11 @@ fsharp_style_pipeline_operator.js:32:4 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:32:4 - │ - 32 │ |> (y) => y + 1 - │ ^ + 31 │ const _f = (x) => x + > 32 │ |> (y) => y + 1 + │ ^ + 33 │ |> (z) => z * y + 34 │ fsharp_style_pipeline_operator.js:32:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -442,18 +480,22 @@ fsharp_style_pipeline_operator.js:32:10 parse ━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ fsharp_style_pipeline_operator.js:32:10 - │ - 32 │ |> (y) => y + 1 - │ ^^ + 31 │ const _f = (x) => x + > 32 │ |> (y) => y + 1 + │ ^^ + 33 │ |> (z) => z * y + 34 │ i ...Which is required to end this statement - ┌─ fsharp_style_pipeline_operator.js:31:1 - │ - 31 │ ┌ const _f = (x) => x - 32 │ │ |> (y) => y + 1 - │ └─────────^ + 29 │ |> (z) => z * y + 30 │ + > 31 │ const _f = (x) => x + │ ^^^^^^^^^^^^^^^^^^^ + > 32 │ |> (y) => y + 1 + │ ^^^^^^^ + 33 │ |> (z) => z * y + 34 │ fsharp_style_pipeline_operator.js:36:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -461,10 +503,11 @@ fsharp_style_pipeline_operator.js:36:4 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:36:4 - │ - 36 │ |> (y) => (y + 1 |> (z) => z * y) - │ ^ + 35 │ const g = (x) => x + > 36 │ |> (y) => (y + 1 |> (z) => z * y) + │ ^ + 37 │ + 38 │ const _g = (x) => x fsharp_style_pipeline_operator.js:36:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -472,18 +515,22 @@ fsharp_style_pipeline_operator.js:36:10 parse ━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ fsharp_style_pipeline_operator.js:36:10 - │ - 36 │ |> (y) => (y + 1 |> (z) => z * y) - │ ^^ + 35 │ const g = (x) => x + > 36 │ |> (y) => (y + 1 |> (z) => z * y) + │ ^^ + 37 │ + 38 │ const _g = (x) => x i ...Which is required to end this statement - ┌─ fsharp_style_pipeline_operator.js:35:1 - │ - 35 │ ┌ const g = (x) => x - 36 │ │ |> (y) => (y + 1 |> (z) => z * y) - │ └─────────^ + 33 │ |> (z) => z * y + 34 │ + > 35 │ const g = (x) => x + │ ^^^^^^^^^^^^^^^^^^ + > 36 │ |> (y) => (y + 1 |> (z) => z * y) + │ ^^^^^^^ + 37 │ + 38 │ const _g = (x) => x fsharp_style_pipeline_operator.js:39:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -491,10 +538,11 @@ fsharp_style_pipeline_operator.js:39:4 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:39:4 - │ - 39 │ |> (y => (y + 1 |> (z) => z * y)) - │ ^ + 38 │ const _g = (x) => x + > 39 │ |> (y => (y + 1 |> (z) => z * y)) + │ ^ + 40 │ + 41 │ const __g = (x) => x fsharp_style_pipeline_operator.js:39:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -502,10 +550,11 @@ fsharp_style_pipeline_operator.js:39:20 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:39:20 - │ - 39 │ |> (y => (y + 1 |> (z) => z * y)) - │ ^ + 38 │ const _g = (x) => x + > 39 │ |> (y => (y + 1 |> (z) => z * y)) + │ ^ + 40 │ + 41 │ const __g = (x) => x fsharp_style_pipeline_operator.js:39:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -513,10 +562,11 @@ fsharp_style_pipeline_operator.js:39:26 parse ━━━━━━━━━━━ × unexpected - ┌─ fsharp_style_pipeline_operator.js:39:26 - │ - 39 │ |> (y => (y + 1 |> (z) => z * y)) - │ ^^ + 38 │ const _g = (x) => x + > 39 │ |> (y => (y + 1 |> (z) => z * y)) + │ ^^ + 40 │ + 41 │ const __g = (x) => x fsharp_style_pipeline_operator.js:42:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -524,10 +574,11 @@ fsharp_style_pipeline_operator.js:42:4 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:42:4 - │ - 42 │ |> ( - │ ^ + 41 │ const __g = (x) => x + > 42 │ |> ( + │ ^ + 43 │ y => { + 44 │ return (y + 1 |> (z) => z * y); fsharp_style_pipeline_operator.js:44:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -535,10 +586,12 @@ fsharp_style_pipeline_operator.js:44:22 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:44:22 - │ - 44 │ return (y + 1 |> (z) => z * y); - │ ^ + 42 │ |> ( + 43 │ y => { + > 44 │ return (y + 1 |> (z) => z * y); + │ ^ + 45 │ } + 46 │ ) fsharp_style_pipeline_operator.js:44:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -546,10 +599,12 @@ fsharp_style_pipeline_operator.js:44:28 parse ━━━━━━━━━━━ × unexpected - ┌─ fsharp_style_pipeline_operator.js:44:28 - │ - 44 │ return (y + 1 |> (z) => z * y); - │ ^^ + 42 │ |> ( + 43 │ y => { + > 44 │ return (y + 1 |> (z) => z * y); + │ ^^ + 45 │ } + 46 │ ) fsharp_style_pipeline_operator.js:48:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -557,10 +612,12 @@ fsharp_style_pipeline_operator.js:48:27 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:48:27 - │ - 48 │ const f = x + ((f) => (f |> f)); - │ ^ + 46 │ ) + 47 │ + > 48 │ const f = x + ((f) => (f |> f)); + │ ^ + 49 │ const f = x |> (f) => f |> f; + 50 │ fsharp_style_pipeline_operator.js:49:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -568,10 +625,10 @@ fsharp_style_pipeline_operator.js:49:14 parse ━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ fsharp_style_pipeline_operator.js:49:14 - │ - 49 │ const f = x |> (f) => f |> f; - │ ^ + 48 │ const f = x + ((f) => (f |> f)); + > 49 │ const f = x |> (f) => f |> f; + │ ^ + 50 │ fsharp_style_pipeline_operator.js:49:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -579,17 +636,17 @@ fsharp_style_pipeline_operator.js:49:20 parse ━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ fsharp_style_pipeline_operator.js:49:20 - │ - 49 │ const f = x |> (f) => f |> f; - │ ^^ + 48 │ const f = x + ((f) => (f |> f)); + > 49 │ const f = x |> (f) => f |> f; + │ ^^ + 50 │ i ...Which is required to end this statement - ┌─ fsharp_style_pipeline_operator.js:49:1 - │ - 49 │ const f = x |> (f) => f |> f; - │ ^^^^^^^^^^^^^^^^^^^ + 48 │ const f = x + ((f) => (f |> f)); + > 49 │ const f = x |> (f) => f |> f; + │ ^^^^^^^^^^^^^^^^^^^ + 50 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/hack_pipeline_operator.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/hack_pipeline_operator.js.snap index 395e61c30ae..d455d4e640e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/hack_pipeline_operator.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/hack_pipeline_operator.js.snap @@ -226,10 +226,10 @@ hack_pipeline_operator.js:1:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:1:4 - │ - 1 │ a |> await % |> % * 3; - │ ^ + > 1 │ a |> await % |> % * 3; + │ ^ + 2 │ + 3 │ foo hack_pipeline_operator.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -237,10 +237,10 @@ hack_pipeline_operator.js:1:12 parse ━━━━━━━━━━━━━━ × Expected an unary expression here - ┌─ hack_pipeline_operator.js:1:12 - │ - 1 │ a |> await % |> % * 3; - │ ^ + > 1 │ a |> await % |> % * 3; + │ ^ + 2 │ + 3 │ foo hack_pipeline_operator.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -248,10 +248,10 @@ hack_pipeline_operator.js:1:14 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:1:14 - │ - 1 │ a |> await % |> % * 3; - │ ^ + > 1 │ a |> await % |> % * 3; + │ ^ + 2 │ + 3 │ foo hack_pipeline_operator.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -259,10 +259,10 @@ hack_pipeline_operator.js:1:15 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:1:15 - │ - 1 │ a |> await % |> % * 3; - │ ^ + > 1 │ a |> await % |> % * 3; + │ ^ + 2 │ + 3 │ foo hack_pipeline_operator.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -270,10 +270,10 @@ hack_pipeline_operator.js:1:17 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:1:17 - │ - 1 │ a |> await % |> % * 3; - │ ^ + > 1 │ a |> await % |> % * 3; + │ ^ + 2 │ + 3 │ foo hack_pipeline_operator.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -281,10 +281,10 @@ hack_pipeline_operator.js:1:19 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:1:19 - │ - 1 │ a |> await % |> % * 3; - │ ^ + > 1 │ a |> await % |> % * 3; + │ ^ + 2 │ + 3 │ foo hack_pipeline_operator.js:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -292,10 +292,11 @@ hack_pipeline_operator.js:4:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:4:4 - │ - 4 │ |> await % - │ ^ + 3 │ foo + > 4 │ |> await % + │ ^ + 5 │ |> % || throw new Error(`foo ${bar1}`) + 6 │ |> bar2(%, ", ") hack_pipeline_operator.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -303,10 +304,11 @@ hack_pipeline_operator.js:4:12 parse ━━━━━━━━━━━━━━ × Expected an unary expression here - ┌─ hack_pipeline_operator.js:4:12 - │ - 4 │ |> await % - │ ^ + 3 │ foo + > 4 │ |> await % + │ ^ + 5 │ |> % || throw new Error(`foo ${bar1}`) + 6 │ |> bar2(%, ", ") hack_pipeline_operator.js:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -314,10 +316,12 @@ hack_pipeline_operator.js:5:3 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:5:3 - │ - 5 │ |> % || throw new Error(`foo ${bar1}`) - │ ^ + 3 │ foo + 4 │ |> await % + > 5 │ |> % || throw new Error(`foo ${bar1}`) + │ ^ + 6 │ |> bar2(%, ", ") + 7 │ |> bar3(%) hack_pipeline_operator.js:5:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -325,10 +329,12 @@ hack_pipeline_operator.js:5:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:5:4 - │ - 5 │ |> % || throw new Error(`foo ${bar1}`) - │ ^ + 3 │ foo + 4 │ |> await % + > 5 │ |> % || throw new Error(`foo ${bar1}`) + │ ^ + 6 │ |> bar2(%, ", ") + 7 │ |> bar3(%) hack_pipeline_operator.js:5:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -336,10 +342,12 @@ hack_pipeline_operator.js:5:6 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:5:6 - │ - 5 │ |> % || throw new Error(`foo ${bar1}`) - │ ^ + 3 │ foo + 4 │ |> await % + > 5 │ |> % || throw new Error(`foo ${bar1}`) + │ ^ + 6 │ |> bar2(%, ", ") + 7 │ |> bar3(%) hack_pipeline_operator.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -347,10 +355,12 @@ hack_pipeline_operator.js:5:8 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:5:8 - │ - 5 │ |> % || throw new Error(`foo ${bar1}`) - │ ^^ + 3 │ foo + 4 │ |> await % + > 5 │ |> % || throw new Error(`foo ${bar1}`) + │ ^^ + 6 │ |> bar2(%, ", ") + 7 │ |> bar3(%) hack_pipeline_operator.js:5:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -358,10 +368,12 @@ hack_pipeline_operator.js:5:11 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:5:11 - │ - 5 │ |> % || throw new Error(`foo ${bar1}`) - │ ^^^^^ + 3 │ foo + 4 │ |> await % + > 5 │ |> % || throw new Error(`foo ${bar1}`) + │ ^^^^^ + 6 │ |> bar2(%, ", ") + 7 │ |> bar3(%) hack_pipeline_operator.js:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -369,10 +381,12 @@ hack_pipeline_operator.js:6:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:6:4 - │ - 6 │ |> bar2(%, ", ") - │ ^ + 4 │ |> await % + 5 │ |> % || throw new Error(`foo ${bar1}`) + > 6 │ |> bar2(%, ", ") + │ ^ + 7 │ |> bar3(%) + 8 │ |> % + "!" hack_pipeline_operator.js:6:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -380,10 +394,12 @@ hack_pipeline_operator.js:6:11 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:6:11 - │ - 6 │ |> bar2(%, ", ") - │ ^ + 4 │ |> await % + 5 │ |> % || throw new Error(`foo ${bar1}`) + > 6 │ |> bar2(%, ", ") + │ ^ + 7 │ |> bar3(%) + 8 │ |> % + "!" hack_pipeline_operator.js:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -391,10 +407,12 @@ hack_pipeline_operator.js:6:12 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:6:12 - │ - 6 │ |> bar2(%, ", ") - │ ^ + 4 │ |> await % + 5 │ |> % || throw new Error(`foo ${bar1}`) + > 6 │ |> bar2(%, ", ") + │ ^ + 7 │ |> bar3(%) + 8 │ |> % + "!" hack_pipeline_operator.js:7:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -402,10 +420,12 @@ hack_pipeline_operator.js:7:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:7:4 - │ - 7 │ |> bar3(%) - │ ^ + 5 │ |> % || throw new Error(`foo ${bar1}`) + 6 │ |> bar2(%, ", ") + > 7 │ |> bar3(%) + │ ^ + 8 │ |> % + "!" + 9 │ |> new Bar.Foo(%) hack_pipeline_operator.js:7:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -413,10 +433,12 @@ hack_pipeline_operator.js:7:11 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:7:11 - │ - 7 │ |> bar3(%) - │ ^ + 5 │ |> % || throw new Error(`foo ${bar1}`) + 6 │ |> bar2(%, ", ") + > 7 │ |> bar3(%) + │ ^ + 8 │ |> % + "!" + 9 │ |> new Bar.Foo(%) hack_pipeline_operator.js:7:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -424,10 +446,12 @@ hack_pipeline_operator.js:7:12 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:7:12 - │ - 7 │ |> bar3(%) - │ ^ + 5 │ |> % || throw new Error(`foo ${bar1}`) + 6 │ |> bar2(%, ", ") + > 7 │ |> bar3(%) + │ ^ + 8 │ |> % + "!" + 9 │ |> new Bar.Foo(%) hack_pipeline_operator.js:8:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -435,10 +459,12 @@ hack_pipeline_operator.js:8:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:8:4 - │ - 8 │ |> % + "!" - │ ^ + 6 │ |> bar2(%, ", ") + 7 │ |> bar3(%) + > 8 │ |> % + "!" + │ ^ + 9 │ |> new Bar.Foo(%) + 10 │ |> await bar.bar(%) hack_pipeline_operator.js:8:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -446,10 +472,12 @@ hack_pipeline_operator.js:8:6 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:8:6 - │ - 8 │ |> % + "!" - │ ^ + 6 │ |> bar2(%, ", ") + 7 │ |> bar3(%) + > 8 │ |> % + "!" + │ ^ + 9 │ |> new Bar.Foo(%) + 10 │ |> await bar.bar(%) hack_pipeline_operator.js:9:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -457,10 +485,12 @@ hack_pipeline_operator.js:9:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:9:4 - │ - 9 │ |> new Bar.Foo(%) - │ ^ + 7 │ |> bar3(%) + 8 │ |> % + "!" + > 9 │ |> new Bar.Foo(%) + │ ^ + 10 │ |> await bar.bar(%) + 11 │ |> console.log(%); hack_pipeline_operator.js:9:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -468,10 +498,12 @@ hack_pipeline_operator.js:9:18 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:9:18 - │ - 9 │ |> new Bar.Foo(%) - │ ^ + 7 │ |> bar3(%) + 8 │ |> % + "!" + > 9 │ |> new Bar.Foo(%) + │ ^ + 10 │ |> await bar.bar(%) + 11 │ |> console.log(%); hack_pipeline_operator.js:9:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -479,10 +511,12 @@ hack_pipeline_operator.js:9:19 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:9:19 - │ - 9 │ |> new Bar.Foo(%) - │ ^ + 7 │ |> bar3(%) + 8 │ |> % + "!" + > 9 │ |> new Bar.Foo(%) + │ ^ + 10 │ |> await bar.bar(%) + 11 │ |> console.log(%); hack_pipeline_operator.js:10:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -490,10 +524,12 @@ hack_pipeline_operator.js:10:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:10:4 - │ - 10 │ |> await bar.bar(%) - │ ^ + 8 │ |> % + "!" + 9 │ |> new Bar.Foo(%) + > 10 │ |> await bar.bar(%) + │ ^ + 11 │ |> console.log(%); + 12 │ hack_pipeline_operator.js:10:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -501,10 +537,12 @@ hack_pipeline_operator.js:10:20 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:10:20 - │ - 10 │ |> await bar.bar(%) - │ ^ + 8 │ |> % + "!" + 9 │ |> new Bar.Foo(%) + > 10 │ |> await bar.bar(%) + │ ^ + 11 │ |> console.log(%); + 12 │ hack_pipeline_operator.js:10:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -512,10 +550,12 @@ hack_pipeline_operator.js:10:21 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:10:21 - │ - 10 │ |> await bar.bar(%) - │ ^ + 8 │ |> % + "!" + 9 │ |> new Bar.Foo(%) + > 10 │ |> await bar.bar(%) + │ ^ + 11 │ |> console.log(%); + 12 │ hack_pipeline_operator.js:11:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -523,10 +563,12 @@ hack_pipeline_operator.js:11:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:11:4 - │ - 11 │ |> console.log(%); - │ ^ + 9 │ |> new Bar.Foo(%) + 10 │ |> await bar.bar(%) + > 11 │ |> console.log(%); + │ ^ + 12 │ + 13 │ const result = "hello" hack_pipeline_operator.js:11:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -534,10 +576,12 @@ hack_pipeline_operator.js:11:18 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:11:18 - │ - 11 │ |> console.log(%); - │ ^ + 9 │ |> new Bar.Foo(%) + 10 │ |> await bar.bar(%) + > 11 │ |> console.log(%); + │ ^ + 12 │ + 13 │ const result = "hello" hack_pipeline_operator.js:11:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -545,10 +589,12 @@ hack_pipeline_operator.js:11:19 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:11:19 - │ - 11 │ |> console.log(%); - │ ^ + 9 │ |> new Bar.Foo(%) + 10 │ |> await bar.bar(%) + > 11 │ |> console.log(%); + │ ^ + 12 │ + 13 │ const result = "hello" hack_pipeline_operator.js:14:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -556,10 +602,11 @@ hack_pipeline_operator.js:14:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:14:4 - │ - 14 │ |> doubleSay(%) - │ ^ + 13 │ const result = "hello" + > 14 │ |> doubleSay(%) + │ ^ + 15 │ |> capitalize(%, "foo") + 16 │ |> exclaim(%); hack_pipeline_operator.js:14:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -567,10 +614,11 @@ hack_pipeline_operator.js:14:16 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:14:16 - │ - 14 │ |> doubleSay(%) - │ ^ + 13 │ const result = "hello" + > 14 │ |> doubleSay(%) + │ ^ + 15 │ |> capitalize(%, "foo") + 16 │ |> exclaim(%); hack_pipeline_operator.js:14:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -578,10 +626,11 @@ hack_pipeline_operator.js:14:17 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:14:17 - │ - 14 │ |> doubleSay(%) - │ ^ + 13 │ const result = "hello" + > 14 │ |> doubleSay(%) + │ ^ + 15 │ |> capitalize(%, "foo") + 16 │ |> exclaim(%); hack_pipeline_operator.js:15:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -589,10 +638,12 @@ hack_pipeline_operator.js:15:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:15:4 - │ - 15 │ |> capitalize(%, "foo") - │ ^ + 13 │ const result = "hello" + 14 │ |> doubleSay(%) + > 15 │ |> capitalize(%, "foo") + │ ^ + 16 │ |> exclaim(%); + 17 │ hack_pipeline_operator.js:15:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -600,10 +651,12 @@ hack_pipeline_operator.js:15:17 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:15:17 - │ - 15 │ |> capitalize(%, "foo") - │ ^ + 13 │ const result = "hello" + 14 │ |> doubleSay(%) + > 15 │ |> capitalize(%, "foo") + │ ^ + 16 │ |> exclaim(%); + 17 │ hack_pipeline_operator.js:15:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -611,10 +664,12 @@ hack_pipeline_operator.js:15:18 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:15:18 - │ - 15 │ |> capitalize(%, "foo") - │ ^ + 13 │ const result = "hello" + 14 │ |> doubleSay(%) + > 15 │ |> capitalize(%, "foo") + │ ^ + 16 │ |> exclaim(%); + 17 │ hack_pipeline_operator.js:16:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -622,10 +677,12 @@ hack_pipeline_operator.js:16:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:16:4 - │ - 16 │ |> exclaim(%); - │ ^ + 14 │ |> doubleSay(%) + 15 │ |> capitalize(%, "foo") + > 16 │ |> exclaim(%); + │ ^ + 17 │ + 18 │ function createPerson (attrs) { hack_pipeline_operator.js:16:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -633,10 +690,12 @@ hack_pipeline_operator.js:16:14 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:16:14 - │ - 16 │ |> exclaim(%); - │ ^ + 14 │ |> doubleSay(%) + 15 │ |> capitalize(%, "foo") + > 16 │ |> exclaim(%); + │ ^ + 17 │ + 18 │ function createPerson (attrs) { hack_pipeline_operator.js:16:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -644,10 +703,12 @@ hack_pipeline_operator.js:16:15 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:16:15 - │ - 16 │ |> exclaim(%); - │ ^ + 14 │ |> doubleSay(%) + 15 │ |> capitalize(%, "foo") + > 16 │ |> exclaim(%); + │ ^ + 17 │ + 18 │ function createPerson (attrs) { hack_pipeline_operator.js:20:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -655,10 +716,12 @@ hack_pipeline_operator.js:20:6 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:20:6 - │ - 20 │ |> foo(%) - │ ^ + 18 │ function createPerson (attrs) { + 19 │ attrs + > 20 │ |> foo(%) + │ ^ + 21 │ |> foo(%) + 22 │ |> Person.insertIntoDatabase(%); hack_pipeline_operator.js:20:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -666,10 +729,12 @@ hack_pipeline_operator.js:20:12 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:20:12 - │ - 20 │ |> foo(%) - │ ^ + 18 │ function createPerson (attrs) { + 19 │ attrs + > 20 │ |> foo(%) + │ ^ + 21 │ |> foo(%) + 22 │ |> Person.insertIntoDatabase(%); hack_pipeline_operator.js:20:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -677,10 +742,12 @@ hack_pipeline_operator.js:20:13 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:20:13 - │ - 20 │ |> foo(%) - │ ^ + 18 │ function createPerson (attrs) { + 19 │ attrs + > 20 │ |> foo(%) + │ ^ + 21 │ |> foo(%) + 22 │ |> Person.insertIntoDatabase(%); hack_pipeline_operator.js:21:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -688,10 +755,12 @@ hack_pipeline_operator.js:21:6 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:21:6 - │ - 21 │ |> foo(%) - │ ^ + 19 │ attrs + 20 │ |> foo(%) + > 21 │ |> foo(%) + │ ^ + 22 │ |> Person.insertIntoDatabase(%); + 23 │ } hack_pipeline_operator.js:21:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -699,10 +768,12 @@ hack_pipeline_operator.js:21:12 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:21:12 - │ - 21 │ |> foo(%) - │ ^ + 19 │ attrs + 20 │ |> foo(%) + > 21 │ |> foo(%) + │ ^ + 22 │ |> Person.insertIntoDatabase(%); + 23 │ } hack_pipeline_operator.js:21:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -710,10 +781,12 @@ hack_pipeline_operator.js:21:13 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:21:13 - │ - 21 │ |> foo(%) - │ ^ + 19 │ attrs + 20 │ |> foo(%) + > 21 │ |> foo(%) + │ ^ + 22 │ |> Person.insertIntoDatabase(%); + 23 │ } hack_pipeline_operator.js:22:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -721,10 +794,12 @@ hack_pipeline_operator.js:22:6 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:22:6 - │ - 22 │ |> Person.insertIntoDatabase(%); - │ ^ + 20 │ |> foo(%) + 21 │ |> foo(%) + > 22 │ |> Person.insertIntoDatabase(%); + │ ^ + 23 │ } + 24 │ hack_pipeline_operator.js:22:34 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -732,10 +807,12 @@ hack_pipeline_operator.js:22:34 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:22:34 - │ - 22 │ |> Person.insertIntoDatabase(%); - │ ^ + 20 │ |> foo(%) + 21 │ |> foo(%) + > 22 │ |> Person.insertIntoDatabase(%); + │ ^ + 23 │ } + 24 │ hack_pipeline_operator.js:22:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -743,10 +820,12 @@ hack_pipeline_operator.js:22:35 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:22:35 - │ - 22 │ |> Person.insertIntoDatabase(%); - │ ^ + 20 │ |> foo(%) + 21 │ |> foo(%) + > 22 │ |> Person.insertIntoDatabase(%); + │ ^ + 23 │ } + 24 │ hack_pipeline_operator.js:26:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -754,10 +833,11 @@ hack_pipeline_operator.js:26:3 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:26:3 - │ - 26 │ |> %.map(a => a * 2 ) - │ ^ + 25 │ const result = [1,2,3] + > 26 │ |> %.map(a => a * 2 ) + │ ^ + 27 │ |> %.filter(a => a > 5) + 28 │ |> %.reduce((sum, a) => a+sum, 0) hack_pipeline_operator.js:26:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -765,10 +845,11 @@ hack_pipeline_operator.js:26:5 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:26:5 - │ - 26 │ |> %.map(a => a * 2 ) - │ ^ + 25 │ const result = [1,2,3] + > 26 │ |> %.map(a => a * 2 ) + │ ^ + 27 │ |> %.filter(a => a > 5) + 28 │ |> %.reduce((sum, a) => a+sum, 0) hack_pipeline_operator.js:26:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -776,10 +857,11 @@ hack_pipeline_operator.js:26:6 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:26:6 - │ - 26 │ |> %.map(a => a * 2 ) - │ ^ + 25 │ const result = [1,2,3] + > 26 │ |> %.map(a => a * 2 ) + │ ^ + 27 │ |> %.filter(a => a > 5) + 28 │ |> %.reduce((sum, a) => a+sum, 0) hack_pipeline_operator.js:33:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -787,10 +869,11 @@ hack_pipeline_operator.js:33:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:33:4 - │ - 33 │ |> map(%, event => event.target.value) - │ ^ + 32 │ const searchResults$ = fromEvent(document.querySelector('input'), 'input') + > 33 │ |> map(%, event => event.target.value) + │ ^ + 34 │ |> filter(%, searchText => searchText.length > 2) + 35 │ |> debounce(%, 300) hack_pipeline_operator.js:33:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -798,10 +881,11 @@ hack_pipeline_operator.js:33:10 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:33:10 - │ - 33 │ |> map(%, event => event.target.value) - │ ^ + 32 │ const searchResults$ = fromEvent(document.querySelector('input'), 'input') + > 33 │ |> map(%, event => event.target.value) + │ ^ + 34 │ |> filter(%, searchText => searchText.length > 2) + 35 │ |> debounce(%, 300) hack_pipeline_operator.js:33:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -809,10 +893,11 @@ hack_pipeline_operator.js:33:11 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:33:11 - │ - 33 │ |> map(%, event => event.target.value) - │ ^ + 32 │ const searchResults$ = fromEvent(document.querySelector('input'), 'input') + > 33 │ |> map(%, event => event.target.value) + │ ^ + 34 │ |> filter(%, searchText => searchText.length > 2) + 35 │ |> debounce(%, 300) hack_pipeline_operator.js:34:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -820,10 +905,12 @@ hack_pipeline_operator.js:34:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:34:4 - │ - 34 │ |> filter(%, searchText => searchText.length > 2) - │ ^ + 32 │ const searchResults$ = fromEvent(document.querySelector('input'), 'input') + 33 │ |> map(%, event => event.target.value) + > 34 │ |> filter(%, searchText => searchText.length > 2) + │ ^ + 35 │ |> debounce(%, 300) + 36 │ |> distinctUntilChanged(%) hack_pipeline_operator.js:34:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -831,10 +918,12 @@ hack_pipeline_operator.js:34:13 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:34:13 - │ - 34 │ |> filter(%, searchText => searchText.length > 2) - │ ^ + 32 │ const searchResults$ = fromEvent(document.querySelector('input'), 'input') + 33 │ |> map(%, event => event.target.value) + > 34 │ |> filter(%, searchText => searchText.length > 2) + │ ^ + 35 │ |> debounce(%, 300) + 36 │ |> distinctUntilChanged(%) hack_pipeline_operator.js:34:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -842,10 +931,12 @@ hack_pipeline_operator.js:34:14 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:34:14 - │ - 34 │ |> filter(%, searchText => searchText.length > 2) - │ ^ + 32 │ const searchResults$ = fromEvent(document.querySelector('input'), 'input') + 33 │ |> map(%, event => event.target.value) + > 34 │ |> filter(%, searchText => searchText.length > 2) + │ ^ + 35 │ |> debounce(%, 300) + 36 │ |> distinctUntilChanged(%) hack_pipeline_operator.js:35:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -853,10 +944,12 @@ hack_pipeline_operator.js:35:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:35:4 - │ - 35 │ |> debounce(%, 300) - │ ^ + 33 │ |> map(%, event => event.target.value) + 34 │ |> filter(%, searchText => searchText.length > 2) + > 35 │ |> debounce(%, 300) + │ ^ + 36 │ |> distinctUntilChanged(%) + 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) hack_pipeline_operator.js:35:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -864,10 +957,12 @@ hack_pipeline_operator.js:35:15 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:35:15 - │ - 35 │ |> debounce(%, 300) - │ ^ + 33 │ |> map(%, event => event.target.value) + 34 │ |> filter(%, searchText => searchText.length > 2) + > 35 │ |> debounce(%, 300) + │ ^ + 36 │ |> distinctUntilChanged(%) + 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) hack_pipeline_operator.js:35:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -875,10 +970,12 @@ hack_pipeline_operator.js:35:16 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:35:16 - │ - 35 │ |> debounce(%, 300) - │ ^ + 33 │ |> map(%, event => event.target.value) + 34 │ |> filter(%, searchText => searchText.length > 2) + > 35 │ |> debounce(%, 300) + │ ^ + 36 │ |> distinctUntilChanged(%) + 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) hack_pipeline_operator.js:36:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -886,10 +983,12 @@ hack_pipeline_operator.js:36:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:36:4 - │ - 36 │ |> distinctUntilChanged(%) - │ ^ + 34 │ |> filter(%, searchText => searchText.length > 2) + 35 │ |> debounce(%, 300) + > 36 │ |> distinctUntilChanged(%) + │ ^ + 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) + 38 │ |> share(%); hack_pipeline_operator.js:36:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -897,10 +996,12 @@ hack_pipeline_operator.js:36:27 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:36:27 - │ - 36 │ |> distinctUntilChanged(%) - │ ^ + 34 │ |> filter(%, searchText => searchText.length > 2) + 35 │ |> debounce(%, 300) + > 36 │ |> distinctUntilChanged(%) + │ ^ + 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) + 38 │ |> share(%); hack_pipeline_operator.js:36:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -908,10 +1009,12 @@ hack_pipeline_operator.js:36:28 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:36:28 - │ - 36 │ |> distinctUntilChanged(%) - │ ^ + 34 │ |> filter(%, searchText => searchText.length > 2) + 35 │ |> debounce(%, 300) + > 36 │ |> distinctUntilChanged(%) + │ ^ + 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) + 38 │ |> share(%); hack_pipeline_operator.js:37:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -919,10 +1022,12 @@ hack_pipeline_operator.js:37:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:37:4 - │ - 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) - │ ^ + 35 │ |> debounce(%, 300) + 36 │ |> distinctUntilChanged(%) + > 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) + │ ^ + 38 │ |> share(%); + 39 │ hack_pipeline_operator.js:37:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -930,10 +1035,12 @@ hack_pipeline_operator.js:37:16 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:37:16 - │ - 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) - │ ^ + 35 │ |> debounce(%, 300) + 36 │ |> distinctUntilChanged(%) + > 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) + │ ^ + 38 │ |> share(%); + 39 │ hack_pipeline_operator.js:37:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -941,10 +1048,12 @@ hack_pipeline_operator.js:37:17 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:37:17 - │ - 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) - │ ^ + 35 │ |> debounce(%, 300) + 36 │ |> distinctUntilChanged(%) + > 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) + │ ^ + 38 │ |> share(%); + 39 │ hack_pipeline_operator.js:37:55 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -952,10 +1061,12 @@ hack_pipeline_operator.js:37:55 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:37:55 - │ - 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) - │ ^ + 35 │ |> debounce(%, 300) + 36 │ |> distinctUntilChanged(%) + > 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) + │ ^ + 38 │ |> share(%); + 39 │ hack_pipeline_operator.js:37:63 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -963,10 +1074,12 @@ hack_pipeline_operator.js:37:63 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:37:63 - │ - 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) - │ ^ + 35 │ |> debounce(%, 300) + 36 │ |> distinctUntilChanged(%) + > 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) + │ ^ + 38 │ |> share(%); + 39 │ hack_pipeline_operator.js:37:64 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -974,10 +1087,12 @@ hack_pipeline_operator.js:37:64 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:37:64 - │ - 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) - │ ^ + 35 │ |> debounce(%, 300) + 36 │ |> distinctUntilChanged(%) + > 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) + │ ^ + 38 │ |> share(%); + 39 │ hack_pipeline_operator.js:38:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -985,10 +1100,12 @@ hack_pipeline_operator.js:38:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:38:4 - │ - 38 │ |> share(%); - │ ^ + 36 │ |> distinctUntilChanged(%) + 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) + > 38 │ |> share(%); + │ ^ + 39 │ + 40 │ v |> %.method() |> f(%); hack_pipeline_operator.js:38:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -996,10 +1113,12 @@ hack_pipeline_operator.js:38:12 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:38:12 - │ - 38 │ |> share(%); - │ ^ + 36 │ |> distinctUntilChanged(%) + 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) + > 38 │ |> share(%); + │ ^ + 39 │ + 40 │ v |> %.method() |> f(%); hack_pipeline_operator.js:38:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1007,10 +1126,12 @@ hack_pipeline_operator.js:38:13 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:38:13 - │ - 38 │ |> share(%); - │ ^ + 36 │ |> distinctUntilChanged(%) + 37 │ |> switchMap(%, searchText => queryApi(searchText) |> retry(%, 3)) + > 38 │ |> share(%); + │ ^ + 39 │ + 40 │ v |> %.method() |> f(%); hack_pipeline_operator.js:40:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1018,10 +1139,12 @@ hack_pipeline_operator.js:40:4 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:40:4 - │ - 40 │ v |> %.method() |> f(%); - │ ^ + 38 │ |> share(%); + 39 │ + > 40 │ v |> %.method() |> f(%); + │ ^ + 41 │ + 42 │ async function * f () { hack_pipeline_operator.js:40:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1029,10 +1152,12 @@ hack_pipeline_operator.js:40:6 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:40:6 - │ - 40 │ v |> %.method() |> f(%); - │ ^ + 38 │ |> share(%); + 39 │ + > 40 │ v |> %.method() |> f(%); + │ ^ + 41 │ + 42 │ async function * f () { hack_pipeline_operator.js:40:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1040,10 +1165,12 @@ hack_pipeline_operator.js:40:7 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:40:7 - │ - 40 │ v |> %.method() |> f(%); - │ ^ + 38 │ |> share(%); + 39 │ + > 40 │ v |> %.method() |> f(%); + │ ^ + 41 │ + 42 │ async function * f () { hack_pipeline_operator.js:44:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1051,10 +1178,12 @@ hack_pipeline_operator.js:44:6 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ hack_pipeline_operator.js:44:6 - │ - 44 │ |> (yield %) - │ ^ + 42 │ async function * f () { + 43 │ return x + > 44 │ |> (yield %) + │ ^ + 45 │ |> (await %) + 46 │ |> y(%) hack_pipeline_operator.js:44:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1062,10 +1191,12 @@ hack_pipeline_operator.js:44:15 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ hack_pipeline_operator.js:44:15 - │ - 44 │ |> (yield %) - │ ^ + 42 │ async function * f () { + 43 │ return x + > 44 │ |> (yield %) + │ ^ + 45 │ |> (await %) + 46 │ |> y(%) hack_pipeline_operator.js:44:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -1073,10 +1204,12 @@ hack_pipeline_operator.js:44:16 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ hack_pipeline_operator.js:44:16 - │ - 44 │ |> (yield %) - │ ^ + 42 │ async function * f () { + 43 │ return x + > 44 │ |> (yield %) + │ ^ + 45 │ |> (await %) + 46 │ |> y(%) ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/minimal_pipeline_operator.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/minimal_pipeline_operator.js.snap index 462a3edeb21..e720e860bd9 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/minimal_pipeline_operator.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/minimal_pipeline_operator.js.snap @@ -205,10 +205,10 @@ minimal_pipeline_operator.js:1:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:1:4 - │ - 1 │ a |> b |> c; - │ ^ + > 1 │ a |> b |> c; + │ ^ + 2 │ + 3 │ a |> (b |> c); minimal_pipeline_operator.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -216,10 +216,10 @@ minimal_pipeline_operator.js:1:9 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:1:9 - │ - 1 │ a |> b |> c; - │ ^ + > 1 │ a |> b |> c; + │ ^ + 2 │ + 3 │ a |> (b |> c); minimal_pipeline_operator.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -227,10 +227,12 @@ minimal_pipeline_operator.js:3:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:3:4 - │ - 3 │ a |> (b |> c); - │ ^ + 1 │ a |> b |> c; + 2 │ + > 3 │ a |> (b |> c); + │ ^ + 4 │ + 5 │ (a |> b) || c; minimal_pipeline_operator.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -238,10 +240,12 @@ minimal_pipeline_operator.js:3:10 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:3:10 - │ - 3 │ a |> (b |> c); - │ ^ + 1 │ a |> b |> c; + 2 │ + > 3 │ a |> (b |> c); + │ ^ + 4 │ + 5 │ (a |> b) || c; minimal_pipeline_operator.js:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -249,10 +253,12 @@ minimal_pipeline_operator.js:5:5 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:5:5 - │ - 5 │ (a |> b) || c; - │ ^ + 3 │ a |> (b |> c); + 4 │ + > 5 │ (a |> b) || c; + │ ^ + 6 │ a |> (b || c); + 7 │ minimal_pipeline_operator.js:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -260,10 +266,11 @@ minimal_pipeline_operator.js:6:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:6:4 - │ - 6 │ a |> (b || c); - │ ^ + 5 │ (a |> b) || c; + > 6 │ a |> (b || c); + │ ^ + 7 │ + 8 │ let result = "hello" minimal_pipeline_operator.js:9:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -271,10 +278,11 @@ minimal_pipeline_operator.js:9:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:9:4 - │ - 9 │ |> doubleSay - │ ^ + 8 │ let result = "hello" + > 9 │ |> doubleSay + │ ^ + 10 │ |> capitalize + 11 │ |> exclaim; minimal_pipeline_operator.js:10:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -282,10 +290,12 @@ minimal_pipeline_operator.js:10:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:10:4 - │ - 10 │ |> capitalize - │ ^ + 8 │ let result = "hello" + 9 │ |> doubleSay + > 10 │ |> capitalize + │ ^ + 11 │ |> exclaim; + 12 │ minimal_pipeline_operator.js:11:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -293,10 +303,12 @@ minimal_pipeline_operator.js:11:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:11:4 - │ - 11 │ |> exclaim; - │ ^ + 9 │ |> doubleSay + 10 │ |> capitalize + > 11 │ |> exclaim; + │ ^ + 12 │ + 13 │ let newScore = person.score minimal_pipeline_operator.js:14:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -304,10 +316,11 @@ minimal_pipeline_operator.js:14:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:14:4 - │ - 14 │ |> double - │ ^ + 13 │ let newScore = person.score + > 14 │ |> double + │ ^ + 15 │ |> (_ => add(7, _)) + 16 │ |> (_ => subtract(2, _)) minimal_pipeline_operator.js:15:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -315,10 +328,12 @@ minimal_pipeline_operator.js:15:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:15:4 - │ - 15 │ |> (_ => add(7, _)) - │ ^ + 13 │ let newScore = person.score + 14 │ |> double + > 15 │ |> (_ => add(7, _)) + │ ^ + 16 │ |> (_ => subtract(2, _)) + 17 │ |> (_ => boundScore(0, 100, _)); minimal_pipeline_operator.js:16:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -326,10 +341,12 @@ minimal_pipeline_operator.js:16:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:16:4 - │ - 16 │ |> (_ => subtract(2, _)) - │ ^ + 14 │ |> double + 15 │ |> (_ => add(7, _)) + > 16 │ |> (_ => subtract(2, _)) + │ ^ + 17 │ |> (_ => boundScore(0, 100, _)); + 18 │ minimal_pipeline_operator.js:17:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -337,10 +354,12 @@ minimal_pipeline_operator.js:17:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:17:4 - │ - 17 │ |> (_ => boundScore(0, 100, _)); - │ ^ + 15 │ |> (_ => add(7, _)) + 16 │ |> (_ => subtract(2, _)) + > 17 │ |> (_ => boundScore(0, 100, _)); + │ ^ + 18 │ + 19 │ function createPerson (attrs) { minimal_pipeline_operator.js:21:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -348,10 +367,12 @@ minimal_pipeline_operator.js:21:6 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:21:6 - │ - 21 │ |> bounded('age', 1, 100) - │ ^ + 19 │ function createPerson (attrs) { + 20 │ attrs + > 21 │ |> bounded('age', 1, 100) + │ ^ + 22 │ |> format('name', /^[a-z]$/i) + 23 │ |> Person.insertIntoDatabase; minimal_pipeline_operator.js:22:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -359,10 +380,12 @@ minimal_pipeline_operator.js:22:6 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:22:6 - │ - 22 │ |> format('name', /^[a-z]$/i) - │ ^ + 20 │ attrs + 21 │ |> bounded('age', 1, 100) + > 22 │ |> format('name', /^[a-z]$/i) + │ ^ + 23 │ |> Person.insertIntoDatabase; + 24 │ } minimal_pipeline_operator.js:23:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -370,10 +393,12 @@ minimal_pipeline_operator.js:23:6 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:23:6 - │ - 23 │ |> Person.insertIntoDatabase; - │ ^ + 21 │ |> bounded('age', 1, 100) + 22 │ |> format('name', /^[a-z]$/i) + > 23 │ |> Person.insertIntoDatabase; + │ ^ + 24 │ } + 25 │ minimal_pipeline_operator.js:26:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -381,10 +406,12 @@ minimal_pipeline_operator.js:26:6 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:26:6 - │ - 26 │ foo |> (bar ?? baz); - │ ^ + 24 │ } + 25 │ + > 26 │ foo |> (bar ?? baz); + │ ^ + 27 │ (foo |> bar) ?? baz; + 28 │ minimal_pipeline_operator.js:27:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -392,10 +419,11 @@ minimal_pipeline_operator.js:27:7 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:27:7 - │ - 27 │ (foo |> bar) ?? baz; - │ ^ + 26 │ foo |> (bar ?? baz); + > 27 │ (foo |> bar) ?? baz; + │ ^ + 28 │ + 29 │ const result = [1,2,3] minimal_pipeline_operator.js:30:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -403,10 +431,11 @@ minimal_pipeline_operator.js:30:3 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:30:3 - │ - 30 │ |> map(a => a * 2) - │ ^ + 29 │ const result = [1,2,3] + > 30 │ |> map(a => a * 2) + │ ^ + 31 │ |> filter(a => a > 5) + 32 │ |> reduce((sum, a) => a+sum, 0) minimal_pipeline_operator.js:31:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -414,10 +443,12 @@ minimal_pipeline_operator.js:31:3 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:31:3 - │ - 31 │ |> filter(a => a > 5) - │ ^ + 29 │ const result = [1,2,3] + 30 │ |> map(a => a * 2) + > 31 │ |> filter(a => a > 5) + │ ^ + 32 │ |> reduce((sum, a) => a+sum, 0) + 33 │ |> increment minimal_pipeline_operator.js:32:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -425,10 +456,12 @@ minimal_pipeline_operator.js:32:3 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:32:3 - │ - 32 │ |> reduce((sum, a) => a+sum, 0) - │ ^ + 30 │ |> map(a => a * 2) + 31 │ |> filter(a => a > 5) + > 32 │ |> reduce((sum, a) => a+sum, 0) + │ ^ + 33 │ |> increment + 34 │ |> add(3) minimal_pipeline_operator.js:33:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -436,10 +469,12 @@ minimal_pipeline_operator.js:33:3 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:33:3 - │ - 33 │ |> increment - │ ^ + 31 │ |> filter(a => a > 5) + 32 │ |> reduce((sum, a) => a+sum, 0) + > 33 │ |> increment + │ ^ + 34 │ |> add(3) + 35 │ minimal_pipeline_operator.js:34:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -447,10 +482,12 @@ minimal_pipeline_operator.js:34:3 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:34:3 - │ - 34 │ |> add(3) - │ ^ + 32 │ |> reduce((sum, a) => a+sum, 0) + 33 │ |> increment + > 34 │ |> add(3) + │ ^ + 35 │ + 36 │ const searchResults$ = fromEvent(document.querySelector('input'), 'input') minimal_pipeline_operator.js:37:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -458,10 +495,11 @@ minimal_pipeline_operator.js:37:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:37:4 - │ - 37 │ |> map(event => event.target.value) - │ ^ + 36 │ const searchResults$ = fromEvent(document.querySelector('input'), 'input') + > 37 │ |> map(event => event.target.value) + │ ^ + 38 │ |> filter(searchText => searchText.length > 2) + 39 │ |> debounce(300) minimal_pipeline_operator.js:38:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -469,10 +507,12 @@ minimal_pipeline_operator.js:38:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:38:4 - │ - 38 │ |> filter(searchText => searchText.length > 2) - │ ^ + 36 │ const searchResults$ = fromEvent(document.querySelector('input'), 'input') + 37 │ |> map(event => event.target.value) + > 38 │ |> filter(searchText => searchText.length > 2) + │ ^ + 39 │ |> debounce(300) + 40 │ |> distinctUntilChanged() minimal_pipeline_operator.js:39:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -480,10 +520,12 @@ minimal_pipeline_operator.js:39:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:39:4 - │ - 39 │ |> debounce(300) - │ ^ + 37 │ |> map(event => event.target.value) + 38 │ |> filter(searchText => searchText.length > 2) + > 39 │ |> debounce(300) + │ ^ + 40 │ |> distinctUntilChanged() + 41 │ |> switchMap(searchText => queryApi(searchText) |> retry(3)) minimal_pipeline_operator.js:40:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -491,10 +533,12 @@ minimal_pipeline_operator.js:40:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:40:4 - │ - 40 │ |> distinctUntilChanged() - │ ^ + 38 │ |> filter(searchText => searchText.length > 2) + 39 │ |> debounce(300) + > 40 │ |> distinctUntilChanged() + │ ^ + 41 │ |> switchMap(searchText => queryApi(searchText) |> retry(3)) + 42 │ |> share(); minimal_pipeline_operator.js:41:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -502,10 +546,12 @@ minimal_pipeline_operator.js:41:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:41:4 - │ - 41 │ |> switchMap(searchText => queryApi(searchText) |> retry(3)) - │ ^ + 39 │ |> debounce(300) + 40 │ |> distinctUntilChanged() + > 41 │ |> switchMap(searchText => queryApi(searchText) |> retry(3)) + │ ^ + 42 │ |> share(); + 43 │ minimal_pipeline_operator.js:41:52 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -513,10 +559,12 @@ minimal_pipeline_operator.js:41:52 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:41:52 - │ - 41 │ |> switchMap(searchText => queryApi(searchText) |> retry(3)) - │ ^ + 39 │ |> debounce(300) + 40 │ |> distinctUntilChanged() + > 41 │ |> switchMap(searchText => queryApi(searchText) |> retry(3)) + │ ^ + 42 │ |> share(); + 43 │ minimal_pipeline_operator.js:42:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -524,10 +572,12 @@ minimal_pipeline_operator.js:42:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:42:4 - │ - 42 │ |> share(); - │ ^ + 40 │ |> distinctUntilChanged() + 41 │ |> switchMap(searchText => queryApi(searchText) |> retry(3)) + > 42 │ |> share(); + │ ^ + 43 │ + 44 │ const result = [5,10] minimal_pipeline_operator.js:45:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -535,10 +585,11 @@ minimal_pipeline_operator.js:45:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:45:4 - │ - 45 │ |> (_ => _.map(x => x * 2)) - │ ^ + 44 │ const result = [5,10] + > 45 │ |> (_ => _.map(x => x * 2)) + │ ^ + 46 │ |> (_ => _.reduce( (a,b) => a + b )) + 47 │ |> (sum => sum + 1) minimal_pipeline_operator.js:46:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -546,10 +597,12 @@ minimal_pipeline_operator.js:46:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:46:4 - │ - 46 │ |> (_ => _.reduce( (a,b) => a + b )) - │ ^ + 44 │ const result = [5,10] + 45 │ |> (_ => _.map(x => x * 2)) + > 46 │ |> (_ => _.reduce( (a,b) => a + b )) + │ ^ + 47 │ |> (sum => sum + 1) + 48 │ minimal_pipeline_operator.js:47:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -557,10 +610,12 @@ minimal_pipeline_operator.js:47:4 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:47:4 - │ - 47 │ |> (sum => sum + 1) - │ ^ + 45 │ |> (_ => _.map(x => x * 2)) + 46 │ |> (_ => _.reduce( (a,b) => a + b )) + > 47 │ |> (sum => sum + 1) + │ ^ + 48 │ + 49 │ const result2 = [4, 9].map( x => x |> inc |> double ) minimal_pipeline_operator.js:49:37 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -568,10 +623,11 @@ minimal_pipeline_operator.js:49:37 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:49:37 - │ - 49 │ const result2 = [4, 9].map( x => x |> inc |> double ) - │ ^ + 47 │ |> (sum => sum + 1) + 48 │ + > 49 │ const result2 = [4, 9].map( x => x |> inc |> double ) + │ ^ + 50 │ minimal_pipeline_operator.js:49:44 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -579,10 +635,11 @@ minimal_pipeline_operator.js:49:44 parse ━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ minimal_pipeline_operator.js:49:44 - │ - 49 │ const result2 = [4, 9].map( x => x |> inc |> double ) - │ ^ + 47 │ |> (sum => sum + 1) + 48 │ + > 49 │ const result2 = [4, 9].map( x => x |> inc |> double ) + │ ^ + 50 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/record/computed.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/record/computed.js.snap index b81c5258cbb..1d73edb0598 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/record/computed.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/record/computed.js.snap @@ -65,19 +65,21 @@ computed.js:2:9 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ computed.js:2:9 - │ - 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) - │ ^ + 1 │ const key = "a"; + > 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) + │ ^ + 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + 4 │ computed.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ computed.js:2:8 - │ - 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) - │ ^ + 1 │ const key = "a"; + > 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) + │ ^ + 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + 4 │ computed.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -85,10 +87,11 @@ computed.js:2:9 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ computed.js:2:9 - │ - 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) - │ ^ + 1 │ const key = "a"; + > 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) + │ ^ + 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + 4 │ computed.js:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -96,19 +99,21 @@ computed.js:2:27 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ computed.js:2:27 - │ - 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) - │ ^ + 1 │ const key = "a"; + > 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) + │ ^ + 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + 4 │ computed.js:2:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ computed.js:2:26 - │ - 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) - │ ^ + 1 │ const key = "a"; + > 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) + │ ^ + 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + 4 │ computed.js:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -116,10 +121,11 @@ computed.js:2:27 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ computed.js:2:27 - │ - 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) - │ ^ + 1 │ const key = "a"; + > 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) + │ ^ + 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + 4 │ computed.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -127,19 +133,23 @@ computed.js:3:9 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ computed.js:3:9 - │ - 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) - │ ^ + 1 │ const key = "a"; + 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) + > 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + │ ^ + 4 │ + 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) computed.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ computed.js:3:8 - │ - 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) - │ ^ + 1 │ const key = "a"; + 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) + > 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + │ ^ + 4 │ + 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) computed.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -147,10 +157,12 @@ computed.js:3:9 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ computed.js:3:9 - │ - 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) - │ ^ + 1 │ const key = "a"; + 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) + > 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + │ ^ + 4 │ + 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) computed.js:3:41 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -158,19 +170,23 @@ computed.js:3:41 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ computed.js:3:41 - │ - 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) - │ ^ + 1 │ const key = "a"; + 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) + > 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + │ ^ + 4 │ + 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) computed.js:3:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ computed.js:3:40 - │ - 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) - │ ^ + 1 │ const key = "a"; + 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) + > 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + │ ^ + 4 │ + 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) computed.js:3:41 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -178,10 +194,12 @@ computed.js:3:41 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ computed.js:3:41 - │ - 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) - │ ^ + 1 │ const key = "a"; + 2 │ assert(#{ [key]: 1 } === #{ a: 1 }) + > 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + │ ^ + 4 │ + 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) computed.js:5:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -189,19 +207,23 @@ computed.js:5:9 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ computed.js:5:9 - │ - 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) - │ ^ + 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + 4 │ + > 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) + │ ^ + 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + 7 │ computed.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ computed.js:5:8 - │ - 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) - │ ^ + 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + 4 │ + > 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) + │ ^ + 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + 7 │ computed.js:5:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -209,10 +231,12 @@ computed.js:5:9 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ computed.js:5:9 - │ - 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) - │ ^ + 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + 4 │ + > 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) + │ ^ + 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + 7 │ computed.js:5:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -220,19 +244,23 @@ computed.js:5:28 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ computed.js:5:28 - │ - 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) - │ ^ + 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + 4 │ + > 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) + │ ^ + 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + 7 │ computed.js:5:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ computed.js:5:27 - │ - 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) - │ ^ + 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + 4 │ + > 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) + │ ^ + 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + 7 │ computed.js:5:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -240,10 +268,12 @@ computed.js:5:28 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ computed.js:5:28 - │ - 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) - │ ^ + 3 │ assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + 4 │ + > 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) + │ ^ + 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + 7 │ computed.js:6:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -251,19 +281,21 @@ computed.js:6:9 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ computed.js:6:9 - │ - 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) - │ ^ + 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) + > 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + │ ^ + 7 │ + 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) computed.js:6:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ computed.js:6:8 - │ - 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) - │ ^ + 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) + > 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + │ ^ + 7 │ + 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) computed.js:6:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -271,10 +303,11 @@ computed.js:6:9 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ computed.js:6:9 - │ - 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) - │ ^ + 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) + > 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + │ ^ + 7 │ + 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) computed.js:6:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -282,19 +315,21 @@ computed.js:6:28 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ computed.js:6:28 - │ - 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) - │ ^ + 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) + > 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + │ ^ + 7 │ + 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) computed.js:6:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ computed.js:6:27 - │ - 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) - │ ^ + 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) + > 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + │ ^ + 7 │ + 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) computed.js:6:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -302,10 +337,11 @@ computed.js:6:28 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ computed.js:6:28 - │ - 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) - │ ^ + 5 │ assert(#{ [true]: 1 } === #{ true: 1 }) + > 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + │ ^ + 7 │ + 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) computed.js:8:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -313,19 +349,23 @@ computed.js:8:9 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ computed.js:8:9 - │ - 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) - │ ^ + 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + 7 │ + > 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) + │ ^ + 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) + 10 │ computed.js:8:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ computed.js:8:8 - │ - 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) - │ ^ + 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + 7 │ + > 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) + │ ^ + 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) + 10 │ computed.js:8:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -333,10 +373,12 @@ computed.js:8:9 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ computed.js:8:9 - │ - 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) - │ ^ + 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + 7 │ + > 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) + │ ^ + 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) + 10 │ computed.js:8:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -344,19 +386,23 @@ computed.js:8:33 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ computed.js:8:33 - │ - 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) - │ ^ + 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + 7 │ + > 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) + │ ^ + 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) + 10 │ computed.js:8:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ computed.js:8:32 - │ - 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) - │ ^ + 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + 7 │ + > 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) + │ ^ + 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) + 10 │ computed.js:8:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -364,10 +410,12 @@ computed.js:8:33 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ computed.js:8:33 - │ - 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) - │ ^ + 6 │ assert(#{ [true]: 1 } === #{ ["true"]: 1 }) + 7 │ + > 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) + │ ^ + 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) + 10 │ computed.js:9:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -375,19 +423,19 @@ computed.js:9:9 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ computed.js:9:9 - │ - 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) - │ ^ + 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) + > 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) + │ ^ + 10 │ computed.js:9:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ computed.js:9:8 - │ - 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) - │ ^ + 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) + > 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) + │ ^ + 10 │ computed.js:9:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -395,10 +443,10 @@ computed.js:9:9 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ computed.js:9:9 - │ - 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) - │ ^ + 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) + > 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) + │ ^ + 10 │ computed.js:9:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -406,19 +454,19 @@ computed.js:9:33 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ computed.js:9:33 - │ - 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) - │ ^ + 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) + > 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) + │ ^ + 10 │ computed.js:9:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ computed.js:9:32 - │ - 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) - │ ^ + 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) + > 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) + │ ^ + 10 │ computed.js:9:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -426,10 +474,10 @@ computed.js:9:33 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ computed.js:9:33 - │ - 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) - │ ^ + 8 │ assert(#{ [1 + 1]: "two" } === #{ 2: "two" }) + > 9 │ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }) + │ ^ + 10 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/record/destructuring.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/record/destructuring.js.snap index 9752981a51f..bee2469b16b 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/record/destructuring.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/record/destructuring.js.snap @@ -76,19 +76,19 @@ destructuring.js:1:19 parse ━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ destructuring.js:1:19 - │ - 1 │ const { a, b } = #{ a: 1, b: 2 }; - │ ^ + > 1 │ const { a, b } = #{ a: 1, b: 2 }; + │ ^ + 2 │ assert(a === 1); + 3 │ assert(b === 2); destructuring.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ destructuring.js:1:18 - │ - 1 │ const { a, b } = #{ a: 1, b: 2 }; - │ ^ + > 1 │ const { a, b } = #{ a: 1, b: 2 }; + │ ^ + 2 │ assert(a === 1); + 3 │ assert(b === 2); destructuring.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -96,17 +96,17 @@ destructuring.js:1:19 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ destructuring.js:1:19 - │ - 1 │ const { a, b } = #{ a: 1, b: 2 }; - │ ^ + > 1 │ const { a, b } = #{ a: 1, b: 2 }; + │ ^ + 2 │ assert(a === 1); + 3 │ assert(b === 2); i ...Which is required to end this statement - ┌─ destructuring.js:1:1 - │ - 1 │ const { a, b } = #{ a: 1, b: 2 }; - │ ^^^^^^^^^^^^^^^^^^ + > 1 │ const { a, b } = #{ a: 1, b: 2 }; + │ ^^^^^^^^^^^^^^^^^^ + 2 │ assert(a === 1); + 3 │ assert(b === 2); destructuring.js:1:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -114,17 +114,17 @@ destructuring.js:1:28 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ destructuring.js:1:28 - │ - 1 │ const { a, b } = #{ a: 1, b: 2 }; - │ ^ + > 1 │ const { a, b } = #{ a: 1, b: 2 }; + │ ^ + 2 │ assert(a === 1); + 3 │ assert(b === 2); i ...Which is required to end this statement - ┌─ destructuring.js:1:24 - │ - 1 │ const { a, b } = #{ a: 1, b: 2 }; - │ ^^^^^ + > 1 │ const { a, b } = #{ a: 1, b: 2 }; + │ ^^^^^ + 2 │ assert(a === 1); + 3 │ assert(b === 2); destructuring.js:5:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -132,19 +132,23 @@ destructuring.js:5:25 parse ━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ destructuring.js:5:25 - │ - 5 │ const { a, ...rest } = #{ a: 1, b: 2, c: 3 }; - │ ^ + 3 │ assert(b === 2); + 4 │ + > 5 │ const { a, ...rest } = #{ a: 1, b: 2, c: 3 }; + │ ^ + 6 │ assert(a === 1); + 7 │ assert(typeof rest === "object"); destructuring.js:5:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ destructuring.js:5:24 - │ - 5 │ const { a, ...rest } = #{ a: 1, b: 2, c: 3 }; - │ ^ + 3 │ assert(b === 2); + 4 │ + > 5 │ const { a, ...rest } = #{ a: 1, b: 2, c: 3 }; + │ ^ + 6 │ assert(a === 1); + 7 │ assert(typeof rest === "object"); destructuring.js:5:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -152,17 +156,21 @@ destructuring.js:5:25 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ destructuring.js:5:25 - │ - 5 │ const { a, ...rest } = #{ a: 1, b: 2, c: 3 }; - │ ^ + 3 │ assert(b === 2); + 4 │ + > 5 │ const { a, ...rest } = #{ a: 1, b: 2, c: 3 }; + │ ^ + 6 │ assert(a === 1); + 7 │ assert(typeof rest === "object"); i ...Which is required to end this statement - ┌─ destructuring.js:5:1 - │ - 5 │ const { a, ...rest } = #{ a: 1, b: 2, c: 3 }; - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ assert(b === 2); + 4 │ + > 5 │ const { a, ...rest } = #{ a: 1, b: 2, c: 3 }; + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + 6 │ assert(a === 1); + 7 │ assert(typeof rest === "object"); destructuring.js:5:34 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -170,17 +178,21 @@ destructuring.js:5:34 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ destructuring.js:5:34 - │ - 5 │ const { a, ...rest } = #{ a: 1, b: 2, c: 3 }; - │ ^ + 3 │ assert(b === 2); + 4 │ + > 5 │ const { a, ...rest } = #{ a: 1, b: 2, c: 3 }; + │ ^ + 6 │ assert(a === 1); + 7 │ assert(typeof rest === "object"); i ...Which is required to end this statement - ┌─ destructuring.js:5:30 - │ - 5 │ const { a, ...rest } = #{ a: 1, b: 2, c: 3 }; - │ ^^^^^ + 3 │ assert(b === 2); + 4 │ + > 5 │ const { a, ...rest } = #{ a: 1, b: 2, c: 3 }; + │ ^^^^^ + 6 │ assert(a === 1); + 7 │ assert(typeof rest === "object"); ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/record/record.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/record/record.js.snap index c49a45f69f1..e34a5a5d5b6 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/record/record.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/record/record.js.snap @@ -88,19 +88,19 @@ record.js:1:18 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ record.js:1:18 - │ - 1 │ const record1 = #{ - │ ^ + > 1 │ const record1 = #{ + │ ^ + 2 │ a: 1, + 3 │ b: 2, record.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ record.js:1:17 - │ - 1 │ const record1 = #{ - │ ^ + > 1 │ const record1 = #{ + │ ^ + 2 │ a: 1, + 3 │ b: 2, record.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -108,17 +108,17 @@ record.js:1:18 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ record.js:1:18 - │ - 1 │ const record1 = #{ - │ ^ + > 1 │ const record1 = #{ + │ ^ + 2 │ a: 1, + 3 │ b: 2, i ...Which is required to end this statement - ┌─ record.js:1:1 - │ - 1 │ const record1 = #{ - │ ^^^^^^^^^^^^^^^^^ + > 1 │ const record1 = #{ + │ ^^^^^^^^^^^^^^^^^ + 2 │ a: 1, + 3 │ b: 2, record.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -126,19 +126,22 @@ record.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ record.js:3:6 - │ - 3 │ b: 2, - │ ^ + 1 │ const record1 = #{ + 2 │ a: 1, + > 3 │ b: 2, + │ ^ + 4 │ c: 3, + 5 │ }; i ...Which is required to end this statement - ┌─ record.js:2:8 - │ - 2 │ a: 1, - │ ┌────────^ - 3 │ │ b: 2, - │ └──────^ + 1 │ const record1 = #{ + > 2 │ a: 1, + │ ^^ + > 3 │ b: 2, + │ ^^ + 4 │ c: 3, + 5 │ }; record.js:7:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -146,19 +149,23 @@ record.js:7:18 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ record.js:7:18 - │ - 7 │ const record2 = #{...record1, b: 5}; - │ ^ + 5 │ }; + 6 │ + > 7 │ const record2 = #{...record1, b: 5}; + │ ^ + 8 │ + 9 │ assert(record1.a === 1); record.js:7:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ record.js:7:17 - │ - 7 │ const record2 = #{...record1, b: 5}; - │ ^ + 5 │ }; + 6 │ + > 7 │ const record2 = #{...record1, b: 5}; + │ ^ + 8 │ + 9 │ assert(record1.a === 1); record.js:7:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -166,17 +173,21 @@ record.js:7:18 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ record.js:7:18 - │ - 7 │ const record2 = #{...record1, b: 5}; - │ ^ + 5 │ }; + 6 │ + > 7 │ const record2 = #{...record1, b: 5}; + │ ^ + 8 │ + 9 │ assert(record1.a === 1); i ...Which is required to end this statement - ┌─ record.js:7:1 - │ - 7 │ const record2 = #{...record1, b: 5}; - │ ^^^^^^^^^^^^^^^^^ + 5 │ }; + 6 │ + > 7 │ const record2 = #{...record1, b: 5}; + │ ^^^^^^^^^^^^^^^^^ + 8 │ + 9 │ assert(record1.a === 1); record.js:7:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -184,10 +195,12 @@ record.js:7:19 parse ━━━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ record.js:7:19 - │ - 7 │ const record2 = #{...record1, b: 5}; - │ ^^^^^^^^^^^^^^^^ + 5 │ }; + 6 │ + > 7 │ const record2 = #{...record1, b: 5}; + │ ^^^^^^^^^^^^^^^^ + 8 │ + 9 │ assert(record1.a === 1); record.js:12:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -195,19 +208,23 @@ record.js:12:21 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ record.js:12:21 - │ - 12 │ assert(record2 === #{ a: 1, c: 3, b: 5 }); - │ ^ + 10 │ assert(record1["a"] === 1); + 11 │ assert(record1 !== record2); + > 12 │ assert(record2 === #{ a: 1, c: 3, b: 5 }); + │ ^ + 13 │ assert(record1?.a === 1); + 14 │ assert(record1?.d === undefined); record.js:12:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ record.js:12:20 - │ - 12 │ assert(record2 === #{ a: 1, c: 3, b: 5 }); - │ ^ + 10 │ assert(record1["a"] === 1); + 11 │ assert(record1 !== record2); + > 12 │ assert(record2 === #{ a: 1, c: 3, b: 5 }); + │ ^ + 13 │ assert(record1?.a === 1); + 14 │ assert(record1?.d === undefined); record.js:12:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -215,10 +232,12 @@ record.js:12:21 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ record.js:12:21 - │ - 12 │ assert(record2 === #{ a: 1, c: 3, b: 5 }); - │ ^ + 10 │ assert(record1["a"] === 1); + 11 │ assert(record1 !== record2); + > 12 │ assert(record2 === #{ a: 1, c: 3, b: 5 }); + │ ^ + 13 │ assert(record1?.a === 1); + 14 │ assert(record1?.d === undefined); ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/record/shorthand.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/record/shorthand.js.snap index a1c1436aebe..6e0a325a558 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/record/shorthand.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/record/shorthand.js.snap @@ -48,19 +48,21 @@ shorthand.js:2:17 parse ━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ shorthand.js:2:17 - │ - 2 │ const record = #{ url } - │ ^ + 1 │ const url = "https://github.com/tc39/proposal-record-tuple"; + > 2 │ const record = #{ url } + │ ^ + 3 │ console.log(record.url) // https://github.com/tc39/proposal-record-tuple + 4 │ shorthand.js:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ shorthand.js:2:16 - │ - 2 │ const record = #{ url } - │ ^ + 1 │ const url = "https://github.com/tc39/proposal-record-tuple"; + > 2 │ const record = #{ url } + │ ^ + 3 │ console.log(record.url) // https://github.com/tc39/proposal-record-tuple + 4 │ shorthand.js:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -68,17 +70,19 @@ shorthand.js:2:17 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ shorthand.js:2:17 - │ - 2 │ const record = #{ url } - │ ^ + 1 │ const url = "https://github.com/tc39/proposal-record-tuple"; + > 2 │ const record = #{ url } + │ ^ + 3 │ console.log(record.url) // https://github.com/tc39/proposal-record-tuple + 4 │ i ...Which is required to end this statement - ┌─ shorthand.js:2:1 - │ - 2 │ const record = #{ url } - │ ^^^^^^^^^^^^^^^^ + 1 │ const url = "https://github.com/tc39/proposal-record-tuple"; + > 2 │ const record = #{ url } + │ ^^^^^^^^^^^^^^^^ + 3 │ console.log(record.url) // https://github.com/tc39/proposal-record-tuple + 4 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/record/spread.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/record/spread.js.snap index 6adf5446702..30304fde752 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/record/spread.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/record/spread.js.snap @@ -74,19 +74,19 @@ spread.js:1:19 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ spread.js:1:19 - │ - 1 │ const formData = #{ title: "Implement all the things" } - │ ^ + > 1 │ const formData = #{ title: "Implement all the things" } + │ ^ + 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + 3 │ const taskLater = #{ ...taskNow, status: "DONE" } spread.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ spread.js:1:18 - │ - 1 │ const formData = #{ title: "Implement all the things" } - │ ^ + > 1 │ const formData = #{ title: "Implement all the things" } + │ ^ + 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + 3 │ const taskLater = #{ ...taskNow, status: "DONE" } spread.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -94,17 +94,17 @@ spread.js:1:19 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ spread.js:1:19 - │ - 1 │ const formData = #{ title: "Implement all the things" } - │ ^ + > 1 │ const formData = #{ title: "Implement all the things" } + │ ^ + 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + 3 │ const taskLater = #{ ...taskNow, status: "DONE" } i ...Which is required to end this statement - ┌─ spread.js:1:1 - │ - 1 │ const formData = #{ title: "Implement all the things" } - │ ^^^^^^^^^^^^^^^^^^ + > 1 │ const formData = #{ title: "Implement all the things" } + │ ^^^^^^^^^^^^^^^^^^ + 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + 3 │ const taskLater = #{ ...taskNow, status: "DONE" } spread.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -112,19 +112,21 @@ spread.js:2:18 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ spread.js:2:18 - │ - 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } - │ ^ + 1 │ const formData = #{ title: "Implement all the things" } + > 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + │ ^ + 3 │ const taskLater = #{ ...taskNow, status: "DONE" } + 4 │ spread.js:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ spread.js:2:17 - │ - 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } - │ ^ + 1 │ const formData = #{ title: "Implement all the things" } + > 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + │ ^ + 3 │ const taskLater = #{ ...taskNow, status: "DONE" } + 4 │ spread.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -132,17 +134,19 @@ spread.js:2:18 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ spread.js:2:18 - │ - 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } - │ ^ + 1 │ const formData = #{ title: "Implement all the things" } + > 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + │ ^ + 3 │ const taskLater = #{ ...taskNow, status: "DONE" } + 4 │ i ...Which is required to end this statement - ┌─ spread.js:2:1 - │ - 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } - │ ^^^^^^^^^^^^^^^^^ + 1 │ const formData = #{ title: "Implement all the things" } + > 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + │ ^^^^^^^^^^^^^^^^^ + 3 │ const taskLater = #{ ...taskNow, status: "DONE" } + 4 │ spread.js:2:34 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -150,17 +154,19 @@ spread.js:2:34 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ spread.js:2:34 - │ - 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } - │ ^ + 1 │ const formData = #{ title: "Implement all the things" } + > 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + │ ^ + 3 │ const taskLater = #{ ...taskNow, status: "DONE" } + 4 │ i ...Which is required to end this statement - ┌─ spread.js:2:24 - │ - 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } - │ ^^^^^^^^^^^ + 1 │ const formData = #{ title: "Implement all the things" } + > 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + │ ^^^^^^^^^^^ + 3 │ const taskLater = #{ ...taskNow, status: "DONE" } + 4 │ spread.js:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -168,19 +174,23 @@ spread.js:3:20 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ spread.js:3:20 - │ - 3 │ const taskLater = #{ ...taskNow, status: "DONE" } - │ ^ + 1 │ const formData = #{ title: "Implement all the things" } + 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + > 3 │ const taskLater = #{ ...taskNow, status: "DONE" } + │ ^ + 4 │ + 5 │ // A reminder: The ordering of keys in record literals does not affect equality (and is not retained) spread.js:3:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ spread.js:3:19 - │ - 3 │ const taskLater = #{ ...taskNow, status: "DONE" } - │ ^ + 1 │ const formData = #{ title: "Implement all the things" } + 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + > 3 │ const taskLater = #{ ...taskNow, status: "DONE" } + │ ^ + 4 │ + 5 │ // A reminder: The ordering of keys in record literals does not affect equality (and is not retained) spread.js:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -188,17 +198,21 @@ spread.js:3:20 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ spread.js:3:20 - │ - 3 │ const taskLater = #{ ...taskNow, status: "DONE" } - │ ^ + 1 │ const formData = #{ title: "Implement all the things" } + 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + > 3 │ const taskLater = #{ ...taskNow, status: "DONE" } + │ ^ + 4 │ + 5 │ // A reminder: The ordering of keys in record literals does not affect equality (and is not retained) i ...Which is required to end this statement - ┌─ spread.js:3:1 - │ - 3 │ const taskLater = #{ ...taskNow, status: "DONE" } - │ ^^^^^^^^^^^^^^^^^^^ + 1 │ const formData = #{ title: "Implement all the things" } + 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + > 3 │ const taskLater = #{ ...taskNow, status: "DONE" } + │ ^^^^^^^^^^^^^^^^^^^ + 4 │ + 5 │ // A reminder: The ordering of keys in record literals does not affect equality (and is not retained) spread.js:3:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -206,10 +220,12 @@ spread.js:3:22 parse ━━━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ spread.js:3:22 - │ - 3 │ const taskLater = #{ ...taskNow, status: "DONE" } - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ const formData = #{ title: "Implement all the things" } + 2 │ const taskNow = #{ id: 42, status: "WIP", ...formData } + > 3 │ const taskLater = #{ ...taskNow, status: "DONE" } + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ + 5 │ // A reminder: The ordering of keys in record literals does not affect equality (and is not retained) spread.js:6:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -217,19 +233,19 @@ spread.js:6:23 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ spread.js:6:23 - │ - 6 │ assert(taskLater === #{ status: "DONE", title: formData.title, id: 42 }) - │ ^ + 5 │ // A reminder: The ordering of keys in record literals does not affect equality (and is not retained) + > 6 │ assert(taskLater === #{ status: "DONE", title: formData.title, id: 42 }) + │ ^ + 7 │ spread.js:6:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ spread.js:6:22 - │ - 6 │ assert(taskLater === #{ status: "DONE", title: formData.title, id: 42 }) - │ ^ + 5 │ // A reminder: The ordering of keys in record literals does not affect equality (and is not retained) + > 6 │ assert(taskLater === #{ status: "DONE", title: formData.title, id: 42 }) + │ ^ + 7 │ spread.js:6:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -237,10 +253,10 @@ spread.js:6:23 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ spread.js:6:23 - │ - 6 │ assert(taskLater === #{ status: "DONE", title: formData.title, id: 42 }) - │ ^ + 5 │ // A reminder: The ordering of keys in record literals does not affect equality (and is not retained) + > 6 │ assert(taskLater === #{ status: "DONE", title: formData.title, id: 42 }) + │ ^ + 7 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/record/syntax.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/record/syntax.js.snap index cd3e94361c6..2a5e43bbce6 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/record/syntax.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/record/syntax.js.snap @@ -72,10 +72,10 @@ syntax.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ syntax.js:1:1 - │ - 1 │ #{} - │ ^ + > 1 │ #{} + │ ^ + 2 │ #{ a: 1, b: 2 } + 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } syntax.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -83,19 +83,21 @@ syntax.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ syntax.js:2:2 - │ - 2 │ #{ a: 1, b: 2 } - │ ^ + 1 │ #{} + > 2 │ #{ a: 1, b: 2 } + │ ^ + 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } + 4 │ syntax.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ syntax.js:2:1 - │ - 2 │ #{ a: 1, b: 2 } - │ ^ + 1 │ #{} + > 2 │ #{ a: 1, b: 2 } + │ ^ + 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } + 4 │ syntax.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -103,17 +105,19 @@ syntax.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ syntax.js:2:2 - │ - 2 │ #{ a: 1, b: 2 } - │ ^ + 1 │ #{} + > 2 │ #{ a: 1, b: 2 } + │ ^ + 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } + 4 │ i ...Which is required to end this statement - ┌─ syntax.js:2:1 - │ - 2 │ #{ a: 1, b: 2 } - │ ^^ + 1 │ #{} + > 2 │ #{ a: 1, b: 2 } + │ ^^ + 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } + 4 │ syntax.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -121,17 +125,19 @@ syntax.js:2:11 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ syntax.js:2:11 - │ - 2 │ #{ a: 1, b: 2 } - │ ^ + 1 │ #{} + > 2 │ #{ a: 1, b: 2 } + │ ^ + 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } + 4 │ i ...Which is required to end this statement - ┌─ syntax.js:2:7 - │ - 2 │ #{ a: 1, b: 2 } - │ ^^^^^ + 1 │ #{} + > 2 │ #{ a: 1, b: 2 } + │ ^^^^^ + 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } + 4 │ syntax.js:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -139,19 +145,21 @@ syntax.js:3:2 parse ━━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ syntax.js:3:2 - │ - 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } - │ ^ + 1 │ #{} + 2 │ #{ a: 1, b: 2 } + > 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } + │ ^ + 4 │ syntax.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ syntax.js:3:1 - │ - 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } - │ ^ + 1 │ #{} + 2 │ #{ a: 1, b: 2 } + > 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } + │ ^ + 4 │ syntax.js:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -159,17 +167,19 @@ syntax.js:3:2 parse ━━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ syntax.js:3:2 - │ - 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } - │ ^ + 1 │ #{} + 2 │ #{ a: 1, b: 2 } + > 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } + │ ^ + 4 │ i ...Which is required to end this statement - ┌─ syntax.js:3:1 - │ - 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } - │ ^^ + 1 │ #{} + 2 │ #{ a: 1, b: 2 } + > 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } + │ ^^ + 4 │ syntax.js:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -177,17 +187,19 @@ syntax.js:3:11 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ syntax.js:3:11 - │ - 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } - │ ^ + 1 │ #{} + 2 │ #{ a: 1, b: 2 } + > 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } + │ ^ + 4 │ i ...Which is required to end this statement - ┌─ syntax.js:3:7 - │ - 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } - │ ^^^^^ + 1 │ #{} + 2 │ #{ a: 1, b: 2 } + > 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } + │ ^^^^^ + 4 │ syntax.js:3:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -195,19 +207,20 @@ syntax.js:3:30 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ syntax.js:3:30 - │ - 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } - │ ^ + 1 │ #{} + 2 │ #{ a: 1, b: 2 } + > 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } + │ ^ + 4 │ syntax.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `!` following a `#`, but found none - ┌─ syntax.js:1:1 - │ - 1 │ #{} - │ ^ + > 1 │ #{} + │ ^ + 2 │ #{ a: 1, b: 2 } + 3 │ #{ a: 1, b: #[2, 3, #{ c: 4 }] } ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/return-outside-function/return-outside-function.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/return-outside-function/return-outside-function.js.snap index 330bab2acf8..954ec8e346f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/return-outside-function/return-outside-function.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/return-outside-function/return-outside-function.js.snap @@ -39,10 +39,9 @@ return-outside-function.js:1:1 parse ━━━━━━━━━━━━━━ × Illegal return statement outside of a function - ┌─ return-outside-function.js:1:1 - │ - 1 │ return someVeryLongStringA && someVeryLongStringB && someVeryLongStringC && someVeryLongStringD - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ return someVeryLongStringA && someVeryLongStringB && someVeryLongStringC && someVeryLongStringD + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-if.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-if.js.snap index 8ddb947a8aa..2ff5e048e93 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-if.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-if.js.snap @@ -36,10 +36,9 @@ function-declaration-in-if.js:1:12 parse ━━━━━━━━━━━━━ × wrap the function in a block statement - ┌─ function-declaration-in-if.js:1:12 - │ - 1 │ if (false) function foo(){} - │ ^^^^^^^^^^^^^^^^ + > 1 │ if (false) function foo(){} + │ ^^^^^^^^^^^^^^^^ + 2 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-while.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-while.js.snap index 08fbfb4ec32..b19223bae52 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-while.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-while.js.snap @@ -36,10 +36,9 @@ function-declaration-in-while.js:1:15 parse ━━━━━━━━━━━━ × wrap the function in a block statement - ┌─ function-declaration-in-while.js:1:15 - │ - 1 │ while (false) function foo(){} - │ ^^^^^^^^^^^^^^^^ + > 1 │ while (false) function foo(){} + │ ^^^^^^^^^^^^^^^^ + 2 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/throw_expressions/throw_expression.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/throw_expressions/throw_expression.js.snap index b018a7a28e4..245514802b1 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/throw_expressions/throw_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/throw_expressions/throw_expression.js.snap @@ -112,10 +112,10 @@ throw_expression.js:1:26 parse ━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ throw_expression.js:1:26 - │ - 1 │ function save(filename = throw new TypeError("Argument required")) {} - │ ^^^^^ + > 1 │ function save(filename = throw new TypeError("Argument required")) {} + │ ^^^^^ + 2 │ + 3 │ lint(ast, { throw_expression.js:1:36 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -123,10 +123,10 @@ throw_expression.js:1:36 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ throw_expression.js:1:36 - │ - 1 │ function save(filename = throw new TypeError("Argument required")) {} - │ ^^^^^^^^^ + > 1 │ function save(filename = throw new TypeError("Argument required")) {} + │ ^^^^^^^^^ + 2 │ + 3 │ lint(ast, { throw_expression.js:1:45 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -134,10 +134,10 @@ throw_expression.js:1:45 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ throw_expression.js:1:45 - │ - 1 │ function save(filename = throw new TypeError("Argument required")) {} - │ ^ + > 1 │ function save(filename = throw new TypeError("Argument required")) {} + │ ^ + 2 │ + 3 │ lint(ast, { throw_expression.js:1:66 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -145,10 +145,10 @@ throw_expression.js:1:66 parse ━━━━━━━━━━━━━━━━ × Expected a function body here - ┌─ throw_expression.js:1:66 - │ - 1 │ function save(filename = throw new TypeError("Argument required")) {} - │ ^ + > 1 │ function save(filename = throw new TypeError("Argument required")) {} + │ ^ + 2 │ + 3 │ lint(ast, { throw_expression.js:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -156,10 +156,11 @@ throw_expression.js:4:15 parse ━━━━━━━━━━━━━━━━ × Expected a function body, or an expression here - ┌─ throw_expression.js:4:15 - │ - 4 │ with: () => throw new Error("avoid using 'with' statements.") - │ ^^^^^ + 3 │ lint(ast, { + > 4 │ with: () => throw new Error("avoid using 'with' statements.") + │ ^^^^^ + 5 │ }); + 6 │ throw_expression.js:4:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -167,10 +168,11 @@ throw_expression.js:4:21 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ throw_expression.js:4:21 - │ - 4 │ with: () => throw new Error("avoid using 'with' statements.") - │ ^^^ + 3 │ lint(ast, { + > 4 │ with: () => throw new Error("avoid using 'with' statements.") + │ ^^^ + 5 │ }); + 6 │ throw_expression.js:11:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -178,10 +180,12 @@ throw_expression.js:11:19 parse ━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ throw_expression.js:11:19 - │ - 11 │ : throw new Error("Unsupported encoding"); - │ ^^^^^ + 9 │ : encoding === "utf16le" ? new UTF16Encoder(false) + 10 │ : encoding === "utf16be" ? new UTF16Encoder(true) + > 11 │ : throw new Error("Unsupported encoding"); + │ ^^^^^ + 12 │ } + 13 │ throw_expression.js:16:39 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -189,10 +193,12 @@ throw_expression.js:16:39 parse ━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ throw_expression.js:16:39 - │ - 16 │ set id(value) { this._id = value || throw new Error("Invalid value"); } - │ ^^^^^ + 14 │ class Product { + 15 │ get id() { return this._id; } + > 16 │ set id(value) { this._id = value || throw new Error("Invalid value"); } + │ ^^^^^ + 17 │ } + 18 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/destructuring.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/destructuring.js.snap index afe78e24c96..00788ad0a13 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/destructuring.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/destructuring.js.snap @@ -64,19 +64,19 @@ destructuring.js:1:17 parse ━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ destructuring.js:1:17 - │ - 1 │ const [a, b] = #[1, 2]; - │ ^ + > 1 │ const [a, b] = #[1, 2]; + │ ^ + 2 │ assert(a === 1); + 3 │ assert(b === 2); destructuring.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ destructuring.js:1:16 - │ - 1 │ const [a, b] = #[1, 2]; - │ ^ + > 1 │ const [a, b] = #[1, 2]; + │ ^ + 2 │ assert(a === 1); + 3 │ assert(b === 2); destructuring.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -84,17 +84,17 @@ destructuring.js:1:17 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ destructuring.js:1:17 - │ - 1 │ const [a, b] = #[1, 2]; - │ ^ + > 1 │ const [a, b] = #[1, 2]; + │ ^ + 2 │ assert(a === 1); + 3 │ assert(b === 2); i ...Which is required to end this statement - ┌─ destructuring.js:1:1 - │ - 1 │ const [a, b] = #[1, 2]; - │ ^^^^^^^^^^^^^^^^ + > 1 │ const [a, b] = #[1, 2]; + │ ^^^^^^^^^^^^^^^^ + 2 │ assert(a === 1); + 3 │ assert(b === 2); destructuring.js:5:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -102,19 +102,23 @@ destructuring.js:5:23 parse ━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ destructuring.js:5:23 - │ - 5 │ const [a, ...rest] = #[1, 2, 3]; - │ ^ + 3 │ assert(b === 2); + 4 │ + > 5 │ const [a, ...rest] = #[1, 2, 3]; + │ ^ + 6 │ assert(a === 1); + 7 │ assert(Array.isArray(rest)); destructuring.js:5:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ destructuring.js:5:22 - │ - 5 │ const [a, ...rest] = #[1, 2, 3]; - │ ^ + 3 │ assert(b === 2); + 4 │ + > 5 │ const [a, ...rest] = #[1, 2, 3]; + │ ^ + 6 │ assert(a === 1); + 7 │ assert(Array.isArray(rest)); destructuring.js:5:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -122,17 +126,21 @@ destructuring.js:5:23 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ destructuring.js:5:23 - │ - 5 │ const [a, ...rest] = #[1, 2, 3]; - │ ^ + 3 │ assert(b === 2); + 4 │ + > 5 │ const [a, ...rest] = #[1, 2, 3]; + │ ^ + 6 │ assert(a === 1); + 7 │ assert(Array.isArray(rest)); i ...Which is required to end this statement - ┌─ destructuring.js:5:1 - │ - 5 │ const [a, ...rest] = #[1, 2, 3]; - │ ^^^^^^^^^^^^^^^^^^^^^^ + 3 │ assert(b === 2); + 4 │ + > 5 │ const [a, ...rest] = #[1, 2, 3]; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 6 │ assert(a === 1); + 7 │ assert(Array.isArray(rest)); ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/syntax.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/syntax.js.snap index 26bee70fa18..cb3d60c1037 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/syntax.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/syntax.js.snap @@ -54,12 +54,12 @@ syntax.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ syntax.js:1:1 - │ - 1 │ ┌ #[] - 2 │ │ #[1, 2] - 3 │ │ #[1, 2, #{ a: 3 }] - │ └─────────^ + > 1 │ #[] + │ ^^^ + > 2 │ #[1, 2] + > 3 │ #[1, 2, #{ a: 3 }] + │ ^^^^^^^^^ + 4 │ syntax.js:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -67,19 +67,20 @@ syntax.js:3:18 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ syntax.js:3:18 - │ - 3 │ #[1, 2, #{ a: 3 }] - │ ^ + 1 │ #[] + 2 │ #[1, 2] + > 3 │ #[1, 2, #{ a: 3 }] + │ ^ + 4 │ syntax.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `!` following a `#`, but found none - ┌─ syntax.js:1:1 - │ - 1 │ #[] - │ ^ + > 1 │ #[] + │ ^ + 2 │ #[1, 2] + 3 │ #[1, 2, #{ a: 3 }] ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple-trailing-comma.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple-trailing-comma.js.snap index 10e82b1dcaf..78eadea86ce 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple-trailing-comma.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple-trailing-comma.js.snap @@ -36,19 +36,17 @@ tuple-trailing-comma.js:1:1 parse ━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ tuple-trailing-comma.js:1:1 - │ - 1 │ #[1,] - │ ^^^^^ + > 1 │ #[1,] + │ ^^^^^ + 2 │ tuple-trailing-comma.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `!` following a `#`, but found none - ┌─ tuple-trailing-comma.js:1:1 - │ - 1 │ #[1,] - │ ^ + > 1 │ #[1,] + │ ^ + 2 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple.js.snap index 26fb1a33966..4fb776f8e50 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple.js.snap @@ -84,19 +84,19 @@ tuple.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ tuple.js:1:17 - │ - 1 │ const tuple1 = #[1, 2, 3]; - │ ^ + > 1 │ const tuple1 = #[1, 2, 3]; + │ ^ + 2 │ + 3 │ assert(tuple1[0] === 1); tuple.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ tuple.js:1:16 - │ - 1 │ const tuple1 = #[1, 2, 3]; - │ ^ + > 1 │ const tuple1 = #[1, 2, 3]; + │ ^ + 2 │ + 3 │ assert(tuple1[0] === 1); tuple.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -104,17 +104,17 @@ tuple.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ tuple.js:1:17 - │ - 1 │ const tuple1 = #[1, 2, 3]; - │ ^ + > 1 │ const tuple1 = #[1, 2, 3]; + │ ^ + 2 │ + 3 │ assert(tuple1[0] === 1); i ...Which is required to end this statement - ┌─ tuple.js:1:1 - │ - 1 │ const tuple1 = #[1, 2, 3]; - │ ^^^^^^^^^^^^^^^^ + > 1 │ const tuple1 = #[1, 2, 3]; + │ ^^^^^^^^^^^^^^^^ + 2 │ + 3 │ assert(tuple1[0] === 1); tuple.js:7:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -122,19 +122,23 @@ tuple.js:7:20 parse ━━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ tuple.js:7:20 - │ - 7 │ assert(tuple2 === #[2, 2, 3]); - │ ^ + 5 │ const tuple2 = tuple1.with(0, 2); + 6 │ assert(tuple1 !== tuple2); + > 7 │ assert(tuple2 === #[2, 2, 3]); + │ ^ + 8 │ + 9 │ const tuple3 = #[1, ...tuple2]; tuple.js:7:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ tuple.js:7:19 - │ - 7 │ assert(tuple2 === #[2, 2, 3]); - │ ^ + 5 │ const tuple2 = tuple1.with(0, 2); + 6 │ assert(tuple1 !== tuple2); + > 7 │ assert(tuple2 === #[2, 2, 3]); + │ ^ + 8 │ + 9 │ const tuple3 = #[1, ...tuple2]; tuple.js:7:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -142,10 +146,12 @@ tuple.js:7:20 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ tuple.js:7:20 - │ - 7 │ assert(tuple2 === #[2, 2, 3]); - │ ^ + 5 │ const tuple2 = tuple1.with(0, 2); + 6 │ assert(tuple1 !== tuple2); + > 7 │ assert(tuple2 === #[2, 2, 3]); + │ ^ + 8 │ + 9 │ const tuple3 = #[1, ...tuple2]; tuple.js:9:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -153,19 +159,23 @@ tuple.js:9:17 parse ━━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ tuple.js:9:17 - │ - 9 │ const tuple3 = #[1, ...tuple2]; - │ ^ + 7 │ assert(tuple2 === #[2, 2, 3]); + 8 │ + > 9 │ const tuple3 = #[1, ...tuple2]; + │ ^ + 10 │ assert(tuple3 === #[1, 2, 2, 3]); + 11 │ tuple.js:9:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ tuple.js:9:16 - │ - 9 │ const tuple3 = #[1, ...tuple2]; - │ ^ + 7 │ assert(tuple2 === #[2, 2, 3]); + 8 │ + > 9 │ const tuple3 = #[1, ...tuple2]; + │ ^ + 10 │ assert(tuple3 === #[1, 2, 2, 3]); + 11 │ tuple.js:9:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -173,17 +183,21 @@ tuple.js:9:17 parse ━━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ tuple.js:9:17 - │ - 9 │ const tuple3 = #[1, ...tuple2]; - │ ^ + 7 │ assert(tuple2 === #[2, 2, 3]); + 8 │ + > 9 │ const tuple3 = #[1, ...tuple2]; + │ ^ + 10 │ assert(tuple3 === #[1, 2, 2, 3]); + 11 │ i ...Which is required to end this statement - ┌─ tuple.js:9:1 - │ - 9 │ const tuple3 = #[1, ...tuple2]; - │ ^^^^^^^^^^^^^^^^ + 7 │ assert(tuple2 === #[2, 2, 3]); + 8 │ + > 9 │ const tuple3 = #[1, ...tuple2]; + │ ^^^^^^^^^^^^^^^^ + 10 │ assert(tuple3 === #[1, 2, 2, 3]); + 11 │ tuple.js:10:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -191,19 +205,21 @@ tuple.js:10:20 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ tuple.js:10:20 - │ - 10 │ assert(tuple3 === #[1, 2, 2, 3]); - │ ^ + 9 │ const tuple3 = #[1, ...tuple2]; + > 10 │ assert(tuple3 === #[1, 2, 2, 3]); + │ ^ + 11 │ + 12 │ const tuple4 = tuple3.pushed(4); tuple.js:10:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ tuple.js:10:19 - │ - 10 │ assert(tuple3 === #[1, 2, 2, 3]); - │ ^ + 9 │ const tuple3 = #[1, ...tuple2]; + > 10 │ assert(tuple3 === #[1, 2, 2, 3]); + │ ^ + 11 │ + 12 │ const tuple4 = tuple3.pushed(4); tuple.js:10:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -211,10 +227,11 @@ tuple.js:10:20 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ tuple.js:10:20 - │ - 10 │ assert(tuple3 === #[1, 2, 2, 3]); - │ ^ + 9 │ const tuple3 = #[1, ...tuple2]; + > 10 │ assert(tuple3 === #[1, 2, 2, 3]); + │ ^ + 11 │ + 12 │ const tuple4 = tuple3.pushed(4); tuple.js:13:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -222,19 +239,21 @@ tuple.js:13:20 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ tuple.js:13:20 - │ - 13 │ assert(tuple4 === #[1, 2, 2, 3, 4]); - │ ^ + 12 │ const tuple4 = tuple3.pushed(4); + > 13 │ assert(tuple4 === #[1, 2, 2, 3, 4]); + │ ^ + 14 │ + 15 │ assert(tuple4.first() === 1); tuple.js:13:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ tuple.js:13:19 - │ - 13 │ assert(tuple4 === #[1, 2, 2, 3, 4]); - │ ^ + 12 │ const tuple4 = tuple3.pushed(4); + > 13 │ assert(tuple4 === #[1, 2, 2, 3, 4]); + │ ^ + 14 │ + 15 │ assert(tuple4.first() === 1); tuple.js:13:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -242,10 +261,11 @@ tuple.js:13:20 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ tuple.js:13:20 - │ - 13 │ assert(tuple4 === #[1, 2, 2, 3, 4]); - │ ^ + 12 │ const tuple4 = tuple3.pushed(4); + > 13 │ assert(tuple4 === #[1, 2, 2, 3, 4]); + │ ^ + 14 │ + 15 │ assert(tuple4.first() === 1); tuple.js:17:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -253,19 +273,21 @@ tuple.js:17:20 parse ━━━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ tuple.js:17:20 - │ - 17 │ assert(tuple5 === #[2, 2, 3, 4]); - │ ^ + 15 │ assert(tuple4.first() === 1); + 16 │ const tuple5 = tuple4.popped(); + > 17 │ assert(tuple5 === #[2, 2, 3, 4]); + │ ^ + 18 │ tuple.js:17:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ tuple.js:17:19 - │ - 17 │ assert(tuple5 === #[2, 2, 3, 4]); - │ ^ + 15 │ assert(tuple4.first() === 1); + 16 │ const tuple5 = tuple4.popped(); + > 17 │ assert(tuple5 === #[2, 2, 3, 4]); + │ ^ + 18 │ tuple.js:17:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -273,10 +295,11 @@ tuple.js:17:20 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ tuple.js:17:20 - │ - 17 │ assert(tuple5 === #[2, 2, 3, 4]); - │ ^ + 15 │ assert(tuple4.first() === 1); + 16 │ const tuple5 = tuple4.popped(); + > 17 │ assert(tuple5 === #[2, 2, 3, 4]); + │ ^ + 18 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/v8_intrinsic/intrinsic_call.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/v8_intrinsic/intrinsic_call.js.snap index 5b51324b1ac..b2c85b2ec09 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/v8_intrinsic/intrinsic_call.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/v8_intrinsic/intrinsic_call.js.snap @@ -106,12 +106,14 @@ intrinsic_call.js:2:13 parse ━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ intrinsic_call.js:2:13 - │ - 2 │ ┌ %DebugPrint - 3 │ │ ( - 4 │ │ foo ) - │ └─────────────────────^ + 1 │ function doSmth() { + > 2 │ %DebugPrint + │ ^^^^^^^^^^^ + > 3 │ ( + > 4 │ foo ) + │ ^^^^^ + 5 │ } + 6 │ intrinsic_call.js:10:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -119,10 +121,12 @@ intrinsic_call.js:10:8 parse ━━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ intrinsic_call.js:10:8 - │ - 10 │ if(% - │ ^ + 8 │ f + 9 │ ) { + > 10 │ if(% + │ ^ + 11 │ IsAsmWasmCode(f)) console.log("asm.js"); + 12 │ if( intrinsic_call.js:14:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -130,10 +134,12 @@ intrinsic_call.js:14:9 parse ━━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ intrinsic_call.js:14:9 - │ - 14 │ % IsWasmCode( - │ ^ + 12 │ if( + 13 │ + > 14 │ % IsWasmCode( + │ ^ + 15 │ f)) + 16 │ console.log ( intrinsic_call.js:21:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -141,10 +147,11 @@ intrinsic_call.js:21:6 parse ━━━━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ intrinsic_call.js:21:6 - │ - 21 │ (% - │ ^ + 20 │ console.log + > 21 │ (% + │ ^ + 22 │ GetFunctioName(f) + 23 │ ); ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/with/indent.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/with/indent.js.snap index a1cdd13b4a1..b128b130a44 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/with/indent.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/with/indent.js.snap @@ -41,19 +41,20 @@ indent.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━ × `with` statements are not allowed in strict mode - ┌─ indent.js:1:1 - │ - 1 │ with (0) {} - │ ^^^^^^^^^^^ + > 1 │ with (0) {} + │ ^^^^^^^^^^^ + 2 │ + 3 │ with (0) 1; indent.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `with` statements are not allowed in strict mode - ┌─ indent.js:3:1 - │ - 3 │ with (0) 1; - │ ^^^^^^^^^^^ + 1 │ with (0) {} + 2 │ + > 3 │ with (0) 1; + │ ^^^^^^^^^^^ + 4 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/do/do.js.snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/do/do.js.snap index 22517614abc..e643c26ee7e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/jsx/do/do.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/do/do.js.snap @@ -49,19 +49,22 @@ do.js:2:4 parse ━━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ do.js:2:4 - │ - 2 │ {do { - │ ^^ + 1 │
+ > 2 │ {do { + │ ^^ + 3 │ 1 + 4 │ }} do.js:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Unexpected token. Did you mean `{'}'}` or `}`? - ┌─ do.js:4:4 - │ - 4 │ }} - │ ^ + 2 │ {do { + 3 │ 1 + > 4 │ }} + │ ^ + 5 │
+ 6 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/assignment/issue-5370.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/assignment/issue-5370.ts.snap index 50d0e04da7a..17244ae7500 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/assignment/issue-5370.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/assignment/issue-5370.ts.snap @@ -43,10 +43,11 @@ issue-5370.ts:3:1 parse ━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ issue-5370.ts:3:1 - │ - 3 │ > = myExperienceSelectable.concat(otherDurabilityMetricsSelectable); - │ ^ + 1 │ const durabilityMetricsSelectable: Immutable.OrderedSet< + 2 │ SomeReportingMetric, + > 3 │ > = myExperienceSelectable.concat(otherDurabilityMetricsSelectable); + │ ^ + 4 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/constructor.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/constructor.ts.snap index 52b5c2686ee..336c6e34686 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/constructor.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/constructor.ts.snap @@ -74,10 +74,11 @@ constructor.ts:2:15 parse ━━━━━━━━━━━━━━━━━━ × 'static' cannot appear on a parameter. - ┌─ constructor.ts:2:15 - │ - 2 │ constructor(static a: number) {} - │ ^^^^^^ + 1 │ class foo { + > 2 │ constructor(static a: number) {} + │ ^^^^^^ + 3 │ } + 4 │ constructor.ts:6:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -85,10 +86,11 @@ constructor.ts:6:15 parse ━━━━━━━━━━━━━━━━━━ × Expected a parameter here - ┌─ constructor.ts:6:15 - │ - 6 │ constructor(export a: number) {} - │ ^^^^^^ + 5 │ class foo { + > 6 │ constructor(export a: number) {} + │ ^^^^^^ + 7 │ } + 8 │ constructor.ts:6:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -96,19 +98,21 @@ constructor.ts:6:22 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ constructor.ts:6:22 - │ - 6 │ constructor(export a: number) {} - │ ^ + 5 │ class foo { + > 6 │ constructor(export a: number) {} + │ ^ + 7 │ } + 8 │ constructor.ts:10:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class properties may not be called `constructor` - ┌─ constructor.ts:10:5 - │ - 10 │ 'constructor': typeof A - │ ^^^^^^^^^^^^^^^^^^^^^^^ + 9 │ class A { + > 10 │ 'constructor': typeof A + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 11 │ static Foo() { + 12 │ return new A() constructor.ts:17:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -116,19 +120,21 @@ constructor.ts:17:15 parse ━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ constructor.ts:17:15 - │ - 17 │ constructor<>() {} - │ ^ + 16 │ class B { + > 17 │ constructor<>() {} + │ ^ + 18 │ } + 19 │ constructor.ts:17:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × constructors cannot have type parameters. - ┌─ constructor.ts:17:14 - │ - 17 │ constructor<>() {} - │ ^^ + 16 │ class B { + > 17 │ constructor<>() {} + │ ^^ + 18 │ } + 19 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/duplicates-access-modifier.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/duplicates-access-modifier.ts.snap index e1f857bd24f..02173ae05bd 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/duplicates-access-modifier.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/duplicates-access-modifier.ts.snap @@ -58,17 +58,19 @@ duplicates-access-modifier.ts:2:10 parse ━━━━━━━━━━━━━ × duplicate modifier - ┌─ duplicates-access-modifier.ts:2:10 - │ - 2 │ public public a; - │ ^^^^^^ + 1 │ class Foo { + > 2 │ public public a; + │ ^^^^^^ + 3 │ private public b; + 4 │ protected private c; i first modifier - ┌─ duplicates-access-modifier.ts:2:3 - │ - 2 │ public public a; - │ ^^^^^^ + 1 │ class Foo { + > 2 │ public public a; + │ ^^^^^^ + 3 │ private public b; + 4 │ protected private c; duplicates-access-modifier.ts:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -76,17 +78,21 @@ duplicates-access-modifier.ts:3:11 parse ━━━━━━━━━━━━━ × duplicate modifier - ┌─ duplicates-access-modifier.ts:3:11 - │ - 3 │ private public b; - │ ^^^^^^ + 1 │ class Foo { + 2 │ public public a; + > 3 │ private public b; + │ ^^^^^^ + 4 │ protected private c; + 5 │ public protected d; i first modifier - ┌─ duplicates-access-modifier.ts:3:3 - │ - 3 │ private public b; - │ ^^^^^^^ + 1 │ class Foo { + 2 │ public public a; + > 3 │ private public b; + │ ^^^^^^^ + 4 │ protected private c; + 5 │ public protected d; duplicates-access-modifier.ts:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -94,17 +100,21 @@ duplicates-access-modifier.ts:4:13 parse ━━━━━━━━━━━━━ × duplicate modifier - ┌─ duplicates-access-modifier.ts:4:13 - │ - 4 │ protected private c; - │ ^^^^^^^ + 2 │ public public a; + 3 │ private public b; + > 4 │ protected private c; + │ ^^^^^^^ + 5 │ public protected d; + 6 │ public protected private e; i first modifier - ┌─ duplicates-access-modifier.ts:4:3 - │ - 4 │ protected private c; - │ ^^^^^^^^^ + 2 │ public public a; + 3 │ private public b; + > 4 │ protected private c; + │ ^^^^^^^^^ + 5 │ public protected d; + 6 │ public protected private e; duplicates-access-modifier.ts:5:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -112,17 +122,21 @@ duplicates-access-modifier.ts:5:10 parse ━━━━━━━━━━━━━ × duplicate modifier - ┌─ duplicates-access-modifier.ts:5:10 - │ - 5 │ public protected d; - │ ^^^^^^^^^ + 3 │ private public b; + 4 │ protected private c; + > 5 │ public protected d; + │ ^^^^^^^^^ + 6 │ public protected private e; + 7 │ } i first modifier - ┌─ duplicates-access-modifier.ts:5:3 - │ - 5 │ public protected d; - │ ^^^^^^ + 3 │ private public b; + 4 │ protected private c; + > 5 │ public protected d; + │ ^^^^^^ + 6 │ public protected private e; + 7 │ } duplicates-access-modifier.ts:6:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -130,17 +144,21 @@ duplicates-access-modifier.ts:6:10 parse ━━━━━━━━━━━━━ × duplicate modifier - ┌─ duplicates-access-modifier.ts:6:10 - │ - 6 │ public protected private e; - │ ^^^^^^^^^ + 4 │ protected private c; + 5 │ public protected d; + > 6 │ public protected private e; + │ ^^^^^^^^^ + 7 │ } + 8 │ i first modifier - ┌─ duplicates-access-modifier.ts:6:3 - │ - 6 │ public protected private e; - │ ^^^^^^ + 4 │ protected private c; + 5 │ public protected d; + > 6 │ public protected private e; + │ ^^^^^^ + 7 │ } + 8 │ duplicates-access-modifier.ts:6:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -148,17 +166,21 @@ duplicates-access-modifier.ts:6:20 parse ━━━━━━━━━━━━━ × duplicate modifier - ┌─ duplicates-access-modifier.ts:6:20 - │ - 6 │ public protected private e; - │ ^^^^^^^ + 4 │ protected private c; + 5 │ public protected d; + > 6 │ public protected private e; + │ ^^^^^^^ + 7 │ } + 8 │ i first modifier - ┌─ duplicates-access-modifier.ts:6:10 - │ - 6 │ public protected private e; - │ ^^^^^^^^^ + 4 │ protected private c; + 5 │ public protected d; + > 6 │ public protected private e; + │ ^^^^^^^^^ + 7 │ } + 8 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/methods.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/methods.ts.snap index 29e3cd71947..e6a18566abb 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/methods.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/methods.ts.snap @@ -64,10 +64,11 @@ methods.ts:6:10 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ methods.ts:6:10 - │ - 6 │ export [Symbol.iterator](): Iterator; - │ ^ + 5 │ interface Iterable { + > 6 │ export [Symbol.iterator](): Iterator; + │ ^ + 7 │ } + 8 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/type-parameters.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/type-parameters.ts.snap index a08bf513e1e..928bf2ca262 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/type-parameters.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/type-parameters.ts.snap @@ -106,10 +106,11 @@ type-parameters.ts:2:25 parse ━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ type-parameters.ts:2:25 - │ - 2 │ const a: T = 1; - │ ^ + 1 │ functionName(); + > 2 │ const a: T = 1; + │ ^ + 3 │ functionName(); + 4 │ function foo() {} type-parameters.ts:3:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -117,10 +118,12 @@ type-parameters.ts:3:27 parse ━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ type-parameters.ts:3:27 - │ - 3 │ functionName(); - │ ^ + 1 │ functionName(); + 2 │ const a: T = 1; + > 3 │ functionName(); + │ ^ + 4 │ function foo() {} + 5 │ interface Foo { type-parameters.ts:4:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -128,10 +131,12 @@ type-parameters.ts:4:27 parse ━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ type-parameters.ts:4:27 - │ - 4 │ function foo() {} - │ ^ + 2 │ const a: T = 1; + 3 │ functionName(); + > 4 │ function foo() {} + │ ^ + 5 │ interface Foo { + 6 │ (arg): any; type-parameters.ts:6:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -139,10 +144,12 @@ type-parameters.ts:6:16 parse ━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ type-parameters.ts:6:16 - │ - 6 │ (arg): any; - │ ^ + 4 │ function foo() {} + 5 │ interface Foo { + > 6 │ (arg): any; + │ ^ + 7 │ } + 8 │ type T = (arg) => any; type-parameters.ts:8:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -150,10 +157,12 @@ type-parameters.ts:8:24 parse ━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ type-parameters.ts:8:24 - │ - 8 │ type T = (arg) => any; - │ ^ + 6 │ (arg): any; + 7 │ } + > 8 │ type T = (arg) => any; + │ ^ + 9 │ + 10 │ functionName< type-parameters.ts:15:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -161,10 +170,12 @@ type-parameters.ts:15:1 parse ━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ type-parameters.ts:15:1 - │ - 15 │ > = 1; - │ ^ + 13 │ const a: T< + 14 │ // comment + > 15 │ > = 1; + │ ^ + 16 │ functionName< + 17 │ // comment type-parameters.ts:18:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -172,10 +183,12 @@ type-parameters.ts:18:1 parse ━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ type-parameters.ts:18:1 - │ - 18 │ >(); - │ ^ + 16 │ functionName< + 17 │ // comment + > 18 │ >(); + │ ^ + 19 │ function foo< + 20 │ // comment type-parameters.ts:21:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -183,10 +196,12 @@ type-parameters.ts:21:1 parse ━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ type-parameters.ts:21:1 - │ - 21 │ >() {} - │ ^ + 19 │ function foo< + 20 │ // comment + > 21 │ >() {} + │ ^ + 22 │ interface Foo { + 23 │ < type-parameters.ts:29:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -194,10 +209,11 @@ type-parameters.ts:29:1 parse ━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ type-parameters.ts:29:1 - │ - 29 │ >(arg) => any; - │ ^ + 27 │ type T = < + 28 │ // comment + > 29 │ >(arg) => any; + │ ^ + 30 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/decrementAndIncrementOperators.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/decrementAndIncrementOperators.ts.snap index 5b8c12a31bd..73df872524f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/decrementAndIncrementOperators.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/decrementAndIncrementOperators.ts.snap @@ -121,10 +121,11 @@ decrementAndIncrementOperators.ts:4:1 parse ━━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ decrementAndIncrementOperators.ts:4:1 - │ - 4 │ 1 ++; - │ ^ + 3 │ // errors + > 4 │ 1 ++; + │ ^ + 5 │ + 6 │ (1)++; decrementAndIncrementOperators.ts:6:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -132,10 +133,12 @@ decrementAndIncrementOperators.ts:6:2 parse ━━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ decrementAndIncrementOperators.ts:6:2 - │ - 6 │ (1)++; - │ ^ + 4 │ 1 ++; + 5 │ + > 6 │ (1)++; + │ ^ + 7 │ (1)--; + 8 │ decrementAndIncrementOperators.ts:7:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -143,10 +146,11 @@ decrementAndIncrementOperators.ts:7:2 parse ━━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ decrementAndIncrementOperators.ts:7:2 - │ - 7 │ (1)--; - │ ^ + 6 │ (1)++; + > 7 │ (1)--; + │ ^ + 8 │ + 9 │ ++(1); decrementAndIncrementOperators.ts:9:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -154,10 +158,12 @@ decrementAndIncrementOperators.ts:9:4 parse ━━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ decrementAndIncrementOperators.ts:9:4 - │ - 9 │ ++(1); - │ ^ + 7 │ (1)--; + 8 │ + > 9 │ ++(1); + │ ^ + 10 │ --(1); + 11 │ decrementAndIncrementOperators.ts:10:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -165,10 +171,11 @@ decrementAndIncrementOperators.ts:10:4 parse ━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ decrementAndIncrementOperators.ts:10:4 - │ - 10 │ --(1); - │ ^ + 9 │ ++(1); + > 10 │ --(1); + │ ^ + 11 │ + 12 │ (1 + 2)++; decrementAndIncrementOperators.ts:12:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -176,10 +183,12 @@ decrementAndIncrementOperators.ts:12:2 parse ━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ decrementAndIncrementOperators.ts:12:2 - │ - 12 │ (1 + 2)++; - │ ^^^^^ + 10 │ --(1); + 11 │ + > 12 │ (1 + 2)++; + │ ^^^^^ + 13 │ (1 + 2)--; + 14 │ decrementAndIncrementOperators.ts:13:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -187,10 +196,11 @@ decrementAndIncrementOperators.ts:13:2 parse ━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ decrementAndIncrementOperators.ts:13:2 - │ - 13 │ (1 + 2)--; - │ ^^^^^ + 12 │ (1 + 2)++; + > 13 │ (1 + 2)--; + │ ^^^^^ + 14 │ + 15 │ ++(1 + 2); decrementAndIncrementOperators.ts:15:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -198,10 +208,12 @@ decrementAndIncrementOperators.ts:15:4 parse ━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ decrementAndIncrementOperators.ts:15:4 - │ - 15 │ ++(1 + 2); - │ ^^^^^ + 13 │ (1 + 2)--; + 14 │ + > 15 │ ++(1 + 2); + │ ^^^^^ + 16 │ --(1 + 2); + 17 │ decrementAndIncrementOperators.ts:16:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -209,10 +221,11 @@ decrementAndIncrementOperators.ts:16:4 parse ━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ decrementAndIncrementOperators.ts:16:4 - │ - 16 │ --(1 + 2); - │ ^^^^^ + 15 │ ++(1 + 2); + > 16 │ --(1 + 2); + │ ^^^^^ + 17 │ + 18 │ (x + x)++; decrementAndIncrementOperators.ts:18:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -220,10 +233,12 @@ decrementAndIncrementOperators.ts:18:2 parse ━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ decrementAndIncrementOperators.ts:18:2 - │ - 18 │ (x + x)++; - │ ^^^^^ + 16 │ --(1 + 2); + 17 │ + > 18 │ (x + x)++; + │ ^^^^^ + 19 │ (x + x)--; + 20 │ decrementAndIncrementOperators.ts:19:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -231,10 +246,11 @@ decrementAndIncrementOperators.ts:19:2 parse ━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ decrementAndIncrementOperators.ts:19:2 - │ - 19 │ (x + x)--; - │ ^^^^^ + 18 │ (x + x)++; + > 19 │ (x + x)--; + │ ^^^^^ + 20 │ + 21 │ ++(x + x); decrementAndIncrementOperators.ts:21:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -242,10 +258,12 @@ decrementAndIncrementOperators.ts:21:4 parse ━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ decrementAndIncrementOperators.ts:21:4 - │ - 21 │ ++(x + x); - │ ^^^^^ + 19 │ (x + x)--; + 20 │ + > 21 │ ++(x + x); + │ ^^^^^ + 22 │ --(x + x); + 23 │ decrementAndIncrementOperators.ts:22:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -253,10 +271,11 @@ decrementAndIncrementOperators.ts:22:4 parse ━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ decrementAndIncrementOperators.ts:22:4 - │ - 22 │ --(x + x); - │ ^^^^^ + 21 │ ++(x + x); + > 22 │ --(x + x); + │ ^^^^^ + 23 │ + 24 │ //OK ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/downlevelLetConst1.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/downlevelLetConst1.ts.snap index 69f7054106f..0d131b3b79f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/downlevelLetConst1.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/downlevelLetConst1.ts.snap @@ -35,10 +35,8 @@ downlevelLetConst1.ts:1:6 parse ━━━━━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern here - ┌─ downlevelLetConst1.ts:1:6 - │ - 1 │ const - │ ^ + > 1 │ const + │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/errorOnInitializerInInterfaceProperty.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/errorOnInitializerInInterfaceProperty.ts.snap index b14bc88b6cc..c0d8f791b7e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/errorOnInitializerInInterfaceProperty.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/errorOnInitializerInInterfaceProperty.ts.snap @@ -42,10 +42,11 @@ errorOnInitializerInInterfaceProperty.ts:2:17 parse ━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ errorOnInitializerInInterfaceProperty.ts:2:17 - │ - 2 │ bar: number = 5; - │ ^ + 1 │ interface Foo { + > 2 │ bar: number = 5; + │ ^ + 3 │ } + 4 │ errorOnInitializerInInterfaceProperty.ts:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -53,10 +54,11 @@ errorOnInitializerInInterfaceProperty.ts:2:20 parse ━━━━━━━━━ × Expected a property, or a signature here - ┌─ errorOnInitializerInInterfaceProperty.ts:2:20 - │ - 2 │ bar: number = 5; - │ ^ + 1 │ interface Foo { + > 2 │ bar: number = 5; + │ ^ + 3 │ } + 4 │ errorOnInitializerInInterfaceProperty.ts:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -64,10 +66,11 @@ errorOnInitializerInInterfaceProperty.ts:3:1 parse ━━━━━━━━━ × Expected a statement here - ┌─ errorOnInitializerInInterfaceProperty.ts:3:1 - │ - 3 │ } - │ ^ + 1 │ interface Foo { + 2 │ bar: number = 5; + > 3 │ } + │ ^ + 4 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts.snap index 8e0a977e36e..71d54ad9cde 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts.snap @@ -140,10 +140,10 @@ classAbstractInstantiations2.ts:49:5 parse ━━━━━━━━━━━━ × Only abstract classes can have abstract members - ┌─ classAbstractInstantiations2.ts:49:5 - │ - 49 │ abstract baz() : number; - │ ^^^^^^^^ + 48 │ class H { + > 49 │ abstract baz() : number; + │ ^^^^^^^^ + 50 │ } ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts.snap index 0ba9d46d741..b7f16f265fe 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts.snap @@ -74,17 +74,21 @@ classAbstractMixedWithModifiers.ts:6:5 parse ━━━━━━━━━━━ × 'private' cannot be used with 'abstract' modifier. - ┌─ classAbstractMixedWithModifiers.ts:6:5 - │ - 6 │ private abstract foo_d(); - │ ^^^^^^^ + 4 │ public abstract foo_b(); + 5 │ protected abstract foo_c(); + > 6 │ private abstract foo_d(); + │ ^^^^^^^ + 7 │ + 8 │ abstract public foo_bb(); i 'abstract' modifier - ┌─ classAbstractMixedWithModifiers.ts:6:13 - │ - 6 │ private abstract foo_d(); - │ ^^^^^^^^ + 4 │ public abstract foo_b(); + 5 │ protected abstract foo_c(); + > 6 │ private abstract foo_d(); + │ ^^^^^^^^ + 7 │ + 8 │ abstract public foo_bb(); classAbstractMixedWithModifiers.ts:8:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -92,17 +96,21 @@ classAbstractMixedWithModifiers.ts:8:14 parse ━━━━━━━━━━━ × move this modifier - ┌─ classAbstractMixedWithModifiers.ts:8:14 - │ - 8 │ abstract public foo_bb(); - │ ^^^^^^ + 6 │ private abstract foo_d(); + 7 │ + > 8 │ abstract public foo_bb(); + │ ^^^^^^ + 9 │ abstract protected foo_cc(); + 10 │ abstract private foo_dd(); i before this modifier - ┌─ classAbstractMixedWithModifiers.ts:8:5 - │ - 8 │ abstract public foo_bb(); - │ ^^^^^^^^ + 6 │ private abstract foo_d(); + 7 │ + > 8 │ abstract public foo_bb(); + │ ^^^^^^^^ + 9 │ abstract protected foo_cc(); + 10 │ abstract private foo_dd(); classAbstractMixedWithModifiers.ts:9:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -110,65 +118,77 @@ classAbstractMixedWithModifiers.ts:9:14 parse ━━━━━━━━━━━ × move this modifier - ┌─ classAbstractMixedWithModifiers.ts:9:14 - │ - 9 │ abstract protected foo_cc(); - │ ^^^^^^^^^ + 8 │ abstract public foo_bb(); + > 9 │ abstract protected foo_cc(); + │ ^^^^^^^^^ + 10 │ abstract private foo_dd(); + 11 │ i before this modifier - ┌─ classAbstractMixedWithModifiers.ts:9:5 - │ - 9 │ abstract protected foo_cc(); - │ ^^^^^^^^ + 8 │ abstract public foo_bb(); + > 9 │ abstract protected foo_cc(); + │ ^^^^^^^^ + 10 │ abstract private foo_dd(); + 11 │ classAbstractMixedWithModifiers.ts:10:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'private' cannot be used with 'abstract' modifier. - ┌─ classAbstractMixedWithModifiers.ts:10:14 - │ - 10 │ abstract private foo_dd(); - │ ^^^^^^^ + 8 │ abstract public foo_bb(); + 9 │ abstract protected foo_cc(); + > 10 │ abstract private foo_dd(); + │ ^^^^^^^ + 11 │ + 12 │ abstract static foo_d(); i 'abstract' modifier - ┌─ classAbstractMixedWithModifiers.ts:10:5 - │ - 10 │ abstract private foo_dd(); - │ ^^^^^^^^ + 8 │ abstract public foo_bb(); + 9 │ abstract protected foo_cc(); + > 10 │ abstract private foo_dd(); + │ ^^^^^^^^ + 11 │ + 12 │ abstract static foo_d(); classAbstractMixedWithModifiers.ts:12:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' cannot be used with 'static' modifier. - ┌─ classAbstractMixedWithModifiers.ts:12:5 - │ - 12 │ abstract static foo_d(); - │ ^^^^^^^^ + 10 │ abstract private foo_dd(); + 11 │ + > 12 │ abstract static foo_d(); + │ ^^^^^^^^ + 13 │ + 14 │ static abstract foo_e(); i 'static' modifier - ┌─ classAbstractMixedWithModifiers.ts:12:14 - │ - 12 │ abstract static foo_d(); - │ ^^^^^^ + 10 │ abstract private foo_dd(); + 11 │ + > 12 │ abstract static foo_d(); + │ ^^^^^^ + 13 │ + 14 │ static abstract foo_e(); classAbstractMixedWithModifiers.ts:14:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' cannot be used with 'static' modifier. - ┌─ classAbstractMixedWithModifiers.ts:14:12 - │ - 14 │ static abstract foo_e(); - │ ^^^^^^^^ + 12 │ abstract static foo_d(); + 13 │ + > 14 │ static abstract foo_e(); + │ ^^^^^^^^ + 15 │ } i 'static' modifier - ┌─ classAbstractMixedWithModifiers.ts:14:5 - │ - 14 │ static abstract foo_e(); - │ ^^^^^^ + 12 │ abstract static foo_d(); + 13 │ + > 14 │ static abstract foo_e(); + │ ^^^^^^ + 15 │ } ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts.snap index 23cf4dc8e42..8e640f228ed 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts.snap @@ -69,33 +69,39 @@ classAbstractProperties.ts:5:5 parse ━━━━━━━━━━━━━━ × 'private' cannot be used with 'abstract' modifier. - ┌─ classAbstractProperties.ts:5:5 - │ - 5 │ private abstract w : number; - │ ^^^^^^^ + 3 │ public abstract y : number; + 4 │ protected abstract z : number; + > 5 │ private abstract w : number; + │ ^^^^^^^ + 6 │ + 7 │ abstract m: () => void;· i 'abstract' modifier - ┌─ classAbstractProperties.ts:5:13 - │ - 5 │ private abstract w : number; - │ ^^^^^^^^ + 3 │ public abstract y : number; + 4 │ protected abstract z : number; + > 5 │ private abstract w : number; + │ ^^^^^^^^ + 6 │ + 7 │ abstract m: () => void;· classAbstractProperties.ts:12:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'private' cannot be used with 'abstract' modifier. - ┌─ classAbstractProperties.ts:12:5 - │ - 12 │ private abstract foo_w() : number; - │ ^^^^^^^ + 10 │ public abstract foo_y() : number; + 11 │ protected abstract foo_z() : number; + > 12 │ private abstract foo_w() : number; + │ ^^^^^^^ + 13 │ } i 'abstract' modifier - ┌─ classAbstractProperties.ts:12:13 - │ - 12 │ private abstract foo_w() : number; - │ ^^^^^^^^ + 10 │ public abstract foo_y() : number; + 11 │ protected abstract foo_z() : number; + > 12 │ private abstract foo_w() : number; + │ ^^^^^^^^ + 13 │ } ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts.snap index 08ed12be7b6..1c1fc7b14df 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts.snap @@ -65,17 +65,19 @@ readonlyInConstructorParameters.ts:7:26 parse ━━━━━━━━━━━ × move this modifier - ┌─ readonlyInConstructorParameters.ts:7:26 - │ - 7 │ constructor(readonly public x: number) {} - │ ^^^^^^ + 6 │ class E { + > 7 │ constructor(readonly public x: number) {} + │ ^^^^^^ + 8 │ } + 9 │ i before this modifier - ┌─ readonlyInConstructorParameters.ts:7:17 - │ - 7 │ constructor(readonly public x: number) {} - │ ^^^^^^^^ + 6 │ class E { + > 7 │ constructor(readonly public x: number) {} + │ ^^^^^^^^ + 8 │ } + 9 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts.snap index a98c272e93a..f847a37ea70 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts.snap @@ -45,17 +45,19 @@ readonlyReadonly.ts:2:14 parse ━━━━━━━━━━━━━━━━ × duplicate modifier - ┌─ readonlyReadonly.ts:2:14 - │ - 2 │ readonly readonly x: number; - │ ^^^^^^^^ + 1 │ class C { + > 2 │ readonly readonly x: number; + │ ^^^^^^^^ + 3 │ constructor(readonly readonly y: number) {} + 4 │ } i first seen here - ┌─ readonlyReadonly.ts:2:5 - │ - 2 │ readonly readonly x: number; - │ ^^^^^^^^ + 1 │ class C { + > 2 │ readonly readonly x: number; + │ ^^^^^^^^ + 3 │ constructor(readonly readonly y: number) {} + 4 │ } readonlyReadonly.ts:3:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -63,17 +65,19 @@ readonlyReadonly.ts:3:26 parse ━━━━━━━━━━━━━━━━ × duplicate modifier - ┌─ readonlyReadonly.ts:3:26 - │ - 3 │ constructor(readonly readonly y: number) {} - │ ^^^^^^^^ + 1 │ class C { + 2 │ readonly readonly x: number; + > 3 │ constructor(readonly readonly y: number) {} + │ ^^^^^^^^ + 4 │ } i first seen here - ┌─ readonlyReadonly.ts:3:17 - │ - 3 │ constructor(readonly readonly y: number) {} - │ ^^^^^^^^ + 1 │ class C { + 2 │ readonly readonly x: number; + > 3 │ constructor(readonly readonly y: number) {} + │ ^^^^^^^^ + 4 │ } ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts.snap index bf577048fe9..543303fd02f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts.snap @@ -40,10 +40,10 @@ parserES5ForOfStatement21.ts:2:15 parse ━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ parserES5ForOfStatement21.ts:2:15 - │ - 2 │ for (var of of) { } - │ ^ + 1 │ //@target: ES5 + > 2 │ for (var of of) { } + │ ^ + 3 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/abstractKeyword/abstractKeyword.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/abstractKeyword/abstractKeyword.ts.snap index eb76b3c8dba..f80d6522056 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/abstractKeyword/abstractKeyword.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/abstractKeyword/abstractKeyword.ts.snap @@ -38,17 +38,15 @@ abstractKeyword.ts:1:10 parse ━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ abstractKeyword.ts:1:10 - │ - 1 │ abstract interface I {} - │ ^^^^^^^^^ + > 1 │ abstract interface I {} + │ ^^^^^^^^^ + 2 │ i ...Which is required to end this statement - ┌─ abstractKeyword.ts:1:1 - │ - 1 │ abstract interface I {} - │ ^^^^^^^^^^^^^^^^^^ + > 1 │ abstract interface I {} + │ ^^^^^^^^^^^^^^^^^^ + 2 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/parameterProperty/parameterProperty.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/parameterProperty/parameterProperty.ts.snap index 61ba02aa230..66a27dec830 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/parameterProperty/parameterProperty.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/parameterProperty/parameterProperty.ts.snap @@ -51,10 +51,12 @@ parameterProperty.ts:5:19 parse ━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `public` as an identifier in strict mode - ┌─ parameterProperty.ts:5:19 - │ - 5 │ not_constructor(public arg: number = 10) { - │ ^^^^^^ + 3 │ // fails because of comment + 4 │ } + > 5 │ not_constructor(public arg: number = 10) { + │ ^^^^^^ + 6 │ } + 7 │ } parameterProperty.ts:5:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -62,10 +64,12 @@ parameterProperty.ts:5:26 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ parameterProperty.ts:5:26 - │ - 5 │ not_constructor(public arg: number = 10) { - │ ^^^ + 3 │ // fails because of comment + 4 │ } + > 5 │ not_constructor(public arg: number = 10) { + │ ^^^ + 6 │ } + 7 │ } ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/custom/abstract/abstractProperties.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/custom/abstract/abstractProperties.ts.snap index 1e507f97fc5..27d19f0a5a9 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/custom/abstract/abstractProperties.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/custom/abstract/abstractProperties.ts.snap @@ -58,97 +58,119 @@ abstractProperties.ts:2:14 parse ━━━━━━━━━━━━━━━ × 'private' cannot be used with 'abstract' modifier. - ┌─ abstractProperties.ts:2:14 - │ - 2 │ abstract private a: 1; - │ ^^^^^^^ + 1 │ abstract class Foo { + > 2 │ abstract private a: 1; + │ ^^^^^^^ + 3 │ private abstract b: 2; + 4 │ static abstract c: 3; i 'abstract' modifier - ┌─ abstractProperties.ts:2:5 - │ - 2 │ abstract private a: 1; - │ ^^^^^^^^ + 1 │ abstract class Foo { + > 2 │ abstract private a: 1; + │ ^^^^^^^^ + 3 │ private abstract b: 2; + 4 │ static abstract c: 3; abstractProperties.ts:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'private' cannot be used with 'abstract' modifier. - ┌─ abstractProperties.ts:3:5 - │ - 3 │ private abstract b: 2; - │ ^^^^^^^ + 1 │ abstract class Foo { + 2 │ abstract private a: 1; + > 3 │ private abstract b: 2; + │ ^^^^^^^ + 4 │ static abstract c: 3; + 5 │ abstract private ['g']; i 'abstract' modifier - ┌─ abstractProperties.ts:3:13 - │ - 3 │ private abstract b: 2; - │ ^^^^^^^^ + 1 │ abstract class Foo { + 2 │ abstract private a: 1; + > 3 │ private abstract b: 2; + │ ^^^^^^^^ + 4 │ static abstract c: 3; + 5 │ abstract private ['g']; abstractProperties.ts:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' cannot be used with 'static' modifier. - ┌─ abstractProperties.ts:4:12 - │ - 4 │ static abstract c: 3; - │ ^^^^^^^^ + 2 │ abstract private a: 1; + 3 │ private abstract b: 2; + > 4 │ static abstract c: 3; + │ ^^^^^^^^ + 5 │ abstract private ['g']; + 6 │ private abstract ['h']; i 'static' modifier - ┌─ abstractProperties.ts:4:5 - │ - 4 │ static abstract c: 3; - │ ^^^^^^ + 2 │ abstract private a: 1; + 3 │ private abstract b: 2; + > 4 │ static abstract c: 3; + │ ^^^^^^ + 5 │ abstract private ['g']; + 6 │ private abstract ['h']; abstractProperties.ts:5:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'private' cannot be used with 'abstract' modifier. - ┌─ abstractProperties.ts:5:14 - │ - 5 │ abstract private ['g']; - │ ^^^^^^^ + 3 │ private abstract b: 2; + 4 │ static abstract c: 3; + > 5 │ abstract private ['g']; + │ ^^^^^^^ + 6 │ private abstract ['h']; + 7 │ static abstract ['i']; i 'abstract' modifier - ┌─ abstractProperties.ts:5:5 - │ - 5 │ abstract private ['g']; - │ ^^^^^^^^ + 3 │ private abstract b: 2; + 4 │ static abstract c: 3; + > 5 │ abstract private ['g']; + │ ^^^^^^^^ + 6 │ private abstract ['h']; + 7 │ static abstract ['i']; abstractProperties.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'private' cannot be used with 'abstract' modifier. - ┌─ abstractProperties.ts:6:5 - │ - 6 │ private abstract ['h']; - │ ^^^^^^^ + 4 │ static abstract c: 3; + 5 │ abstract private ['g']; + > 6 │ private abstract ['h']; + │ ^^^^^^^ + 7 │ static abstract ['i']; + 8 │ } i 'abstract' modifier - ┌─ abstractProperties.ts:6:13 - │ - 6 │ private abstract ['h']; - │ ^^^^^^^^ + 4 │ static abstract c: 3; + 5 │ abstract private ['g']; + > 6 │ private abstract ['h']; + │ ^^^^^^^^ + 7 │ static abstract ['i']; + 8 │ } abstractProperties.ts:7:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' cannot be used with 'static' modifier. - ┌─ abstractProperties.ts:7:12 - │ - 7 │ static abstract ['i']; - │ ^^^^^^^^ + 5 │ abstract private ['g']; + 6 │ private abstract ['h']; + > 7 │ static abstract ['i']; + │ ^^^^^^^^ + 8 │ } + 9 │ i 'static' modifier - ┌─ abstractProperties.ts:7:5 - │ - 7 │ static abstract ['i']; - │ ^^^^^^ + 5 │ abstract private ['g']; + 6 │ private abstract ['h']; + > 7 │ static abstract ['i']; + │ ^^^^^^ + 8 │ } + 9 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/declare/declare_function_with_body.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/declare/declare_function_with_body.ts.snap index eedbbcc1680..2342199e879 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/declare/declare_function_with_body.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/declare/declare_function_with_body.ts.snap @@ -49,10 +49,11 @@ declare_function_with_body.ts:2:24 parse ━━━━━━━━━━━━━ × remove this body - ┌─ declare_function_with_body.ts:2:24 - │ - 2 │ declare function foo() {} - │ ^^ + 1 │ // Invalid, but recoverable + > 2 │ declare function foo() {} + │ ^^ + 3 │ declare function bar() { + 4 │ // comment declare_function_with_body.ts:3:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -60,13 +61,14 @@ declare_function_with_body.ts:3:24 parse ━━━━━━━━━━━━━ × remove this body - ┌─ declare_function_with_body.ts:3:24 - │ - 3 │ declare function bar() { - │ ┌────────────────────────^ - 4 │ │ // comment - 5 │ │ } - │ └─^ + 1 │ // Invalid, but recoverable + 2 │ declare function foo() {} + > 3 │ declare function bar() { + │ ^ + > 4 │ // comment + > 5 │ } + │ ^ + 6 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/decorators-comments.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/decorators-comments.ts.snap index 3da3a301507..50ad05e6e27 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/decorators-comments.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/decorators-comments.ts.snap @@ -129,19 +129,23 @@ decorators-comments.ts:35:5 parse ━━━━━━━━━━━━━━━ × Only abstract classes can have abstract members - ┌─ decorators-comments.ts:35:5 - │ - 35 │ abstract property: Array - │ ^^^^^^^^ + 33 │ @foo() + 34 │ // comment + > 35 │ abstract property: Array + │ ^^^^^^^^ + 36 │ } + 37 │ decorators-comments.ts:41:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Only abstract classes can have abstract members - ┌─ decorators-comments.ts:41:5 - │ - 41 │ abstract method(): Array - │ ^^^^^^^^ + 39 │ @foo() + 40 │ // comment + > 41 │ abstract method(): Array + │ ^^^^^^^^ + 42 │ } + 43 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/definite.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/definite.ts.snap index 0cbaae33fd7..2683160bec9 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/definite.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/definite.ts.snap @@ -51,15 +51,19 @@ definite.ts:5:18 parse ━━━━━━━━━━━━━━━━━━━ × Declarations with initializers cannot also have definite assignment assertions. - ┌─ definite.ts:5:18 - │ - 5 │ const x!: string = ''; - │ ^^^^ + 3 │ } + 4 │ + > 5 │ const x!: string = ''; + │ ^^^^ + 6 │ + 7 │ var y!: MyComponent - ┌─ definite.ts:5:8 - │ - 5 │ const x!: string = ''; - │ ^^^^^^^^^ + 3 │ } + 4 │ + > 5 │ const x!: string = ''; + │ ^^^^^^^^^ + 6 │ + 7 │ var y!: MyComponent ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/without-annotation.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/without-annotation.ts.snap index 3bcee919654..af3e60d3124 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/without-annotation.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/without-annotation.ts.snap @@ -75,46 +75,56 @@ without-annotation.ts:3:3 parse ━━━━━━━━━━━━━━━━ × Properties with definite assignment assertions must also have type annotations. - ┌─ without-annotation.ts:3:3 - │ - 3 │ #b! - │ ^ + 1 │ class Foo { + 2 │ a! + > 3 │ #b! + │ ^ + 4 │ static c! + 5 │ [d]! = 1 without-annotation.ts:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Properties with definite assignment assertions must also have type annotations. - ┌─ without-annotation.ts:4:3 - │ - 4 │ static c! - │ ^^^^^^ + 2 │ a! + 3 │ #b! + > 4 │ static c! + │ ^^^^^^ + 5 │ [d]! = 1 + 6 │ 'e'! without-annotation.ts:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Properties with definite assignment assertions must also have type annotations. - ┌─ without-annotation.ts:5:3 - │ - 5 │ [d]! = 1 - │ ^ + 3 │ #b! + 4 │ static c! + > 5 │ [d]! = 1 + │ ^ + 6 │ 'e'! + 7 │ } without-annotation.ts:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Properties with definite assignment assertions must also have type annotations. - ┌─ without-annotation.ts:5:8 - │ - 5 │ [d]! = 1 - │ ^ + 3 │ #b! + 4 │ static c! + > 5 │ [d]! = 1 + │ ^ + 6 │ 'e'! + 7 │ } without-annotation.ts:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Properties with definite assignment assertions must also have type annotations. - ┌─ without-annotation.ts:7:1 - │ - 7 │ } - │ ^ + 5 │ [d]! = 1 + 6 │ 'e'! + > 7 │ } + │ ^ + 8 │ + 9 │ let a! = x without-annotation.ts:9:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -122,10 +132,12 @@ without-annotation.ts:9:8 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ without-annotation.ts:9:8 - │ - 9 │ let a! = x - │ ^ + 7 │ } + 8 │ + > 9 │ let a! = x + │ ^ + 10 │ const b! = x + 11 │ var c/* */! = x without-annotation.ts:10:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -133,10 +145,11 @@ without-annotation.ts:10:10 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ without-annotation.ts:10:10 - │ - 10 │ const b! = x - │ ^ + 9 │ let a! = x + > 10 │ const b! = x + │ ^ + 11 │ var c/* */! = x + 12 │ export const d! = x without-annotation.ts:11:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -144,10 +157,12 @@ without-annotation.ts:11:13 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ without-annotation.ts:11:13 - │ - 11 │ var c/* */! = x - │ ^ + 9 │ let a! = x + 10 │ const b! = x + > 11 │ var c/* */! = x + │ ^ + 12 │ export const d! = x + 13 │ without-annotation.ts:12:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -155,10 +170,11 @@ without-annotation.ts:12:17 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ without-annotation.ts:12:17 - │ - 12 │ export const d! = x - │ ^ + 10 │ const b! = x + 11 │ var c/* */! = x + > 12 │ export const d! = x + │ ^ + 13 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/generic.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/generic.ts.snap index 314819b69ff..40546e62473 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/generic.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/generic.ts.snap @@ -85,10 +85,10 @@ generic.ts:1:4 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ generic.ts:1:4 - │ - 1 │ f1<>(); - │ ^ + > 1 │ f1<>(); + │ ^ + 2 │ + 3 │ new f2<>(); generic.ts:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -96,10 +96,12 @@ generic.ts:3:8 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ generic.ts:3:8 - │ - 3 │ new f2<>(); - │ ^ + 1 │ f1<>(); + 2 │ + > 3 │ new f2<>(); + │ ^ + 4 │ + 5 │ function f3<>() {} generic.ts:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -107,10 +109,12 @@ generic.ts:5:13 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ generic.ts:5:13 - │ - 5 │ function f3<>() {} - │ ^ + 3 │ new f2<>(); + 4 │ + > 5 │ function f3<>() {} + │ ^ + 6 │ + 7 │ class f4 { generic.ts:8:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -118,19 +122,21 @@ generic.ts:8:17 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ generic.ts:8:17 - │ - 8 │ constructor<>() {} - │ ^ + 7 │ class f4 { + > 8 │ constructor<>() {} + │ ^ + 9 │ } + 10 │ generic.ts:8:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × constructors cannot have type parameters. - ┌─ generic.ts:8:16 - │ - 8 │ constructor<>() {} - │ ^^ + 7 │ class f4 { + > 8 │ constructor<>() {} + │ ^^ + 9 │ } + 10 │ generic.ts:11:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -138,10 +144,12 @@ generic.ts:11:21 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ generic.ts:11:21 - │ - 11 │ const f5 = function<>() {} - │ ^ + 9 │ } + 10 │ + > 11 │ const f5 = function<>() {} + │ ^ + 12 │ + 13 │ interface f6<> { generic.ts:13:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -149,10 +157,12 @@ generic.ts:13:14 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ generic.ts:13:14 - │ - 13 │ interface f6<> { - │ ^ + 11 │ const f5 = function<>() {} + 12 │ + > 13 │ interface f6<> { + │ ^ + 14 │ test<>(); + 15 │ } generic.ts:14:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -160,10 +170,11 @@ generic.ts:14:10 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ generic.ts:14:10 - │ - 14 │ test<>(); - │ ^ + 13 │ interface f6<> { + > 14 │ test<>(); + │ ^ + 15 │ } + 16 │ generic.ts:17:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -171,10 +182,12 @@ generic.ts:17:10 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ generic.ts:17:10 - │ - 17 │ class f7<> { - │ ^ + 15 │ } + 16 │ + > 17 │ class f7<> { + │ ^ + 18 │ test<>() {} + 19 │ } generic.ts:18:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -182,10 +195,11 @@ generic.ts:18:10 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ generic.ts:18:10 - │ - 18 │ test<>() {} - │ ^ + 17 │ class f7<> { + > 18 │ test<>() {} + │ ^ + 19 │ } + 20 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/index-signature.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/index-signature.ts.snap index 4093952a229..7a4ca51f733 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/index-signature.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/index-signature.ts.snap @@ -109,10 +109,10 @@ index-signature.ts:1:26 parse ━━━━━━━━━━━━━━━━ × An index signature must have a type annotation - ┌─ index-signature.ts:1:26 - │ - 1 │ type A = { [key: string] }; - │ ^ + > 1 │ type A = { [key: string] }; + │ ^ + 2 │ + 3 │ type TwoParams = { index-signature.ts:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -120,10 +120,11 @@ index-signature.ts:4:13 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ index-signature.ts:4:13 - │ - 4 │ [a: string, b: string]: string; - │ ^ + 3 │ type TwoParams = { + > 4 │ [a: string, b: string]: string; + │ ^ + 5 │ }; + 6 │ type ThreeParams = { index-signature.ts:4:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -131,10 +132,11 @@ index-signature.ts:4:24 parse ━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ index-signature.ts:4:24 - │ - 4 │ [a: string, b: string]: string; - │ ^ + 3 │ type TwoParams = { + > 4 │ [a: string, b: string]: string; + │ ^ + 5 │ }; + 6 │ type ThreeParams = { index-signature.ts:4:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -142,10 +144,11 @@ index-signature.ts:4:33 parse ━━━━━━━━━━━━━━━━ × Expected a property, or a signature here - ┌─ index-signature.ts:4:33 - │ - 4 │ [a: string, b: string]: string; - │ ^ + 3 │ type TwoParams = { + > 4 │ [a: string, b: string]: string; + │ ^ + 5 │ }; + 6 │ type ThreeParams = { index-signature.ts:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -153,10 +156,12 @@ index-signature.ts:5:1 parse ━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ index-signature.ts:5:1 - │ - 5 │ }; - │ ^ + 3 │ type TwoParams = { + 4 │ [a: string, b: string]: string; + > 5 │ }; + │ ^ + 6 │ type ThreeParams = { + 7 │ [a: string, b: string, c: string]: string; index-signature.ts:7:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -164,10 +169,12 @@ index-signature.ts:7:13 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ index-signature.ts:7:13 - │ - 7 │ [a: string, b: string, c: string]: string; - │ ^ + 5 │ }; + 6 │ type ThreeParams = { + > 7 │ [a: string, b: string, c: string]: string; + │ ^ + 8 │ }; + 9 │ index-signature.ts:7:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -175,10 +182,12 @@ index-signature.ts:7:35 parse ━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ index-signature.ts:7:35 - │ - 7 │ [a: string, b: string, c: string]: string; - │ ^ + 5 │ }; + 6 │ type ThreeParams = { + > 7 │ [a: string, b: string, c: string]: string; + │ ^ + 8 │ }; + 9 │ index-signature.ts:7:44 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -186,10 +195,12 @@ index-signature.ts:7:44 parse ━━━━━━━━━━━━━━━━ × Expected a property, or a signature here - ┌─ index-signature.ts:7:44 - │ - 7 │ [a: string, b: string, c: string]: string; - │ ^ + 5 │ }; + 6 │ type ThreeParams = { + > 7 │ [a: string, b: string, c: string]: string; + │ ^ + 8 │ }; + 9 │ index-signature.ts:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -197,10 +208,12 @@ index-signature.ts:8:1 parse ━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ index-signature.ts:8:1 - │ - 8 │ }; - │ ^ + 6 │ type ThreeParams = { + 7 │ [a: string, b: string, c: string]: string; + > 8 │ }; + │ ^ + 9 │ + 10 │ type TooLong = { index-signature.ts:11:41 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -208,10 +221,11 @@ index-signature.ts:11:41 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ index-signature.ts:11:41 - │ - 11 │ [loooooooooooooooooooooooooong: string, looooooooooooooooooooooooooooooooooooooong: string]: string; - │ ^ + 10 │ type TooLong = { + > 11 │ [loooooooooooooooooooooooooong: string, looooooooooooooooooooooooooooooooooooooong: string]: string; + │ ^ + 12 │ } + 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } index-signature.ts:11:93 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -219,10 +233,11 @@ index-signature.ts:11:93 parse ━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ index-signature.ts:11:93 - │ - 11 │ [loooooooooooooooooooooooooong: string, looooooooooooooooooooooooooooooooooooooong: string]: string; - │ ^ + 10 │ type TooLong = { + > 11 │ [loooooooooooooooooooooooooong: string, looooooooooooooooooooooooooooooooooooooong: string]: string; + │ ^ + 12 │ } + 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } index-signature.ts:11:102 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -230,10 +245,11 @@ index-signature.ts:11:102 parse ━━━━━━━━━━━━━━━━ × Expected a property, or a signature here - ┌─ index-signature.ts:11:102 - │ - 11 │ [loooooooooooooooooooooooooong: string, looooooooooooooooooooooooooooooooooooooong: string]: string; - │ ^ + 10 │ type TooLong = { + > 11 │ [loooooooooooooooooooooooooong: string, looooooooooooooooooooooooooooooooooooooong: string]: string; + │ ^ + 12 │ } + 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } index-signature.ts:12:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -241,10 +257,12 @@ index-signature.ts:12:1 parse ━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ index-signature.ts:12:1 - │ - 12 │ } - │ ^ + 10 │ type TooLong = { + 11 │ [loooooooooooooooooooooooooong: string, looooooooooooooooooooooooooooooooooooooong: string]: string; + > 12 │ } + │ ^ + 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } + 14 │ type TooLong80 = { [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string; } index-signature.ts:13:58 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -252,10 +270,12 @@ index-signature.ts:13:58 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ index-signature.ts:13:58 - │ - 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } - │ ^ + 11 │ [loooooooooooooooooooooooooong: string, looooooooooooooooooooooooooooooooooooooong: string]: string; + 12 │ } + > 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } + │ ^ + 14 │ type TooLong80 = { [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string; } + 15 │ index-signature.ts:13:89 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -263,10 +283,12 @@ index-signature.ts:13:89 parse ━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ index-signature.ts:13:89 - │ - 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } - │ ^ + 11 │ [loooooooooooooooooooooooooong: string, looooooooooooooooooooooooooooooooooooooong: string]: string; + 12 │ } + > 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } + │ ^ + 14 │ type TooLong80 = { [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string; } + 15 │ index-signature.ts:13:98 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -274,10 +296,12 @@ index-signature.ts:13:98 parse ━━━━━━━━━━━━━━━━ × Expected a property, or a signature here - ┌─ index-signature.ts:13:98 - │ - 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } - │ ^ + 11 │ [loooooooooooooooooooooooooong: string, looooooooooooooooooooooooooooooooooooooong: string]: string; + 12 │ } + > 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } + │ ^ + 14 │ type TooLong80 = { [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string; } + 15 │ index-signature.ts:13:100 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -285,10 +309,12 @@ index-signature.ts:13:100 parse ━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ index-signature.ts:13:100 - │ - 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } - │ ^ + 11 │ [loooooooooooooooooooooooooong: string, looooooooooooooooooooooooooooooooooooooong: string]: string; + 12 │ } + > 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } + │ ^ + 14 │ type TooLong80 = { [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string; } + 15 │ index-signature.ts:14:58 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -296,10 +322,12 @@ index-signature.ts:14:58 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ index-signature.ts:14:58 - │ - 14 │ type TooLong80 = { [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string; } - │ ^ + 12 │ } + 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } + > 14 │ type TooLong80 = { [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string; } + │ ^ + 15 │ + 16 │ // note lack of trailing comma in the index signature index-signature.ts:14:88 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -307,10 +335,12 @@ index-signature.ts:14:88 parse ━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ index-signature.ts:14:88 - │ - 14 │ type TooLong80 = { [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string; } - │ ^ + 12 │ } + 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } + > 14 │ type TooLong80 = { [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string; } + │ ^ + 15 │ + 16 │ // note lack of trailing comma in the index signature index-signature.ts:14:97 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -318,10 +348,12 @@ index-signature.ts:14:97 parse ━━━━━━━━━━━━━━━━ × Expected a property, or a signature here - ┌─ index-signature.ts:14:97 - │ - 14 │ type TooLong80 = { [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string; } - │ ^ + 12 │ } + 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } + > 14 │ type TooLong80 = { [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string; } + │ ^ + 15 │ + 16 │ // note lack of trailing comma in the index signature index-signature.ts:14:99 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -329,10 +361,12 @@ index-signature.ts:14:99 parse ━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ index-signature.ts:14:99 - │ - 14 │ type TooLong80 = { [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string; } - │ ^ + 12 │ } + 13 │ type TooLong81 = { [loooooooooooooooooooooooooong: string, loooooooooooooooooong: string]: string; } + > 14 │ type TooLong80 = { [loooooooooooooooooooooooooong: string, looooooooooooooooong: string]: string; } + │ ^ + 15 │ + 16 │ // note lack of trailing comma in the index signature ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/jsdoc_only_types.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/jsdoc_only_types.ts.snap index c655911950c..f7b8f608062 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/jsdoc_only_types.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/jsdoc_only_types.ts.snap @@ -77,10 +77,10 @@ jsdoc_only_types.ts:1:8 parse ━━━━━━━━━━━━━━━━ × Expected a type here - ┌─ jsdoc_only_types.ts:1:8 - │ - 1 │ let a: *; - │ ^ + > 1 │ let a: *; + │ ^ + 2 │ function b(x: ?) {} + 3 │ let c: ?string; jsdoc_only_types.ts:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -88,10 +88,11 @@ jsdoc_only_types.ts:2:15 parse ━━━━━━━━━━━━━━━━ × Expected a type here - ┌─ jsdoc_only_types.ts:2:15 - │ - 2 │ function b(x: ?) {} - │ ^ + 1 │ let a: *; + > 2 │ function b(x: ?) {} + │ ^ + 3 │ let c: ?string; + 4 │ let d: string?; jsdoc_only_types.ts:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -99,10 +100,12 @@ jsdoc_only_types.ts:3:8 parse ━━━━━━━━━━━━━━━━ × Expected a type here - ┌─ jsdoc_only_types.ts:3:8 - │ - 3 │ let c: ?string; - │ ^ + 1 │ let a: *; + 2 │ function b(x: ?) {} + > 3 │ let c: ?string; + │ ^ + 4 │ let d: string?; + 5 │ let e: ?(string | number); jsdoc_only_types.ts:4:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -110,17 +113,21 @@ jsdoc_only_types.ts:4:14 parse ━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ jsdoc_only_types.ts:4:14 - │ - 4 │ let d: string?; - │ ^ + 2 │ function b(x: ?) {} + 3 │ let c: ?string; + > 4 │ let d: string?; + │ ^ + 5 │ let e: ?(string | number); + 6 │ let f: !string; i ...Which is required to end this statement - ┌─ jsdoc_only_types.ts:4:1 - │ - 4 │ let d: string?; - │ ^^^^^^^^^^^^^ + 2 │ function b(x: ?) {} + 3 │ let c: ?string; + > 4 │ let d: string?; + │ ^^^^^^^^^^^^^ + 5 │ let e: ?(string | number); + 6 │ let f: !string; jsdoc_only_types.ts:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -128,10 +135,12 @@ jsdoc_only_types.ts:5:8 parse ━━━━━━━━━━━━━━━━ × Expected a type here - ┌─ jsdoc_only_types.ts:5:8 - │ - 5 │ let e: ?(string | number); - │ ^ + 3 │ let c: ?string; + 4 │ let d: string?; + > 5 │ let e: ?(string | number); + │ ^ + 6 │ let f: !string; + 7 │ let g: string!; jsdoc_only_types.ts:6:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -139,10 +148,12 @@ jsdoc_only_types.ts:6:8 parse ━━━━━━━━━━━━━━━━ × Expected a type here - ┌─ jsdoc_only_types.ts:6:8 - │ - 6 │ let f: !string; - │ ^ + 4 │ let d: string?; + 5 │ let e: ?(string | number); + > 6 │ let f: !string; + │ ^ + 7 │ let g: string!; + 8 │ let h: !(string | number); jsdoc_only_types.ts:7:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -150,17 +161,21 @@ jsdoc_only_types.ts:7:14 parse ━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ jsdoc_only_types.ts:7:14 - │ - 7 │ let g: string!; - │ ^ + 5 │ let e: ?(string | number); + 6 │ let f: !string; + > 7 │ let g: string!; + │ ^ + 8 │ let h: !(string | number); + 9 │ i ...Which is required to end this statement - ┌─ jsdoc_only_types.ts:7:1 - │ - 7 │ let g: string!; - │ ^^^^^^^^^^^^^ + 5 │ let e: ?(string | number); + 6 │ let f: !string; + > 7 │ let g: string!; + │ ^^^^^^^^^^^^^ + 8 │ let h: !(string | number); + 9 │ jsdoc_only_types.ts:8:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -168,10 +183,11 @@ jsdoc_only_types.ts:8:8 parse ━━━━━━━━━━━━━━━━ × Expected a type here - ┌─ jsdoc_only_types.ts:8:8 - │ - 8 │ let h: !(string | number); - │ ^ + 6 │ let f: !string; + 7 │ let g: string!; + > 8 │ let h: !(string | number); + │ ^ + 9 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/import-export/type-modifier.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/import-export/type-modifier.ts.snap index 61df81ea760..8d7ca0b0c41 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/import-export/type-modifier.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/import-export/type-modifier.ts.snap @@ -65,10 +65,11 @@ type-modifier.ts:15:8 parse ━━━━━━━━━━━━━━━━━ × A type-only import can specify a default import or named bindings, but not both. - ┌─ type-modifier.ts:15:8 - │ - 15 │ import type foo, { bar } from 'bar'; - │ ^^^^^^^^^^^^^^^^^ + 13 │ import type * as foo from './bar'; + 14 │ import type foo from 'bar'; + > 15 │ import type foo, { bar } from 'bar'; + │ ^^^^^^^^^^^^^^^^^ + 16 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/infer-extends/basic.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/infer-extends/basic.ts.snap index 0974a43dc73..d0a87451b80 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/infer-extends/basic.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/infer-extends/basic.ts.snap @@ -68,10 +68,10 @@ basic.ts:1:47 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:1:47 - │ - 1 │ type X3 = T extends [infer U extends number] ? MustBeNumber : never; - │ ^ + > 1 │ type X3 = T extends [infer U extends number] ? MustBeNumber : never; + │ ^ + 2 │ type X4 = T extends [infer U extends number, infer U extends number] ? MustBeNumber : never; + 3 │ type X5 = T extends [infer U extends number, infer U] ? MustBeNumber : never; basic.ts:2:47 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -79,10 +79,11 @@ basic.ts:2:47 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:2:47 - │ - 2 │ type X4 = T extends [infer U extends number, infer U extends number] ? MustBeNumber : never; - │ ^ + 1 │ type X3 = T extends [infer U extends number] ? MustBeNumber : never; + > 2 │ type X4 = T extends [infer U extends number, infer U extends number] ? MustBeNumber : never; + │ ^ + 3 │ type X5 = T extends [infer U extends number, infer U] ? MustBeNumber : never; + 4 │ type X6 = T extends [infer U, infer U extends number] ? MustBeNumber : never; basic.ts:2:71 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -90,10 +91,11 @@ basic.ts:2:71 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:2:71 - │ - 2 │ type X4 = T extends [infer U extends number, infer U extends number] ? MustBeNumber : never; - │ ^ + 1 │ type X3 = T extends [infer U extends number] ? MustBeNumber : never; + > 2 │ type X4 = T extends [infer U extends number, infer U extends number] ? MustBeNumber : never; + │ ^ + 3 │ type X5 = T extends [infer U extends number, infer U] ? MustBeNumber : never; + 4 │ type X6 = T extends [infer U, infer U extends number] ? MustBeNumber : never; basic.ts:3:47 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -101,10 +103,12 @@ basic.ts:3:47 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:3:47 - │ - 3 │ type X5 = T extends [infer U extends number, infer U] ? MustBeNumber : never; - │ ^ + 1 │ type X3 = T extends [infer U extends number] ? MustBeNumber : never; + 2 │ type X4 = T extends [infer U extends number, infer U extends number] ? MustBeNumber : never; + > 3 │ type X5 = T extends [infer U extends number, infer U] ? MustBeNumber : never; + │ ^ + 4 │ type X6 = T extends [infer U, infer U extends number] ? MustBeNumber : never; + 5 │ type X7 = T extends [infer U extends string, infer U extends number] ? U : never; basic.ts:4:56 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -112,10 +116,12 @@ basic.ts:4:56 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:4:56 - │ - 4 │ type X6 = T extends [infer U, infer U extends number] ? MustBeNumber : never; - │ ^ + 2 │ type X4 = T extends [infer U extends number, infer U extends number] ? MustBeNumber : never; + 3 │ type X5 = T extends [infer U extends number, infer U] ? MustBeNumber : never; + > 4 │ type X6 = T extends [infer U, infer U extends number] ? MustBeNumber : never; + │ ^ + 5 │ type X7 = T extends [infer U extends string, infer U extends number] ? U : never; + 6 │ type X8 = T extends infer U extends number ? U : T; basic.ts:5:47 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -123,10 +129,12 @@ basic.ts:5:47 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:5:47 - │ - 5 │ type X7 = T extends [infer U extends string, infer U extends number] ? U : never; - │ ^ + 3 │ type X5 = T extends [infer U extends number, infer U] ? MustBeNumber : never; + 4 │ type X6 = T extends [infer U, infer U extends number] ? MustBeNumber : never; + > 5 │ type X7 = T extends [infer U extends string, infer U extends number] ? U : never; + │ ^ + 6 │ type X8 = T extends infer U extends number ? U : T; + 7 │ type X9 = T extends (infer U extends number ? U : T) ? U : T; basic.ts:5:71 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -134,10 +142,12 @@ basic.ts:5:71 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:5:71 - │ - 5 │ type X7 = T extends [infer U extends string, infer U extends number] ? U : never; - │ ^ + 3 │ type X5 = T extends [infer U extends number, infer U] ? MustBeNumber : never; + 4 │ type X6 = T extends [infer U, infer U extends number] ? MustBeNumber : never; + > 5 │ type X7 = T extends [infer U extends string, infer U extends number] ? U : never; + │ ^ + 6 │ type X8 = T extends infer U extends number ? U : T; + 7 │ type X9 = T extends (infer U extends number ? U : T) ? U : T; basic.ts:6:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -145,10 +155,12 @@ basic.ts:6:35 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:6:35 - │ - 6 │ type X8 = T extends infer U extends number ? U : T; - │ ^^^^^^^ + 4 │ type X6 = T extends [infer U, infer U extends number] ? MustBeNumber : never; + 5 │ type X7 = T extends [infer U extends string, infer U extends number] ? U : never; + > 6 │ type X8 = T extends infer U extends number ? U : T; + │ ^^^^^^^ + 7 │ type X9 = T extends (infer U extends number ? U : T) ? U : T; + 8 │ basic.ts:6:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -156,10 +168,12 @@ basic.ts:6:43 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:6:43 - │ - 6 │ type X8 = T extends infer U extends number ? U : T; - │ ^^^^^^ + 4 │ type X6 = T extends [infer U, infer U extends number] ? MustBeNumber : never; + 5 │ type X7 = T extends [infer U extends string, infer U extends number] ? U : never; + > 6 │ type X8 = T extends infer U extends number ? U : T; + │ ^^^^^^ + 7 │ type X9 = T extends (infer U extends number ? U : T) ? U : T; + 8 │ basic.ts:6:50 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -167,17 +181,21 @@ basic.ts:6:50 parse ━━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ basic.ts:6:50 - │ - 6 │ type X8 = T extends infer U extends number ? U : T; - │ ^ + 4 │ type X6 = T extends [infer U, infer U extends number] ? MustBeNumber : never; + 5 │ type X7 = T extends [infer U extends string, infer U extends number] ? U : never; + > 6 │ type X8 = T extends infer U extends number ? U : T; + │ ^ + 7 │ type X9 = T extends (infer U extends number ? U : T) ? U : T; + 8 │ i ...Which is required to end this statement - ┌─ basic.ts:6:1 - │ - 6 │ type X8 = T extends infer U extends number ? U : T; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ type X6 = T extends [infer U, infer U extends number] ? MustBeNumber : never; + 5 │ type X7 = T extends [infer U extends string, infer U extends number] ? U : never; + > 6 │ type X8 = T extends infer U extends number ? U : T; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 7 │ type X9 = T extends (infer U extends number ? U : T) ? U : T; + 8 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/interface/abstract.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/interface/abstract.ts.snap index c07a069354c..1fc4565f061 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/interface/abstract.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/interface/abstract.ts.snap @@ -40,17 +40,17 @@ abstract.ts:1:10 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ abstract.ts:1:10 - │ - 1 │ abstract interface I { - │ ^^^^^^^^^ + > 1 │ abstract interface I { + │ ^^^^^^^^^ + 2 │ + 3 │ } i ...Which is required to end this statement - ┌─ abstract.ts:1:1 - │ - 1 │ abstract interface I { - │ ^^^^^^^^^^^^^^^^^^ + > 1 │ abstract interface I { + │ ^^^^^^^^^^^^^^^^^^ + 2 │ + 3 │ } ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/interface2/break.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/interface2/break.ts.snap index a1d4af629b8..979fe9613f0 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/interface2/break.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/interface2/break.ts.snap @@ -225,10 +225,12 @@ break.ts:5:1 parse ━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ break.ts:5:1 - │ - 5 │ > { - │ ^ + 3 │ AnotherType, + 4 │ YetAnotherType, + > 5 │ > { + │ ^ + 6 │ m(): void; + 7 │ }; break.ts:16:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -236,10 +238,12 @@ break.ts:16:1 parse ━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ break.ts:16:1 - │ - 16 │ > { - │ ^ + 14 │ DifferentType3, + 15 │ DifferentType4, + > 16 │ > { + │ ^ + 17 │ m() {}; + 18 │ }; ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/keywords.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/keywords.ts.snap index f0a16384d53..53feb79b1da 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/keywords.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/keywords.ts.snap @@ -202,10 +202,11 @@ keywords.ts:4:5 parse ━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `public` as an identifier in strict mode - ┌─ keywords.ts:4:5 - │ - 4 │ public module Module { - │ ^^^^^^ + 3 │ module Y3 { + > 4 │ public module Module { + │ ^^^^^^ + 5 │ class A { s: string } + 6 │ } keywords.ts:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -213,17 +214,19 @@ keywords.ts:4:12 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ keywords.ts:4:12 - │ - 4 │ public module Module { - │ ^^^^^^ + 3 │ module Y3 { + > 4 │ public module Module { + │ ^^^^^^ + 5 │ class A { s: string } + 6 │ } i ...Which is required to end this statement - ┌─ keywords.ts:4:5 - │ - 4 │ public module Module { - │ ^^^^^^^^^^^^^ + 3 │ module Y3 { + > 4 │ public module Module { + │ ^^^^^^^^^^^^^ + 5 │ class A { s: string } + 6 │ } keywords.ts:9:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -231,10 +234,11 @@ keywords.ts:9:12 parse ━━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration here - ┌─ keywords.ts:9:12 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^ + 10 │ + 11 │ interface x { keywords.ts:9:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -242,17 +246,19 @@ keywords.ts:9:20 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ keywords.ts:9:20 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^ + 10 │ + 11 │ interface x { i ...Which is required to end this statement - ┌─ keywords.ts:9:12 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^^^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^^^^^^ + 10 │ + 11 │ interface x { keywords.ts:9:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -260,17 +266,19 @@ keywords.ts:9:27 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ keywords.ts:9:27 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^ + 10 │ + 11 │ interface x { i ...Which is required to end this statement - ┌─ keywords.ts:9:20 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^^^^^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^^^^^^^^ + 10 │ + 11 │ interface x { keywords.ts:9:37 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -278,17 +286,19 @@ keywords.ts:9:37 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ keywords.ts:9:37 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^ + 10 │ + 11 │ interface x { i ...Which is required to end this statement - ┌─ keywords.ts:9:27 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^^^^^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^^^^^^^^ + 10 │ + 11 │ interface x { keywords.ts:9:44 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -296,17 +306,19 @@ keywords.ts:9:44 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ keywords.ts:9:44 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^ + 10 │ + 11 │ interface x { i ...Which is required to end this statement - ┌─ keywords.ts:9:37 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^^^^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^^^^^^^ + 10 │ + 11 │ interface x { keywords.ts:9:53 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -314,17 +326,19 @@ keywords.ts:9:53 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ keywords.ts:9:53 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^ + 10 │ + 11 │ interface x { i ...Which is required to end this statement - ┌─ keywords.ts:9:44 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^^^^^^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^^^^^^^^^ + 10 │ + 11 │ interface x { keywords.ts:9:62 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -332,17 +346,19 @@ keywords.ts:9:62 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ keywords.ts:9:62 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^ + 10 │ + 11 │ interface x { i ...Which is required to end this statement - ┌─ keywords.ts:9:53 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^^^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^^^^^^ + 10 │ + 11 │ interface x { keywords.ts:9:68 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -350,17 +366,19 @@ keywords.ts:9:68 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ keywords.ts:9:68 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^ + 10 │ + 11 │ interface x { i ...Which is required to end this statement - ┌─ keywords.ts:9:62 - │ - 9 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^^ + 8 │ // Apparently this parses :P + > 9 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^^ + 10 │ + 11 │ interface x { keywords.ts:12:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -368,28 +386,31 @@ keywords.ts:12:16 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ keywords.ts:12:16 - │ - 12 │ export private static readonly [x: any]: any; - │ ^^^^^^^ + 11 │ interface x { + > 12 │ export private static readonly [x: any]: any; + │ ^^^^^^^ + 13 │ } + 14 │ } keywords.ts:12:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × index signature members cannot be static - ┌─ keywords.ts:12:24 - │ - 12 │ export private static readonly [x: any]: any; - │ ^^^^^^ + 11 │ interface x { + > 12 │ export private static readonly [x: any]: any; + │ ^^^^^^ + 13 │ } + 14 │ } keywords.ts:17:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `public` as an identifier in strict mode - ┌─ keywords.ts:17:5 - │ - 17 │ public enum Color { Blue, Red } - │ ^^^^^^ + 16 │ module Y4 { + > 17 │ public enum Color { Blue, Red } + │ ^^^^^^ + 18 │ } + 19 │ keywords.ts:17:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -397,26 +418,29 @@ keywords.ts:17:12 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ keywords.ts:17:12 - │ - 17 │ public enum Color { Blue, Red } - │ ^^^^ + 16 │ module Y4 { + > 17 │ public enum Color { Blue, Red } + │ ^^^^ + 18 │ } + 19 │ i ...Which is required to end this statement - ┌─ keywords.ts:17:5 - │ - 17 │ public enum Color { Blue, Red } - │ ^^^^^^^^^^^ + 16 │ module Y4 { + > 17 │ public enum Color { Blue, Red } + │ ^^^^^^^^^^^ + 18 │ } + 19 │ keywords.ts:21:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `private` as an identifier in strict mode - ┌─ keywords.ts:21:5 - │ - 21 │ private module Module { - │ ^^^^^^^ + 20 │ module YY3 { + > 21 │ private module Module { + │ ^^^^^^^ + 22 │ class A { s: string } + 23 │ } keywords.ts:21:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -424,26 +448,29 @@ keywords.ts:21:13 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ keywords.ts:21:13 - │ - 21 │ private module Module { - │ ^^^^^^ + 20 │ module YY3 { + > 21 │ private module Module { + │ ^^^^^^ + 22 │ class A { s: string } + 23 │ } i ...Which is required to end this statement - ┌─ keywords.ts:21:5 - │ - 21 │ private module Module { - │ ^^^^^^^^^^^^^^ + 20 │ module YY3 { + > 21 │ private module Module { + │ ^^^^^^^^^^^^^^ + 22 │ class A { s: string } + 23 │ } keywords.ts:27:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `private` as an identifier in strict mode - ┌─ keywords.ts:27:5 - │ - 27 │ private enum Color { Blue, Red } - │ ^^^^^^^ + 26 │ module YY4 { + > 27 │ private enum Color { Blue, Red } + │ ^^^^^^^ + 28 │ } + 29 │ keywords.ts:27:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -451,26 +478,29 @@ keywords.ts:27:13 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ keywords.ts:27:13 - │ - 27 │ private enum Color { Blue, Red } - │ ^^^^ + 26 │ module YY4 { + > 27 │ private enum Color { Blue, Red } + │ ^^^^ + 28 │ } + 29 │ i ...Which is required to end this statement - ┌─ keywords.ts:27:5 - │ - 27 │ private enum Color { Blue, Red } - │ ^^^^^^^^^^^^ + 26 │ module YY4 { + > 27 │ private enum Color { Blue, Red } + │ ^^^^^^^^^^^^ + 28 │ } + 29 │ keywords.ts:31:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `static` as an identifier in strict mode - ┌─ keywords.ts:31:5 - │ - 31 │ static module Module { - │ ^^^^^^ + 30 │ module YYY3 { + > 31 │ static module Module { + │ ^^^^^^ + 32 │ class A { s: string } + 33 │ } keywords.ts:31:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -478,26 +508,29 @@ keywords.ts:31:12 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ keywords.ts:31:12 - │ - 31 │ static module Module { - │ ^^^^^^ + 30 │ module YYY3 { + > 31 │ static module Module { + │ ^^^^^^ + 32 │ class A { s: string } + 33 │ } i ...Which is required to end this statement - ┌─ keywords.ts:31:5 - │ - 31 │ static module Module { - │ ^^^^^^^^^^^^^ + 30 │ module YYY3 { + > 31 │ static module Module { + │ ^^^^^^^^^^^^^ + 32 │ class A { s: string } + 33 │ } keywords.ts:37:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `static` as an identifier in strict mode - ┌─ keywords.ts:37:5 - │ - 37 │ static enum Color { Blue, Red } - │ ^^^^^^ + 36 │ module YYY4 { + > 37 │ static enum Color { Blue, Red } + │ ^^^^^^ + 38 │ } + 39 │ keywords.ts:37:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -505,17 +538,19 @@ keywords.ts:37:12 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ keywords.ts:37:12 - │ - 37 │ static enum Color { Blue, Red } - │ ^^^^ + 36 │ module YYY4 { + > 37 │ static enum Color { Blue, Red } + │ ^^^^ + 38 │ } + 39 │ i ...Which is required to end this statement - ┌─ keywords.ts:37:5 - │ - 37 │ static enum Color { Blue, Red } - │ ^^^^^^^^^^^ + 36 │ module YYY4 { + > 37 │ static enum Color { Blue, Red } + │ ^^^^^^^^^^^ + 38 │ } + 39 │ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/module.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/module.ts.snap index 60386b623b5..602ef3914dd 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/module.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/module.ts.snap @@ -91,10 +91,11 @@ module.ts:2:3 parse ━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `public` as an identifier in strict mode - ┌─ module.ts:2:3 - │ - 2 │ public module Module { - │ ^^^^^^ + 1 │ module Y3 { + > 2 │ public module Module { + │ ^^^^^^ + 3 │ class A { s: string } + 4 │ } module.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -102,17 +103,19 @@ module.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module.ts:2:10 - │ - 2 │ public module Module { - │ ^^^^^^ + 1 │ module Y3 { + > 2 │ public module Module { + │ ^^^^^^ + 3 │ class A { s: string } + 4 │ } i ...Which is required to end this statement - ┌─ module.ts:2:3 - │ - 2 │ public module Module { - │ ^^^^^^^^^^^^^ + 1 │ module Y3 { + > 2 │ public module Module { + │ ^^^^^^^^^^^^^ + 3 │ class A { s: string } + 4 │ } module.ts:7:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -120,10 +123,11 @@ module.ts:7:10 parse ━━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration here - ┌─ module.ts:7:10 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^ + 8 │ + 9 │ interface x { module.ts:7:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -131,17 +135,19 @@ module.ts:7:18 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module.ts:7:18 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^ + 8 │ + 9 │ interface x { i ...Which is required to end this statement - ┌─ module.ts:7:10 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^^^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^^^^^^ + 8 │ + 9 │ interface x { module.ts:7:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -149,17 +155,19 @@ module.ts:7:25 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module.ts:7:25 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^ + 8 │ + 9 │ interface x { i ...Which is required to end this statement - ┌─ module.ts:7:18 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^^^^^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^^^^^^^^ + 8 │ + 9 │ interface x { module.ts:7:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -167,17 +175,19 @@ module.ts:7:35 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module.ts:7:35 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^ + 8 │ + 9 │ interface x { i ...Which is required to end this statement - ┌─ module.ts:7:25 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^^^^^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^^^^^^^^ + 8 │ + 9 │ interface x { module.ts:7:42 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -185,17 +195,19 @@ module.ts:7:42 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module.ts:7:42 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^ + 8 │ + 9 │ interface x { i ...Which is required to end this statement - ┌─ module.ts:7:35 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^^^^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^^^^^^^ + 8 │ + 9 │ interface x { module.ts:7:51 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -203,17 +215,19 @@ module.ts:7:51 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module.ts:7:51 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^ + 8 │ + 9 │ interface x { i ...Which is required to end this statement - ┌─ module.ts:7:42 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^^^^^^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^^^^^^^^^ + 8 │ + 9 │ interface x { module.ts:7:60 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -221,17 +235,19 @@ module.ts:7:60 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module.ts:7:60 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^ + 8 │ + 9 │ interface x { i ...Which is required to end this statement - ┌─ module.ts:7:51 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^^^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^^^^^^ + 8 │ + 9 │ interface x { module.ts:7:66 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -239,17 +255,19 @@ module.ts:7:66 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module.ts:7:66 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^ + 8 │ + 9 │ interface x { i ...Which is required to end this statement - ┌─ module.ts:7:60 - │ - 7 │ export private public protected static readonly abstract async enum X { } - │ ^^^^^^^^^^ + 6 │ // Apparently this parses :P + > 7 │ export private public protected static readonly abstract async enum X { } + │ ^^^^^^^^^^ + 8 │ + 9 │ interface x { module.ts:10:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -257,19 +275,21 @@ module.ts:10:14 parse ━━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module.ts:10:14 - │ - 10 │ export private static readonly [x: any]: any; - │ ^^^^^^^ + 9 │ interface x { + > 10 │ export private static readonly [x: any]: any; + │ ^^^^^^^ + 11 │ } + 12 │ } module.ts:10:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × index signature members cannot be static - ┌─ module.ts:10:22 - │ - 10 │ export private static readonly [x: any]: any; - │ ^^^^^^ + 9 │ interface x { + > 10 │ export private static readonly [x: any]: any; + │ ^^^^^^ + 11 │ } + 12 │ } ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/optional-variance/basic.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/optional-variance/basic.ts.snap index 8428361c9d5..9c96fe6675d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/optional-variance/basic.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/optional-variance/basic.ts.snap @@ -243,10 +243,10 @@ basic.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:1:20 - │ - 1 │ type Covariant = { - │ ^ + > 1 │ type Covariant = { + │ ^ + 2 │ x: T; + 3 │ } basic.ts:4:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -254,10 +254,12 @@ basic.ts:4:20 parse ━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ basic.ts:4:20 - │ - 4 │ type Contravariant = { - │ ^^ + 2 │ x: T; + 3 │ } + > 4 │ type Contravariant = { + │ ^^ + 5 │ f: (x: T) => void; + 6 │ } basic.ts:4:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -265,10 +267,12 @@ basic.ts:4:23 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:4:23 - │ - 4 │ type Contravariant = { - │ ^ + 2 │ x: T; + 3 │ } + > 4 │ type Contravariant = { + │ ^ + 5 │ f: (x: T) => void; + 6 │ } basic.ts:7:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -276,10 +280,12 @@ basic.ts:7:16 parse ━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ basic.ts:7:16 - │ - 7 │ type Invariant = { - │ ^^ + 5 │ f: (x: T) => void; + 6 │ } + > 7 │ type Invariant = { + │ ^^ + 8 │ f: (x: T) => T; + 9 │ } basic.ts:7:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -287,10 +293,12 @@ basic.ts:7:19 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:7:19 - │ - 7 │ type Invariant = { - │ ^^^ + 5 │ f: (x: T) => void; + 6 │ } + > 7 │ type Invariant = { + │ ^^^ + 8 │ f: (x: T) => T; + 9 │ } basic.ts:7:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -298,10 +306,12 @@ basic.ts:7:23 parse ━━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:7:23 - │ - 7 │ type Invariant = { - │ ^ + 5 │ f: (x: T) => void; + 6 │ } + > 7 │ type Invariant = { + │ ^ + 8 │ f: (x: T) => T; + 9 │ } basic.ts:10:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -309,10 +319,12 @@ basic.ts:10:14 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:10:14 - │ - 10 │ type T10 = T; - │ ^ + 8 │ f: (x: T) => T; + 9 │ } + > 10 │ type T10 = T; + │ ^ + 11 │ type T11 = keyof T; + 12 │ type T12 = T[K]; basic.ts:11:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -320,10 +332,12 @@ basic.ts:11:10 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ basic.ts:11:10 - │ - 11 │ type T11 = keyof T; - │ ^^ + 9 │ } + 10 │ type T10 = T; + > 11 │ type T11 = keyof T; + │ ^^ + 12 │ type T12 = T[K]; + 13 │ type T13 = T[keyof T]; basic.ts:11:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -331,10 +345,12 @@ basic.ts:11:13 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:11:13 - │ - 11 │ type T11 = keyof T; - │ ^ + 9 │ } + 10 │ type T10 = T; + > 11 │ type T11 = keyof T; + │ ^ + 12 │ type T12 = T[K]; + 13 │ type T13 = T[keyof T]; basic.ts:12:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -342,10 +358,12 @@ basic.ts:12:14 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:12:14 - │ - 12 │ type T12 = T[K]; - │ ^ + 10 │ type T10 = T; + 11 │ type T11 = keyof T; + > 12 │ type T12 = T[K]; + │ ^ + 13 │ type T13 = T[keyof T]; + 14 │ basic.ts:12:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -353,10 +371,12 @@ basic.ts:12:21 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:12:21 - │ - 12 │ type T12 = T[K]; - │ ^ + 10 │ type T10 = T; + 11 │ type T11 = keyof T; + > 12 │ type T12 = T[K]; + │ ^ + 13 │ type T13 = T[keyof T]; + 14 │ basic.ts:13:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -364,10 +384,12 @@ basic.ts:13:10 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ basic.ts:13:10 - │ - 13 │ type T13 = T[keyof T]; - │ ^^ + 11 │ type T11 = keyof T; + 12 │ type T12 = T[K]; + > 13 │ type T13 = T[keyof T]; + │ ^^ + 14 │ + 15 │ type Covariant1 = { basic.ts:13:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -375,10 +397,12 @@ basic.ts:13:13 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:13:13 - │ - 13 │ type T13 = T[keyof T]; - │ ^^^ + 11 │ type T11 = keyof T; + 12 │ type T12 = T[K]; + > 13 │ type T13 = T[keyof T]; + │ ^^^ + 14 │ + 15 │ type Covariant1 = { basic.ts:13:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -386,10 +410,12 @@ basic.ts:13:17 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:13:17 - │ - 13 │ type T13 = T[keyof T]; - │ ^ + 11 │ type T11 = keyof T; + 12 │ type T12 = T[K]; + > 13 │ type T13 = T[keyof T]; + │ ^ + 14 │ + 15 │ type Covariant1 = { basic.ts:15:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -397,10 +423,12 @@ basic.ts:15:17 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ basic.ts:15:17 - │ - 15 │ type Covariant1 = { - │ ^^ + 13 │ type T13 = T[keyof T]; + 14 │ + > 15 │ type Covariant1 = { + │ ^^ + 16 │ x: T; + 17 │ } basic.ts:15:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -408,10 +436,12 @@ basic.ts:15:20 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:15:20 - │ - 15 │ type Covariant1 = { - │ ^ + 13 │ type T13 = T[keyof T]; + 14 │ + > 15 │ type Covariant1 = { + │ ^ + 16 │ x: T; + 17 │ } basic.ts:19:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -419,10 +449,12 @@ basic.ts:19:25 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:19:25 - │ - 19 │ type Contravariant1 = keyof T; - │ ^ + 17 │ } + 18 │ + > 19 │ type Contravariant1 = keyof T; + │ ^ + 20 │ + 21 │ type Contravariant2 = { basic.ts:21:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -430,10 +462,12 @@ basic.ts:21:25 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:21:25 - │ - 21 │ type Contravariant2 = { - │ ^ + 19 │ type Contravariant1 = keyof T; + 20 │ + > 21 │ type Contravariant2 = { + │ ^ + 22 │ f: (x: T) => void; + 23 │ } basic.ts:25:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -441,10 +475,12 @@ basic.ts:25:17 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ basic.ts:25:17 - │ - 25 │ type Invariant1 = { - │ ^^ + 23 │ } + 24 │ + > 25 │ type Invariant1 = { + │ ^^ + 26 │ f: (x: T) => T; + 27 │ } basic.ts:25:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -452,10 +488,12 @@ basic.ts:25:20 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:25:20 - │ - 25 │ type Invariant1 = { - │ ^ + 23 │ } + 24 │ + > 25 │ type Invariant1 = { + │ ^ + 26 │ f: (x: T) => T; + 27 │ } basic.ts:29:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -463,10 +501,12 @@ basic.ts:29:21 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:29:21 - │ - 29 │ type Invariant2 = { - │ ^ + 27 │ } + 28 │ + > 29 │ type Invariant2 = { + │ ^ + 30 │ f: (x: T) => T; + 31 │ } basic.ts:32:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -474,10 +514,12 @@ basic.ts:32:11 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ basic.ts:32:11 - │ - 32 │ type Foo1 = { - │ ^^ + 30 │ f: (x: T) => T; + 31 │ } + > 32 │ type Foo1 = { + │ ^^ + 33 │ x: T; + 34 │ f: FooFn1; basic.ts:32:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -485,10 +527,12 @@ basic.ts:32:14 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:32:14 - │ - 32 │ type Foo1 = { - │ ^ + 30 │ f: (x: T) => T; + 31 │ } + > 32 │ type Foo1 = { + │ ^ + 33 │ x: T; + 34 │ f: FooFn1; basic.ts:37:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -496,10 +540,12 @@ basic.ts:37:15 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:37:15 - │ - 37 │ type Foo2 = { - │ ^ + 35 │ } + 36 │ + > 37 │ type Foo2 = { + │ ^ + 38 │ x: T; + 39 │ f: FooFn2; basic.ts:42:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -507,10 +553,12 @@ basic.ts:42:11 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ basic.ts:42:11 - │ - 42 │ type Foo3 = { - │ ^^ + 40 │ } + 41 │ + > 42 │ type Foo3 = { + │ ^^ + 43 │ x: T; + 44 │ f: FooFn3; basic.ts:42:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -518,10 +566,12 @@ basic.ts:42:14 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:42:14 - │ - 42 │ type Foo3 = { - │ ^^^ + 40 │ } + 41 │ + > 42 │ type Foo3 = { + │ ^^^ + 43 │ x: T; + 44 │ f: FooFn3; basic.ts:42:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -529,10 +579,12 @@ basic.ts:42:18 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:42:18 - │ - 42 │ type Foo3 = { - │ ^ + 40 │ } + 41 │ + > 42 │ type Foo3 = { + │ ^ + 43 │ x: T; + 44 │ f: FooFn3; basic.ts:47:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -540,10 +592,12 @@ basic.ts:47:10 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ basic.ts:47:10 - │ - 47 │ type T21 = T; - │ ^^ + 45 │ } + 46 │ + > 47 │ type T21 = T; + │ ^^ + 48 │ + 49 │ interface Baz {} basic.ts:47:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -551,10 +605,12 @@ basic.ts:47:13 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:47:13 - │ - 47 │ type T21 = T; - │ ^^^ + 45 │ } + 46 │ + > 47 │ type T21 = T; + │ ^^^ + 48 │ + 49 │ interface Baz {} basic.ts:47:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -562,10 +618,12 @@ basic.ts:47:17 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:47:17 - │ - 47 │ type T21 = T; - │ ^ + 45 │ } + 46 │ + > 47 │ type T21 = T; + │ ^ + 48 │ + 49 │ interface Baz {} basic.ts:49:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -573,10 +631,12 @@ basic.ts:49:19 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:49:19 - │ - 49 │ interface Baz {} - │ ^ + 47 │ type T21 = T; + 48 │ + > 49 │ interface Baz {} + │ ^ + 50 │ interface Baz {} + 51 │ basic.ts:50:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -584,10 +644,11 @@ basic.ts:50:15 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ basic.ts:50:15 - │ - 50 │ interface Baz {} - │ ^^ + 49 │ interface Baz {} + > 50 │ interface Baz {} + │ ^^ + 51 │ + 52 │ interface Parent { basic.ts:50:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -595,10 +656,11 @@ basic.ts:50:18 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:50:18 - │ - 50 │ interface Baz {} - │ ^ + 49 │ interface Baz {} + > 50 │ interface Baz {} + │ ^ + 51 │ + 52 │ interface Parent { basic.ts:52:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -606,10 +668,12 @@ basic.ts:52:22 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:52:22 - │ - 52 │ interface Parent { - │ ^ + 50 │ interface Baz {} + 51 │ + > 52 │ interface Parent { + │ ^ + 53 │ child: Child | null; + 54 │ parent: Parent | null; basic.ts:57:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -617,10 +681,12 @@ basic.ts:57:35 parse ━━━━━━━━━━━━━━━━━━━ × Expected a type parameter here - ┌─ basic.ts:57:35 - │ - 57 │ declare class StateNode { - │ ^^ + 55 │ } + 56 │ + > 57 │ declare class StateNode { + │ ^^ + 58 │ _storedEvent: TEvent; + 59 │ _action: ActionObject; basic.ts:57:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -628,10 +694,12 @@ basic.ts:57:38 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:57:38 - │ - 57 │ declare class StateNode { - │ ^^^ + 55 │ } + 56 │ + > 57 │ declare class StateNode { + │ ^^^ + 58 │ _storedEvent: TEvent; + 59 │ _action: ActionObject; basic.ts:57:42 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -639,10 +707,12 @@ basic.ts:57:42 parse ━━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ basic.ts:57:42 - │ - 57 │ declare class StateNode { - │ ^^^^^^ + 55 │ } + 56 │ + > 57 │ declare class StateNode { + │ ^^^^^^ + 58 │ _storedEvent: TEvent; + 59 │ _action: ActionObject; ``` diff --git a/crates/rome_js_parser/test_data/inline/err/abstract_class_in_js.rast b/crates/rome_js_parser/test_data/inline/err/abstract_class_in_js.rast index 325a912161b..37a6edfb793 100644 --- a/crates/rome_js_parser/test_data/inline/err/abstract_class_in_js.rast +++ b/crates/rome_js_parser/test_data/inline/err/abstract_class_in_js.rast @@ -38,10 +38,9 @@ abstract_class_in_js.js:1:1 parse ━━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ abstract_class_in_js.js:1:1 - │ - 1 │ abstract class A {} - │ ^^^^^^^^^^^^^^^^^^^ + > 1 │ abstract class A {} + │ ^^^^^^^^^^^^^^^^^^^ + 2 │ -- abstract class A {} diff --git a/crates/rome_js_parser/test_data/inline/err/array_assignment_target_err.rast b/crates/rome_js_parser/test_data/inline/err/array_assignment_target_err.rast index a16855ff3af..79b77669871 100644 --- a/crates/rome_js_parser/test_data/inline/err/array_assignment_target_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/array_assignment_target_err.rast @@ -299,10 +299,10 @@ array_assignment_target_err.js:1:4 parse ━━━━━━━━━━━━━ × unexpected - ┌─ array_assignment_target_err.js:1:4 - │ - 1 │ [a a, ++b, ] = test; - │ ^ + > 1 │ [a a, ++b, ] = test; + │ ^ + 2 │ [a, c, ...rest,] = test; + 3 │ [a = , = "test"] = test; -- array_assignment_target_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -311,10 +311,10 @@ array_assignment_target_err.js:1:7 parse ━━━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ array_assignment_target_err.js:1:7 - │ - 1 │ [a a, ++b, ] = test; - │ ^^^ + > 1 │ [a a, ++b, ] = test; + │ ^^^ + 2 │ [a, c, ...rest,] = test; + 3 │ [a = , = "test"] = test; -- array_assignment_target_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -323,17 +323,19 @@ array_assignment_target_err.js:2:15 parse ━━━━━━━━━━━━ × Remove the trailing comma here - ┌─ array_assignment_target_err.js:2:15 - │ - 2 │ [a, c, ...rest,] = test; - │ ^ + 1 │ [a a, ++b, ] = test; + > 2 │ [a, c, ...rest,] = test; + │ ^ + 3 │ [a = , = "test"] = test; + 4 │ [[a b] [c]]= test; i Rest element - ┌─ array_assignment_target_err.js:2:8 - │ - 2 │ [a, c, ...rest,] = test; - │ ^^^^^^^ + 1 │ [a a, ++b, ] = test; + > 2 │ [a, c, ...rest,] = test; + │ ^^^^^^^ + 3 │ [a = , = "test"] = test; + 4 │ [[a b] [c]]= test; -- array_assignment_target_err.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -342,10 +344,12 @@ array_assignment_target_err.js:3:6 parse ━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ array_assignment_target_err.js:3:6 - │ - 3 │ [a = , = "test"] = test; - │ ^ + 1 │ [a a, ++b, ] = test; + 2 │ [a, c, ...rest,] = test; + > 3 │ [a = , = "test"] = test; + │ ^ + 4 │ [[a b] [c]]= test; + 5 │ [a: b] = c -- array_assignment_target_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -354,10 +358,12 @@ array_assignment_target_err.js:3:8 parse ━━━━━━━━━━━━━ × Expected an identifier, or an assignment target here - ┌─ array_assignment_target_err.js:3:8 - │ - 3 │ [a = , = "test"] = test; - │ ^ + 1 │ [a a, ++b, ] = test; + 2 │ [a, c, ...rest,] = test; + > 3 │ [a = , = "test"] = test; + │ ^ + 4 │ [[a b] [c]]= test; + 5 │ [a: b] = c -- array_assignment_target_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -366,10 +372,12 @@ array_assignment_target_err.js:4:5 parse ━━━━━━━━━━━━━ × unexpected - ┌─ array_assignment_target_err.js:4:5 - │ - 4 │ [[a b] [c]]= test; - │ ^ + 2 │ [a, c, ...rest,] = test; + 3 │ [a = , = "test"] = test; + > 4 │ [[a b] [c]]= test; + │ ^ + 5 │ [a: b] = c + 6 │ -- array_assignment_target_err.js:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -378,10 +386,11 @@ array_assignment_target_err.js:5:3 parse ━━━━━━━━━━━━━ × unexpected - ┌─ array_assignment_target_err.js:5:3 - │ - 5 │ [a: b] = c - │ ^ + 3 │ [a = , = "test"] = test; + 4 │ [[a b] [c]]= test; + > 5 │ [a: b] = c + │ ^ + 6 │ -- [a a, ++b, ] = test; diff --git a/crates/rome_js_parser/test_data/inline/err/array_assignment_target_rest_err.rast b/crates/rome_js_parser/test_data/inline/err/array_assignment_target_rest_err.rast index 330e0794eaa..9761bc35f38 100644 --- a/crates/rome_js_parser/test_data/inline/err/array_assignment_target_rest_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/array_assignment_target_rest_err.rast @@ -165,10 +165,10 @@ array_assignment_target_rest_err.js:1:7 parse ━━━━━━━━━━━ × Expected an identifier, or an assignment target here - ┌─ array_assignment_target_rest_err.js:1:7 - │ - 1 │ ([ ... ] = a); - │ ^ + > 1 │ ([ ... ] = a); + │ + 2 │ ([ ...c = "default" ] = a); + 3 │ ([ ...rest, other_assignment ] = a); -- array_assignment_target_rest_err.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -177,17 +177,19 @@ array_assignment_target_rest_err.js:2:9 parse ━━━━━━━━━━━ × Remove the default value here - ┌─ array_assignment_target_rest_err.js:2:9 - │ - 2 │ ([ ...c = "default" ] = a); - │ ^^^^^^^^^^^^ + 1 │ ([ ... ] = a); + > 2 │ ([ ...c = "default" ] = a); + │ ^^^^^^^^^^^^ + 3 │ ([ ...rest, other_assignment ] = a); + 4 │ i Rest element - ┌─ array_assignment_target_rest_err.js:2:4 - │ - 2 │ ([ ...c = "default" ] = a); - │ ^^^^ + 1 │ ([ ... ] = a); + > 2 │ ([ ...c = "default" ] = a); + │ ^^^^ + 3 │ ([ ...rest, other_assignment ] = a); + 4 │ -- array_assignment_target_rest_err.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -196,10 +198,11 @@ array_assignment_target_rest_err.js:3:4 parse ━━━━━━━━━━━ × Move the rest element to the end of the pattern, right before the closing ']' - ┌─ array_assignment_target_rest_err.js:3:4 - │ - 3 │ ([ ...rest, other_assignment ] = a); - │ ^^^^^^^ + 1 │ ([ ... ] = a); + 2 │ ([ ...c = "default" ] = a); + > 3 │ ([ ...rest, other_assignment ] = a); + │ ^^^^^^^ + 4 │ -- ([ ... ] = a); diff --git a/crates/rome_js_parser/test_data/inline/err/array_binding_err.rast b/crates/rome_js_parser/test_data/inline/err/array_binding_err.rast index d3dab7e1f74..07995a8fb17 100644 --- a/crates/rome_js_parser/test_data/inline/err/array_binding_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/array_binding_err.rast @@ -273,10 +273,10 @@ array_binding_err.js:1:8 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ array_binding_err.js:1:8 - │ - 1 │ let [a b] = [1, 2]; - │ ^ + > 1 │ let [a b] = [1, 2]; + │ ^ + 2 │ let [="default"] = [1, 2]; + 3 │ let ["default"] = [1, 2]; -- array_binding_err.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -285,10 +285,11 @@ array_binding_err.js:2:6 parse ━━━━━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern here - ┌─ array_binding_err.js:2:6 - │ - 2 │ let [="default"] = [1, 2]; - │ ^ + 1 │ let [a b] = [1, 2]; + > 2 │ let [="default"] = [1, 2]; + │ ^ + 3 │ let ["default"] = [1, 2]; + 4 │ let [[c ] = []; -- array_binding_err.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -297,10 +298,12 @@ array_binding_err.js:3:6 parse ━━━━━━━━━━━━━━━━ × Expected an identifier, an object pattern, an array pattern, or a rest pattern here - ┌─ array_binding_err.js:3:6 - │ - 3 │ let ["default"] = [1, 2]; - │ ^^^^^^^^^ + 1 │ let [a b] = [1, 2]; + 2 │ let [="default"] = [1, 2]; + > 3 │ let ["default"] = [1, 2]; + │ ^^^^^^^^^ + 4 │ let [[c ] = []; + 5 │ -- array_binding_err.js:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -309,10 +312,11 @@ array_binding_err.js:4:15 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ array_binding_err.js:4:15 - │ - 4 │ let [[c ] = []; - │ ^ + 2 │ let [="default"] = [1, 2]; + 3 │ let ["default"] = [1, 2]; + > 4 │ let [[c ] = []; + │ ^ + 5 │ -- array_binding_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -321,10 +325,11 @@ array_binding_err.js:4:5 parse ━━━━━━━━━━━━━━━━ × this pattern is declared, but it is not given an initialized value - ┌─ array_binding_err.js:4:5 - │ - 4 │ let [[c ] = []; - │ ^^^^^^^^^^ + 2 │ let [="default"] = [1, 2]; + 3 │ let ["default"] = [1, 2]; + > 4 │ let [[c ] = []; + │ ^^^^^^^^^^ + 5 │ -- let [a b] = [1, 2]; diff --git a/crates/rome_js_parser/test_data/inline/err/array_binding_rest_err.rast b/crates/rome_js_parser/test_data/inline/err/array_binding_rest_err.rast index 0e179d60090..49f571d7dd9 100644 --- a/crates/rome_js_parser/test_data/inline/err/array_binding_rest_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/array_binding_rest_err.rast @@ -183,10 +183,10 @@ array_binding_rest_err.js:1:10 parse ━━━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern here - ┌─ array_binding_rest_err.js:1:10 - │ - 1 │ let [ ... ] = a; - │ ^ + > 1 │ let [ ... ] = a; + │ + 2 │ let [ ...c = "default" ] = a; + 3 │ let [ ...rest, other_assignment ] = a; -- array_binding_rest_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -195,17 +195,19 @@ array_binding_rest_err.js:2:12 parse ━━━━━━━━━━━━━━ × Remove the default value here - ┌─ array_binding_rest_err.js:2:12 - │ - 2 │ let [ ...c = "default" ] = a; - │ ^^^^^^^^^^^^ + 1 │ let [ ... ] = a; + > 2 │ let [ ...c = "default" ] = a; + │ ^^^^^^^^^^^^ + 3 │ let [ ...rest, other_assignment ] = a; + 4 │ i Rest element - ┌─ array_binding_rest_err.js:2:7 - │ - 2 │ let [ ...c = "default" ] = a; - │ ^^^^ + 1 │ let [ ... ] = a; + > 2 │ let [ ...c = "default" ] = a; + │ ^^^^ + 3 │ let [ ...rest, other_assignment ] = a; + 4 │ -- array_binding_rest_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -214,10 +216,11 @@ array_binding_rest_err.js:3:7 parse ━━━━━━━━━━━━━━ × Move the rest element to the end of the pattern, right before the closing ']' - ┌─ array_binding_rest_err.js:3:7 - │ - 3 │ let [ ...rest, other_assignment ] = a; - │ ^^^^^^^ + 1 │ let [ ... ] = a; + 2 │ let [ ...c = "default" ] = a; + > 3 │ let [ ...rest, other_assignment ] = a; + │ ^^^^^^^ + 4 │ -- let [ ... ] = a; diff --git a/crates/rome_js_parser/test_data/inline/err/array_expr_incomplete.rast b/crates/rome_js_parser/test_data/inline/err/array_expr_incomplete.rast index 71bd8b20f1b..a75a901632b 100644 --- a/crates/rome_js_parser/test_data/inline/err/array_expr_incomplete.rast +++ b/crates/rome_js_parser/test_data/inline/err/array_expr_incomplete.rast @@ -55,10 +55,9 @@ array_expr_incomplete.js:2:1 parse ━━━━━━━━━━━━━━━ × the file ends here - ┌─ array_expr_incomplete.js:2:1 - │ - 2 │ - │ ^ + 1 │ let a = [ + > 2 │ + │ -- let a = [ diff --git a/crates/rome_js_parser/test_data/inline/err/arrow_escaped_async.rast b/crates/rome_js_parser/test_data/inline/err/arrow_escaped_async.rast index aa29e290017..29607a3f94a 100644 --- a/crates/rome_js_parser/test_data/inline/err/arrow_escaped_async.rast +++ b/crates/rome_js_parser/test_data/inline/err/arrow_escaped_async.rast @@ -50,10 +50,9 @@ arrow_escaped_async.js:1:1 parse ━━━━━━━━━━━━━━━ × 'async' keyword cannot contain escape character. - ┌─ arrow_escaped_async.js:1:1 - │ - 1 │ \u0061sync () => {} - │ ^^^^^^^^^^ + > 1 │ \u0061sync () => {} + │ ^^^^^^^^^^ + 2 │ -- \u0061sync () => {} diff --git a/crates/rome_js_parser/test_data/inline/err/arrow_rest_in_expr_in_initializer.rast b/crates/rome_js_parser/test_data/inline/err/arrow_rest_in_expr_in_initializer.rast index a17a869186a..c3493c4f18c 100644 --- a/crates/rome_js_parser/test_data/inline/err/arrow_rest_in_expr_in_initializer.rast +++ b/crates/rome_js_parser/test_data/inline/err/arrow_rest_in_expr_in_initializer.rast @@ -110,10 +110,9 @@ arrow_rest_in_expr_in_initializer.js:1:12 parse ━━━━━━━━━━ × rest elements may not have default initializers - ┌─ arrow_rest_in_expr_in_initializer.js:1:12 - │ - 1 │ for ((...a = "b" in {}) => {};;) {} - │ ^^^^^^^^^^^ + > 1 │ for ((...a = "b" in {}) => {};;) {} + │ ^^^^^^^^^^^ + 2 │ -- for ((...a = "b" in {}) => {};;) {} diff --git a/crates/rome_js_parser/test_data/inline/err/assign_eval_or_arguments.rast b/crates/rome_js_parser/test_data/inline/err/assign_eval_or_arguments.rast index 55216e52a2a..78b8a42a837 100644 --- a/crates/rome_js_parser/test_data/inline/err/assign_eval_or_arguments.rast +++ b/crates/rome_js_parser/test_data/inline/err/assign_eval_or_arguments.rast @@ -244,60 +244,69 @@ assign_eval_or_arguments.js:1:1 parse ━━━━━━━━━━━━━━ × Illegal use of `eval` as an identifier in strict mode - ┌─ assign_eval_or_arguments.js:1:1 - │ - 1 │ eval = 0 - │ ^^^^ + > 1 │ eval = 0 + │ ^^^^ + 2 │ eval ??= 2 + 3 │ eval *= 4 -- assign_eval_or_arguments.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `eval` as an identifier in strict mode - ┌─ assign_eval_or_arguments.js:2:1 - │ - 2 │ eval ??= 2 - │ ^^^^ + 1 │ eval = 0 + > 2 │ eval ??= 2 + │ ^^^^ + 3 │ eval *= 4 + 4 │ arguments = "foo" -- assign_eval_or_arguments.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `eval` as an identifier in strict mode - ┌─ assign_eval_or_arguments.js:3:1 - │ - 3 │ eval *= 4 - │ ^^^^ + 1 │ eval = 0 + 2 │ eval ??= 2 + > 3 │ eval *= 4 + │ ^^^^ + 4 │ arguments = "foo" + 5 │ arguments ||= "baz" -- assign_eval_or_arguments.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `arguments` as an identifier in strict mode - ┌─ assign_eval_or_arguments.js:4:1 - │ - 4 │ arguments = "foo" - │ ^^^^^^^^^ + 2 │ eval ??= 2 + 3 │ eval *= 4 + > 4 │ arguments = "foo" + │ ^^^^^^^^^ + 5 │ arguments ||= "baz" + 6 │ ({ eval } = o) -- assign_eval_or_arguments.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `arguments` as an identifier in strict mode - ┌─ assign_eval_or_arguments.js:5:1 - │ - 5 │ arguments ||= "baz" - │ ^^^^^^^^^ + 3 │ eval *= 4 + 4 │ arguments = "foo" + > 5 │ arguments ||= "baz" + │ ^^^^^^^^^ + 6 │ ({ eval } = o) + 7 │ ({ foo: { eval }}) = o -- assign_eval_or_arguments.js:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `eval` as an identifier in strict mode - ┌─ assign_eval_or_arguments.js:6:4 - │ - 6 │ ({ eval } = o) - │ ^^^^ + 4 │ arguments = "foo" + 5 │ arguments ||= "baz" + > 6 │ ({ eval } = o) + │ ^^^^ + 7 │ ({ foo: { eval }}) = o + 8 │ -- assign_eval_or_arguments.js:5:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -308,13 +317,14 @@ assign_eval_or_arguments.js:5:15 parse ━━━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ assign_eval_or_arguments.js:5:15 - │ - 5 │ arguments ||= "baz" - │ ┌───────────────^ - 6 │ │ ({ eval } = o) - 7 │ │ ({ foo: { eval }}) = o - │ └──────────────────^ + 3 │ eval *= 4 + 4 │ arguments = "foo" + > 5 │ arguments ||= "baz" + │ ^^^^^ + > 6 │ ({ eval } = o) + > 7 │ ({ foo: { eval }}) = o + │ ^^^^^^^^^^^^^^^^^^ + 8 │ -- eval = 0 diff --git a/crates/rome_js_parser/test_data/inline/err/assign_expr_left.rast b/crates/rome_js_parser/test_data/inline/err/assign_expr_left.rast index e267c5b8585..43cfc08aa6b 100644 --- a/crates/rome_js_parser/test_data/inline/err/assign_expr_left.rast +++ b/crates/rome_js_parser/test_data/inline/err/assign_expr_left.rast @@ -57,10 +57,9 @@ assign_expr_left.js:1:3 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ assign_expr_left.js:1:3 - │ - 1 │ ( = foo); - │ ^ + > 1 │ ( = foo); + │ ^ + 2 │ -- assign_expr_left.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -69,17 +68,15 @@ assign_expr_left.js:1:8 parse ━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ assign_expr_left.js:1:8 - │ - 1 │ ( = foo); - │ ^ + > 1 │ ( = foo); + │ ^ + 2 │ i ...Which is required to end this statement - ┌─ assign_expr_left.js:1:1 - │ - 1 │ ( = foo); - │ ^^^^^^^^ + > 1 │ ( = foo); + │ ^^^^^^^^ + 2 │ -- ( = foo); diff --git a/crates/rome_js_parser/test_data/inline/err/assign_expr_right.rast b/crates/rome_js_parser/test_data/inline/err/assign_expr_right.rast index 4c38205d615..2844ef6d633 100644 --- a/crates/rome_js_parser/test_data/inline/err/assign_expr_right.rast +++ b/crates/rome_js_parser/test_data/inline/err/assign_expr_right.rast @@ -42,10 +42,9 @@ assign_expr_right.js:1:8 parse ━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ assign_expr_right.js:1:8 - │ - 1 │ (foo = ); - │ ^ + > 1 │ (foo = ); + │ ^ + 2 │ -- (foo = ); diff --git a/crates/rome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.rast b/crates/rome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.rast index f1f0da6bcf0..b1a46caf0b0 100644 --- a/crates/rome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.rast +++ b/crates/rome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.rast @@ -171,10 +171,10 @@ async_arrow_expr_await_parameter.js:1:15 parse ━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context - ┌─ async_arrow_expr_await_parameter.js:1:15 - │ - 1 │ let a = async await => {} - │ ^^^^^ + > 1 │ let a = async await => {} + │ ^^^^^ + 2 │ async() => { (a = await) => {} }; + 3 │ -- async_arrow_expr_await_parameter.js:2:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -183,20 +183,20 @@ async_arrow_expr_await_parameter.js:2:24 parse ━━━━━━━━━━━ × Expected an unary expression here - ┌─ async_arrow_expr_await_parameter.js:2:24 - │ - 2 │ async() => { (a = await) => {} }; - │ ^ + 1 │ let a = async await => {} + > 2 │ async() => { (a = await) => {} }; + │ ^ + 3 │ -- async_arrow_expr_await_parameter.js:2:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `await` is only allowed within async functions and at the top levels of modules. - ┌─ async_arrow_expr_await_parameter.js:2:19 - │ - 2 │ async() => { (a = await) => {} }; - │ ^^^^^ + 1 │ let a = async await => {} + > 2 │ async() => { (a = await) => {} }; + │ ^^^^^ + 3 │ -- let a = async await => {} diff --git a/crates/rome_js_parser/test_data/inline/err/async_or_generator_in_single_statement_context.rast b/crates/rome_js_parser/test_data/inline/err/async_or_generator_in_single_statement_context.rast index bb740666168..f249d9ca4cd 100644 --- a/crates/rome_js_parser/test_data/inline/err/async_or_generator_in_single_statement_context.rast +++ b/crates/rome_js_parser/test_data/inline/err/async_or_generator_in_single_statement_context.rast @@ -116,20 +116,20 @@ async_or_generator_in_single_statement_context.js:1:11 parse ━━━━━━ × `async` and generator functions can only be declared at top level or inside a block - ┌─ async_or_generator_in_single_statement_context.js:1:11 - │ - 1 │ if (true) async function t() {} - │ ^^^^^^^^^^^^^^^^^^^^^ + > 1 │ if (true) async function t() {} + │ ^^^^^^^^^^^^^^^^^^^^^ + 2 │ if (true) function* t() {} + 3 │ -- async_or_generator_in_single_statement_context.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `async` and generator functions can only be declared at top level or inside a block - ┌─ async_or_generator_in_single_statement_context.js:2:11 - │ - 2 │ if (true) function* t() {} - │ ^^^^^^^^^^^^^^^^ + 1 │ if (true) async function t() {} + > 2 │ if (true) function* t() {} + │ ^^^^^^^^^^^^^^^^ + 3 │ -- if (true) async function t() {} diff --git a/crates/rome_js_parser/test_data/inline/err/await_in_parameter_initializer.rast b/crates/rome_js_parser/test_data/inline/err/await_in_parameter_initializer.rast index 9cdadcf5ba6..c7810358130 100644 --- a/crates/rome_js_parser/test_data/inline/err/await_in_parameter_initializer.rast +++ b/crates/rome_js_parser/test_data/inline/err/await_in_parameter_initializer.rast @@ -203,20 +203,20 @@ await_in_parameter_initializer.js:1:25 parse ━━━━━━━━━━━ × `await` is only allowed within async functions and at the top levels of modules. - ┌─ await_in_parameter_initializer.js:1:25 - │ - 1 │ async function test(a = await b()) {} - │ ^^^^^^^^^ + > 1 │ async function test(a = await b()) {} + │ ^^^^^^^^^ + 2 │ function test2(a = await b()) {} + 3 │ -- await_in_parameter_initializer.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier inside of a module - ┌─ await_in_parameter_initializer.js:2:20 - │ - 2 │ function test2(a = await b()) {} - │ ^^^^^ + 1 │ async function test(a = await b()) {} + > 2 │ function test2(a = await b()) {} + │ ^^^^^ + 3 │ -- await_in_parameter_initializer.js:2:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -225,10 +225,10 @@ await_in_parameter_initializer.js:2:26 parse ━━━━━━━━━━━ × unexpected - ┌─ await_in_parameter_initializer.js:2:26 - │ - 2 │ function test2(a = await b()) {} - │ ^ + 1 │ async function test(a = await b()) {} + > 2 │ function test2(a = await b()) {} + │ ^ + 3 │ -- await_in_parameter_initializer.js:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -237,10 +237,10 @@ await_in_parameter_initializer.js:2:27 parse ━━━━━━━━━━━ × unexpected - ┌─ await_in_parameter_initializer.js:2:27 - │ - 2 │ function test2(a = await b()) {} - │ ^ + 1 │ async function test(a = await b()) {} + > 2 │ function test2(a = await b()) {} + │ ^ + 3 │ -- await_in_parameter_initializer.js:2:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -249,10 +249,10 @@ await_in_parameter_initializer.js:2:29 parse ━━━━━━━━━━━ × Expected a function body here - ┌─ await_in_parameter_initializer.js:2:29 - │ - 2 │ function test2(a = await b()) {} - │ ^ + 1 │ async function test(a = await b()) {} + > 2 │ function test2(a = await b()) {} + │ ^ + 3 │ -- async function test(a = await b()) {} diff --git a/crates/rome_js_parser/test_data/inline/err/await_in_static_initialization_block_member.rast b/crates/rome_js_parser/test_data/inline/err/await_in_static_initialization_block_member.rast index 33b95a6fd9a..7208e70fa9a 100644 --- a/crates/rome_js_parser/test_data/inline/err/await_in_static_initialization_block_member.rast +++ b/crates/rome_js_parser/test_data/inline/err/await_in_static_initialization_block_member.rast @@ -67,20 +67,24 @@ await_in_static_initialization_block_member.js:4:10 parse ━━━━━━━ × Expected an unary expression here - ┌─ await_in_static_initialization_block_member.js:4:10 - │ - 4 │ await; - │ ^ + 2 │ class A { + 3 │ static { + > 4 │ await; + │ ^ + 5 │ } + 6 │ } -- await_in_static_initialization_block_member.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `await` is only allowed within async functions and at the top levels of modules. - ┌─ await_in_static_initialization_block_member.js:4:5 - │ - 4 │ await; - │ ^^^^^ + 2 │ class A { + 3 │ static { + > 4 │ await; + │ ^^^^^ + 5 │ } + 6 │ } -- // SCRIPT diff --git a/crates/rome_js_parser/test_data/inline/err/binary_expressions_err.rast b/crates/rome_js_parser/test_data/inline/err/binary_expressions_err.rast index 44b9d016005..9044d96c9e9 100644 --- a/crates/rome_js_parser/test_data/inline/err/binary_expressions_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/binary_expressions_err.rast @@ -124,10 +124,10 @@ binary_expressions_err.js:1:10 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ binary_expressions_err.js:1:10 - │ - 1 │ foo(foo +); - │ ^ + > 1 │ foo(foo +); + │ ^ + 2 │ foo + * 2; + 3 │ !foo * bar; -- binary_expressions_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -136,10 +136,11 @@ binary_expressions_err.js:2:7 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ binary_expressions_err.js:2:7 - │ - 2 │ foo + * 2; - │ ^ + 1 │ foo(foo +); + > 2 │ foo + * 2; + │ ^ + 3 │ !foo * bar; + 4 │ -- foo(foo +); diff --git a/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid.rast b/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid.rast index 7259c75e1b4..c00f21b89bd 100644 --- a/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid.rast +++ b/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid.rast @@ -308,50 +308,58 @@ binding_identifier_invalid.js:1:19 parse ━━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context - ┌─ binding_identifier_invalid.js:1:19 - │ - 1 │ async () => { let await = 5; } - │ ^^^^^ + > 1 │ async () => { let await = 5; } + │ ^^^^^ + 2 │ function *foo() { + 3 │ let yield = 5; -- binding_identifier_invalid.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `yield` as an identifier in generator function - ┌─ binding_identifier_invalid.js:3:8 - │ - 3 │ let yield = 5; - │ ^^^^^ + 1 │ async () => { let await = 5; } + 2 │ function *foo() { + > 3 │ let yield = 5; + │ ^^^^^ + 4 │ } + 5 │ let eval = 5; -- binding_identifier_invalid.js:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `eval` as an identifier in strict mode - ┌─ binding_identifier_invalid.js:5:5 - │ - 5 │ let eval = 5; - │ ^^^^ + 3 │ let yield = 5; + 4 │ } + > 5 │ let eval = 5; + │ ^^^^ + 6 │ let let = 5; + 7 │ const let = 5; -- binding_identifier_invalid.js:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `let` as an identifier in strict mode - ┌─ binding_identifier_invalid.js:6:5 - │ - 6 │ let let = 5; - │ ^^^ + 4 │ } + 5 │ let eval = 5; + > 6 │ let let = 5; + │ ^^^ + 7 │ const let = 5; + 8 │ let a, a; -- binding_identifier_invalid.js:7:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `let` as an identifier in strict mode - ┌─ binding_identifier_invalid.js:7:7 - │ - 7 │ const let = 5; - │ ^^^ + 5 │ let eval = 5; + 6 │ let let = 5; + > 7 │ const let = 5; + │ ^^^ + 8 │ let a, a; + 9 │ -- binding_identifier_invalid.js:8:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -360,17 +368,19 @@ binding_identifier_invalid.js:8:8 parse ━━━━━━━━━━━━━ × a second declaration of `a` is not allowed - ┌─ binding_identifier_invalid.js:8:8 - │ - 8 │ let a, a; - │ ^ + 6 │ let let = 5; + 7 │ const let = 5; + > 8 │ let a, a; + │ ^ + 9 │ i `a` is first declared here - ┌─ binding_identifier_invalid.js:8:5 - │ - 8 │ let a, a; - │ ^ + 6 │ let let = 5; + 7 │ const let = 5; + > 8 │ let a, a; + │ ^ + 9 │ -- async () => { let await = 5; } diff --git a/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid_script.rast b/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid_script.rast index 1eb3efd2296..934e0be41c5 100644 --- a/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid_script.rast +++ b/crates/rome_js_parser/test_data/inline/err/binding_identifier_invalid_script.rast @@ -88,10 +88,11 @@ binding_identifier_invalid_script.js:2:5 parse ━━━━━━━━━━━ × Rename the let identifier here - ┌─ binding_identifier_invalid_script.js:2:5 - │ - 2 │ let let = 5; - │ ^^^ + 1 │ // SCRIPT + > 2 │ let let = 5; + │ ^^^ + 3 │ const let = 5; + 4 │ -- binding_identifier_invalid_script.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -100,10 +101,11 @@ binding_identifier_invalid_script.js:3:7 parse ━━━━━━━━━━━ × Rename the let identifier here - ┌─ binding_identifier_invalid_script.js:3:7 - │ - 3 │ const let = 5; - │ ^^^ + 1 │ // SCRIPT + 2 │ let let = 5; + > 3 │ const let = 5; + │ ^^^ + 4 │ -- // SCRIPT diff --git a/crates/rome_js_parser/test_data/inline/err/block_stmt_in_class.rast b/crates/rome_js_parser/test_data/inline/err/block_stmt_in_class.rast index e4c7d9819dd..9ac8e383733 100644 --- a/crates/rome_js_parser/test_data/inline/err/block_stmt_in_class.rast +++ b/crates/rome_js_parser/test_data/inline/err/block_stmt_in_class.rast @@ -57,10 +57,9 @@ block_stmt_in_class.js:1:9 parse ━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, a private field name, or a computed name here - ┌─ block_stmt_in_class.js:1:9 - │ - 1 │ class S{{}} - │ ^ + > 1 │ class S{{}} + │ ^ + 2 │ -- block_stmt_in_class.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -69,10 +68,9 @@ block_stmt_in_class.js:1:11 parse ━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ block_stmt_in_class.js:1:11 - │ - 1 │ class S{{}} - │ ^ + > 1 │ class S{{}} + │ ^ + 2 │ -- class S{{}} diff --git a/crates/rome_js_parser/test_data/inline/err/bracket_expr_err.rast b/crates/rome_js_parser/test_data/inline/err/bracket_expr_err.rast index 37172413910..85e1d813b06 100644 --- a/crates/rome_js_parser/test_data/inline/err/bracket_expr_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/bracket_expr_err.rast @@ -90,10 +90,10 @@ bracket_expr_err.js:1:5 parse ━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ bracket_expr_err.js:1:5 - │ - 1 │ foo[] - │ ^ + > 1 │ foo[] + │ ^ + 2 │ foo?.[] + 3 │ foo[ -- bracket_expr_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -102,10 +102,11 @@ bracket_expr_err.js:2:7 parse ━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ bracket_expr_err.js:2:7 - │ - 2 │ foo?.[] - │ ^ + 1 │ foo[] + > 2 │ foo?.[] + │ ^ + 3 │ foo[ + 4 │ -- bracket_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -114,10 +115,10 @@ bracket_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ bracket_expr_err.js:4:1 - │ - 4 │ - │ ^ + 2 │ foo?.[] + 3 │ foo[ + > 4 │ + │ -- foo[] diff --git a/crates/rome_js_parser/test_data/inline/err/break_in_nested_function.rast b/crates/rome_js_parser/test_data/inline/err/break_in_nested_function.rast index 610da52c92c..2deb8450e3c 100644 --- a/crates/rome_js_parser/test_data/inline/err/break_in_nested_function.rast +++ b/crates/rome_js_parser/test_data/inline/err/break_in_nested_function.rast @@ -88,10 +88,12 @@ break_in_nested_function.js:3:5 parse ━━━━━━━━━━━━━━ × A `break` statement can only be used within an enclosing iteration or switch statement. - ┌─ break_in_nested_function.js:3:5 - │ - 3 │ break; - │ ^^^^^ + 1 │ while (true) { + 2 │ function helper() { + > 3 │ break; + │ ^^^^^ + 4 │ } + 5 │ } -- while (true) { diff --git a/crates/rome_js_parser/test_data/inline/err/break_stmt.rast b/crates/rome_js_parser/test_data/inline/err/break_stmt.rast index 06dc31c13c1..c463eb5302a 100644 --- a/crates/rome_js_parser/test_data/inline/err/break_stmt.rast +++ b/crates/rome_js_parser/test_data/inline/err/break_stmt.rast @@ -99,10 +99,10 @@ break_stmt.js:1:18 parse ━━━━━━━━━━━━━━━━━━ × A `break` statement can only be used within an enclosing iteration or switch statement. - ┌─ break_stmt.js:1:18 - │ - 1 │ function foo() { break; } - │ ^^^^^ + > 1 │ function foo() { break; } + │ ^^^^^ + 2 │ while (true) { + 3 │ break foo; -- break_stmt.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -111,10 +111,12 @@ break_stmt.js:3:9 parse ━━━━━━━━━━━━━━━━━━ × This label is used, but it is never defined - ┌─ break_stmt.js:3:9 - │ - 3 │ break foo; - │ ^^^ + 1 │ function foo() { break; } + 2 │ while (true) { + > 3 │ break foo; + │ ^^^ + 4 │ } + 5 │ -- function foo() { break; } diff --git a/crates/rome_js_parser/test_data/inline/err/class_constructor_parameter.rast b/crates/rome_js_parser/test_data/inline/err/class_constructor_parameter.rast index 633d7b1195d..a8dde5a34e3 100644 --- a/crates/rome_js_parser/test_data/inline/err/class_constructor_parameter.rast +++ b/crates/rome_js_parser/test_data/inline/err/class_constructor_parameter.rast @@ -99,10 +99,9 @@ class_constructor_parameter.js:1:23 parse ━━━━━━━━━━━━ × 'protected' modifier can only be used in TypeScript files - ┌─ class_constructor_parameter.js:1:23 - │ - 1 │ class B { constructor(protected b) {} } - │ ^^^^^^^^^ + > 1 │ class B { constructor(protected b) {} } + │ ^^^^^^^^^ + 2 │ -- class B { constructor(protected b) {} } diff --git a/crates/rome_js_parser/test_data/inline/err/class_constructor_parameter_readonly.rast b/crates/rome_js_parser/test_data/inline/err/class_constructor_parameter_readonly.rast index 6f68ccbda19..f5702c3f674 100644 --- a/crates/rome_js_parser/test_data/inline/err/class_constructor_parameter_readonly.rast +++ b/crates/rome_js_parser/test_data/inline/err/class_constructor_parameter_readonly.rast @@ -99,10 +99,9 @@ class_constructor_parameter_readonly.js:1:23 parse ━━━━━━━━━ × 'readonly' modifier can only be used in TypeScript files - ┌─ class_constructor_parameter_readonly.js:1:23 - │ - 1 │ class B { constructor(readonly b) {} } - │ ^^^^^^^^ + > 1 │ class B { constructor(readonly b) {} } + │ ^^^^^^^^ + 2 │ -- class B { constructor(readonly b) {} } diff --git a/crates/rome_js_parser/test_data/inline/err/class_decl_err.rast b/crates/rome_js_parser/test_data/inline/err/class_decl_err.rast index aa51275ec12..5480bd980b1 100644 --- a/crates/rome_js_parser/test_data/inline/err/class_decl_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/class_decl_err.rast @@ -154,30 +154,33 @@ class_decl_err.js:1:1 parse ━━━━━━━━━━━━━━━━━ × class declarations must have a name - ┌─ class_decl_err.js:1:1 - │ - 1 │ class {} - │ ^^^^^^ + > 1 │ class {} + │ ^^^^^^ + 2 │ class extends bar {} + 3 │ class foo { set {} } -- class_decl_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name - ┌─ class_decl_err.js:2:1 - │ - 2 │ class extends bar {} - │ ^^^^^^ + 1 │ class {} + > 2 │ class extends bar {} + │ ^^^^^^ + 3 │ class foo { set {} } + 4 │ class extends {} -- class_decl_err.js:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ class_decl_err.js:3:13 - │ - 3 │ class foo { set {} } - │ ^^^ + 1 │ class {} + 2 │ class extends bar {} + > 3 │ class foo { set {} } + │ ^^^ + 4 │ class extends {} + 5 │ -- class_decl_err.js:3:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -186,10 +189,12 @@ class_decl_err.js:3:17 parse ━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, a private field name, or a computed name here - ┌─ class_decl_err.js:3:17 - │ - 3 │ class foo { set {} } - │ ^ + 1 │ class {} + 2 │ class extends bar {} + > 3 │ class foo { set {} } + │ ^ + 4 │ class extends {} + 5 │ -- class_decl_err.js:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -198,30 +203,34 @@ class_decl_err.js:3:20 parse ━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ class_decl_err.js:3:20 - │ - 3 │ class foo { set {} } - │ ^ + 1 │ class {} + 2 │ class extends bar {} + > 3 │ class foo { set {} } + │ ^ + 4 │ class extends {} + 5 │ -- class_decl_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name - ┌─ class_decl_err.js:4:1 - │ - 4 │ class extends {} - │ ^^^^^^ + 2 │ class extends bar {} + 3 │ class foo { set {} } + > 4 │ class extends {} + │ ^^^^^^ + 5 │ -- class_decl_err.js:4:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'extends' list cannot be empty. - ┌─ class_decl_err.js:4:14 - │ - 4 │ class extends {} - │ ^ + 2 │ class extends bar {} + 3 │ class foo { set {} } + > 4 │ class extends {} + │ + 5 │ -- class {} diff --git a/crates/rome_js_parser/test_data/inline/err/class_decl_no_id.rast b/crates/rome_js_parser/test_data/inline/err/class_decl_no_id.rast index 21199056e95..4f38a6d7225 100644 --- a/crates/rome_js_parser/test_data/inline/err/class_decl_no_id.rast +++ b/crates/rome_js_parser/test_data/inline/err/class_decl_no_id.rast @@ -74,20 +74,20 @@ class_decl_no_id.ts:1:1 parse ━━━━━━━━━━━━━━━━ × class declarations must have a name - ┌─ class_decl_no_id.ts:1:1 - │ - 1 │ class {} - │ ^^^^^^ + > 1 │ class {} + │ ^^^^^^ + 2 │ class implements B {} + 3 │ -- class_decl_no_id.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name - ┌─ class_decl_no_id.ts:2:1 - │ - 2 │ class implements B {} - │ ^^^^^^ + 1 │ class {} + > 2 │ class implements B {} + │ ^^^^^^ + 3 │ -- class {} diff --git a/crates/rome_js_parser/test_data/inline/err/class_declare_member.rast b/crates/rome_js_parser/test_data/inline/err/class_declare_member.rast index 74717dd46d3..5fc3b106994 100644 --- a/crates/rome_js_parser/test_data/inline/err/class_declare_member.rast +++ b/crates/rome_js_parser/test_data/inline/err/class_declare_member.rast @@ -59,10 +59,9 @@ class_declare_member.js:1:11 parse ━━━━━━━━━━━━━━━ × 'declare' modifier can only be used in TypeScript files - ┌─ class_declare_member.js:1:11 - │ - 1 │ class B { declare foo } - │ ^^^^^^^ + > 1 │ class B { declare foo } + │ ^^^^^^^ + 2 │ -- class B { declare foo } diff --git a/crates/rome_js_parser/test_data/inline/err/class_declare_method.rast b/crates/rome_js_parser/test_data/inline/err/class_declare_method.rast index 24a6a682aa2..7a0d015e555 100644 --- a/crates/rome_js_parser/test_data/inline/err/class_declare_method.rast +++ b/crates/rome_js_parser/test_data/inline/err/class_declare_method.rast @@ -81,10 +81,9 @@ class_declare_method.js:1:11 parse ━━━━━━━━━━━━━━━ × 'declare' modifier can only be used in TypeScript files - ┌─ class_declare_method.js:1:11 - │ - 1 │ class B { declare fn() {} } - │ ^^^^^^^ + > 1 │ class B { declare fn() {} } + │ ^^^^^^^ + 2 │ -- class B { declare fn() {} } diff --git a/crates/rome_js_parser/test_data/inline/err/class_extends_err.rast b/crates/rome_js_parser/test_data/inline/err/class_extends_err.rast index 8bd320f6274..ad21af6c11f 100644 --- a/crates/rome_js_parser/test_data/inline/err/class_extends_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/class_extends_err.rast @@ -150,37 +150,39 @@ class_extends_err.js:1:21 parse ━━━━━━━━━━━━━━━━ × 'extends' clause already seen. - ┌─ class_extends_err.js:1:21 - │ - 1 │ class A extends bar extends foo {} - │ ^^^^^^^^^^^ + > 1 │ class A extends bar extends foo {} + │ ^^^^^^^^^^^ + 2 │ class B extends bar, foo {} + 3 │ class C implements B {} i first 'extends' clause - ┌─ class_extends_err.js:1:9 - │ - 1 │ class A extends bar extends foo {} - │ ^^^^^^^^^^^ + > 1 │ class A extends bar extends foo {} + │ ^^^^^^^^^^^ + 2 │ class B extends bar, foo {} + 3 │ class C implements B {} -- class_extends_err.js:2:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Classes can only extend a single class. - ┌─ class_extends_err.js:2:22 - │ - 2 │ class B extends bar, foo {} - │ ^^^ + 1 │ class A extends bar extends foo {} + > 2 │ class B extends bar, foo {} + │ ^^^ + 3 │ class C implements B {} + 4 │ -- class_extends_err.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × classes can only implement interfaces in TypeScript files - ┌─ class_extends_err.js:3:9 - │ - 3 │ class C implements B {} - │ ^^^^^^^^^^^^ + 1 │ class A extends bar extends foo {} + 2 │ class B extends bar, foo {} + > 3 │ class C implements B {} + │ ^^^^^^^^^^^^ + 4 │ -- class A extends bar extends foo {} diff --git a/crates/rome_js_parser/test_data/inline/err/class_implements.rast b/crates/rome_js_parser/test_data/inline/err/class_implements.rast index 91959023ba9..10196a3aba3 100644 --- a/crates/rome_js_parser/test_data/inline/err/class_implements.rast +++ b/crates/rome_js_parser/test_data/inline/err/class_implements.rast @@ -54,10 +54,9 @@ class_implements.js:1:9 parse ━━━━━━━━━━━━━━━━ × classes can only implement interfaces in TypeScript files - ┌─ class_implements.js:1:9 - │ - 1 │ class B implements C {} - │ ^^^^^^^^^^^^ + > 1 │ class B implements C {} + │ ^^^^^^^^^^^^ + 2 │ -- class B implements C {} diff --git a/crates/rome_js_parser/test_data/inline/err/class_in_single_statement_context.rast b/crates/rome_js_parser/test_data/inline/err/class_in_single_statement_context.rast index d70f3d6210b..e2c65eab1f7 100644 --- a/crates/rome_js_parser/test_data/inline/err/class_in_single_statement_context.rast +++ b/crates/rome_js_parser/test_data/inline/err/class_in_single_statement_context.rast @@ -52,10 +52,9 @@ class_in_single_statement_context.js:1:11 parse ━━━━━━━━━━ × wrap the class in a block statement - ┌─ class_in_single_statement_context.js:1:11 - │ - 1 │ if (true) class A {} - │ ^^^^^^^^^^ + > 1 │ if (true) class A {} + │ ^^^^^^^^^^ + 2 │ -- if (true) class A {} diff --git a/crates/rome_js_parser/test_data/inline/err/class_invalid_modifiers.rast b/crates/rome_js_parser/test_data/inline/err/class_invalid_modifiers.rast index fbdcca712a7..9d3269c54db 100644 --- a/crates/rome_js_parser/test_data/inline/err/class_invalid_modifiers.rast +++ b/crates/rome_js_parser/test_data/inline/err/class_invalid_modifiers.rast @@ -147,10 +147,10 @@ class_invalid_modifiers.js:1:11 parse ━━━━━━━━━━━━━━ × 'public' modifier can only be used in TypeScript files - ┌─ class_invalid_modifiers.js:1:11 - │ - 1 │ class A { public foo() {} } - │ ^^^^^^ + > 1 │ class A { public foo() {} } + │ ^^^^^^ + 2 │ class B { static static foo() {} } + 3 │ -- class_invalid_modifiers.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -159,17 +159,17 @@ class_invalid_modifiers.js:2:18 parse ━━━━━━━━━━━━━━ × duplicate modifier - ┌─ class_invalid_modifiers.js:2:18 - │ - 2 │ class B { static static foo() {} } - │ ^^^^^^ + 1 │ class A { public foo() {} } + > 2 │ class B { static static foo() {} } + │ ^^^^^^ + 3 │ i first seen here - ┌─ class_invalid_modifiers.js:2:11 - │ - 2 │ class B { static static foo() {} } - │ ^^^^^^ + 1 │ class A { public foo() {} } + > 2 │ class B { static static foo() {} } + │ ^^^^^^ + 3 │ -- class A { public foo() {} } diff --git a/crates/rome_js_parser/test_data/inline/err/class_member_method_parameters.rast b/crates/rome_js_parser/test_data/inline/err/class_member_method_parameters.rast index 10f9cc72563..b6cadaea686 100644 --- a/crates/rome_js_parser/test_data/inline/err/class_member_method_parameters.rast +++ b/crates/rome_js_parser/test_data/inline/err/class_member_method_parameters.rast @@ -118,10 +118,9 @@ class_member_method_parameters.js:1:17 parse ━━━━━━━━━━━ × unexpected - ┌─ class_member_method_parameters.js:1:17 - │ - 1 │ class B { foo(a {} } - │ ^ + > 1 │ class B { foo(a {} } + │ ^ + 2 │ -- class_member_method_parameters.js:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -130,10 +129,9 @@ class_member_method_parameters.js:1:20 parse ━━━━━━━━━━━ × unexpected - ┌─ class_member_method_parameters.js:1:20 - │ - 1 │ class B { foo(a {} } - │ ^ + > 1 │ class B { foo(a {} } + │ ^ + 2 │ -- class_member_method_parameters.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -142,10 +140,9 @@ class_member_method_parameters.js:2:1 parse ━━━━━━━━━━━━ × the file ends here - ┌─ class_member_method_parameters.js:2:1 - │ - 2 │ - │ ^ + 1 │ class B { foo(a {} } + > 2 │ + │ -- class B { foo(a {} } diff --git a/crates/rome_js_parser/test_data/inline/err/class_member_modifier.rast b/crates/rome_js_parser/test_data/inline/err/class_member_modifier.rast index 1b5e060c251..72711f5abe3 100644 --- a/crates/rome_js_parser/test_data/inline/err/class_member_modifier.rast +++ b/crates/rome_js_parser/test_data/inline/err/class_member_modifier.rast @@ -61,10 +61,9 @@ class_member_modifier.js:1:11 parse ━━━━━━━━━━━━━━ × Only abstract classes can have abstract members - ┌─ class_member_modifier.js:1:11 - │ - 1 │ class A { abstract foo; } - │ ^^^^^^^^ + > 1 │ class A { abstract foo; } + │ ^^^^^^^^ + 2 │ -- class A { abstract foo; } diff --git a/crates/rome_js_parser/test_data/inline/err/class_property_initializer.rast b/crates/rome_js_parser/test_data/inline/err/class_property_initializer.rast index 4933e76720a..20c590469e1 100644 --- a/crates/rome_js_parser/test_data/inline/err/class_property_initializer.rast +++ b/crates/rome_js_parser/test_data/inline/err/class_property_initializer.rast @@ -64,10 +64,9 @@ class_property_initializer.js:1:19 parse ━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ class_property_initializer.js:1:19 - │ - 1 │ class B { lorem = ; } - │ ^ + > 1 │ class B { lorem = ; } + │ ^ + 2 │ -- class B { lorem = ; } diff --git a/crates/rome_js_parser/test_data/inline/err/class_yield_property_initializer.rast b/crates/rome_js_parser/test_data/inline/err/class_yield_property_initializer.rast index 5065658ddb3..669f938d73b 100644 --- a/crates/rome_js_parser/test_data/inline/err/class_yield_property_initializer.rast +++ b/crates/rome_js_parser/test_data/inline/err/class_yield_property_initializer.rast @@ -111,10 +111,12 @@ class_yield_property_initializer.js:4:12 parse ━━━━━━━━━━━ × Illegal use of reserved keyword `yield` as an identifier in strict mode - ┌─ class_yield_property_initializer.js:4:12 - │ - 4 │ prop = yield; - │ ^^^^^ + 2 │ async function* test() { + 3 │ class A { + > 4 │ prop = yield; + │ ^^^^^ + 5 │ } + 6 │ } -- // SCRIPT diff --git a/crates/rome_js_parser/test_data/inline/err/conditional_expr_err.rast b/crates/rome_js_parser/test_data/inline/err/conditional_expr_err.rast index 6e1255d2a55..32f6d7aab1f 100644 --- a/crates/rome_js_parser/test_data/inline/err/conditional_expr_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/conditional_expr_err.rast @@ -143,10 +143,10 @@ conditional_expr_err.js:1:11 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ conditional_expr_err.js:1:11 - │ - 1 │ foo ? bar baz - │ ^^^ + > 1 │ foo ? bar baz + │ ^^^ + 2 │ foo ? bar baz ? foo : bar + 3 │ foo ? bar : -- conditional_expr_err.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -155,10 +155,11 @@ conditional_expr_err.js:2:11 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ conditional_expr_err.js:2:11 - │ - 2 │ foo ? bar baz ? foo : bar - │ ^^^ + 1 │ foo ? bar baz + > 2 │ foo ? bar baz ? foo : bar + │ ^^^ + 3 │ foo ? bar : + 4 │ -- conditional_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -167,10 +168,10 @@ conditional_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ conditional_expr_err.js:4:1 - │ - 4 │ - │ ^ + 2 │ foo ? bar baz ? foo : bar + 3 │ foo ? bar : + > 4 │ + │ -- foo ? bar baz diff --git a/crates/rome_js_parser/test_data/inline/err/continue_stmt.rast b/crates/rome_js_parser/test_data/inline/err/continue_stmt.rast index c7562dc723f..91302b01073 100644 --- a/crates/rome_js_parser/test_data/inline/err/continue_stmt.rast +++ b/crates/rome_js_parser/test_data/inline/err/continue_stmt.rast @@ -127,10 +127,10 @@ continue_stmt.js:1:18 parse ━━━━━━━━━━━━━━━━━ × A `continue` statement can only be used within an enclosing `for`, `while` or `do while` statement. - ┌─ continue_stmt.js:1:18 - │ - 1 │ function foo() { continue; } - │ ^^^^^^^^ + > 1 │ function foo() { continue; } + │ ^^^^^^^^ + 2 │ while (true) { + 3 │ continue foo; -- continue_stmt.js:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -139,10 +139,12 @@ continue_stmt.js:3:12 parse ━━━━━━━━━━━━━━━━━ × This label is used, but it is never defined - ┌─ continue_stmt.js:3:12 - │ - 3 │ continue foo; - │ ^^^ + 1 │ function foo() { continue; } + 2 │ while (true) { + > 3 │ continue foo; + │ ^^^ + 4 │ } + 5 │ foo: { -- continue_stmt.js:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -151,17 +153,21 @@ continue_stmt.js:6:12 parse ━━━━━━━━━━━━━━━━━ × This label - ┌─ continue_stmt.js:6:12 - │ - 6 │ continue foo; - │ ^^^ + 4 │ } + 5 │ foo: { + > 6 │ continue foo; + │ ^^^ + 7 │ } + 8 │ i points to non-iteration statement - ┌─ continue_stmt.js:5:1 - │ - 5 │ foo: { - │ ^^^ + 3 │ continue foo; + 4 │ } + > 5 │ foo: { + │ ^^^ + 6 │ continue foo; + 7 │ } -- function foo() { continue; } diff --git a/crates/rome_js_parser/test_data/inline/err/debugger_stmt.rast b/crates/rome_js_parser/test_data/inline/err/debugger_stmt.rast index a1d82bd9d93..74ab53b3fa9 100644 --- a/crates/rome_js_parser/test_data/inline/err/debugger_stmt.rast +++ b/crates/rome_js_parser/test_data/inline/err/debugger_stmt.rast @@ -107,17 +107,19 @@ debugger_stmt.js:2:12 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ debugger_stmt.js:2:12 - │ - 2 │ debugger { - │ ^ + 1 │ function foo() { + > 2 │ debugger { + │ ^ + 3 │ var something = "lorem"; + 4 │ } i ...Which is required to end this statement - ┌─ debugger_stmt.js:2:3 - │ - 2 │ debugger { - │ ^^^^^^^^ + 1 │ function foo() { + > 2 │ debugger { + │ ^^^^^^^^ + 3 │ var something = "lorem"; + 4 │ } -- function foo() { diff --git a/crates/rome_js_parser/test_data/inline/err/do_while_no_continue_break.rast b/crates/rome_js_parser/test_data/inline/err/do_while_no_continue_break.rast index 6951f1958ab..c5c489f5925 100644 --- a/crates/rome_js_parser/test_data/inline/err/do_while_no_continue_break.rast +++ b/crates/rome_js_parser/test_data/inline/err/do_while_no_continue_break.rast @@ -136,10 +136,10 @@ do_while_no_continue_break.js:1:8 parse ━━━━━━━━━━━━━ × unexpected - ┌─ do_while_no_continue_break.js:1:8 - │ - 1 │ do { } break (continue) - │ ^^^^^ + > 1 │ do { } break (continue) + │ ^^^^^ + 2 │ do { } continue (break) + 3 │ -- do_while_no_continue_break.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -148,27 +148,27 @@ do_while_no_continue_break.js:1:14 parse ━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ do_while_no_continue_break.js:1:14 - │ - 1 │ do { } break (continue) - │ ^ + > 1 │ do { } break (continue) + │ ^ + 2 │ do { } continue (break) + 3 │ i ...Which is required to end this statement - ┌─ do_while_no_continue_break.js:1:8 - │ - 1 │ do { } break (continue) - │ ^^^^^^^ + > 1 │ do { } break (continue) + │ ^^^^^^^ + 2 │ do { } continue (break) + 3 │ -- do_while_no_continue_break.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A `break` statement can only be used within an enclosing iteration or switch statement. - ┌─ do_while_no_continue_break.js:1:8 - │ - 1 │ do { } break (continue) - │ ^^^^^ + > 1 │ do { } break (continue) + │ ^^^^^ + 2 │ do { } continue (break) + 3 │ -- do_while_no_continue_break.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -177,10 +177,10 @@ do_while_no_continue_break.js:1:15 parse ━━━━━━━━━━━━━ × unexpected - ┌─ do_while_no_continue_break.js:1:15 - │ - 1 │ do { } break (continue) - │ ^^^^^^^^ + > 1 │ do { } break (continue) + │ ^^^^^^^^ + 2 │ do { } continue (break) + 3 │ -- do_while_no_continue_break.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -189,27 +189,27 @@ do_while_no_continue_break.js:1:23 parse ━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ do_while_no_continue_break.js:1:23 - │ - 1 │ do { } break (continue) - │ ^ + > 1 │ do { } break (continue) + │ ^ + 2 │ do { } continue (break) + 3 │ i ...Which is required to end this statement - ┌─ do_while_no_continue_break.js:1:15 - │ - 1 │ do { } break (continue) - │ ^^^^^^^^^ + > 1 │ do { } break (continue) + │ ^^^^^^^^^ + 2 │ do { } continue (break) + 3 │ -- do_while_no_continue_break.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A `continue` statement can only be used within an enclosing `for`, `while` or `do while` statement. - ┌─ do_while_no_continue_break.js:1:15 - │ - 1 │ do { } break (continue) - │ ^^^^^^^^ + > 1 │ do { } break (continue) + │ ^^^^^^^^ + 2 │ do { } continue (break) + 3 │ -- do_while_no_continue_break.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -218,10 +218,10 @@ do_while_no_continue_break.js:1:23 parse ━━━━━━━━━━━━━ × Expected a statement here - ┌─ do_while_no_continue_break.js:1:23 - │ - 1 │ do { } break (continue) - │ ^ + > 1 │ do { } break (continue) + │ ^ + 2 │ do { } continue (break) + 3 │ -- do_while_no_continue_break.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -230,10 +230,10 @@ do_while_no_continue_break.js:2:8 parse ━━━━━━━━━━━━━ × unexpected - ┌─ do_while_no_continue_break.js:2:8 - │ - 2 │ do { } continue (break) - │ ^^^^^^^^ + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^^^^^^^^ + 3 │ -- do_while_no_continue_break.js:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -242,27 +242,27 @@ do_while_no_continue_break.js:2:17 parse ━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ do_while_no_continue_break.js:2:17 - │ - 2 │ do { } continue (break) - │ ^ + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^ + 3 │ i ...Which is required to end this statement - ┌─ do_while_no_continue_break.js:2:8 - │ - 2 │ do { } continue (break) - │ ^^^^^^^^^^ + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^^^^^^^^^^ + 3 │ -- do_while_no_continue_break.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A `continue` statement can only be used within an enclosing `for`, `while` or `do while` statement. - ┌─ do_while_no_continue_break.js:2:8 - │ - 2 │ do { } continue (break) - │ ^^^^^^^^ + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^^^^^^^^ + 3 │ -- do_while_no_continue_break.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -271,10 +271,10 @@ do_while_no_continue_break.js:2:18 parse ━━━━━━━━━━━━━ × unexpected - ┌─ do_while_no_continue_break.js:2:18 - │ - 2 │ do { } continue (break) - │ ^^^^^ + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^^^^^ + 3 │ -- do_while_no_continue_break.js:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -283,27 +283,27 @@ do_while_no_continue_break.js:2:23 parse ━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ do_while_no_continue_break.js:2:23 - │ - 2 │ do { } continue (break) - │ ^ + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^ + 3 │ i ...Which is required to end this statement - ┌─ do_while_no_continue_break.js:2:18 - │ - 2 │ do { } continue (break) - │ ^^^^^^ + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^^^^^^ + 3 │ -- do_while_no_continue_break.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A `break` statement can only be used within an enclosing iteration or switch statement. - ┌─ do_while_no_continue_break.js:2:18 - │ - 2 │ do { } continue (break) - │ ^^^^^ + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^^^^^ + 3 │ -- do_while_no_continue_break.js:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -312,10 +312,10 @@ do_while_no_continue_break.js:2:23 parse ━━━━━━━━━━━━━ × Expected a statement here - ┌─ do_while_no_continue_break.js:2:23 - │ - 2 │ do { } continue (break) - │ ^ + 1 │ do { } break (continue) + > 2 │ do { } continue (break) + │ ^ + 3 │ -- do { } break (continue) diff --git a/crates/rome_js_parser/test_data/inline/err/do_while_stmt_err.rast b/crates/rome_js_parser/test_data/inline/err/do_while_stmt_err.rast index 65ad4ad3715..a7e0e1510d5 100644 --- a/crates/rome_js_parser/test_data/inline/err/do_while_stmt_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/do_while_stmt_err.rast @@ -104,10 +104,11 @@ do_while_stmt_err.js:2:11 parse ━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ do_while_stmt_err.js:2:11 - │ - 2 │ do while () - │ ^ + 1 │ do while (true) + > 2 │ do while () + │ ^ + 3 │ do while true + 4 │ -- do_while_stmt_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -116,10 +117,11 @@ do_while_stmt_err.js:3:10 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ do_while_stmt_err.js:3:10 - │ - 3 │ do while true - │ ^^^^ + 1 │ do while (true) + 2 │ do while () + > 3 │ do while true + │ ^^^^ + 4 │ -- do_while_stmt_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -128,10 +130,10 @@ do_while_stmt_err.js:4:1 parse ━━━━━━━━━━━━━━━━ × the file ends here - ┌─ do_while_stmt_err.js:4:1 - │ - 4 │ - │ ^ + 2 │ do while () + 3 │ do while true + > 4 │ + │ -- do while (true) diff --git a/crates/rome_js_parser/test_data/inline/err/double_label.rast b/crates/rome_js_parser/test_data/inline/err/double_label.rast index 3356222e721..09f2a46cc14 100644 --- a/crates/rome_js_parser/test_data/inline/err/double_label.rast +++ b/crates/rome_js_parser/test_data/inline/err/double_label.rast @@ -68,17 +68,19 @@ double_label.js:3:5 parse ━━━━━━━━━━━━━━━━━━ × a second use of `label1` here is not allowed - ┌─ double_label.js:3:5 - │ - 3 │ label1: {} - │ ^^^^^^ + 1 │ label1: { + 2 │ label2: { + > 3 │ label1: {} + │ ^^^^^^ + 4 │ } + 5 │ } i `label1` is first used as a label here - ┌─ double_label.js:1:1 - │ - 1 │ label1: { - │ ^^^^^^ + > 1 │ label1: { + │ ^^^^^^ + 2 │ label2: { + 3 │ label1: {} -- label1: { diff --git a/crates/rome_js_parser/test_data/inline/err/empty_parenthesized_expression.rast b/crates/rome_js_parser/test_data/inline/err/empty_parenthesized_expression.rast index fccfe1bedb1..f21deb52eaa 100644 --- a/crates/rome_js_parser/test_data/inline/err/empty_parenthesized_expression.rast +++ b/crates/rome_js_parser/test_data/inline/err/empty_parenthesized_expression.rast @@ -32,10 +32,9 @@ empty_parenthesized_expression.js:1:2 parse ━━━━━━━━━━━━ × Expected an expression here - ┌─ empty_parenthesized_expression.js:1:2 - │ - 1 │ (); - │ ^ + > 1 │ (); + │ ^ + 2 │ -- (); diff --git a/crates/rome_js_parser/test_data/inline/err/enum_decl_no_id.rast b/crates/rome_js_parser/test_data/inline/err/enum_decl_no_id.rast index 9f8556dd6e5..21008a2f302 100644 --- a/crates/rome_js_parser/test_data/inline/err/enum_decl_no_id.rast +++ b/crates/rome_js_parser/test_data/inline/err/enum_decl_no_id.rast @@ -121,20 +121,20 @@ enum_decl_no_id.ts:1:1 parse ━━━━━━━━━━━━━━━━━ × `enum` statements must have a name - ┌─ enum_decl_no_id.ts:1:1 - │ - 1 │ enum {A,B,C} - │ ^^^^^ + > 1 │ enum {A,B,C} + │ ^^^^^ + 2 │ enum 1 {A,B,C} + 3 │ -- enum_decl_no_id.ts:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × invalid `enum` name - ┌─ enum_decl_no_id.ts:2:6 - │ - 2 │ enum 1 {A,B,C} - │ ^ + 1 │ enum {A,B,C} + > 2 │ enum 1 {A,B,C} + │ ^ + 3 │ -- enum {A,B,C} diff --git a/crates/rome_js_parser/test_data/inline/err/enum_in_js.rast b/crates/rome_js_parser/test_data/inline/err/enum_in_js.rast index 63c0a92bc96..63aca5ae6d6 100644 --- a/crates/rome_js_parser/test_data/inline/err/enum_in_js.rast +++ b/crates/rome_js_parser/test_data/inline/err/enum_in_js.rast @@ -36,10 +36,9 @@ enum_in_js.js:1:1 parse ━━━━━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ enum_in_js.js:1:1 - │ - 1 │ enum A {} - │ ^^^^^^^^^ + > 1 │ enum A {} + │ ^^^^^^^^^ + 2 │ -- enum A {} diff --git a/crates/rome_js_parser/test_data/inline/err/enum_no_l_curly.rast b/crates/rome_js_parser/test_data/inline/err/enum_no_l_curly.rast index e00f02683be..872b51cdd5d 100644 --- a/crates/rome_js_parser/test_data/inline/err/enum_no_l_curly.rast +++ b/crates/rome_js_parser/test_data/inline/err/enum_no_l_curly.rast @@ -59,10 +59,10 @@ enum_no_l_curly.ts:1:1 parse ━━━━━━━━━━━━━━━━━ × `enum` statements must have a name - ┌─ enum_no_l_curly.ts:1:1 - │ - 1 │ enum; - │ ^^^^ + > 1 │ enum; + │ ^^^^ + 2 │ enum A; + 3 │ -- enum_no_l_curly.ts:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -71,10 +71,10 @@ enum_no_l_curly.ts:1:5 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ enum_no_l_curly.ts:1:5 - │ - 1 │ enum; - │ ^ + > 1 │ enum; + │ ^ + 2 │ enum A; + 3 │ -- enum_no_l_curly.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -83,10 +83,10 @@ enum_no_l_curly.ts:2:7 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ enum_no_l_curly.ts:2:7 - │ - 2 │ enum A; - │ ^ + 1 │ enum; + > 2 │ enum A; + │ ^ + 3 │ -- enum; diff --git a/crates/rome_js_parser/test_data/inline/err/enum_no_r_curly.rast b/crates/rome_js_parser/test_data/inline/err/enum_no_r_curly.rast index b6deb7c663e..d3809a6a286 100644 --- a/crates/rome_js_parser/test_data/inline/err/enum_no_r_curly.rast +++ b/crates/rome_js_parser/test_data/inline/err/enum_no_r_curly.rast @@ -59,10 +59,10 @@ enum_no_r_curly.ts:1:1 parse ━━━━━━━━━━━━━━━━━ × `enum` statements must have a name - ┌─ enum_no_r_curly.ts:1:1 - │ - 1 │ enum {; - │ ^^^^^ + > 1 │ enum {; + │ ^^^^^ + 2 │ enum A {; + 3 │ -- enum_no_r_curly.ts:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -71,10 +71,10 @@ enum_no_r_curly.ts:1:7 parse ━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, or a computed name here - ┌─ enum_no_r_curly.ts:1:7 - │ - 1 │ enum {; - │ ^ + > 1 │ enum {; + │ ^ + 2 │ enum A {; + 3 │ -- enum_no_r_curly.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -83,10 +83,10 @@ enum_no_r_curly.ts:2:9 parse ━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, or a computed name here - ┌─ enum_no_r_curly.ts:2:9 - │ - 2 │ enum A {; - │ ^ + 1 │ enum {; + > 2 │ enum A {; + │ ^ + 3 │ -- enum {; diff --git a/crates/rome_js_parser/test_data/inline/err/escaped_from.rast b/crates/rome_js_parser/test_data/inline/err/escaped_from.rast index 8355163cb45..8c0e1ba2ed5 100644 --- a/crates/rome_js_parser/test_data/inline/err/escaped_from.rast +++ b/crates/rome_js_parser/test_data/inline/err/escaped_from.rast @@ -43,10 +43,9 @@ escaped_from.js:1:11 parse ━━━━━━━━━━━━━━━━━ × 'from' keyword cannot contain escape character. - ┌─ escaped_from.js:1:11 - │ - 1 │ export {} \u0066rom "./escaped-from.js"; - │ ^^^^^^^^^ + > 1 │ export {} \u0066rom "./escaped-from.js"; + │ ^^^^^^^^^ + 2 │ -- export {} \u0066rom "./escaped-from.js"; diff --git a/crates/rome_js_parser/test_data/inline/err/eval_arguments_assignment.rast b/crates/rome_js_parser/test_data/inline/err/eval_arguments_assignment.rast index 450e4b55455..890caa85852 100644 --- a/crates/rome_js_parser/test_data/inline/err/eval_arguments_assignment.rast +++ b/crates/rome_js_parser/test_data/inline/err/eval_arguments_assignment.rast @@ -60,20 +60,20 @@ eval_arguments_assignment.js:1:1 parse ━━━━━━━━━━━━━ × Illegal use of `eval` as an identifier in strict mode - ┌─ eval_arguments_assignment.js:1:1 - │ - 1 │ eval = "test"; - │ ^^^^ + > 1 │ eval = "test"; + │ ^^^^ + 2 │ arguments = "test"; + 3 │ -- eval_arguments_assignment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `arguments` as an identifier in strict mode - ┌─ eval_arguments_assignment.js:2:1 - │ - 2 │ arguments = "test"; - │ ^^^^^^^^^ + 1 │ eval = "test"; + > 2 │ arguments = "test"; + │ ^^^^^^^^^ + 3 │ -- eval = "test"; diff --git a/crates/rome_js_parser/test_data/inline/err/exponent_unary_unparenthesized.rast b/crates/rome_js_parser/test_data/inline/err/exponent_unary_unparenthesized.rast index afdc5dc914b..e2d47fdc2f9 100644 --- a/crates/rome_js_parser/test_data/inline/err/exponent_unary_unparenthesized.rast +++ b/crates/rome_js_parser/test_data/inline/err/exponent_unary_unparenthesized.rast @@ -224,105 +224,125 @@ exponent_unary_unparenthesized.js:1:1 parse ━━━━━━━━━━━━ × unparenthesized unary expression can't appear on the left-hand side of '**' - ┌─ exponent_unary_unparenthesized.js:1:1 - │ - 1 │ delete a.b ** 2; - │ ^^^^^^^^^^ + > 1 │ delete a.b ** 2; + │ ^^^^^^^^^^ + 2 │ void ident ** 2; + 3 │ typeof ident ** 2; - ┌─ exponent_unary_unparenthesized.js:1:12 - │ - 1 │ delete a.b ** 2; - │ ^^ + > 1 │ delete a.b ** 2; + │ ^^ + 2 │ void ident ** 2; + 3 │ typeof ident ** 2; -- exponent_unary_unparenthesized.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unparenthesized unary expression can't appear on the left-hand side of '**' - ┌─ exponent_unary_unparenthesized.js:2:1 - │ - 2 │ void ident ** 2; - │ ^^^^^^^^^^ + 1 │ delete a.b ** 2; + > 2 │ void ident ** 2; + │ ^^^^^^^^^^ + 3 │ typeof ident ** 2; + 4 │ -3 ** 2; - ┌─ exponent_unary_unparenthesized.js:2:12 - │ - 2 │ void ident ** 2; - │ ^^ + 1 │ delete a.b ** 2; + > 2 │ void ident ** 2; + │ ^^ + 3 │ typeof ident ** 2; + 4 │ -3 ** 2; -- exponent_unary_unparenthesized.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unparenthesized unary expression can't appear on the left-hand side of '**' - ┌─ exponent_unary_unparenthesized.js:3:1 - │ - 3 │ typeof ident ** 2; - │ ^^^^^^^^^^^^ + 1 │ delete a.b ** 2; + 2 │ void ident ** 2; + > 3 │ typeof ident ** 2; + │ ^^^^^^^^^^^^ + 4 │ -3 ** 2; + 5 │ +3 ** 2; - ┌─ exponent_unary_unparenthesized.js:3:14 - │ - 3 │ typeof ident ** 2; - │ ^^ + 1 │ delete a.b ** 2; + 2 │ void ident ** 2; + > 3 │ typeof ident ** 2; + │ ^^ + 4 │ -3 ** 2; + 5 │ +3 ** 2; -- exponent_unary_unparenthesized.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unparenthesized unary expression can't appear on the left-hand side of '**' - ┌─ exponent_unary_unparenthesized.js:4:1 - │ - 4 │ -3 ** 2; - │ ^^ + 2 │ void ident ** 2; + 3 │ typeof ident ** 2; + > 4 │ -3 ** 2; + │ ^^ + 5 │ +3 ** 2; + 6 │ ~3 ** 2; - ┌─ exponent_unary_unparenthesized.js:4:4 - │ - 4 │ -3 ** 2; - │ ^^ + 2 │ void ident ** 2; + 3 │ typeof ident ** 2; + > 4 │ -3 ** 2; + │ ^^ + 5 │ +3 ** 2; + 6 │ ~3 ** 2; -- exponent_unary_unparenthesized.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unparenthesized unary expression can't appear on the left-hand side of '**' - ┌─ exponent_unary_unparenthesized.js:5:1 - │ - 5 │ +3 ** 2; - │ ^^ + 3 │ typeof ident ** 2; + 4 │ -3 ** 2; + > 5 │ +3 ** 2; + │ ^^ + 6 │ ~3 ** 2; + 7 │ !true ** 2; - ┌─ exponent_unary_unparenthesized.js:5:4 - │ - 5 │ +3 ** 2; - │ ^^ + 3 │ typeof ident ** 2; + 4 │ -3 ** 2; + > 5 │ +3 ** 2; + │ ^^ + 6 │ ~3 ** 2; + 7 │ !true ** 2; -- exponent_unary_unparenthesized.js:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unparenthesized unary expression can't appear on the left-hand side of '**' - ┌─ exponent_unary_unparenthesized.js:6:1 - │ - 6 │ ~3 ** 2; - │ ^^ + 4 │ -3 ** 2; + 5 │ +3 ** 2; + > 6 │ ~3 ** 2; + │ ^^ + 7 │ !true ** 2; + 8 │ - ┌─ exponent_unary_unparenthesized.js:6:4 - │ - 6 │ ~3 ** 2; - │ ^^ + 4 │ -3 ** 2; + 5 │ +3 ** 2; + > 6 │ ~3 ** 2; + │ ^^ + 7 │ !true ** 2; + 8 │ -- exponent_unary_unparenthesized.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unparenthesized unary expression can't appear on the left-hand side of '**' - ┌─ exponent_unary_unparenthesized.js:7:1 - │ - 7 │ !true ** 2; - │ ^^^^^ + 5 │ +3 ** 2; + 6 │ ~3 ** 2; + > 7 │ !true ** 2; + │ ^^^^^ + 8 │ - ┌─ exponent_unary_unparenthesized.js:7:7 - │ - 7 │ !true ** 2; - │ ^^ + 5 │ +3 ** 2; + 6 │ ~3 ** 2; + > 7 │ !true ** 2; + │ ^^ + 8 │ -- delete a.b ** 2; diff --git a/crates/rome_js_parser/test_data/inline/err/export_as_identifier_err.rast b/crates/rome_js_parser/test_data/inline/err/export_as_identifier_err.rast index 48b54f166f1..e440136bda3 100644 --- a/crates/rome_js_parser/test_data/inline/err/export_as_identifier_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/export_as_identifier_err.rast @@ -51,10 +51,9 @@ export_as_identifier_err.js:1:10 parse ━━━━━━━━━━━━━ × Expected an identifier here - ┌─ export_as_identifier_err.js:1:10 - │ - 1 │ export { as c } - │ ^ + > 1 │ export { as c } + │ + 2 │ -- export { as c } diff --git a/crates/rome_js_parser/test_data/inline/err/export_decl_not_top_level.rast b/crates/rome_js_parser/test_data/inline/err/export_decl_not_top_level.rast index 5c1a93cadff..7b7b3415623 100644 --- a/crates/rome_js_parser/test_data/inline/err/export_decl_not_top_level.rast +++ b/crates/rome_js_parser/test_data/inline/err/export_decl_not_top_level.rast @@ -70,10 +70,11 @@ export_decl_not_top_level.js:2:2 parse ━━━━━━━━━━━━━ × move this declaration to the top level - ┌─ export_decl_not_top_level.js:2:2 - │ - 2 │ export { pain } from "life"; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ { + > 2 │ export { pain } from "life"; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ } + 4 │ -- { diff --git a/crates/rome_js_parser/test_data/inline/err/export_default_expression_clause_err.rast b/crates/rome_js_parser/test_data/inline/err/export_default_expression_clause_err.rast index e93e31eb02d..282cc471596 100644 --- a/crates/rome_js_parser/test_data/inline/err/export_default_expression_clause_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/export_default_expression_clause_err.rast @@ -52,17 +52,15 @@ export_default_expression_clause_err.js:1:17 parse ━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ export_default_expression_clause_err.js:1:17 - │ - 1 │ export default a, b; - │ ^ + > 1 │ export default a, b; + │ ^ + 2 │ i ...Which is required to end this statement - ┌─ export_default_expression_clause_err.js:1:8 - │ - 1 │ export default a, b; - │ ^^^^^^^^^ + > 1 │ export default a, b; + │ ^^^^^^^^^ + 2 │ -- export default a, b; diff --git a/crates/rome_js_parser/test_data/inline/err/export_err.rast b/crates/rome_js_parser/test_data/inline/err/export_err.rast index 4e14fecc8e2..dd7752676fe 100644 --- a/crates/rome_js_parser/test_data/inline/err/export_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/export_err.rast @@ -25,10 +25,9 @@ export_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration here - ┌─ export_err.js:2:1 - │ - 2 │ - │ ^ + 1 │ export + > 2 │ + │ -- export diff --git a/crates/rome_js_parser/test_data/inline/err/export_from_clause_err.rast b/crates/rome_js_parser/test_data/inline/err/export_from_clause_err.rast index d02e7f4d1d9..bef9d895e7e 100644 --- a/crates/rome_js_parser/test_data/inline/err/export_from_clause_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/export_from_clause_err.rast @@ -122,10 +122,10 @@ export_from_clause_err.js:1:9 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ export_from_clause_err.js:1:9 - │ - 1 │ export *; - │ ^ + > 1 │ export *; + │ ^ + 2 │ export * from 5; + 3 │ export as from "test"; -- export_from_clause_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -134,10 +134,11 @@ export_from_clause_err.js:2:15 parse ━━━━━━━━━━━━━━ × Expected a string literal here - ┌─ export_from_clause_err.js:2:15 - │ - 2 │ export * from 5; - │ ^ + 1 │ export *; + > 2 │ export * from 5; + │ ^ + 3 │ export as from "test"; + 4 │ export from "test"; -- export_from_clause_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -146,10 +147,12 @@ export_from_clause_err.js:3:8 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ export_from_clause_err.js:3:8 - │ - 3 │ export as from "test"; - │ ^^ + 1 │ export *; + 2 │ export * from 5; + > 3 │ export as from "test"; + │ ^^ + 4 │ export from "test"; + 5 │ -- export_from_clause_err.js:3:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -158,10 +161,12 @@ export_from_clause_err.js:3:16 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ export_from_clause_err.js:3:16 - │ - 3 │ export as from "test"; - │ ^^^^^^ + 1 │ export *; + 2 │ export * from 5; + > 3 │ export as from "test"; + │ ^^^^^^ + 4 │ export from "test"; + 5 │ -- export_from_clause_err.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -170,10 +175,11 @@ export_from_clause_err.js:4:8 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ export_from_clause_err.js:4:8 - │ - 4 │ export from "test"; - │ ^^^^ + 2 │ export * from 5; + 3 │ export as from "test"; + > 4 │ export from "test"; + │ ^^^^ + 5 │ -- export *; diff --git a/crates/rome_js_parser/test_data/inline/err/export_huge_function_in_script.rast b/crates/rome_js_parser/test_data/inline/err/export_huge_function_in_script.rast index d16101c349b..b6192702afb 100644 --- a/crates/rome_js_parser/test_data/inline/err/export_huge_function_in_script.rast +++ b/crates/rome_js_parser/test_data/inline/err/export_huge_function_in_script.rast @@ -76,10 +76,10 @@ export_huge_function_in_script.js:2:1 parse ━━━━━━━━━━━━ × not allowed inside scripts - ┌─ export_huge_function_in_script.js:2:1 - │ - 2 │ export function A () { return "Kinsmen hot Moria tea serves. Sticky camp spell covering forged they're Oakenshield vines. Admirable relatives march regained wheel Ere eternally on rest parts unhappy? Leave hundreds market's Argonath answered avail gr - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ // SCRIPT + > 2 │ export function A () { return "Kinsmen hot Moria tea serves. Sticky camp spell covering forged they're Oakenshield vines. Admirable relatives march regained wheel Ere eternally on rest parts unhappy? Leave hundreds market's Argonath answered avail grieve doing goodness! Wrong miserable well-wishers wander stood immediately neither Agreed goat poison holes fire? Nobody tosses a Dwarf. Brigands Bilbo Baggins prisoner stinker birthday injuries. Kili's loosened shy spiders till. Gandalf's death was not in vain. Nor would he have you give up hope. Bread kindly ghost Beorn's jelly. Andûril two-faced bitterness biding seemed says drinking splendor feed light unnoticed one! Carven nearest Eärendil fireworks former. Mattress smelling wandering teaching appear taste wise Mithril uprooted winter forebearers wheel. Let's beside Proudfoots succumbed! Excuse Anárion stolen helpless nudge study shown holding form? Changes point Snowbourn material side outer highest eaves flash-flame relic descendant lurking. Thousand death Agreed oppose whole? Glóin head's hurts feasting fight shiny legacy. Thror's broken odds suffice believe well-protected? Rightfully manners begged Maggot's fairer. Unheard-of grog shields sad wondering gardener killed gone Galadriel! Pan Frodo fingers spreads magic parting amount interest idly naked. It's some form of Elvish. I can't read it. Silverwork Wraiths riddled enchantment apple anywhere."; } + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ -- // SCRIPT diff --git a/crates/rome_js_parser/test_data/inline/err/export_named_clause_err.rast b/crates/rome_js_parser/test_data/inline/err/export_named_clause_err.rast index 5d2c76c241c..6969896a3b7 100644 --- a/crates/rome_js_parser/test_data/inline/err/export_named_clause_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/export_named_clause_err.rast @@ -217,10 +217,10 @@ export_named_clause_err.js:1:10 parse ━━━━━━━━━━━━━━ × "default" can only be used with "export ... from ..." - ┌─ export_named_clause_err.js:1:10 - │ - 1 │ export { default as "b" }; - │ ^^^^^^^ + > 1 │ export { default as "b" }; + │ ^^^^^^^ + 2 │ export { "a" as b }; + 3 │ export { as b }; -- export_named_clause_err.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -229,10 +229,11 @@ export_named_clause_err.js:2:10 parse ━━━━━━━━━━━━━━ × Expected an export name here - ┌─ export_named_clause_err.js:2:10 - │ - 2 │ export { "a" as b }; - │ ^^^^^^^^ + 1 │ export { default as "b" }; + > 2 │ export { "a" as b }; + │ ^^^^^^^^ + 3 │ export { as b }; + 4 │ export { a as 5 }; -- export_named_clause_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -241,10 +242,12 @@ export_named_clause_err.js:3:10 parse ━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ export_named_clause_err.js:3:10 - │ - 3 │ export { as b }; - │ ^ + 1 │ export { default as "b" }; + 2 │ export { "a" as b }; + > 3 │ export { as b }; + │ + 4 │ export { a as 5 }; + 5 │ export { a b c }; -- export_named_clause_err.js:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -253,10 +256,12 @@ export_named_clause_err.js:4:15 parse ━━━━━━━━━━━━━━ × Expected a string literal, or an identifier here - ┌─ export_named_clause_err.js:4:15 - │ - 4 │ export { a as 5 }; - │ ^ + 2 │ export { "a" as b }; + 3 │ export { as b }; + > 4 │ export { a as 5 }; + │ ^ + 5 │ export { a b c }; + 6 │ -- export_named_clause_err.js:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -265,10 +270,11 @@ export_named_clause_err.js:5:12 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ export_named_clause_err.js:5:12 - │ - 5 │ export { a b c }; - │ ^ + 3 │ export { as b }; + 4 │ export { a as 5 }; + > 5 │ export { a b c }; + │ ^ + 6 │ -- export_named_clause_err.js:5:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -277,10 +283,11 @@ export_named_clause_err.js:5:14 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ export_named_clause_err.js:5:14 - │ - 5 │ export { a b c }; - │ ^ + 3 │ export { as b }; + 4 │ export { a as 5 }; + > 5 │ export { a b c }; + │ ^ + 6 │ -- export { default as "b" }; diff --git a/crates/rome_js_parser/test_data/inline/err/export_named_from_clause_err.rast b/crates/rome_js_parser/test_data/inline/err/export_named_from_clause_err.rast index 6e0ecce03bb..058d1f7c30a 100644 --- a/crates/rome_js_parser/test_data/inline/err/export_named_from_clause_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/export_named_from_clause_err.rast @@ -226,10 +226,10 @@ export_named_from_clause_err.js:1:10 parse ━━━━━━━━━━━━ × Expected a string literal, or an identifier here - ┌─ export_named_from_clause_err.js:1:10 - │ - 1 │ export { as b } from "mod"; - │ ^ + > 1 │ export { as b } from "mod"; + │ + 2 │ export { a as 5 } from "mod"; + 3 │ export { a b c } from "mod"; -- export_named_from_clause_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -238,10 +238,11 @@ export_named_from_clause_err.js:2:15 parse ━━━━━━━━━━━━ × Expected a string literal, or an identifier here - ┌─ export_named_from_clause_err.js:2:15 - │ - 2 │ export { a as 5 } from "mod"; - │ ^ + 1 │ export { as b } from "mod"; + > 2 │ export { a as 5 } from "mod"; + │ ^ + 3 │ export { a b c } from "mod"; + 4 │ export { 5 as b } from "mod"; -- export_named_from_clause_err.js:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -250,10 +251,12 @@ export_named_from_clause_err.js:3:12 parse ━━━━━━━━━━━━ × unexpected - ┌─ export_named_from_clause_err.js:3:12 - │ - 3 │ export { a b c } from "mod"; - │ ^ + 1 │ export { as b } from "mod"; + 2 │ export { a as 5 } from "mod"; + > 3 │ export { a b c } from "mod"; + │ ^ + 4 │ export { 5 as b } from "mod"; + 5 │ -- export_named_from_clause_err.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -262,10 +265,12 @@ export_named_from_clause_err.js:3:14 parse ━━━━━━━━━━━━ × unexpected - ┌─ export_named_from_clause_err.js:3:14 - │ - 3 │ export { a b c } from "mod"; - │ ^ + 1 │ export { as b } from "mod"; + 2 │ export { a as 5 } from "mod"; + > 3 │ export { a b c } from "mod"; + │ ^ + 4 │ export { 5 as b } from "mod"; + 5 │ -- export_named_from_clause_err.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -274,10 +279,11 @@ export_named_from_clause_err.js:4:10 parse ━━━━━━━━━━━━ × Expected a string literal, or an identifier here - ┌─ export_named_from_clause_err.js:4:10 - │ - 4 │ export { 5 as b } from "mod"; - │ ^^^^^^ + 2 │ export { a as 5 } from "mod"; + 3 │ export { a b c } from "mod"; + > 4 │ export { 5 as b } from "mod"; + │ ^^^^^^ + 5 │ -- export { as b } from "mod"; diff --git a/crates/rome_js_parser/test_data/inline/err/export_variable_clause_error.rast b/crates/rome_js_parser/test_data/inline/err/export_variable_clause_error.rast index 1eda0a245a0..13b7642ff97 100644 --- a/crates/rome_js_parser/test_data/inline/err/export_variable_clause_error.rast +++ b/crates/rome_js_parser/test_data/inline/err/export_variable_clause_error.rast @@ -127,10 +127,10 @@ export_variable_clause_error.js:1:16 parse ━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ export_variable_clause_error.js:1:16 - │ - 1 │ export let a = ; - │ ^ + > 1 │ export let a = ; + │ ^ + 2 │ export const b; + 3 │ export let d, c; -- export_variable_clause_error.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -139,10 +139,11 @@ export_variable_clause_error.js:2:14 parse ━━━━━━━━━━━━ × this variable needs to be initialized - ┌─ export_variable_clause_error.js:2:14 - │ - 2 │ export const b; - │ ^ + 1 │ export let a = ; + > 2 │ export const b; + │ ^ + 3 │ export let d, c; + 4 │ -- export let a = ; diff --git a/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.rast b/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.rast index b6951467b0a..7e65dc67b9f 100644 --- a/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.rast +++ b/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.rast @@ -292,50 +292,58 @@ for_in_and_of_initializer_loose_mode.js:2:12 parse ━━━━━━━━━ × `for..in` statement declarators cannot have an initializer expression - ┌─ for_in_and_of_initializer_loose_mode.js:2:12 - │ - 2 │ for (let i = 0 in []) {} - │ ^^^ + 1 │ // SCRIPT + > 2 │ for (let i = 0 in []) {} + │ ^^^ + 3 │ for (const i = 0 in []) {} + 4 │ for (var i = 0 of []) {} -- for_in_and_of_initializer_loose_mode.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..in` statement declarators cannot have an initializer expression - ┌─ for_in_and_of_initializer_loose_mode.js:3:14 - │ - 3 │ for (const i = 0 in []) {} - │ ^^^ + 1 │ // SCRIPT + 2 │ for (let i = 0 in []) {} + > 3 │ for (const i = 0 in []) {} + │ ^^^ + 4 │ for (var i = 0 of []) {} + 5 │ for (let i = 0 of []) {} -- for_in_and_of_initializer_loose_mode.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression - ┌─ for_in_and_of_initializer_loose_mode.js:4:12 - │ - 4 │ for (var i = 0 of []) {} - │ ^^^ + 2 │ for (let i = 0 in []) {} + 3 │ for (const i = 0 in []) {} + > 4 │ for (var i = 0 of []) {} + │ ^^^ + 5 │ for (let i = 0 of []) {} + 6 │ for (const i = 0 of []) {} -- for_in_and_of_initializer_loose_mode.js:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression - ┌─ for_in_and_of_initializer_loose_mode.js:5:12 - │ - 5 │ for (let i = 0 of []) {} - │ ^^^ + 3 │ for (const i = 0 in []) {} + 4 │ for (var i = 0 of []) {} + > 5 │ for (let i = 0 of []) {} + │ ^^^ + 6 │ for (const i = 0 of []) {} + 7 │ -- for_in_and_of_initializer_loose_mode.js:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression - ┌─ for_in_and_of_initializer_loose_mode.js:6:14 - │ - 6 │ for (const i = 0 of []) {} - │ ^^^ + 4 │ for (var i = 0 of []) {} + 5 │ for (let i = 0 of []) {} + > 6 │ for (const i = 0 of []) {} + │ ^^^ + 7 │ -- // SCRIPT diff --git a/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.rast b/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.rast index 71f8b7cb620..7590550b23e 100644 --- a/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.rast +++ b/crates/rome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.rast @@ -346,60 +346,68 @@ for_in_and_of_initializer_strict_mode.js:1:12 parse ━━━━━━━━━ × `for..in` statement declarators cannot have an initializer expression - ┌─ for_in_and_of_initializer_strict_mode.js:1:12 - │ - 1 │ for (var i = 0 in []) {} - │ ^^^ + > 1 │ for (var i = 0 in []) {} + │ ^^^ + 2 │ for (let i = 0 in []) {} + 3 │ for (const i = 0 in []) {} -- for_in_and_of_initializer_strict_mode.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..in` statement declarators cannot have an initializer expression - ┌─ for_in_and_of_initializer_strict_mode.js:2:12 - │ - 2 │ for (let i = 0 in []) {} - │ ^^^ + 1 │ for (var i = 0 in []) {} + > 2 │ for (let i = 0 in []) {} + │ ^^^ + 3 │ for (const i = 0 in []) {} + 4 │ for (var i = 0 of []) {} -- for_in_and_of_initializer_strict_mode.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..in` statement declarators cannot have an initializer expression - ┌─ for_in_and_of_initializer_strict_mode.js:3:14 - │ - 3 │ for (const i = 0 in []) {} - │ ^^^ + 1 │ for (var i = 0 in []) {} + 2 │ for (let i = 0 in []) {} + > 3 │ for (const i = 0 in []) {} + │ ^^^ + 4 │ for (var i = 0 of []) {} + 5 │ for (let i = 0 of []) {} -- for_in_and_of_initializer_strict_mode.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression - ┌─ for_in_and_of_initializer_strict_mode.js:4:12 - │ - 4 │ for (var i = 0 of []) {} - │ ^^^ + 2 │ for (let i = 0 in []) {} + 3 │ for (const i = 0 in []) {} + > 4 │ for (var i = 0 of []) {} + │ ^^^ + 5 │ for (let i = 0 of []) {} + 6 │ for (const i = 0 of []) {} -- for_in_and_of_initializer_strict_mode.js:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression - ┌─ for_in_and_of_initializer_strict_mode.js:5:12 - │ - 5 │ for (let i = 0 of []) {} - │ ^^^ + 3 │ for (const i = 0 in []) {} + 4 │ for (var i = 0 of []) {} + > 5 │ for (let i = 0 of []) {} + │ ^^^ + 6 │ for (const i = 0 of []) {} + 7 │ -- for_in_and_of_initializer_strict_mode.js:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression - ┌─ for_in_and_of_initializer_strict_mode.js:6:14 - │ - 6 │ for (const i = 0 of []) {} - │ ^^^ + 4 │ for (var i = 0 of []) {} + 5 │ for (let i = 0 of []) {} + > 6 │ for (const i = 0 of []) {} + │ ^^^ + 7 │ -- for (var i = 0 in []) {} diff --git a/crates/rome_js_parser/test_data/inline/err/for_of_async_identifier.rast b/crates/rome_js_parser/test_data/inline/err/for_of_async_identifier.rast index 6b875d99a16..759cc6ca8c1 100644 --- a/crates/rome_js_parser/test_data/inline/err/for_of_async_identifier.rast +++ b/crates/rome_js_parser/test_data/inline/err/for_of_async_identifier.rast @@ -81,10 +81,10 @@ for_of_async_identifier.js:2:6 parse ━━━━━━━━━━━━━━ × The left-hand side of a `for...of` statement may not be `async` - ┌─ for_of_async_identifier.js:2:6 - │ - 2 │ for (async of [1]) ; - │ ^^^^^ + 1 │ let async; + > 2 │ for (async of [1]) ; + │ ^^^^^ + 3 │ -- let async; diff --git a/crates/rome_js_parser/test_data/inline/err/for_stmt_err.rast b/crates/rome_js_parser/test_data/inline/err/for_stmt_err.rast index 0f5c8a0a8e0..e64108ad71d 100644 --- a/crates/rome_js_parser/test_data/inline/err/for_stmt_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/for_stmt_err.rast @@ -491,10 +491,10 @@ for_stmt_err.js:1:5 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ for_stmt_err.js:1:5 - │ - 1 │ for ;; {} - │ ^ + > 1 │ for ;; {} + │ ^ + 2 │ for let i = 5; i < 10; i++ {} + 3 │ for let i = 5; i < 10; ++i {} -- for_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -503,10 +503,11 @@ for_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ for_stmt_err.js:2:1 - │ - 2 │ for let i = 5; i < 10; i++ {} - │ ^^^ + 1 │ for ;; {} + > 2 │ for let i = 5; i < 10; i++ {} + │ ^^^ + 3 │ for let i = 5; i < 10; ++i {} + 4 │ for (in []) {} -- for_stmt_err.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -515,10 +516,11 @@ for_stmt_err.js:2:5 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ for_stmt_err.js:2:5 - │ - 2 │ for let i = 5; i < 10; i++ {} - │ ^^^ + 1 │ for ;; {} + > 2 │ for let i = 5; i < 10; i++ {} + │ ^^^ + 3 │ for let i = 5; i < 10; ++i {} + 4 │ for (in []) {} -- for_stmt_err.js:2:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -527,10 +529,11 @@ for_stmt_err.js:2:28 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ for_stmt_err.js:2:28 - │ - 2 │ for let i = 5; i < 10; i++ {} - │ ^ + 1 │ for ;; {} + > 2 │ for let i = 5; i < 10; i++ {} + │ ^ + 3 │ for let i = 5; i < 10; ++i {} + 4 │ for (in []) {} -- for_stmt_err.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -539,10 +542,12 @@ for_stmt_err.js:3:5 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ for_stmt_err.js:3:5 - │ - 3 │ for let i = 5; i < 10; ++i {} - │ ^^^ + 1 │ for ;; {} + 2 │ for let i = 5; i < 10; i++ {} + > 3 │ for let i = 5; i < 10; ++i {} + │ ^^^ + 4 │ for (in []) {} + 5 │ for (let i, j = 6 of []) {} -- for_stmt_err.js:3:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -551,10 +556,12 @@ for_stmt_err.js:3:28 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ for_stmt_err.js:3:28 - │ - 3 │ for let i = 5; i < 10; ++i {} - │ ^ + 1 │ for ;; {} + 2 │ for let i = 5; i < 10; i++ {} + > 3 │ for let i = 5; i < 10; ++i {} + │ ^ + 4 │ for (in []) {} + 5 │ for (let i, j = 6 of []) {} -- for_stmt_err.js:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -563,10 +570,12 @@ for_stmt_err.js:5:13 parse ━━━━━━━━━━━━━━━━━ × additional declarations - ┌─ for_stmt_err.js:5:13 - │ - 5 │ for (let i, j = 6 of []) {} - │ ^^^^^ + 3 │ for let i = 5; i < 10; ++i {} + 4 │ for (in []) {} + > 5 │ for (let i, j = 6 of []) {} + │ ^^^^^ + 6 │ for await (let a in []) {} + 7 │ for await (let i = 0; i < 10; ++i) {} -- for_stmt_err.js:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -575,17 +584,21 @@ for_stmt_err.js:6:5 parse ━━━━━━━━━━━━━━━━━━ × Remove the await here - ┌─ for_stmt_err.js:6:5 - │ - 6 │ for await (let a in []) {} - │ ^^^^^ + 4 │ for (in []) {} + 5 │ for (let i, j = 6 of []) {} + > 6 │ for await (let a in []) {} + │ ^^^^^ + 7 │ for await (let i = 0; i < 10; ++i) {} + 8 │ for (let [a];;) {} i or convert this to a `for...of` statement - ┌─ for_stmt_err.js:6:1 - │ - 6 │ for await (let a in []) {} - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ for (in []) {} + 5 │ for (let i, j = 6 of []) {} + > 6 │ for await (let a in []) {} + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 7 │ for await (let i = 0; i < 10; ++i) {} + 8 │ for (let [a];;) {} -- for_stmt_err.js:7:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -594,17 +607,21 @@ for_stmt_err.js:7:5 parse ━━━━━━━━━━━━━━━━━━ × Remove the await here - ┌─ for_stmt_err.js:7:5 - │ - 7 │ for await (let i = 0; i < 10; ++i) {} - │ ^^^^^ + 5 │ for (let i, j = 6 of []) {} + 6 │ for await (let a in []) {} + > 7 │ for await (let i = 0; i < 10; ++i) {} + │ ^^^^^ + 8 │ for (let [a];;) {} + 9 │ i or convert this to a `for...of` statement - ┌─ for_stmt_err.js:7:1 - │ - 7 │ for await (let i = 0; i < 10; ++i) {} - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ for (let i, j = 6 of []) {} + 6 │ for await (let a in []) {} + > 7 │ for await (let i = 0; i < 10; ++i) {} + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 8 │ for (let [a];;) {} + 9 │ -- for_stmt_err.js:8:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -613,10 +630,11 @@ for_stmt_err.js:8:10 parse ━━━━━━━━━━━━━━━━━ × this pattern is declared, but it is not given an initialized value - ┌─ for_stmt_err.js:8:10 - │ - 8 │ for (let [a];;) {} - │ ^^^ + 6 │ for await (let a in []) {} + 7 │ for await (let i = 0; i < 10; ++i) {} + > 8 │ for (let [a];;) {} + │ ^^^ + 9 │ -- for ;; {} diff --git a/crates/rome_js_parser/test_data/inline/err/formal_params_invalid.rast b/crates/rome_js_parser/test_data/inline/err/formal_params_invalid.rast index aab3e74d9c9..b3bef0624a3 100644 --- a/crates/rome_js_parser/test_data/inline/err/formal_params_invalid.rast +++ b/crates/rome_js_parser/test_data/inline/err/formal_params_invalid.rast @@ -91,10 +91,9 @@ formal_params_invalid.js:1:10 parse ━━━━━━━━━━━━━━ × expected a name for the function in a function declaration, but found none - ┌─ formal_params_invalid.js:1:10 - │ - 1 │ function (a++, c) {} - │ ^ + > 1 │ function (a++, c) {} + │ ^ + 2 │ -- formal_params_invalid.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -103,10 +102,9 @@ formal_params_invalid.js:1:12 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ formal_params_invalid.js:1:12 - │ - 1 │ function (a++, c) {} - │ ^^ + > 1 │ function (a++, c) {} + │ ^^ + 2 │ -- function (a++, c) {} diff --git a/crates/rome_js_parser/test_data/inline/err/formal_params_no_binding_element.rast b/crates/rome_js_parser/test_data/inline/err/formal_params_no_binding_element.rast index b5cc98f85d8..4f9114bbbf3 100644 --- a/crates/rome_js_parser/test_data/inline/err/formal_params_no_binding_element.rast +++ b/crates/rome_js_parser/test_data/inline/err/formal_params_no_binding_element.rast @@ -64,10 +64,9 @@ formal_params_no_binding_element.js:1:14 parse ━━━━━━━━━━━ × Expected a parameter here - ┌─ formal_params_no_binding_element.js:1:14 - │ - 1 │ function foo(true) {} - │ ^^^^ + > 1 │ function foo(true) {} + │ ^^^^ + 2 │ -- function foo(true) {} diff --git a/crates/rome_js_parser/test_data/inline/err/function_broken.rast b/crates/rome_js_parser/test_data/inline/err/function_broken.rast index dab900d27f8..0357a2fd58b 100644 --- a/crates/rome_js_parser/test_data/inline/err/function_broken.rast +++ b/crates/rome_js_parser/test_data/inline/err/function_broken.rast @@ -99,10 +99,9 @@ function_broken.js:1:15 parse ━━━━━━━━━━━━━━━━ × Expected a function body here - ┌─ function_broken.js:1:15 - │ - 1 │ function foo())})}{{{ {} - │ ^ + > 1 │ function foo())})}{{{ {} + │ ^ + 2 │ -- function_broken.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -111,10 +110,9 @@ function_broken.js:2:1 parse ━━━━━━━━━━━━━━━━━ × the file ends here - ┌─ function_broken.js:2:1 - │ - 2 │ - │ ^ + 1 │ function foo())})}{{{ {} + > 2 │ + │ -- function foo())})}{{{ {} diff --git a/crates/rome_js_parser/test_data/inline/err/function_decl_err.rast b/crates/rome_js_parser/test_data/inline/err/function_decl_err.rast index d4418bd33a2..ca123e4661a 100644 --- a/crates/rome_js_parser/test_data/inline/err/function_decl_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/function_decl_err.rast @@ -437,10 +437,10 @@ function_decl_err.js:1:9 parse ━━━━━━━━━━━━━━━━ × expected a name for the function in a function declaration, but found none - ┌─ function_decl_err.js:1:9 - │ - 1 │ function() {} - │ ^ + > 1 │ function() {} + │ ^ + 2 │ function foo {} + 3 │ function {} -- function_decl_err.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -449,60 +449,71 @@ function_decl_err.js:2:14 parse ━━━━━━━━━━━━━━━━ × Expected a parenthesis '(' here - ┌─ function_decl_err.js:2:14 - │ - 2 │ function foo {} - │ ^ + 1 │ function() {} + > 2 │ function foo {} + │ ^ + 3 │ function {} + 4 │ function *() {} -- function_decl_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a name for the function in a function declaration, but found none - ┌─ function_decl_err.js:3:10 - │ - 3 │ function {} - │ ^ + 1 │ function() {} + 2 │ function foo {} + > 3 │ function {} + │ ^ + 4 │ function *() {} + 5 │ async function() {} -- function_decl_err.js:4:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a name for the function in a function declaration, but found none - ┌─ function_decl_err.js:4:11 - │ - 4 │ function *() {} - │ ^ + 2 │ function foo {} + 3 │ function {} + > 4 │ function *() {} + │ ^ + 5 │ async function() {} + 6 │ async function *() {} -- function_decl_err.js:5:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a name for the function in a function declaration, but found none - ┌─ function_decl_err.js:5:15 - │ - 5 │ async function() {} - │ ^ + 3 │ function {} + 4 │ function *() {} + > 5 │ async function() {} + │ ^ + 6 │ async function *() {} + 7 │ function *foo2() {} -- function_decl_err.js:6:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a name for the function in a function declaration, but found none - ┌─ function_decl_err.js:6:17 - │ - 6 │ async function *() {} - │ ^ + 4 │ function *() {} + 5 │ async function() {} + > 6 │ async function *() {} + │ ^ + 7 │ function *foo2() {} + 8 │ yield foo3; -- function_decl_err.js:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `yield` as an identifier in strict mode - ┌─ function_decl_err.js:8:1 - │ - 8 │ yield foo3; - │ ^^^^^ + 6 │ async function *() {} + 7 │ function *foo2() {} + > 8 │ yield foo3; + │ ^^^^^ + 9 │ function test2(): number {} + 10 │ function foo4(await) {} -- function_decl_err.js:8:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -511,47 +522,56 @@ function_decl_err.js:8:7 parse ━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ function_decl_err.js:8:7 - │ - 8 │ yield foo3; - │ ^^^^ + 6 │ async function *() {} + 7 │ function *foo2() {} + > 8 │ yield foo3; + │ ^^^^ + 9 │ function test2(): number {} + 10 │ function foo4(await) {} i ...Which is required to end this statement - ┌─ function_decl_err.js:8:1 - │ - 8 │ yield foo3; - │ ^^^^^^^^^^ + 6 │ async function *() {} + 7 │ function *foo2() {} + > 8 │ yield foo3; + │ ^^^^^^^^^^ + 9 │ function test2(): number {} + 10 │ function foo4(await) {} -- function_decl_err.js:9:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × return types can only be used in TypeScript files - ┌─ function_decl_err.js:9:17 - │ - 9 │ function test2(): number {} - │ ^^^^^^^^ + 7 │ function *foo2() {} + 8 │ yield foo3; + > 9 │ function test2(): number {} + │ ^^^^^^^^ + 10 │ function foo4(await) {} + 11 │ function foo5(yield) {} -- function_decl_err.js:10:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier inside of a module - ┌─ function_decl_err.js:10:15 - │ - 10 │ function foo4(await) {} - │ ^^^^^ + 8 │ yield foo3; + 9 │ function test2(): number {} + > 10 │ function foo4(await) {} + │ ^^^^^ + 11 │ function foo5(yield) {} + 12 │ -- function_decl_err.js:11:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `yield` as an identifier in strict mode - ┌─ function_decl_err.js:11:15 - │ - 11 │ function foo5(yield) {} - │ ^^^^^ + 9 │ function test2(): number {} + 10 │ function foo4(await) {} + > 11 │ function foo5(yield) {} + │ ^^^^^ + 12 │ -- function() {} diff --git a/crates/rome_js_parser/test_data/inline/err/function_escaped_async.rast b/crates/rome_js_parser/test_data/inline/err/function_escaped_async.rast index 5b3c76b9936..b1a36a2d8bd 100644 --- a/crates/rome_js_parser/test_data/inline/err/function_escaped_async.rast +++ b/crates/rome_js_parser/test_data/inline/err/function_escaped_async.rast @@ -60,10 +60,9 @@ function_escaped_async.js:1:6 parse ━━━━━━━━━━━━━━ × 'async' keyword cannot contain escape character. - ┌─ function_escaped_async.js:1:6 - │ - 1 │ void \u0061sync function f(){} - │ ^^^^^^^^^^ + > 1 │ void \u0061sync function f(){} + │ ^^^^^^^^^^ + 2 │ -- void \u0061sync function f(){} diff --git a/crates/rome_js_parser/test_data/inline/err/function_expression_id_err.rast b/crates/rome_js_parser/test_data/inline/err/function_expression_id_err.rast index 1103cb22300..06ee042e05e 100644 --- a/crates/rome_js_parser/test_data/inline/err/function_expression_id_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/function_expression_id_err.rast @@ -199,30 +199,32 @@ function_expression_id_err.js:1:17 parse ━━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context - ┌─ function_expression_id_err.js:1:17 - │ - 1 │ (async function await() {}); - │ ^^^^^ + > 1 │ (async function await() {}); + │ ^^^^^ + 2 │ (function* yield() {}); + 3 │ function* test() { function yield() {} } -- function_expression_id_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `yield` as an identifier in generator function - ┌─ function_expression_id_err.js:2:12 - │ - 2 │ (function* yield() {}); - │ ^^^^^ + 1 │ (async function await() {}); + > 2 │ (function* yield() {}); + │ ^^^^^ + 3 │ function* test() { function yield() {} } + 4 │ -- function_expression_id_err.js:3:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `yield` as an identifier in generator function - ┌─ function_expression_id_err.js:3:29 - │ - 3 │ function* test() { function yield() {} } - │ ^^^^^ + 1 │ (async function await() {}); + 2 │ (function* yield() {}); + > 3 │ function* test() { function yield() {} } + │ ^^^^^ + 4 │ -- (async function await() {}); diff --git a/crates/rome_js_parser/test_data/inline/err/function_id_err.rast b/crates/rome_js_parser/test_data/inline/err/function_id_err.rast index 6e3b10656d4..f0ff237b024 100644 --- a/crates/rome_js_parser/test_data/inline/err/function_id_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/function_id_err.rast @@ -110,10 +110,11 @@ function_id_err.js:2:12 parse ━━━━━━━━━━━━━━━━ × Illegal use of `yield` as an identifier in generator function - ┌─ function_id_err.js:2:12 - │ - 2 │ function yield(test) {} - │ ^^^^^ + 1 │ function* test() { + > 2 │ function yield(test) {} + │ ^^^^^ + 3 │ } + 4 │ -- function* test() { diff --git a/crates/rome_js_parser/test_data/inline/err/function_in_single_statement_context_strict.rast b/crates/rome_js_parser/test_data/inline/err/function_in_single_statement_context_strict.rast index 647836778c9..fa18736b85c 100644 --- a/crates/rome_js_parser/test_data/inline/err/function_in_single_statement_context_strict.rast +++ b/crates/rome_js_parser/test_data/inline/err/function_in_single_statement_context_strict.rast @@ -151,10 +151,10 @@ function_in_single_statement_context_strict.js:1:11 parse ━━━━━━━ × wrap the function in a block statement - ┌─ function_in_single_statement_context_strict.js:1:11 - │ - 1 │ if (true) function a() {} - │ ^^^^^^^^^^^^^^^ + > 1 │ if (true) function a() {} + │ ^^^^^^^^^^^^^^^ + 2 │ label1: function b() {} + 3 │ while (true) function c() {} -- function_in_single_statement_context_strict.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -163,10 +163,11 @@ function_in_single_statement_context_strict.js:2:9 parse ━━━━━━━ × wrap the function in a block statement - ┌─ function_in_single_statement_context_strict.js:2:9 - │ - 2 │ label1: function b() {} - │ ^^^^^^^^^^^^^^^ + 1 │ if (true) function a() {} + > 2 │ label1: function b() {} + │ ^^^^^^^^^^^^^^^ + 3 │ while (true) function c() {} + 4 │ -- function_in_single_statement_context_strict.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -175,10 +176,11 @@ function_in_single_statement_context_strict.js:3:14 parse ━━━━━━━ × wrap the function in a block statement - ┌─ function_in_single_statement_context_strict.js:3:14 - │ - 3 │ while (true) function c() {} - │ ^^^^^^^^^^^^^^^ + 1 │ if (true) function a() {} + 2 │ label1: function b() {} + > 3 │ while (true) function c() {} + │ ^^^^^^^^^^^^^^^ + 4 │ -- if (true) function a() {} diff --git a/crates/rome_js_parser/test_data/inline/err/getter_class_no_body.rast b/crates/rome_js_parser/test_data/inline/err/getter_class_no_body.rast index fd34e3933e6..2c36f12722a 100644 --- a/crates/rome_js_parser/test_data/inline/err/getter_class_no_body.rast +++ b/crates/rome_js_parser/test_data/inline/err/getter_class_no_body.rast @@ -63,10 +63,11 @@ getter_class_no_body.js:3:1 parse ━━━━━━━━━━━━━━━ × Expected a class method body here - ┌─ getter_class_no_body.js:3:1 - │ - 3 │ } - │ ^ + 1 │ class Getters { + 2 │ get foo() + > 3 │ } + │ ^ + 4 │ -- class Getters { diff --git a/crates/rome_js_parser/test_data/inline/err/identifier.rast b/crates/rome_js_parser/test_data/inline/err/identifier.rast index 3dc3f7483cb..3e2d442fb0c 100644 --- a/crates/rome_js_parser/test_data/inline/err/identifier.rast +++ b/crates/rome_js_parser/test_data/inline/err/identifier.rast @@ -45,10 +45,10 @@ identifier.js:1:1 parse ━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `yield` as an identifier in strict mode - ┌─ identifier.js:1:1 - │ - 1 │ yield; - │ ^^^^^ + > 1 │ yield; + │ ^^^^^ + 2 │ await; + 3 │ -- identifier.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -57,10 +57,10 @@ identifier.js:2:6 parse ━━━━━━━━━━━━━━━━━━ × Expected an unary expression here - ┌─ identifier.js:2:6 - │ - 2 │ await; - │ ^ + 1 │ yield; + > 2 │ await; + │ ^ + 3 │ -- yield; diff --git a/crates/rome_js_parser/test_data/inline/err/identifier_err.rast b/crates/rome_js_parser/test_data/inline/err/identifier_err.rast index a83d3e6fcf9..399a68d9914 100644 --- a/crates/rome_js_parser/test_data/inline/err/identifier_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/identifier_err.rast @@ -203,10 +203,10 @@ identifier_err.js:1:1 parse ━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `yield` as an identifier in strict mode - ┌─ identifier_err.js:1:1 - │ - 1 │ yield; - │ ^^^^^ + > 1 │ yield; + │ ^^^^^ + 2 │ await; + 3 │ async function test(await) {} -- identifier_err.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -215,30 +215,35 @@ identifier_err.js:2:6 parse ━━━━━━━━━━━━━━━━━ × Expected an unary expression here - ┌─ identifier_err.js:2:6 - │ - 2 │ await; - │ ^ + 1 │ yield; + > 2 │ await; + │ ^ + 3 │ async function test(await) {} + 4 │ function* test(yield) {} -- identifier_err.js:3:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context - ┌─ identifier_err.js:3:21 - │ - 3 │ async function test(await) {} - │ ^^^^^ + 1 │ yield; + 2 │ await; + > 3 │ async function test(await) {} + │ ^^^^^ + 4 │ function* test(yield) {} + 5 │ enum; -- identifier_err.js:4:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `yield` as an identifier in generator function - ┌─ identifier_err.js:4:16 - │ - 4 │ function* test(yield) {} - │ ^^^^^ + 2 │ await; + 3 │ async function test(await) {} + > 4 │ function* test(yield) {} + │ ^^^^^ + 5 │ enum; + 6 │ implements; -- identifier_err.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -247,30 +252,35 @@ identifier_err.js:5:1 parse ━━━━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ identifier_err.js:5:1 - │ - 5 │ enum; - │ ^^^^ + 3 │ async function test(await) {} + 4 │ function* test(yield) {} + > 5 │ enum; + │ ^^^^ + 6 │ implements; + 7 │ interface; -- identifier_err.js:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `implements` as an identifier in strict mode - ┌─ identifier_err.js:6:1 - │ - 6 │ implements; - │ ^^^^^^^^^^ + 4 │ function* test(yield) {} + 5 │ enum; + > 6 │ implements; + │ ^^^^^^^^^^ + 7 │ interface; + 8 │ -- identifier_err.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `interface` as an identifier in strict mode - ┌─ identifier_err.js:7:1 - │ - 7 │ interface; - │ ^^^^^^^^^ + 5 │ enum; + 6 │ implements; + > 7 │ interface; + │ ^^^^^^^^^ + 8 │ -- yield; diff --git a/crates/rome_js_parser/test_data/inline/err/if_stmt_err.rast b/crates/rome_js_parser/test_data/inline/err/if_stmt_err.rast index 66e28781b59..a140a768fb2 100644 --- a/crates/rome_js_parser/test_data/inline/err/if_stmt_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/if_stmt_err.rast @@ -170,10 +170,10 @@ if_stmt_err.js:1:11 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ if_stmt_err.js:1:11 - │ - 1 │ if (true) else {} - │ ^^^^ + > 1 │ if (true) else {} + │ ^^^^ + 2 │ if (true) else + 3 │ if else {} -- if_stmt_err.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -182,10 +182,11 @@ if_stmt_err.js:2:11 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ if_stmt_err.js:2:11 - │ - 2 │ if (true) else - │ ^^^^ + 1 │ if (true) else {} + > 2 │ if (true) else + │ ^^^^ + 3 │ if else {} + 4 │ if () {} else {} -- if_stmt_err.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -194,10 +195,12 @@ if_stmt_err.js:3:4 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ if_stmt_err.js:3:4 - │ - 3 │ if else {} - │ ^^^^ + 1 │ if (true) else {} + 2 │ if (true) else + > 3 │ if else {} + │ ^^^^ + 4 │ if () {} else {} + 5 │ if (true)}}}} {} -- if_stmt_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -206,10 +209,12 @@ if_stmt_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ if_stmt_err.js:4:5 - │ - 4 │ if () {} else {} - │ ^ + 2 │ if (true) else + 3 │ if else {} + > 4 │ if () {} else {} + │ ^ + 5 │ if (true)}}}} {} + 6 │ -- if_stmt_err.js:5:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -218,10 +223,11 @@ if_stmt_err.js:5:10 parse ━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ if_stmt_err.js:5:10 - │ - 5 │ if (true)}}}} {} - │ ^ + 3 │ if else {} + 4 │ if () {} else {} + > 5 │ if (true)}}}} {} + │ ^ + 6 │ -- if (true) else {} diff --git a/crates/rome_js_parser/test_data/inline/err/import_as_identifier_err.rast b/crates/rome_js_parser/test_data/inline/err/import_as_identifier_err.rast index 2bbde07ef71..3ace8870434 100644 --- a/crates/rome_js_parser/test_data/inline/err/import_as_identifier_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/import_as_identifier_err.rast @@ -65,10 +65,9 @@ import_as_identifier_err.js:1:10 parse ━━━━━━━━━━━━━ × Expected a string literal, or an identifier here - ┌─ import_as_identifier_err.js:1:10 - │ - 1 │ import { as c } from "test"; - │ ^ + > 1 │ import { as c } from "test"; + │ + 2 │ -- import { as c } from "test"; diff --git a/crates/rome_js_parser/test_data/inline/err/import_assertion_err.rast b/crates/rome_js_parser/test_data/inline/err/import_assertion_err.rast index 6a23a170647..477fc6c91cd 100644 --- a/crates/rome_js_parser/test_data/inline/err/import_assertion_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/import_assertion_err.rast @@ -459,10 +459,10 @@ import_assertion_err.js:1:27 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ import_assertion_err.js:1:27 - │ - 1 │ import "foo" assert { type, "json" }; - │ ^ + > 1 │ import "foo" assert { type, "json" }; + │ ^ + 2 │ import "bar" \u{61}ssert { type: "json" }; + 3 │ import { foo } assert { type: "json" }; -- import_assertion_err.js:1:36 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -471,20 +471,21 @@ import_assertion_err.js:1:36 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ import_assertion_err.js:1:36 - │ - 1 │ import "foo" assert { type, "json" }; - │ ^ + > 1 │ import "foo" assert { type, "json" }; + │ ^ + 2 │ import "bar" \u{61}ssert { type: "json" }; + 3 │ import { foo } assert { type: "json" }; -- import_assertion_err.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'assert' keyword cannot contain escape character. - ┌─ import_assertion_err.js:2:14 - │ - 2 │ import "bar" \u{61}ssert { type: "json" }; - │ ^^^^^^^^^^^ + 1 │ import "foo" assert { type, "json" }; + > 2 │ import "bar" \u{61}ssert { type: "json" }; + │ ^^^^^^^^^^^ + 3 │ import { foo } assert { type: "json" }; + 4 │ import "lorem" -- import_assertion_err.js:3:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -493,10 +494,12 @@ import_assertion_err.js:3:16 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ import_assertion_err.js:3:16 - │ - 3 │ import { foo } assert { type: "json" }; - │ ^^^^^^ + 1 │ import "foo" assert { type, "json" }; + 2 │ import "bar" \u{61}ssert { type: "json" }; + > 3 │ import { foo } assert { type: "json" }; + │ ^^^^^^ + 4 │ import "lorem" + 5 │ assert { type: "json" } -- import_assertion_err.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -505,17 +508,21 @@ import_assertion_err.js:5:8 parse ━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ import_assertion_err.js:5:8 - │ - 5 │ assert { type: "json" } - │ ^ + 3 │ import { foo } assert { type: "json" }; + 4 │ import "lorem" + > 5 │ assert { type: "json" } + │ ^ + 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + 7 │ import "x" assert; i ...Which is required to end this statement - ┌─ import_assertion_err.js:5:1 - │ - 5 │ assert { type: "json" } - │ ^^^^^^^^ + 3 │ import { foo } assert { type: "json" }; + 4 │ import "lorem" + > 5 │ assert { type: "json" } + │ ^^^^^^^^ + 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + 7 │ import "x" assert; -- import_assertion_err.js:6:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -524,17 +531,21 @@ import_assertion_err.js:6:38 parse ━━━━━━━━━━━━━━━ × First use of the key `type` - ┌─ import_assertion_err.js:6:38 - │ - 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; - │ ^^^^^^ + 4 │ import "lorem" + 5 │ assert { type: "json" } + > 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + │ ^^^^^^ + 7 │ import "x" assert; + 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; i second use here - ┌─ import_assertion_err.js:6:54 - │ - 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; - │ ^^^^ + 4 │ import "lorem" + 5 │ assert { type: "json" } + > 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + │ ^^^^ + 7 │ import "x" assert; + 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; -- import_assertion_err.js:7:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -543,10 +554,12 @@ import_assertion_err.js:7:18 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ import_assertion_err.js:7:18 - │ - 7 │ import "x" assert; - │ ^ + 5 │ assert { type: "json" } + 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + > 7 │ import "x" assert; + │ ^ + 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; + 9 │ import { a } from "a.json" assert -- import_assertion_err.js:8:61 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -555,10 +568,12 @@ import_assertion_err.js:8:61 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ import_assertion_err.js:8:61 - │ - 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; - │ ^^^^ + 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + 7 │ import "x" assert; + > 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; + │ ^^^^ + 9 │ import { a } from "a.json" assert + 10 │ -- import_assertion_err.js:8:65 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -567,10 +582,12 @@ import_assertion_err.js:8:65 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ import_assertion_err.js:8:65 - │ - 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; - │ ^ + 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + 7 │ import "x" assert; + > 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; + │ ^ + 9 │ import { a } from "a.json" assert + 10 │ -- import_assertion_err.js:8:80 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -579,10 +596,12 @@ import_assertion_err.js:8:80 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ import_assertion_err.js:8:80 - │ - 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; - │ ^ + 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; + 7 │ import "x" assert; + > 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; + │ ^ + 9 │ import { a } from "a.json" assert + 10 │ -- import_assertion_err.js:10:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -591,10 +610,10 @@ import_assertion_err.js:10:1 parse ━━━━━━━━━━━━━━━ × the file ends here - ┌─ import_assertion_err.js:10:1 - │ - 10 │ - │ ^ + 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; + 9 │ import { a } from "a.json" assert + > 10 │ + │ -- import "foo" assert { type, "json" }; diff --git a/crates/rome_js_parser/test_data/inline/err/import_decl_not_top_level.rast b/crates/rome_js_parser/test_data/inline/err/import_decl_not_top_level.rast index 520215145a9..2b5b4b29e07 100644 --- a/crates/rome_js_parser/test_data/inline/err/import_decl_not_top_level.rast +++ b/crates/rome_js_parser/test_data/inline/err/import_decl_not_top_level.rast @@ -56,10 +56,11 @@ import_decl_not_top_level.js:2:2 parse ━━━━━━━━━━━━━ × move this declaration to the top level - ┌─ import_decl_not_top_level.js:2:2 - │ - 2 │ import foo from "bar"; - │ ^^^^^^^^^^^^^^^^^^^^^^ + 1 │ { + > 2 │ import foo from "bar"; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 3 │ } + 4 │ -- { diff --git a/crates/rome_js_parser/test_data/inline/err/import_err.rast b/crates/rome_js_parser/test_data/inline/err/import_err.rast index f39fdf41f10..165caabc037 100644 --- a/crates/rome_js_parser/test_data/inline/err/import_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/import_err.rast @@ -481,10 +481,10 @@ import_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━ × Expected a default import, a namespace import, or a named import here - ┌─ import_err.js:1:7 - │ - 1 │ import; - │ ^ + > 1 │ import; + │ ^ + 2 │ import *; + 3 │ import * as c, { a, b } from "c"; -- import_err.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -493,10 +493,11 @@ import_err.js:2:9 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ import_err.js:2:9 - │ - 2 │ import *; - │ ^ + 1 │ import; + > 2 │ import *; + │ ^ + 3 │ import * as c, { a, b } from "c"; + 4 │ import { aa + bb, dd } from "c"; -- import_err.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -505,10 +506,12 @@ import_err.js:3:14 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ import_err.js:3:14 - │ - 3 │ import * as c, { a, b } from "c"; - │ ^ + 1 │ import; + 2 │ import *; + > 3 │ import * as c, { a, b } from "c"; + │ ^ + 4 │ import { aa + bb, dd } from "c"; + 5 │ import { ab, ac } from "c"; -- import_err.js:3:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -517,17 +520,21 @@ import_err.js:3:30 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ import_err.js:3:30 - │ - 3 │ import * as c, { a, b } from "c"; - │ ^^^ + 1 │ import; + 2 │ import *; + > 3 │ import * as c, { a, b } from "c"; + │ ^^^ + 4 │ import { aa + bb, dd } from "c"; + 5 │ import { ab, ac } from "c"; i ...Which is required to end this statement - ┌─ import_err.js:3:25 - │ - 3 │ import * as c, { a, b } from "c"; - │ ^^^^^^^^ + 1 │ import; + 2 │ import *; + > 3 │ import * as c, { a, b } from "c"; + │ ^^^^^^^^ + 4 │ import { aa + bb, dd } from "c"; + 5 │ import { ab, ac } from "c"; -- import_err.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -536,10 +543,12 @@ import_err.js:4:13 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ import_err.js:4:13 - │ - 4 │ import { aa + bb, dd } from "c"; - │ ^ + 2 │ import *; + 3 │ import * as c, { a, b } from "c"; + > 4 │ import { aa + bb, dd } from "c"; + │ ^ + 5 │ import { ab, ac } from "c"; + 6 │ import { default } from "c"; -- import_err.js:6:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -548,10 +557,12 @@ import_err.js:6:18 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ import_err.js:6:18 - │ - 6 │ import { default } from "c"; - │ ^ + 4 │ import { aa + bb, dd } from "c"; + 5 │ import { ab, ac } from "c"; + > 6 │ import { default } from "c"; + │ ^ + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; -- import_err.js:7:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -560,10 +571,12 @@ import_err.js:7:14 parse ━━━━━━━━━━━━━━━━━━ × unexpected - ┌─ import_err.js:7:14 - │ - 7 │ import { "a" } from "c"; - │ ^ + 5 │ import { ab, ac } from "c"; + 6 │ import { default } from "c"; + > 7 │ import { "a" } from "c"; + │ ^ + 8 │ import { as x } from "c"; + 9 │ import 4 from "c"; -- import_err.js:8:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -572,10 +585,12 @@ import_err.js:8:10 parse ━━━━━━━━━━━━━━━━━━ × Expected a string literal, or an identifier here - ┌─ import_err.js:8:10 - │ - 8 │ import { as x } from "c"; - │ ^ + 6 │ import { default } from "c"; + 7 │ import { "a" } from "c"; + > 8 │ import { as x } from "c"; + │ + 9 │ import 4 from "c"; + 10 │ import y from 4; -- import_err.js:9:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -584,10 +599,12 @@ import_err.js:9:8 parse ━━━━━━━━━━━━━━━━━━ × Expected a default import, a namespace import, or a named import here - ┌─ import_err.js:9:8 - │ - 9 │ import 4 from "c"; - │ ^ + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; + > 9 │ import 4 from "c"; + │ ^ + 10 │ import y from 4; + 11 │ -- import_err.js:9:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -596,17 +613,21 @@ import_err.js:9:10 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ import_err.js:9:10 - │ - 9 │ import 4 from "c"; - │ ^^^^ + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; + > 9 │ import 4 from "c"; + │ ^^^^ + 10 │ import y from 4; + 11 │ i ...Which is required to end this statement - ┌─ import_err.js:9:8 - │ - 9 │ import 4 from "c"; - │ ^^^^^^ + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; + > 9 │ import 4 from "c"; + │ ^^^^^^ + 10 │ import y from 4; + 11 │ -- import_err.js:9:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -615,17 +636,21 @@ import_err.js:9:15 parse ━━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ import_err.js:9:15 - │ - 9 │ import 4 from "c"; - │ ^^^ + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; + > 9 │ import 4 from "c"; + │ ^^^ + 10 │ import y from 4; + 11 │ i ...Which is required to end this statement - ┌─ import_err.js:9:10 - │ - 9 │ import 4 from "c"; - │ ^^^^^^^^ + 7 │ import { "a" } from "c"; + 8 │ import { as x } from "c"; + > 9 │ import 4 from "c"; + │ ^^^^^^^^ + 10 │ import y from 4; + 11 │ -- import_err.js:10:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -634,10 +659,11 @@ import_err.js:10:15 parse ━━━━━━━━━━━━━━━━━━ × Expected a string literal here - ┌─ import_err.js:10:15 - │ - 10 │ import y from 4; - │ ^ + 8 │ import { as x } from "c"; + 9 │ import 4 from "c"; + > 10 │ import y from 4; + │ ^ + 11 │ -- import; diff --git a/crates/rome_js_parser/test_data/inline/err/import_invalid_args.rast b/crates/rome_js_parser/test_data/inline/err/import_invalid_args.rast index 177c165dcb0..c12b425212a 100644 --- a/crates/rome_js_parser/test_data/inline/err/import_invalid_args.rast +++ b/crates/rome_js_parser/test_data/inline/err/import_invalid_args.rast @@ -162,30 +162,32 @@ import_invalid_args.js:1:8 parse ━━━━━━━━━━━━━━━ × `import()` requires exactly one or two arguments. - ┌─ import_invalid_args.js:1:8 - │ - 1 │ import() - │ ^ + > 1 │ import() + │ ^ + 2 │ import(...["foo"]) + 3 │ import("foo", { assert: { type: 'json' } }, "bar") -- import_invalid_args.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `...` is not allowed in `import()` - ┌─ import_invalid_args.js:2:8 - │ - 2 │ import(...["foo"]) - │ ^^^^^^^^^^ + 1 │ import() + > 2 │ import(...["foo"]) + │ ^^^^^^^^^^ + 3 │ import("foo", { assert: { type: 'json' } }, "bar") + 4 │ -- import_invalid_args.js:3:45 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `import()` requires exactly one or two arguments. - ┌─ import_invalid_args.js:3:45 - │ - 3 │ import("foo", { assert: { type: 'json' } }, "bar") - │ ^^^^^^ + 1 │ import() + 2 │ import(...["foo"]) + > 3 │ import("foo", { assert: { type: 'json' } }, "bar") + │ ^^^^^^ + 4 │ -- import() diff --git a/crates/rome_js_parser/test_data/inline/err/import_keyword_in_expression_position.rast b/crates/rome_js_parser/test_data/inline/err/import_keyword_in_expression_position.rast index 80821fb7c8b..000ce0685ca 100644 --- a/crates/rome_js_parser/test_data/inline/err/import_keyword_in_expression_position.rast +++ b/crates/rome_js_parser/test_data/inline/err/import_keyword_in_expression_position.rast @@ -57,10 +57,9 @@ import_keyword_in_expression_position.js:1:9 parse ━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ import_keyword_in_expression_position.js:1:9 - │ - 1 │ let a = import; - │ ^^^^^^ + > 1 │ let a = import; + │ ^^^^^^ + 2 │ -- import_keyword_in_expression_position.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -69,10 +68,9 @@ import_keyword_in_expression_position.js:1:15 parse ━━━━━━━━━ × Expected a default import, a namespace import, or a named import here - ┌─ import_keyword_in_expression_position.js:1:15 - │ - 1 │ let a = import; - │ ^ + > 1 │ let a = import; + │ ^ + 2 │ -- let a = import; diff --git a/crates/rome_js_parser/test_data/inline/err/import_no_meta.rast b/crates/rome_js_parser/test_data/inline/err/import_no_meta.rast index 3082f83255e..46dfaea6a43 100644 --- a/crates/rome_js_parser/test_data/inline/err/import_no_meta.rast +++ b/crates/rome_js_parser/test_data/inline/err/import_no_meta.rast @@ -58,20 +58,20 @@ import_no_meta.js:1:8 parse ━━━━━━━━━━━━━━━━━ × Expected `meta` following an import keyword, but found `foo` - ┌─ import_no_meta.js:1:8 - │ - 1 │ import.foo - │ ^^^ + > 1 │ import.foo + │ ^^^ + 2 │ import.metaa + 3 │ -- import_no_meta.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected `meta` following an import keyword, but found `metaa` - ┌─ import_no_meta.js:2:8 - │ - 2 │ import.metaa - │ ^^^^^ + 1 │ import.foo + > 2 │ import.metaa + │ ^^^^^ + 3 │ -- import.foo diff --git a/crates/rome_js_parser/test_data/inline/err/incomplete_parenthesized_sequence_expression.rast b/crates/rome_js_parser/test_data/inline/err/incomplete_parenthesized_sequence_expression.rast index e37559fcddf..2419d3f39ce 100644 --- a/crates/rome_js_parser/test_data/inline/err/incomplete_parenthesized_sequence_expression.rast +++ b/crates/rome_js_parser/test_data/inline/err/incomplete_parenthesized_sequence_expression.rast @@ -91,10 +91,10 @@ incomplete_parenthesized_sequence_expression.js:1:4 parse ━━━━━━━ × Expected an expression here - ┌─ incomplete_parenthesized_sequence_expression.js:1:4 - │ - 1 │ (a,; - │ ^ + > 1 │ (a,; + │ ^ + 2 │ (a, b, c; + 3 │ -- incomplete_parenthesized_sequence_expression.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -103,10 +103,10 @@ incomplete_parenthesized_sequence_expression.js:2:9 parse ━━━━━━━ × unexpected - ┌─ incomplete_parenthesized_sequence_expression.js:2:9 - │ - 2 │ (a, b, c; - │ ^ + 1 │ (a,; + > 2 │ (a, b, c; + │ ^ + 3 │ -- (a,; diff --git a/crates/rome_js_parser/test_data/inline/err/index_signature_class_member_in_js.rast b/crates/rome_js_parser/test_data/inline/err/index_signature_class_member_in_js.rast index 8325f822877..aa0907206a2 100644 --- a/crates/rome_js_parser/test_data/inline/err/index_signature_class_member_in_js.rast +++ b/crates/rome_js_parser/test_data/inline/err/index_signature_class_member_in_js.rast @@ -82,10 +82,11 @@ index_signature_class_member_in_js.js:2:5 parse ━━━━━━━━━━ × TypeScript only syntax - ┌─ index_signature_class_member_in_js.js:2:5 - │ - 2 │ [a: number]: string; - │ ^^^^^^^^^^^^^^^^^^^^ + 1 │ class A { + > 2 │ [a: number]: string; + │ ^^^^^^^^^^^^^^^^^^^^ + 3 │ } + 4 │ -- class A { diff --git a/crates/rome_js_parser/test_data/inline/err/invalid_arg_list.rast b/crates/rome_js_parser/test_data/inline/err/invalid_arg_list.rast index fb7e36079cc..6656196e5a1 100644 --- a/crates/rome_js_parser/test_data/inline/err/invalid_arg_list.rast +++ b/crates/rome_js_parser/test_data/inline/err/invalid_arg_list.rast @@ -329,10 +329,12 @@ invalid_arg_list.js:3:8 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ invalid_arg_list.js:3:8 - │ - 3 │ foo(a,b; - │ ^ + 1 │ function foo(...args) {} + 2 │ let a, b, c; + > 3 │ foo(a,b; + │ ^ + 4 │ foo(a,b var; + 5 │ foo (,,b); -- invalid_arg_list.js:4:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -341,10 +343,12 @@ invalid_arg_list.js:4:9 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ invalid_arg_list.js:4:9 - │ - 4 │ foo(a,b var; - │ ^^^ + 2 │ let a, b, c; + 3 │ foo(a,b; + > 4 │ foo(a,b var; + │ ^^^ + 5 │ foo (,,b); + 6 │ foo (a, ...); -- invalid_arg_list.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -353,10 +357,12 @@ invalid_arg_list.js:4:12 parse ━━━━━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern here - ┌─ invalid_arg_list.js:4:12 - │ - 4 │ foo(a,b var; - │ ^ + 2 │ let a, b, c; + 3 │ foo(a,b; + > 4 │ foo(a,b var; + │ ^ + 5 │ foo (,,b); + 6 │ foo (a, ...); -- invalid_arg_list.js:5:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -365,10 +371,12 @@ invalid_arg_list.js:5:6 parse ━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ invalid_arg_list.js:5:6 - │ - 5 │ foo (,,b); - │ ^ + 3 │ foo(a,b; + 4 │ foo(a,b var; + > 5 │ foo (,,b); + │ ^ + 6 │ foo (a, ...); + 7 │ -- invalid_arg_list.js:5:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -377,10 +385,12 @@ invalid_arg_list.js:5:7 parse ━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ invalid_arg_list.js:5:7 - │ - 5 │ foo (,,b); - │ ^ + 3 │ foo(a,b; + 4 │ foo(a,b var; + > 5 │ foo (,,b); + │ ^ + 6 │ foo (a, ...); + 7 │ -- invalid_arg_list.js:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -389,10 +399,11 @@ invalid_arg_list.js:6:12 parse ━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ invalid_arg_list.js:6:12 - │ - 6 │ foo (a, ...); - │ ^ + 4 │ foo(a,b var; + 5 │ foo (,,b); + > 6 │ foo (a, ...); + │ ^ + 7 │ -- function foo(...args) {} diff --git a/crates/rome_js_parser/test_data/inline/err/invalid_assignment_target.rast b/crates/rome_js_parser/test_data/inline/err/invalid_assignment_target.rast index ac35cabdc33..cc3e4ad8e81 100644 --- a/crates/rome_js_parser/test_data/inline/err/invalid_assignment_target.rast +++ b/crates/rome_js_parser/test_data/inline/err/invalid_assignment_target.rast @@ -235,10 +235,10 @@ invalid_assignment_target.js:1:1 parse ━━━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ invalid_assignment_target.js:1:1 - │ - 1 │ ++a = b; - │ ^^^ + > 1 │ ++a = b; + │ ^^^ + 2 │ (++a) = b; + 3 │ (a = b; -- invalid_assignment_target.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -247,10 +247,11 @@ invalid_assignment_target.js:2:2 parse ━━━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ invalid_assignment_target.js:2:2 - │ - 2 │ (++a) = b; - │ ^^^ + 1 │ ++a = b; + > 2 │ (++a) = b; + │ ^^^ + 3 │ (a = b; + 4 │ a?.b = b; -- invalid_assignment_target.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -259,10 +260,12 @@ invalid_assignment_target.js:3:7 parse ━━━━━━━━━━━━━ × unexpected - ┌─ invalid_assignment_target.js:3:7 - │ - 3 │ (a = b; - │ ^ + 1 │ ++a = b; + 2 │ (++a) = b; + > 3 │ (a = b; + │ ^ + 4 │ a?.b = b; + 5 │ a?.["b"] = b; -- invalid_assignment_target.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -271,10 +274,12 @@ invalid_assignment_target.js:4:1 parse ━━━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ invalid_assignment_target.js:4:1 - │ - 4 │ a?.b = b; - │ ^^^^ + 2 │ (++a) = b; + 3 │ (a = b; + > 4 │ a?.b = b; + │ ^^^^ + 5 │ a?.["b"] = b; + 6 │ (a +) = b; -- invalid_assignment_target.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -283,10 +288,12 @@ invalid_assignment_target.js:5:1 parse ━━━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ invalid_assignment_target.js:5:1 - │ - 5 │ a?.["b"] = b; - │ ^^^^^^^^ + 3 │ (a = b; + 4 │ a?.b = b; + > 5 │ a?.["b"] = b; + │ ^^^^^^^^ + 6 │ (a +) = b; + 7 │ -- invalid_assignment_target.js:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -295,10 +302,11 @@ invalid_assignment_target.js:6:5 parse ━━━━━━━━━━━━━ × Expected an expression here - ┌─ invalid_assignment_target.js:6:5 - │ - 6 │ (a +) = b; - │ ^ + 4 │ a?.b = b; + 5 │ a?.["b"] = b; + > 6 │ (a +) = b; + │ ^ + 7 │ -- invalid_assignment_target.js:6:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -307,10 +315,11 @@ invalid_assignment_target.js:6:2 parse ━━━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ invalid_assignment_target.js:6:2 - │ - 6 │ (a +) = b; - │ ^^^ + 4 │ a?.b = b; + 5 │ a?.["b"] = b; + > 6 │ (a +) = b; + │ ^^^ + 7 │ -- ++a = b; diff --git a/crates/rome_js_parser/test_data/inline/err/invalid_method_recover.rast b/crates/rome_js_parser/test_data/inline/err/invalid_method_recover.rast index f2300c257d5..9b45d7f9349 100644 --- a/crates/rome_js_parser/test_data/inline/err/invalid_method_recover.rast +++ b/crates/rome_js_parser/test_data/inline/err/invalid_method_recover.rast @@ -141,10 +141,10 @@ invalid_method_recover.js:1:1 parse ━━━━━━━━━━━━━━ × class declarations must have a name - ┌─ invalid_method_recover.js:1:1 - │ - 1 │ class { - │ ^^^^^^ + > 1 │ class { + │ ^^^^^^ + 2 │ [1 + 1] = () => { + 3 │ let a=; -- invalid_method_recover.js:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -153,10 +153,12 @@ invalid_method_recover.js:3:11 parse ━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ invalid_method_recover.js:3:11 - │ - 3 │ let a=; - │ ^ + 1 │ class { + 2 │ [1 + 1] = () => { + > 3 │ let a=; + │ ^ + 4 │ }; + 5 │ }; -- class { diff --git a/crates/rome_js_parser/test_data/inline/err/invalid_optional_chain_from_new_expressions.rast b/crates/rome_js_parser/test_data/inline/err/invalid_optional_chain_from_new_expressions.rast index 6c854b711f3..be7b2298abf 100644 --- a/crates/rome_js_parser/test_data/inline/err/invalid_optional_chain_from_new_expressions.rast +++ b/crates/rome_js_parser/test_data/inline/err/invalid_optional_chain_from_new_expressions.rast @@ -386,10 +386,10 @@ invalid_optional_chain_from_new_expressions.ts:1:17 parse ━━━━━━━ × Did you mean to call 'Test()'? - ┌─ invalid_optional_chain_from_new_expressions.ts:1:17 - │ - 1 │ new Test?.test(); - │ ^^ + > 1 │ new Test?.test(); + │ ^^ + 2 │ new Test?.test(); + 3 │ new A.b?.c() -- invalid_optional_chain_from_new_expressions.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -398,10 +398,11 @@ invalid_optional_chain_from_new_expressions.ts:2:9 parse ━━━━━━━ × Did you mean to call 'Test()'? - ┌─ invalid_optional_chain_from_new_expressions.ts:2:9 - │ - 2 │ new Test?.test(); - │ ^^ + 1 │ new Test?.test(); + > 2 │ new Test?.test(); + │ ^^ + 3 │ new A.b?.c() + 4 │ new (A.b)?.c() -- invalid_optional_chain_from_new_expressions.ts:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -410,10 +411,12 @@ invalid_optional_chain_from_new_expressions.ts:3:8 parse ━━━━━━━ × Did you mean to call 'A.b()'? - ┌─ invalid_optional_chain_from_new_expressions.ts:3:8 - │ - 3 │ new A.b?.c() - │ ^^ + 1 │ new Test?.test(); + 2 │ new Test?.test(); + > 3 │ new A.b?.c() + │ ^^ + 4 │ new (A.b)?.c() + 5 │ new (A.b?.()).c() -- invalid_optional_chain_from_new_expressions.ts:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -422,10 +425,12 @@ invalid_optional_chain_from_new_expressions.ts:4:10 parse ━━━━━━━ × Did you mean to call '(A.b)()'? - ┌─ invalid_optional_chain_from_new_expressions.ts:4:10 - │ - 4 │ new (A.b)?.c() - │ ^^ + 2 │ new Test?.test(); + 3 │ new A.b?.c() + > 4 │ new (A.b)?.c() + │ ^^ + 5 │ new (A.b?.()).c() + 6 │ new A.b?.()() -- invalid_optional_chain_from_new_expressions.ts:6:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -434,10 +439,11 @@ invalid_optional_chain_from_new_expressions.ts:6:8 parse ━━━━━━━ × Did you mean to call 'A.b()'? - ┌─ invalid_optional_chain_from_new_expressions.ts:6:8 - │ - 6 │ new A.b?.()() - │ ^^ + 4 │ new (A.b)?.c() + 5 │ new (A.b?.()).c() + > 6 │ new A.b?.()() + │ ^^ + 7 │ -- new Test?.test(); diff --git a/crates/rome_js_parser/test_data/inline/err/js_class_property_with_ts_annotation.rast b/crates/rome_js_parser/test_data/inline/err/js_class_property_with_ts_annotation.rast index ea6b0d53507..b8adf1557de 100644 --- a/crates/rome_js_parser/test_data/inline/err/js_class_property_with_ts_annotation.rast +++ b/crates/rome_js_parser/test_data/inline/err/js_class_property_with_ts_annotation.rast @@ -129,30 +129,35 @@ js_class_property_with_ts_annotation.js:2:3 parse ━━━━━━━━━━ × remove this type annotation - ┌─ js_class_property_with_ts_annotation.js:2:3 - │ - 2 │ a: string; - │ ^^^^^^^^ + 1 │ class A { + > 2 │ a: string; + │ ^^^^^^^^ + 3 │ b?: string; + 4 │ c!: string -- js_class_property_with_ts_annotation.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `?` modifiers can only be used in TypeScript files - ┌─ js_class_property_with_ts_annotation.js:3:3 - │ - 3 │ b?: string; - │ ^ + 1 │ class A { + 2 │ a: string; + > 3 │ b?: string; + │ ^ + 4 │ c!: string + 5 │ } -- js_class_property_with_ts_annotation.js:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `!` modifiers can only be used in TypeScript files - ┌─ js_class_property_with_ts_annotation.js:4:3 - │ - 4 │ c!: string - │ ^ + 2 │ a: string; + 3 │ b?: string; + > 4 │ c!: string + │ ^ + 5 │ } + 6 │ -- class A { diff --git a/crates/rome_js_parser/test_data/inline/err/js_constructor_parameter_reserved_names.rast b/crates/rome_js_parser/test_data/inline/err/js_constructor_parameter_reserved_names.rast index 68ddb56ca9c..7d7431c1bab 100644 --- a/crates/rome_js_parser/test_data/inline/err/js_constructor_parameter_reserved_names.rast +++ b/crates/rome_js_parser/test_data/inline/err/js_constructor_parameter_reserved_names.rast @@ -140,30 +140,30 @@ js_constructor_parameter_reserved_names.js:2:33 parse ━━━━━━━━ × Illegal use of reserved keyword `private` as an identifier in strict mode - ┌─ js_constructor_parameter_reserved_names.js:2:33 - │ - 2 │ class A { constructor(readonly, private, protected, public) {} } - │ ^^^^^^^ + 1 │ // SCRIPT + > 2 │ class A { constructor(readonly, private, protected, public) {} } + │ ^^^^^^^ + 3 │ -- js_constructor_parameter_reserved_names.js:2:42 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `protected` as an identifier in strict mode - ┌─ js_constructor_parameter_reserved_names.js:2:42 - │ - 2 │ class A { constructor(readonly, private, protected, public) {} } - │ ^^^^^^^^^ + 1 │ // SCRIPT + > 2 │ class A { constructor(readonly, private, protected, public) {} } + │ ^^^^^^^^^ + 3 │ -- js_constructor_parameter_reserved_names.js:2:53 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `public` as an identifier in strict mode - ┌─ js_constructor_parameter_reserved_names.js:2:53 - │ - 2 │ class A { constructor(readonly, private, protected, public) {} } - │ ^^^^^^ + 1 │ // SCRIPT + > 2 │ class A { constructor(readonly, private, protected, public) {} } + │ ^^^^^^ + 3 │ -- // SCRIPT diff --git a/crates/rome_js_parser/test_data/inline/err/js_formal_parameter_error.rast b/crates/rome_js_parser/test_data/inline/err/js_formal_parameter_error.rast index 93385460efa..31a994d067c 100644 --- a/crates/rome_js_parser/test_data/inline/err/js_formal_parameter_error.rast +++ b/crates/rome_js_parser/test_data/inline/err/js_formal_parameter_error.rast @@ -130,10 +130,10 @@ js_formal_parameter_error.js:1:13 parse ━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ js_formal_parameter_error.js:1:13 - │ - 1 │ function a(x: string) {} - │ ^^^^^^^^ + > 1 │ function a(x: string) {} + │ ^^^^^^^^ + 2 │ function b(x?) {} + 3 │ -- js_formal_parameter_error.js:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -142,10 +142,10 @@ js_formal_parameter_error.js:2:13 parse ━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ js_formal_parameter_error.js:2:13 - │ - 2 │ function b(x?) {} - │ ^ + 1 │ function a(x: string) {} + > 2 │ function b(x?) {} + │ ^ + 3 │ -- function a(x: string) {} diff --git a/crates/rome_js_parser/test_data/inline/err/js_invalid_assignment.rast b/crates/rome_js_parser/test_data/inline/err/js_invalid_assignment.rast index 3ad67769761..98dc1d48adb 100644 --- a/crates/rome_js_parser/test_data/inline/err/js_invalid_assignment.rast +++ b/crates/rome_js_parser/test_data/inline/err/js_invalid_assignment.rast @@ -209,10 +209,9 @@ js_invalid_assignment.js:1:3 parse ━━━━━━━━━━━━━━━ × Expected a property, an expression, or a method here - ┌─ js_invalid_assignment.js:1:3 - │ - 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ -- js_invalid_assignment.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -221,10 +220,9 @@ js_invalid_assignment.js:1:4 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ js_invalid_assignment.js:1:4 - │ - 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ -- js_invalid_assignment.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -233,10 +231,9 @@ js_invalid_assignment.js:1:8 parse ━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ js_invalid_assignment.js:1:8 - │ - 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ -- js_invalid_assignment.js:1:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -245,10 +242,9 @@ js_invalid_assignment.js:1:13 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ js_invalid_assignment.js:1:13 - │ - 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ -- js_invalid_assignment.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -257,10 +253,9 @@ js_invalid_assignment.js:1:17 parse ━━━━━━━━━━━━━━ × Expected a property, an expression, or a method here - ┌─ js_invalid_assignment.js:1:17 - │ - 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ -- js_invalid_assignment.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -269,10 +264,9 @@ js_invalid_assignment.js:1:18 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ js_invalid_assignment.js:1:18 - │ - 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ -- js_invalid_assignment.js:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -281,10 +275,9 @@ js_invalid_assignment.js:1:22 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ js_invalid_assignment.js:1:22 - │ - 1 │ ([=[(p[=[(p%]>([=[(p[=[( - │ ^ + > 1 │ ([=[(p[=[(p%]>([=[(p[=[( + │ ^ + 2 │ -- js_invalid_assignment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -293,10 +286,9 @@ js_invalid_assignment.js:2:1 parse ━━━━━━━━━━━━━━━ × the file ends here - ┌─ js_invalid_assignment.js:2:1 - │ - 2 │ - │ ^ + 1 │ ([=[(p[=[(p%]>([=[(p[=[( + > 2 │ + │ -- ([=[(p[=[(p%]>([=[(p[=[( diff --git a/crates/rome_js_parser/test_data/inline/err/js_regex_assignment.rast b/crates/rome_js_parser/test_data/inline/err/js_regex_assignment.rast index abcc30581c1..ad2379e101b 100644 --- a/crates/rome_js_parser/test_data/inline/err/js_regex_assignment.rast +++ b/crates/rome_js_parser/test_data/inline/err/js_regex_assignment.rast @@ -37,10 +37,9 @@ js_regex_assignment.js:1:1 parse ━━━━━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ js_regex_assignment.js:1:1 - │ - 1 │ /=0*_:m/=/*_:| - │ ^^^^^^^^ + > 1 │ /=0*_:m/=/*_:| + │ ^^^^^^^^ + 2 │ -- js_regex_assignment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -49,10 +48,9 @@ js_regex_assignment.js:2:1 parse ━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ js_regex_assignment.js:2:1 - │ - 2 │ - │ ^ + 1 │ /=0*_:m/=/*_:| + > 2 │ + │ -- js_regex_assignment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -61,17 +59,15 @@ js_regex_assignment.js:2:1 parse ━━━━━━━━━━━━━━━ × ... but the file ends here - ┌─ js_regex_assignment.js:2:1 - │ - 2 │ - │ ^ + 1 │ /=0*_:m/=/*_:| + > 2 │ + │ i A block comment starts here - ┌─ js_regex_assignment.js:1:10 - │ - 1 │ /=0*_:m/=/*_:| - │ ^^ + > 1 │ /=0*_:m/=/*_:| + │ ^^ + 2 │ -- /=0*_:m/=/*_:| diff --git a/crates/rome_js_parser/test_data/inline/err/js_rewind_at_eof_token.rast b/crates/rome_js_parser/test_data/inline/err/js_rewind_at_eof_token.rast index 382f2f7336a..64f89bb8d24 100644 --- a/crates/rome_js_parser/test_data/inline/err/js_rewind_at_eof_token.rast +++ b/crates/rome_js_parser/test_data/inline/err/js_rewind_at_eof_token.rast @@ -120,10 +120,9 @@ js_rewind_at_eof_token.js:1:12 parse ━━━━━━━━━━━━━━ × Expected a property, an expression, or a method here - ┌─ js_rewind_at_eof_token.js:1:12 - │ - 1 │ (([zAgRvz=[=(e{V{ - │ ^ + > 1 │ (([zAgRvz=[=(e{V{ + │ ^ + 2 │ -- js_rewind_at_eof_token.js:1:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -132,10 +131,9 @@ js_rewind_at_eof_token.js:1:13 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ js_rewind_at_eof_token.js:1:13 - │ - 1 │ (([zAgRvz=[=(e{V{ - │ ^ + > 1 │ (([zAgRvz=[=(e{V{ + │ ^ + 2 │ -- js_rewind_at_eof_token.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -144,10 +142,9 @@ js_rewind_at_eof_token.js:1:15 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ js_rewind_at_eof_token.js:1:15 - │ - 1 │ (([zAgRvz=[=(e{V{ - │ ^ + > 1 │ (([zAgRvz=[=(e{V{ + │ ^ + 2 │ -- js_rewind_at_eof_token.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -156,10 +153,9 @@ js_rewind_at_eof_token.js:1:17 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ js_rewind_at_eof_token.js:1:17 - │ - 1 │ (([zAgRvz=[=(e{V{ - │ ^ + > 1 │ (([zAgRvz=[=(e{V{ + │ ^ + 2 │ -- js_rewind_at_eof_token.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -168,10 +164,9 @@ js_rewind_at_eof_token.js:2:1 parse ━━━━━━━━━━━━━━ × the file ends here - ┌─ js_rewind_at_eof_token.js:2:1 - │ - 2 │ - │ ^ + 1 │ (([zAgRvz=[=(e{V{ + > 2 │ + │ -- (([zAgRvz=[=(e{V{ diff --git a/crates/rome_js_parser/test_data/inline/err/js_right_shift_comments.rast b/crates/rome_js_parser/test_data/inline/err/js_right_shift_comments.rast index d23866c4214..63ff1a566ad 100644 --- a/crates/rome_js_parser/test_data/inline/err/js_right_shift_comments.rast +++ b/crates/rome_js_parser/test_data/inline/err/js_right_shift_comments.rast @@ -45,10 +45,9 @@ js_right_shift_comments.js:1:22 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ js_right_shift_comments.js:1:22 - │ - 1 │ 1 >> /* a comment */ > 2; - │ ^ + > 1 │ 1 >> /* a comment */ > 2; + │ ^ + 2 │ -- 1 >> /* a comment */ > 2; diff --git a/crates/rome_js_parser/test_data/inline/err/js_type_variable_annotation.rast b/crates/rome_js_parser/test_data/inline/err/js_type_variable_annotation.rast index ad82b4f28a0..a60ea378909 100644 --- a/crates/rome_js_parser/test_data/inline/err/js_type_variable_annotation.rast +++ b/crates/rome_js_parser/test_data/inline/err/js_type_variable_annotation.rast @@ -88,10 +88,9 @@ js_type_variable_annotation.js:1:6 parse ━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ js_type_variable_annotation.js:1:6 - │ - 1 │ let a: string, b!: number; - │ ^^^^^^^^ + > 1 │ let a: string, b!: number; + │ ^^^^^^^^ + 2 │ -- js_type_variable_annotation.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -100,10 +99,9 @@ js_type_variable_annotation.js:1:17 parse ━━━━━━━━━━━━ × TypeScript only syntax - ┌─ js_type_variable_annotation.js:1:17 - │ - 1 │ let a: string, b!: number; - │ ^^^^^^^^^ + > 1 │ let a: string, b!: number; + │ ^^^^^^^^^ + 2 │ -- let a: string, b!: number; diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_child_expression_missing_r_curly.rast b/crates/rome_js_parser/test_data/inline/err/jsx_child_expression_missing_r_curly.rast index 526bda56a0f..de0ef1dc04d 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_child_expression_missing_r_curly.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_child_expression_missing_r_curly.rast @@ -84,10 +84,9 @@ jsx_child_expression_missing_r_curly.jsx:1:14 parse ━━━━━━━━━ × unexpected - ┌─ jsx_child_expression_missing_r_curly.jsx:1:14 - │ - 1 │ { 4 + 3 - │ ^ + > 1 │ { 4 + 3 + │ ^ + 2 │ -- { 4 + 3 diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_children_expression_missing_r_curly.rast b/crates/rome_js_parser/test_data/inline/err/jsx_children_expression_missing_r_curly.rast index 45687ac55ad..8990478e3fc 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_children_expression_missing_r_curly.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_children_expression_missing_r_curly.rast @@ -94,10 +94,12 @@ jsx_children_expression_missing_r_curly.jsx:3:3 parse ━━━━━━━━ × unexpected - ┌─ jsx_children_expression_missing_r_curly.jsx:3:3 - │ - 3 │ some text - │ ^^^^ + 1 │ + 2 │ { 5 + 3 + > 3 │ some text + │ ^^^^ + 4 │ + 5 │ -- diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_children_expressions_not_accepted.rast b/crates/rome_js_parser/test_data/inline/err/jsx_children_expressions_not_accepted.rast index d64dc202774..a167ff11b35 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_children_expressions_not_accepted.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_children_expressions_not_accepted.rast @@ -176,40 +176,47 @@ jsx_children_expressions_not_accepted.jsx:2:4 parse ━━━━━━━━━ × This expression is not valid as a JSX expression. - ┌─ jsx_children_expressions_not_accepted.jsx:2:4 - │ - 2 │ {import.meta} - │ ^^^^^^^^^^^ + 1 │
+ > 2 │ {import.meta} + │ ^^^^^^^^^^^ + 3 │ {class A{}} + 4 │ {super()} -- jsx_children_expressions_not_accepted.jsx:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × This expression is not valid as a JSX expression. - ┌─ jsx_children_expressions_not_accepted.jsx:3:4 - │ - 3 │ {class A{}} - │ ^^^^^^^^^ + 1 │
+ 2 │ {import.meta} + > 3 │ {class A{}} + │ ^^^^^^^^^ + 4 │ {super()} + 5 │ {new.target} -- jsx_children_expressions_not_accepted.jsx:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `super` is only valid inside of a class constructor of a subclass. - ┌─ jsx_children_expressions_not_accepted.jsx:4:4 - │ - 4 │ {super()} - │ ^^^^^ + 2 │ {import.meta} + 3 │ {class A{}} + > 4 │ {super()} + │ ^^^^^ + 5 │ {new.target} + 6 │
-- jsx_children_expressions_not_accepted.jsx:5:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × This expression is not valid as a JSX expression. - ┌─ jsx_children_expressions_not_accepted.jsx:5:4 - │ - 5 │ {new.target} - │ ^^^^^^^^^^ + 3 │ {class A{}} + 4 │ {super()} + > 5 │ {new.target} + │ ^^^^^^^^^^ + 6 │
+ 7 │ --
diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_closing_element_mismatch.rast b/crates/rome_js_parser/test_data/inline/err/jsx_closing_element_mismatch.rast index cbdfecb209d..8c866dc508f 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_closing_element_mismatch.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_closing_element_mismatch.rast @@ -258,17 +258,17 @@ jsx_closing_element_mismatch.jsx:1:1 parse ━━━━━━━━━━━━ × Opening tag - ┌─ jsx_closing_element_mismatch.jsx:1:1 - │ - 1 │ ; - │ ^^^^^^ + > 1 │ ; + │ ^^^^^^ + 2 │ ; + 3 │ ; i closing tag - ┌─ jsx_closing_element_mismatch.jsx:1:7 - │ - 1 │ ; - │ ^^^ + > 1 │ ; + │ ^^^ + 2 │ ; + 3 │ ; -- jsx_closing_element_mismatch.jsx:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -277,17 +277,19 @@ jsx_closing_element_mismatch.jsx:2:1 parse ━━━━━━━━━━━━ × Opening tag - ┌─ jsx_closing_element_mismatch.jsx:2:1 - │ - 2 │ ; - │ ^^^^^^ + 1 │ ; + > 2 │ ; + │ ^^^^^^ + 3 │ ; + 4 │ <><5>; i closing tag - ┌─ jsx_closing_element_mismatch.jsx:2:7 - │ - 2 │ ; - │ ^^^^^^^ + 1 │ ; + > 2 │ ; + │ ^^^^^^^ + 3 │ ; + 4 │ <><5>; -- jsx_closing_element_mismatch.jsx:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -296,17 +298,21 @@ jsx_closing_element_mismatch.jsx:3:7 parse ━━━━━━━━━━━━ × Opening tag - ┌─ jsx_closing_element_mismatch.jsx:3:7 - │ - 3 │ ; - │ ^^^^^^^^ + 1 │ ; + 2 │ ; + > 3 │ ; + │ ^^^^^^^^ + 4 │ <><5>; + 5 │ i closing tag - ┌─ jsx_closing_element_mismatch.jsx:3:15 - │ - 3 │ ; - │ ^^^^^^^ + 1 │ ; + 2 │ ; + > 3 │ ; + │ ^^^^^^^ + 4 │ <><5>; + 5 │ -- jsx_closing_element_mismatch.jsx:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -315,17 +321,21 @@ jsx_closing_element_mismatch.jsx:3:1 parse ━━━━━━━━━━━━ × Opening tag - ┌─ jsx_closing_element_mismatch.jsx:3:1 - │ - 3 │ ; - │ ^^^^^^ + 1 │ ; + 2 │ ; + > 3 │ ; + │ ^^^^^^ + 4 │ <><5>; + 5 │ i closing tag - ┌─ jsx_closing_element_mismatch.jsx:3:22 - │ - 3 │ ; - │ ^^^^^^^^^ + 1 │ ; + 2 │ ; + > 3 │ ; + │ ^^^^^^^^^ + 4 │ <><5>; + 5 │ -- jsx_closing_element_mismatch.jsx:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -334,10 +344,11 @@ jsx_closing_element_mismatch.jsx:4:4 parse ━━━━━━━━━━━━ × Expected an identifier here - ┌─ jsx_closing_element_mismatch.jsx:4:4 - │ - 4 │ <><5>; - │ ^ + 2 │ ; + 3 │ ; + > 4 │ <><5>; + │ ^ + 5 │ -- ; diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_closing_missing_r_angle.rast b/crates/rome_js_parser/test_data/inline/err/jsx_closing_missing_r_angle.rast index d3563ce70f5..c34aef40358 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_closing_missing_r_angle.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_closing_missing_r_angle.rast @@ -94,10 +94,9 @@ jsx_closing_missing_r_angle.jsx:1:20 parse ━━━━━━━━━━━━ × unexpected - ┌─ jsx_closing_missing_r_angle.jsx:1:20 - │ - 1 │ <>abcd - │ ^^^^ + > 1 │ <>abcd + │ ^^^^ + 2 │ -- <>abcd diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_element_attribute_expression_error.rast b/crates/rome_js_parser/test_data/inline/err/jsx_element_attribute_expression_error.rast index 22da15e70d5..bba7952a5d4 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_element_attribute_expression_error.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_element_attribute_expression_error.rast @@ -73,10 +73,9 @@ jsx_element_attribute_expression_error.jsx:1:22 parse ━━━━━━━━ × unexpected - ┌─ jsx_element_attribute_expression_error.jsx:1:22 - │ - 1 │
; - │ ^^^^ + > 1 │
; + │ ^^^^ + 2 │ --
; diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_element_attribute_missing_value.rast b/crates/rome_js_parser/test_data/inline/err/jsx_element_attribute_missing_value.rast index c87ec701964..840e7049f3b 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_element_attribute_missing_value.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_element_attribute_missing_value.rast @@ -118,10 +118,11 @@ jsx_element_attribute_missing_value.jsx:2:33 parse ━━━━━━━━━ × Expected a JSX attribute value here - ┌─ jsx_element_attribute_missing_value.jsx:2:33 - │ - 2 │ return
; - │ ^ + 1 │ function f() { + > 2 │ return
; + │ ^ + 3 │ } + 4 │ -- function f() { diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_fragment_closing_missing_r_angle.rast b/crates/rome_js_parser/test_data/inline/err/jsx_fragment_closing_missing_r_angle.rast index 5b33e648362..bd527421014 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_fragment_closing_missing_r_angle.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_fragment_closing_missing_r_angle.rast @@ -94,10 +94,9 @@ jsx_fragment_closing_missing_r_angle.jsx:1:15 parse ━━━━━━━━━ × unexpected - ┌─ jsx_fragment_closing_missing_r_angle.jsx:1:15 - │ - 1 │
<>test - │ ^ + > 1 │
<>test + │ ^ + 2 │ --
<>test diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_invalid_text.rast b/crates/rome_js_parser/test_data/inline/err/jsx_invalid_text.rast index c3bee6b7880..2d491962577 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_invalid_text.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_invalid_text.rast @@ -114,20 +114,20 @@ jsx_invalid_text.jsx:1:10 parse ━━━━━━━━━━━━━━━━ × Unexpected token. Did you mean `{'>'}` or `>`? - ┌─ jsx_invalid_text.jsx:1:10 - │ - 1 │ test >; - │ ^ + > 1 │ test >; + │ ^ + 2 │ invalid }; + 3 │ -- jsx_invalid_text.jsx:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Unexpected token. Did you mean `{'}'}` or `}`? - ┌─ jsx_invalid_text.jsx:2:13 - │ - 2 │ invalid }; - │ ^ + 1 │ test >; + > 2 │ invalid }; + │ ^ + 3 │ -- test >; diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_missing_closing_fragment.rast b/crates/rome_js_parser/test_data/inline/err/jsx_missing_closing_fragment.rast index 5a831ef5cfa..27a8f0bdee6 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_missing_closing_fragment.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_missing_closing_fragment.rast @@ -145,17 +145,17 @@ jsx_missing_closing_fragment.jsx:1:1 parse ━━━━━━━━━━━━ × Opening fragment - ┌─ jsx_missing_closing_fragment.jsx:1:1 - │ - 1 │ <>test; - │ ^^ + > 1 │ <>test; + │ ^^ + 2 │ <>test some text; + 3 │ i Closing tag - ┌─ jsx_missing_closing_fragment.jsx:1:9 - │ - 1 │ <>test; - │ ^^^^ + > 1 │ <>test; + │ ^^^^ + 2 │ <>test some text; + 3 │ -- jsx_missing_closing_fragment.jsx:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -164,10 +164,10 @@ jsx_missing_closing_fragment.jsx:3:1 parse ━━━━━━━━━━━━ × the file ends here - ┌─ jsx_missing_closing_fragment.jsx:3:1 - │ - 3 │ - │ ^ + 1 │ <>test; + 2 │ <>test some text; + > 3 │ + │ -- <>test; diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_namespace_member_element_name.rast b/crates/rome_js_parser/test_data/inline/err/jsx_namespace_member_element_name.rast index 31d72ab73fa..dd092306b41 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_namespace_member_element_name.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_namespace_member_element_name.rast @@ -176,20 +176,20 @@ jsx_namespace_member_element_name.jsx:2:2 parse ━━━━━━━━━━ × JSX property access expressions cannot include JSX namespace names. - ┌─ jsx_namespace_member_element_name.jsx:2:2 - │ - 2 │ ; - │ ^^^^^^^^^^^ + 1 │ ; + > 2 │ ; + │ ^^^^^^^^^^^ + 3 │ -- jsx_namespace_member_element_name.jsx:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × JSX property access expressions cannot include JSX namespace names. - ┌─ jsx_namespace_member_element_name.jsx:2:18 - │ - 2 │ ; - │ ^^^^^^^^^^^ + 1 │ ; + > 2 │ ; + │ ^^^^^^^^^^^ + 3 │ -- ; diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_opening_element_missing_r_angle.rast b/crates/rome_js_parser/test_data/inline/err/jsx_opening_element_missing_r_angle.rast index 496af928cda..442e992b4f4 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_opening_element_missing_r_angle.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_opening_element_missing_r_angle.rast @@ -125,10 +125,9 @@ jsx_opening_element_missing_r_angle.jsx:1:9 parse ━━━━━━━━━━ × unexpected - ┌─ jsx_opening_element_missing_r_angle.jsx:1:9 - │ - 1 │ <> some content - │ ^ + > 1 │ <> some content + │ ^ + 2 │ -- <> some content diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_or_type_assertion.rast b/crates/rome_js_parser/test_data/inline/err/jsx_or_type_assertion.rast index 110a875c525..e83d4e9a1ce 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_or_type_assertion.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_or_type_assertion.rast @@ -386,10 +386,12 @@ jsx_or_type_assertion.js:3:13 parse ━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ jsx_or_type_assertion.js:3:13 - │ - 3 │ let a =
a
; // JSX - │ ^^^^^^ + 1 │ // SCRIPT + 2 │ function f() { + > 3 │ let a =
a
; // JSX + │ ^^^^^^ + 4 │ let b = b; // type assertion + 5 │ let c = bd; // type assertion -- jsx_or_type_assertion.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -398,10 +400,12 @@ jsx_or_type_assertion.js:4:13 parse ━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ jsx_or_type_assertion.js:4:13 - │ - 4 │ let b = b; // type assertion - │ ^^^^^^^^^ + 2 │ function f() { + 3 │ let a =
a
; // JSX + > 4 │ let b = b; // type assertion + │ ^^^^^^^^^ + 5 │ let c = b
d; // type assertion + 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. -- jsx_or_type_assertion.js:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -410,10 +414,12 @@ jsx_or_type_assertion.js:5:13 parse ━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ jsx_or_type_assertion.js:5:13 - │ - 5 │ let c = b
d; // type assertion - │ ^^^^^^^^^ + 3 │ let a =
a
; // JSX + 4 │ let b = b; // type assertion + > 5 │ let c = b
d; // type assertion + │ ^^^^^^^^^ + 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + 7 │ let d = a/; -- jsx_or_type_assertion.js:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -422,10 +428,12 @@ jsx_or_type_assertion.js:6:13 parse ━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ jsx_or_type_assertion.js:6:13 - │ - 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. - │ ^^^^^^ + 4 │ let b = b; // type assertion + 5 │ let c = b
d; // type assertion + > 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + │ ^^^^^^ + 7 │ let d = a/; + 8 │ } -- jsx_or_type_assertion.js:7:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -434,10 +442,12 @@ jsx_or_type_assertion.js:7:13 parse ━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ jsx_or_type_assertion.js:7:13 - │ - 7 │ let d = a/; - │ ^^^^^^^^^ + 5 │ let c = b
d; // type assertion + 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + > 7 │ let d = a/; + │ ^^^^^^^^^ + 8 │ } + 9 │ -- // SCRIPT diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_self_closing_element_missing_r_angle.rast b/crates/rome_js_parser/test_data/inline/err/jsx_self_closing_element_missing_r_angle.rast index ced3d907625..8b375cb628a 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_self_closing_element_missing_r_angle.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_self_closing_element_missing_r_angle.rast @@ -89,10 +89,9 @@ jsx_self_closing_element_missing_r_angle.jsx:1:11 parse ━━━━━━━━ × unexpected - ┌─ jsx_self_closing_element_missing_r_angle.jsx:1:11 - │ - 1 │ <>; - │ ^^^^ + > 1 │ <>; + │ ^^^^ + 2 │ -- <>; diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_spread_attribute_error.rast b/crates/rome_js_parser/test_data/inline/err/jsx_spread_attribute_error.rast index 05edda7d4c1..e1060b8ed77 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_spread_attribute_error.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_spread_attribute_error.rast @@ -263,10 +263,11 @@ jsx_spread_attribute_error.jsx:2:8 parse ━━━━━━━━━━━━━ × Comma operator isn't a valid value for a JSX spread argument. - ┌─ jsx_spread_attribute_error.jsx:2:8 - │ - 2 │
; - │ ^^^^^^^^^^ + 1 │ let obj = {}; + > 2 │ ; + │ ^^^^^^^^^^ + 3 │ ; + 4 │ ; -- jsx_spread_attribute_error.jsx:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -275,10 +276,12 @@ jsx_spread_attribute_error.jsx:3:4 parse ━━━━━━━━━━━━━ × unexpected - ┌─ jsx_spread_attribute_error.jsx:3:4 - │ - 3 │ ; - │ ^^^ + 1 │ let obj = {}; + 2 │ ; + > 3 │ ; + │ ^^^ + 4 │ ; + 5 │
; - │ ^^^ + 2 │ ; + 3 │ ; + > 4 │ ; + │ ^^^ + 5 │
8 │ invalidProp="HelloWorld" + │ ^^^^^^^^^^^ + 9 │ />; + 10 │ -- let obj = {}; diff --git a/crates/rome_js_parser/test_data/inline/err/jsx_spread_no_expression.rast b/crates/rome_js_parser/test_data/inline/err/jsx_spread_no_expression.rast index 594d6ac4772..4b2e9073a55 100644 --- a/crates/rome_js_parser/test_data/inline/err/jsx_spread_no_expression.rast +++ b/crates/rome_js_parser/test_data/inline/err/jsx_spread_no_expression.rast @@ -73,10 +73,9 @@ jsx_spread_no_expression.jsx:1:11 parse ━━━━━━━━━━━━━ × Expected an expression here - ┌─ jsx_spread_no_expression.jsx:1:11 - │ - 1 │ {...} - │ ^ + > 1 │ {...} + │ ^ + 2 │ -- {...} diff --git a/crates/rome_js_parser/test_data/inline/err/labelled_function_decl_in_single_statement_context.rast b/crates/rome_js_parser/test_data/inline/err/labelled_function_decl_in_single_statement_context.rast index 600df180e45..aa421405ca0 100644 --- a/crates/rome_js_parser/test_data/inline/err/labelled_function_decl_in_single_statement_context.rast +++ b/crates/rome_js_parser/test_data/inline/err/labelled_function_decl_in_single_statement_context.rast @@ -80,10 +80,9 @@ labelled_function_decl_in_single_statement_context.js:1:27 parse ━━━━━ × wrap the function in a block statement - ┌─ labelled_function_decl_in_single_statement_context.js:1:27 - │ - 1 │ if (true) label1: label2: function a() {} - │ ^^^^^^^^^^^^^^^ + > 1 │ if (true) label1: label2: function a() {} + │ ^^^^^^^^^^^^^^^ + 2 │ -- if (true) label1: label2: function a() {} diff --git a/crates/rome_js_parser/test_data/inline/err/labelled_function_declaration_strict_mode.rast b/crates/rome_js_parser/test_data/inline/err/labelled_function_declaration_strict_mode.rast index 6fc2ab9ad4f..16de605df56 100644 --- a/crates/rome_js_parser/test_data/inline/err/labelled_function_declaration_strict_mode.rast +++ b/crates/rome_js_parser/test_data/inline/err/labelled_function_declaration_strict_mode.rast @@ -57,10 +57,9 @@ labelled_function_declaration_strict_mode.js:1:9 parse ━━━━━━━━ × wrap the function in a block statement - ┌─ labelled_function_declaration_strict_mode.js:1:9 - │ - 1 │ label1: function a() {} - │ ^^^^^^^^^^^^^^^ + > 1 │ label1: function a() {} + │ ^^^^^^^^^^^^^^^ + 2 │ -- label1: function a() {} diff --git a/crates/rome_js_parser/test_data/inline/err/let_array_with_new_line.rast b/crates/rome_js_parser/test_data/inline/err/let_array_with_new_line.rast index dadcf3f28e5..400032c3f69 100644 --- a/crates/rome_js_parser/test_data/inline/err/let_array_with_new_line.rast +++ b/crates/rome_js_parser/test_data/inline/err/let_array_with_new_line.rast @@ -70,12 +70,12 @@ let_array_with_new_line.js:2:4 parse ━━━━━━━━━━━━━━ × Wrap this declaration in a block statement - ┌─ let_array_with_new_line.js:2:4 - │ - 2 │ L: let - │ ┌────^ - 3 │ │ [a] = 0; - │ └────────^ + 1 │ // SCRIPT + > 2 │ L: let + │ ^^^ + > 3 │ [a] = 0; + │ ^^^^^^^^ + 4 │ -- // SCRIPT diff --git a/crates/rome_js_parser/test_data/inline/err/let_newline_in_async_function.rast b/crates/rome_js_parser/test_data/inline/err/let_newline_in_async_function.rast index 4af6a2ff8ea..c4de5f61144 100644 --- a/crates/rome_js_parser/test_data/inline/err/let_newline_in_async_function.rast +++ b/crates/rome_js_parser/test_data/inline/err/let_newline_in_async_function.rast @@ -92,10 +92,12 @@ let_newline_in_async_function.js:3:3 parse ━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context - ┌─ let_newline_in_async_function.js:3:3 - │ - 3 │ await 0; - │ ^^^^^ + 1 │ async function f() { + 2 │ let + > 3 │ await 0; + │ ^^^^^ + 4 │ } + 5 │ -- let_newline_in_async_function.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -104,18 +106,22 @@ let_newline_in_async_function.js:3:9 parse ━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ let_newline_in_async_function.js:3:9 - │ - 3 │ await 0; - │ ^ + 1 │ async function f() { + 2 │ let + > 3 │ await 0; + │ ^ + 4 │ } + 5 │ i ...Which is required to end this statement - ┌─ let_newline_in_async_function.js:2:3 - │ - 2 │ ┌ let - 3 │ │ await 0; - │ └────────^ + 1 │ async function f() { + > 2 │ let + │ ^^^ + > 3 │ await 0; + │ ^^^^^^ + 4 │ } + 5 │ -- async function f() { diff --git a/crates/rome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.rast b/crates/rome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.rast index e38e8c8d191..51e93058142 100644 --- a/crates/rome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.rast +++ b/crates/rome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.rast @@ -110,10 +110,10 @@ lexical_declaration_in_single_statement_context.js:1:11 parse ━━━━━━ × Wrap this declaration in a block statement - ┌─ lexical_declaration_in_single_statement_context.js:1:11 - │ - 1 │ if (true) let a; - │ ^^^^^^ + > 1 │ if (true) let a; + │ ^^^^^^ + 2 │ while (true) const b = 5; + 3 │ -- lexical_declaration_in_single_statement_context.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -122,10 +122,10 @@ lexical_declaration_in_single_statement_context.js:2:14 parse ━━━━━━ × Wrap this declaration in a block statement - ┌─ lexical_declaration_in_single_statement_context.js:2:14 - │ - 2 │ while (true) const b = 5; - │ ^^^^^^^^^^^^ + 1 │ if (true) let a; + > 2 │ while (true) const b = 5; + │ ^^^^^^^^^^^^ + 3 │ -- if (true) let a; diff --git a/crates/rome_js_parser/test_data/inline/err/literals.rast b/crates/rome_js_parser/test_data/inline/err/literals.rast index af9242f56de..dc2b8b44e49 100644 --- a/crates/rome_js_parser/test_data/inline/err/literals.rast +++ b/crates/rome_js_parser/test_data/inline/err/literals.rast @@ -107,60 +107,61 @@ literals.js:1:1 parse ━━━━━━━━━━━━━━━━━━━ × "0"-prefixed octal literals are deprecated; use the "0o" prefix instead. - ┌─ literals.js:1:1 - │ - 1 │ 00, 012, 08, 091, 0789 // parser errors - │ ^^ + > 1 │ 00, 012, 08, 091, 0789 // parser errors + │ ^^ + 2 │ 01n, 0_0, 01.2 // lexer errors + 3 │ "test -- literals.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × "0"-prefixed octal literals are deprecated; use the "0o" prefix instead. - ┌─ literals.js:1:5 - │ - 1 │ 00, 012, 08, 091, 0789 // parser errors - │ ^^^ + > 1 │ 00, 012, 08, 091, 0789 // parser errors + │ ^^^ + 2 │ 01n, 0_0, 01.2 // lexer errors + 3 │ "test -- literals.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decimals with leading zeros are not allowed in strict mode. - ┌─ literals.js:1:10 - │ - 1 │ 00, 012, 08, 091, 0789 // parser errors - │ ^^ + > 1 │ 00, 012, 08, 091, 0789 // parser errors + │ ^^ + 2 │ 01n, 0_0, 01.2 // lexer errors + 3 │ "test -- literals.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decimals with leading zeros are not allowed in strict mode. - ┌─ literals.js:1:14 - │ - 1 │ 00, 012, 08, 091, 0789 // parser errors - │ ^^^ + > 1 │ 00, 012, 08, 091, 0789 // parser errors + │ ^^^ + 2 │ 01n, 0_0, 01.2 // lexer errors + 3 │ "test -- literals.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decimals with leading zeros are not allowed in strict mode. - ┌─ literals.js:1:19 - │ - 1 │ 00, 012, 08, 091, 0789 // parser errors - │ ^^^^ + > 1 │ 00, 012, 08, 091, 0789 // parser errors + │ ^^^^ + 2 │ 01n, 0_0, 01.2 // lexer errors + 3 │ "test -- literals.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × "0"-prefixed octal literals are deprecated; use the "0o" prefix instead. - ┌─ literals.js:2:11 - │ - 2 │ 01n, 0_0, 01.2 // lexer errors - │ ^^^^ + 1 │ 00, 012, 08, 091, 0789 // parser errors + > 2 │ 01n, 0_0, 01.2 // lexer errors + │ ^^^^ + 3 │ "test + 4 │ continues" // unterminated string literal -- literals.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -170,79 +171,88 @@ literals.js:3:1 parse ━━━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ literals.js:3:1 - │ - 3 │ ┌ "test - 4 │ │ continues" // unterminated string literal - │ └─────────────────────────────────────────^ + 1 │ 00, 012, 08, 091, 0789 // parser errors + 2 │ 01n, 0_0, 01.2 // lexer errors + > 3 │ "test + │ ^^^^^ + > 4 │ continues" // unterminated string literal + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ -- literals.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Octal literals are not allowed for BigInts. - ┌─ literals.js:2:1 - │ - 2 │ 01n, 0_0, 01.2 // lexer errors - │ ^^^ + 1 │ 00, 012, 08, 091, 0789 // parser errors + > 2 │ 01n, 0_0, 01.2 // lexer errors + │ ^^^ + 3 │ "test + 4 │ continues" // unterminated string literal -- literals.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × numeric separator can not be used after leading 0 - ┌─ literals.js:2:7 - │ - 2 │ 01n, 0_0, 01.2 // lexer errors - │ ^ + 1 │ 00, 012, 08, 091, 0789 // parser errors + > 2 │ 01n, 0_0, 01.2 // lexer errors + │ + 3 │ "test + 4 │ continues" // unterminated string literal -- literals.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unexpected number - ┌─ literals.js:2:11 - │ - 2 │ 01n, 0_0, 01.2 // lexer errors - │ ^^^ + 1 │ 00, 012, 08, 091, 0789 // parser errors + > 2 │ 01n, 0_0, 01.2 // lexer errors + │ ^^^ + 3 │ "test + 4 │ continues" // unterminated string literal -- literals.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unterminated string literal - ┌─ literals.js:3:1 - │ - 3 │ "test - │ ^^^^^ + 1 │ 00, 012, 08, 091, 0789 // parser errors + 2 │ 01n, 0_0, 01.2 // lexer errors + > 3 │ "test + │ ^^^^^ + 4 │ continues" // unterminated string literal + 5 │ i line breaks here - ┌─ literals.js:3:6 - │ - 3 │ "test - │ ┌─────^ - 4 │ │ continues" // unterminated string literal - │ └─^ + 1 │ 00, 012, 08, 091, 0789 // parser errors + 2 │ 01n, 0_0, 01.2 // lexer errors + > 3 │ "test + │ + > 4 │ continues" // unterminated string literal + │ ^ + 5 │ -- literals.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unterminated string literal - ┌─ literals.js:4:10 - │ - 4 │ continues" // unterminated string literal - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ 01n, 0_0, 01.2 // lexer errors + 3 │ "test + > 4 │ continues" // unterminated string literal + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ i line breaks here - ┌─ literals.js:4:42 - │ - 4 │ continues" // unterminated string literal - │ ┌─────────────────────────────────────────^ - 5 │ │ - │ └^ + 2 │ 01n, 0_0, 01.2 // lexer errors + 3 │ "test + > 4 │ continues" // unterminated string literal + │ + > 5 │ + │ -- 00, 012, 08, 091, 0789 // parser errors diff --git a/crates/rome_js_parser/test_data/inline/err/logical_expressions_err.rast b/crates/rome_js_parser/test_data/inline/err/logical_expressions_err.rast index e250384e8f5..2b9595cc3ae 100644 --- a/crates/rome_js_parser/test_data/inline/err/logical_expressions_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/logical_expressions_err.rast @@ -124,10 +124,10 @@ logical_expressions_err.js:1:8 parse ━━━━━━━━━━━━━━ × This operator requires a left hand side value - ┌─ logical_expressions_err.js:1:8 - │ - 1 │ foo ?? * 2; - │ ^ + > 1 │ foo ?? * 2; + │ ^ + 2 │ !foo && bar; + 3 │ foo(foo ||) -- logical_expressions_err.js:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -136,10 +136,11 @@ logical_expressions_err.js:3:11 parse ━━━━━━━━━━━━━━ × Expected an expression here - ┌─ logical_expressions_err.js:3:11 - │ - 3 │ foo(foo ||) - │ ^ + 1 │ foo ?? * 2; + 2 │ !foo && bar; + > 3 │ foo(foo ||) + │ ^ + 4 │ -- foo ?? * 2; diff --git a/crates/rome_js_parser/test_data/inline/err/method_getter_err.rast b/crates/rome_js_parser/test_data/inline/err/method_getter_err.rast index 84d369c3fd1..623d9008662 100644 --- a/crates/rome_js_parser/test_data/inline/err/method_getter_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/method_getter_err.rast @@ -71,10 +71,11 @@ method_getter_err.js:2:2 parse ━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ method_getter_err.js:2:2 - │ - 2 │ get {} - │ ^^^ + 1 │ class foo { + > 2 │ get {} + │ ^^^ + 3 │ } + 4 │ -- method_getter_err.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -83,10 +84,11 @@ method_getter_err.js:2:6 parse ━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, a private field name, or a computed name here - ┌─ method_getter_err.js:2:6 - │ - 2 │ get {} - │ ^ + 1 │ class foo { + > 2 │ get {} + │ ^ + 3 │ } + 4 │ -- method_getter_err.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -95,10 +97,11 @@ method_getter_err.js:3:1 parse ━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ method_getter_err.js:3:1 - │ - 3 │ } - │ ^ + 1 │ class foo { + 2 │ get {} + > 3 │ } + │ ^ + 4 │ -- class foo { diff --git a/crates/rome_js_parser/test_data/inline/err/module_closing_curly.rast b/crates/rome_js_parser/test_data/inline/err/module_closing_curly.rast index 772587813c3..1bec6dc0816 100644 --- a/crates/rome_js_parser/test_data/inline/err/module_closing_curly.rast +++ b/crates/rome_js_parser/test_data/inline/err/module_closing_curly.rast @@ -78,17 +78,19 @@ module_closing_curly.ts:2:8 parse ━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ module_closing_curly.ts:2:8 - │ - 2 │ "name": "troublesome-lib", - │ ^ + 1 │ declare module A { + > 2 │ "name": "troublesome-lib", + │ ^ + 3 │ "typings": "lib/index.d.ts", + 4 │ "version": "0.0.1" i ...Which is required to end this statement - ┌─ module_closing_curly.ts:2:2 - │ - 2 │ "name": "troublesome-lib", - │ ^^^^^^^ + 1 │ declare module A { + > 2 │ "name": "troublesome-lib", + │ ^^^^^^^ + 3 │ "typings": "lib/index.d.ts", + 4 │ "version": "0.0.1" -- declare module A { diff --git a/crates/rome_js_parser/test_data/inline/err/multiple_default_exports_err.rast b/crates/rome_js_parser/test_data/inline/err/multiple_default_exports_err.rast index 52126676bf8..9651e48a0d3 100644 --- a/crates/rome_js_parser/test_data/inline/err/multiple_default_exports_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/multiple_default_exports_err.rast @@ -152,17 +152,18 @@ multiple_default_exports_err.js:2:8 parse ━━━━━━━━━━━━ × multiple default exports are erroneous - ┌─ multiple_default_exports_err.js:2:8 - │ - 2 │ export default a + b; - │ ^^^^^^^^^^^^^^ + 1 │ export default (class {}) + > 2 │ export default a + b; + │ ^^^^^^^^^^^^^^ + 3 │ export default (function a() {}) + 4 │ i the module's default export is first defined here - ┌─ multiple_default_exports_err.js:1:8 - │ - 1 │ export default (class {}) - │ ^^^^^^^^^^^^^^^^^^ + > 1 │ export default (class {}) + │ ^^^^^^^^^^^^^^^^^^ + 2 │ export default a + b; + 3 │ export default (function a() {}) -- multiple_default_exports_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -171,17 +172,18 @@ multiple_default_exports_err.js:3:8 parse ━━━━━━━━━━━━ × multiple default exports are erroneous - ┌─ multiple_default_exports_err.js:3:8 - │ - 3 │ export default (function a() {}) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ export default (class {}) + 2 │ export default a + b; + > 3 │ export default (function a() {}) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ i the module's default export is first defined here - ┌─ multiple_default_exports_err.js:1:8 - │ - 1 │ export default (class {}) - │ ^^^^^^^^^^^^^^^^^^ + > 1 │ export default (class {}) + │ ^^^^^^^^^^^^^^^^^^ + 2 │ export default a + b; + 3 │ export default (function a() {}) -- export default (class {}) diff --git a/crates/rome_js_parser/test_data/inline/err/new_exprs.rast b/crates/rome_js_parser/test_data/inline/err/new_exprs.rast index ac4f59450da..f462743a42c 100644 --- a/crates/rome_js_parser/test_data/inline/err/new_exprs.rast +++ b/crates/rome_js_parser/test_data/inline/err/new_exprs.rast @@ -34,10 +34,9 @@ new_exprs.js:1:4 parse ━━━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ new_exprs.js:1:4 - │ - 1 │ new; - │ ^ + > 1 │ new; + │ ^ + 2 │ -- new; diff --git a/crates/rome_js_parser/test_data/inline/err/no_top_level_await_in_scripts.rast b/crates/rome_js_parser/test_data/inline/err/no_top_level_await_in_scripts.rast index 39912ea159b..da4146a7c3c 100644 --- a/crates/rome_js_parser/test_data/inline/err/no_top_level_await_in_scripts.rast +++ b/crates/rome_js_parser/test_data/inline/err/no_top_level_await_in_scripts.rast @@ -98,17 +98,19 @@ no_top_level_await_in_scripts.js:3:7 parse ━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ no_top_level_await_in_scripts.js:3:7 - │ - 3 │ await test(); - │ ^^^^ + 1 │ // SCRIPT + 2 │ async function test() {} + > 3 │ await test(); + │ ^^^^ + 4 │ i ...Which is required to end this statement - ┌─ no_top_level_await_in_scripts.js:3:1 - │ - 3 │ await test(); - │ ^^^^^^^^^^ + 1 │ // SCRIPT + 2 │ async function test() {} + > 3 │ await test(); + │ ^^^^^^^^^^ + 4 │ -- // SCRIPT diff --git a/crates/rome_js_parser/test_data/inline/err/object_binding_pattern.rast b/crates/rome_js_parser/test_data/inline/err/object_binding_pattern.rast index 824f1dc1cd6..28355947c31 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_binding_pattern.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_binding_pattern.rast @@ -333,10 +333,10 @@ object_binding_pattern.js:1:9 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ object_binding_pattern.js:1:9 - │ - 1 │ let { 5 } } = { eval: "foo" }; - │ ^ + > 1 │ let { 5 } } = { eval: "foo" }; + │ ^ + 2 │ let { eval } = { eval: "foo" }; + 3 │ let { 5, 6 } = { eval: "foo" }; -- object_binding_pattern.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -345,10 +345,10 @@ object_binding_pattern.js:1:5 parse ━━━━━━━━━━━━━━ × this pattern is declared, but it is not given an initialized value - ┌─ object_binding_pattern.js:1:5 - │ - 1 │ let { 5 } } = { eval: "foo" }; - │ ^^^^^ + > 1 │ let { 5 } } = { eval: "foo" }; + │ ^^^^^ + 2 │ let { eval } = { eval: "foo" }; + 3 │ let { 5, 6 } = { eval: "foo" }; -- object_binding_pattern.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -357,20 +357,21 @@ object_binding_pattern.js:1:11 parse ━━━━━━━━━━━━━━ × Expected a statement here - ┌─ object_binding_pattern.js:1:11 - │ - 1 │ let { 5 } } = { eval: "foo" }; - │ ^^^ + > 1 │ let { 5 } } = { eval: "foo" }; + │ ^^^ + 2 │ let { eval } = { eval: "foo" }; + 3 │ let { 5, 6 } = { eval: "foo" }; -- object_binding_pattern.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `eval` as an identifier in strict mode - ┌─ object_binding_pattern.js:2:7 - │ - 2 │ let { eval } = { eval: "foo" }; - │ ^^^^ + 1 │ let { 5 } } = { eval: "foo" }; + > 2 │ let { eval } = { eval: "foo" }; + │ ^^^^ + 3 │ let { 5, 6 } = { eval: "foo" }; + 4 │ let { default , eval: } = {}; -- object_binding_pattern.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -379,10 +380,12 @@ object_binding_pattern.js:3:8 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ object_binding_pattern.js:3:8 - │ - 3 │ let { 5, 6 } = { eval: "foo" }; - │ ^ + 1 │ let { 5 } } = { eval: "foo" }; + 2 │ let { eval } = { eval: "foo" }; + > 3 │ let { 5, 6 } = { eval: "foo" }; + │ ^ + 4 │ let { default , eval: } = {}; + 5 │ -- object_binding_pattern.js:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -391,10 +394,12 @@ object_binding_pattern.js:3:12 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ object_binding_pattern.js:3:12 - │ - 3 │ let { 5, 6 } = { eval: "foo" }; - │ ^ + 1 │ let { 5 } } = { eval: "foo" }; + 2 │ let { eval } = { eval: "foo" }; + > 3 │ let { 5, 6 } = { eval: "foo" }; + │ ^ + 4 │ let { default , eval: } = {}; + 5 │ -- object_binding_pattern.js:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -403,10 +408,11 @@ object_binding_pattern.js:4:15 parse ━━━━━━━━━━━━━━ × unexpected - ┌─ object_binding_pattern.js:4:15 - │ - 4 │ let { default , eval: } = {}; - │ ^ + 2 │ let { eval } = { eval: "foo" }; + 3 │ let { 5, 6 } = { eval: "foo" }; + > 4 │ let { default , eval: } = {}; + │ ^ + 5 │ -- object_binding_pattern.js:4:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -415,10 +421,11 @@ object_binding_pattern.js:4:23 parse ━━━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern here - ┌─ object_binding_pattern.js:4:23 - │ - 4 │ let { default , eval: } = {}; - │ ^ + 2 │ let { eval } = { eval: "foo" }; + 3 │ let { 5, 6 } = { eval: "foo" }; + > 4 │ let { default , eval: } = {}; + │ ^ + 5 │ -- let { 5 } } = { eval: "foo" }; diff --git a/crates/rome_js_parser/test_data/inline/err/object_expr_err.rast b/crates/rome_js_parser/test_data/inline/err/object_expr_err.rast index a5b95571b2b..6a8973944a6 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_expr_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_expr_err.rast @@ -170,10 +170,11 @@ object_expr_err.js:2:15 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ object_expr_err.js:2:15 - │ - 2 │ let b = { foo bar } - │ ^^^ + 1 │ let a = {, foo} + > 2 │ let b = { foo bar } + │ ^^^ + 3 │ let b = { foo + 4 │ -- object_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -182,10 +183,10 @@ object_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━ × the file ends here - ┌─ object_expr_err.js:4:1 - │ - 4 │ - │ ^ + 2 │ let b = { foo bar } + 3 │ let b = { foo + > 4 │ + │ -- let a = {, foo} diff --git a/crates/rome_js_parser/test_data/inline/err/object_expr_error_prop_name.rast b/crates/rome_js_parser/test_data/inline/err/object_expr_error_prop_name.rast index 3ef181e5204..b4a18cb1d6b 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_expr_error_prop_name.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_expr_error_prop_name.rast @@ -148,10 +148,10 @@ object_expr_error_prop_name.js:1:11 parse ━━━━━━━━━━━━ × Expected a property, a shorthand property, a getter, a setter, or a method here - ┌─ object_expr_error_prop_name.js:1:11 - │ - 1 │ let a = { /: 6, /: /foo/ } - │ ^ + > 1 │ let a = { /: 6, /: /foo/ } + │ ^ + 2 │ let b = {{}} + 3 │ -- object_expr_error_prop_name.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -160,10 +160,10 @@ object_expr_error_prop_name.js:1:17 parse ━━━━━━━━━━━━ × Expected a property, a shorthand property, a getter, a setter, or a method here - ┌─ object_expr_error_prop_name.js:1:17 - │ - 1 │ let a = { /: 6, /: /foo/ } - │ ^ + > 1 │ let a = { /: 6, /: /foo/ } + │ ^ + 2 │ let b = {{}} + 3 │ -- object_expr_error_prop_name.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -172,10 +172,10 @@ object_expr_error_prop_name.js:2:10 parse ━━━━━━━━━━━━ × Expected a property, a shorthand property, a getter, a setter, or a method here - ┌─ object_expr_error_prop_name.js:2:10 - │ - 2 │ let b = {{}} - │ ^ + 1 │ let a = { /: 6, /: /foo/ } + > 2 │ let b = {{}} + │ ^ + 3 │ -- object_expr_error_prop_name.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -184,10 +184,10 @@ object_expr_error_prop_name.js:2:12 parse ━━━━━━━━━━━━ × Expected a statement here - ┌─ object_expr_error_prop_name.js:2:12 - │ - 2 │ let b = {{}} - │ ^ + 1 │ let a = { /: 6, /: /foo/ } + > 2 │ let b = {{}} + │ ^ + 3 │ -- let a = { /: 6, /: /foo/ } diff --git a/crates/rome_js_parser/test_data/inline/err/object_expr_method.rast b/crates/rome_js_parser/test_data/inline/err/object_expr_method.rast index ac724c4c1e5..87cdd5d3f15 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_expr_method.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_expr_method.rast @@ -73,10 +73,9 @@ object_expr_method.js:1:14 parse ━━━━━━━━━━━━━━━ × unexpected - ┌─ object_expr_method.js:1:14 - │ - 1 │ let b = { foo) } - │ ^ + > 1 │ let b = { foo) } + │ ^ + 2 │ -- let b = { foo) } diff --git a/crates/rome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.rast b/crates/rome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.rast index fd3ce25fa47..e68e7f3c84c 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.rast @@ -68,10 +68,9 @@ object_expr_non_ident_literal_prop.js:1:11 parse ━━━━━━━━━━ × unexpected - ┌─ object_expr_non_ident_literal_prop.js:1:11 - │ - 1 │ let d = {5} - │ ^ + > 1 │ let d = {5} + │ ^ + 2 │ -- let d = {5} diff --git a/crates/rome_js_parser/test_data/inline/err/object_expr_setter.rast b/crates/rome_js_parser/test_data/inline/err/object_expr_setter.rast index 08b39c6d892..60d8b8b8444 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_expr_setter.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_expr_setter.rast @@ -96,10 +96,11 @@ object_expr_setter.js:2:10 parse ━━━━━━━━━━━━━━━ × Expected a parameter here - ┌─ object_expr_setter.js:2:10 - │ - 2 │ set foo() { - │ ^ + 1 │ let b = { + > 2 │ set foo() { + │ ^ + 3 │ return 5; + 4 │ } -- let b = { diff --git a/crates/rome_js_parser/test_data/inline/err/object_property_binding_err.rast b/crates/rome_js_parser/test_data/inline/err/object_property_binding_err.rast index 4889787e077..b0a7e7413e2 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_property_binding_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_property_binding_err.rast @@ -213,10 +213,10 @@ object_property_binding_err.js:1:12 parse ━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern here - ┌─ object_property_binding_err.js:1:12 - │ - 1 │ let { foo: , bar } = {} - │ ^ + > 1 │ let { foo: , bar } = {} + │ ^ + 2 │ let { : lorem = "test" } = {} + 3 │ let { , ipsum: bazz } = {} -- object_property_binding_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -225,10 +225,11 @@ object_property_binding_err.js:2:7 parse ━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, or a computed property here - ┌─ object_property_binding_err.js:2:7 - │ - 2 │ let { : lorem = "test" } = {} - │ ^ + 1 │ let { foo: , bar } = {} + > 2 │ let { : lorem = "test" } = {} + │ ^ + 3 │ let { , ipsum: bazz } = {} + 4 │ -- object_property_binding_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -237,10 +238,11 @@ object_property_binding_err.js:3:7 parse ━━━━━━━━━━━━━ × Expected an identifier, a member name, or a rest pattern here - ┌─ object_property_binding_err.js:3:7 - │ - 3 │ let { , ipsum: bazz } = {} - │ ^ + 1 │ let { foo: , bar } = {} + 2 │ let { : lorem = "test" } = {} + > 3 │ let { , ipsum: bazz } = {} + │ ^ + 4 │ -- let { foo: , bar } = {} diff --git a/crates/rome_js_parser/test_data/inline/err/object_shorthand_property_err.rast b/crates/rome_js_parser/test_data/inline/err/object_shorthand_property_err.rast index 1985c0dd262..64b4e544586 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_shorthand_property_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_shorthand_property_err.rast @@ -192,10 +192,10 @@ object_shorthand_property_err.js:1:9 parse ━━━━━━━━━━━━ × unexpected - ┌─ object_shorthand_property_err.js:1:9 - │ - 1 │ let { a b } = c - │ ^ + > 1 │ let { a b } = c + │ ^ + 2 │ let { = "test" } = c + 3 │ let { , d } = c -- object_shorthand_property_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -204,10 +204,11 @@ object_shorthand_property_err.js:2:7 parse ━━━━━━━━━━━━ × Expected an identifier here - ┌─ object_shorthand_property_err.js:2:7 - │ - 2 │ let { = "test" } = c - │ ^ + 1 │ let { a b } = c + > 2 │ let { = "test" } = c + │ ^ + 3 │ let { , d } = c + 4 │ -- object_shorthand_property_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -216,10 +217,11 @@ object_shorthand_property_err.js:3:7 parse ━━━━━━━━━━━━ × Expected an identifier, a member name, or a rest pattern here - ┌─ object_shorthand_property_err.js:3:7 - │ - 3 │ let { , d } = c - │ ^ + 1 │ let { a b } = c + 2 │ let { = "test" } = c + > 3 │ let { , d } = c + │ ^ + 4 │ -- let { a b } = c diff --git a/crates/rome_js_parser/test_data/inline/err/object_shorthand_with_initializer.rast b/crates/rome_js_parser/test_data/inline/err/object_shorthand_with_initializer.rast index fddda6b6fba..c9e44c43bc8 100644 --- a/crates/rome_js_parser/test_data/inline/err/object_shorthand_with_initializer.rast +++ b/crates/rome_js_parser/test_data/inline/err/object_shorthand_with_initializer.rast @@ -81,10 +81,9 @@ object_shorthand_with_initializer.js:1:10 parse ━━━━━━━━━━ × Did you mean to use a `:`? An `=` can only follow a property name when the containing object literal is part of a destructuring pattern. - ┌─ object_shorthand_with_initializer.js:1:10 - │ - 1 │ ({ arrow = () => {} }) - │ ^ + > 1 │ ({ arrow = () => {} }) + │ ^ + 2 │ -- ({ arrow = () => {} }) diff --git a/crates/rome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.rast b/crates/rome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.rast index 5b0d62053ff..28f5fdbf281 100644 --- a/crates/rome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.rast +++ b/crates/rome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.rast @@ -144,10 +144,11 @@ optional_chain_call_without_arguments.ts:2:9 parse ━━━━━━━━━ × Expected an identifier here - ┌─ optional_chain_call_without_arguments.ts:2:9 - │ - 2 │ a.test?.; - │ ^ + 1 │ let a = { test: null }; + > 2 │ a.test?.; + │ ^ + 3 │ a.test?. 3 │ a.test?. 1 │ class B { foo?; } + │ ^ + 2 │ -- class B { foo?; } diff --git a/crates/rome_js_parser/test_data/inline/err/paren_or_arrow_expr_invalid_params.rast b/crates/rome_js_parser/test_data/inline/err/paren_or_arrow_expr_invalid_params.rast index 5b51df09d41..c78f94b09b2 100644 --- a/crates/rome_js_parser/test_data/inline/err/paren_or_arrow_expr_invalid_params.rast +++ b/crates/rome_js_parser/test_data/inline/err/paren_or_arrow_expr_invalid_params.rast @@ -307,17 +307,17 @@ paren_or_arrow_expr_invalid_params.js:1:9 parse ━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ paren_or_arrow_expr_invalid_params.js:1:9 - │ - 1 │ (5 + 5) => {} - │ ^^ + > 1 │ (5 + 5) => {} + │ ^^ + 2 │ (a, ,b) => {} + 3 │ (a, b) =>; i ...Which is required to end this statement - ┌─ paren_or_arrow_expr_invalid_params.js:1:1 - │ - 1 │ (5 + 5) => {} - │ ^^^^^^^^^^ + > 1 │ (5 + 5) => {} + │ ^^^^^^^^^^ + 2 │ (a, ,b) => {} + 3 │ (a, b) =>; -- paren_or_arrow_expr_invalid_params.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -326,10 +326,11 @@ paren_or_arrow_expr_invalid_params.js:2:5 parse ━━━━━━━━━━ × Expected a parameter here - ┌─ paren_or_arrow_expr_invalid_params.js:2:5 - │ - 2 │ (a, ,b) => {} - │ ^ + 1 │ (5 + 5) => {} + > 2 │ (a, ,b) => {} + │ ^ + 3 │ (a, b) =>; + 4 │ (a: string; -- paren_or_arrow_expr_invalid_params.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -338,10 +339,12 @@ paren_or_arrow_expr_invalid_params.js:3:10 parse ━━━━━━━━━━ × Expected a function body, or an expression here - ┌─ paren_or_arrow_expr_invalid_params.js:3:10 - │ - 3 │ (a, b) =>; - │ ^ + 1 │ (5 + 5) => {} + 2 │ (a, ,b) => {} + > 3 │ (a, b) =>; + │ ^ + 4 │ (a: string; + 5 │ (a, b) -- paren_or_arrow_expr_invalid_params.js:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -350,10 +353,12 @@ paren_or_arrow_expr_invalid_params.js:4:3 parse ━━━━━━━━━━ × TypeScript only syntax - ┌─ paren_or_arrow_expr_invalid_params.js:4:3 - │ - 4 │ (a: string; - │ ^^^^^^^^ + 2 │ (a, ,b) => {} + 3 │ (a, b) =>; + > 4 │ (a: string; + │ ^^^^^^^^ + 5 │ (a, b) + 6 │ => {} -- paren_or_arrow_expr_invalid_params.js:4:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -362,20 +367,23 @@ paren_or_arrow_expr_invalid_params.js:4:11 parse ━━━━━━━━━━ × unexpected - ┌─ paren_or_arrow_expr_invalid_params.js:4:11 - │ - 4 │ (a: string; - │ ^ + 2 │ (a, ,b) => {} + 3 │ (a, b) =>; + > 4 │ (a: string; + │ ^ + 5 │ (a, b) + 6 │ => {} -- paren_or_arrow_expr_invalid_params.js:6:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Line terminator not permitted before arrow. - ┌─ paren_or_arrow_expr_invalid_params.js:6:2 - │ - 6 │ => {} - │ ^^ + 4 │ (a: string; + 5 │ (a, b) + > 6 │ => {} + │ ^^ + 7 │ -- (5 + 5) => {} diff --git a/crates/rome_js_parser/test_data/inline/err/primary_expr_invalid_recovery.rast b/crates/rome_js_parser/test_data/inline/err/primary_expr_invalid_recovery.rast index 5547c7c6e1e..5eb4828e0b5 100644 --- a/crates/rome_js_parser/test_data/inline/err/primary_expr_invalid_recovery.rast +++ b/crates/rome_js_parser/test_data/inline/err/primary_expr_invalid_recovery.rast @@ -88,10 +88,9 @@ primary_expr_invalid_recovery.js:1:9 parse ━━━━━━━━━━━━ × unexpected token `\` - ┌─ primary_expr_invalid_recovery.js:1:9 - │ - 1 │ let a = \; foo(); - │ ^ + > 1 │ let a = \; foo(); + │ ^ + 2 │ -- let a = \; foo(); diff --git a/crates/rome_js_parser/test_data/inline/err/private_name_presence_check_recursive.rast b/crates/rome_js_parser/test_data/inline/err/private_name_presence_check_recursive.rast index f3f9b99f507..908fbf3b63c 100644 --- a/crates/rome_js_parser/test_data/inline/err/private_name_presence_check_recursive.rast +++ b/crates/rome_js_parser/test_data/inline/err/private_name_presence_check_recursive.rast @@ -198,40 +198,48 @@ private_name_presence_check_recursive.js:4:13 parse ━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ private_name_presence_check_recursive.js:4:13 - │ - 4 │ #prop in #prop in this; - │ ^^^^^ + 2 │ #prop; + 3 │ test() { + > 4 │ #prop in #prop in this; + │ ^^^^^ + 5 │ 5 + #prop; + 6 │ #prop -- private_name_presence_check_recursive.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ private_name_presence_check_recursive.js:5:8 - │ - 5 │ 5 + #prop; - │ ^^^^^ + 3 │ test() { + 4 │ #prop in #prop in this; + > 5 │ 5 + #prop; + │ ^^^^^ + 6 │ #prop + 7 │ #prop + 5; -- private_name_presence_check_recursive.js:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ private_name_presence_check_recursive.js:6:4 - │ - 6 │ #prop - │ ^^^^^ + 4 │ #prop in #prop in this; + 5 │ 5 + #prop; + > 6 │ #prop + │ ^^^^^ + 7 │ #prop + 5; + 8 │ } -- private_name_presence_check_recursive.js:7:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression - ┌─ private_name_presence_check_recursive.js:7:4 - │ - 7 │ #prop + 5; - │ ^^^^^ + 5 │ 5 + #prop; + 6 │ #prop + > 7 │ #prop + 5; + │ ^^^^^ + 8 │ } + 9 │ } -- class A { diff --git a/crates/rome_js_parser/test_data/inline/err/private_name_with_space.rast b/crates/rome_js_parser/test_data/inline/err/private_name_with_space.rast index c682fe85464..f0c0954e621 100644 --- a/crates/rome_js_parser/test_data/inline/err/private_name_with_space.rast +++ b/crates/rome_js_parser/test_data/inline/err/private_name_with_space.rast @@ -77,20 +77,22 @@ private_name_with_space.js:2:3 parse ━━━━━━━━━━━━━━ × remove the space here - ┌─ private_name_with_space.js:2:3 - │ - 2 │ # test; - │ ^ + 1 │ class A { + > 2 │ # test; + │ ^ + 3 │ } + 4 │ -- private_name_with_space.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none - ┌─ private_name_with_space.js:2:2 - │ - 2 │ # test; - │ ^ + 1 │ class A { + > 2 │ # test; + │ ^ + 3 │ } + 4 │ -- class A { diff --git a/crates/rome_js_parser/test_data/inline/err/property_assignment_target_err.rast b/crates/rome_js_parser/test_data/inline/err/property_assignment_target_err.rast index 7c91abbd641..86b91fd0528 100644 --- a/crates/rome_js_parser/test_data/inline/err/property_assignment_target_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/property_assignment_target_err.rast @@ -287,10 +287,10 @@ property_assignment_target_err.js:1:3 parse ━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, or a computed property here - ┌─ property_assignment_target_err.js:1:3 - │ - 1 │ ({:y} = {}); - │ ^ + > 1 │ ({:y} = {}); + │ ^ + 2 │ ({=y} = {}); + 3 │ ({:="test"} = {}); -- property_assignment_target_err.js:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -299,10 +299,11 @@ property_assignment_target_err.js:2:3 parse ━━━━━━━━━━━━ × Expected an identifier here - ┌─ property_assignment_target_err.js:2:3 - │ - 2 │ ({=y} = {}); - │ ^ + 1 │ ({:y} = {}); + > 2 │ ({=y} = {}); + │ ^ + 3 │ ({:="test"} = {}); + 4 │ ({:=} = {}); -- property_assignment_target_err.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -311,10 +312,12 @@ property_assignment_target_err.js:3:3 parse ━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, or a computed property here - ┌─ property_assignment_target_err.js:3:3 - │ - 3 │ ({:="test"} = {}); - │ ^ + 1 │ ({:y} = {}); + 2 │ ({=y} = {}); + > 3 │ ({:="test"} = {}); + │ ^ + 4 │ ({:=} = {}); + 5 │ ({ a b } = {}); -- property_assignment_target_err.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -323,10 +326,12 @@ property_assignment_target_err.js:3:4 parse ━━━━━━━━━━━━ × Expected an identifier, or an assignment target here - ┌─ property_assignment_target_err.js:3:4 - │ - 3 │ ({:="test"} = {}); - │ ^ + 1 │ ({:y} = {}); + 2 │ ({=y} = {}); + > 3 │ ({:="test"} = {}); + │ ^ + 4 │ ({:=} = {}); + 5 │ ({ a b } = {}); -- property_assignment_target_err.js:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -335,10 +340,12 @@ property_assignment_target_err.js:4:3 parse ━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, or a computed property here - ┌─ property_assignment_target_err.js:4:3 - │ - 4 │ ({:=} = {}); - │ ^ + 2 │ ({=y} = {}); + 3 │ ({:="test"} = {}); + > 4 │ ({:=} = {}); + │ ^ + 5 │ ({ a b } = {}); + 6 │ -- property_assignment_target_err.js:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -347,10 +354,12 @@ property_assignment_target_err.js:4:4 parse ━━━━━━━━━━━━ × Expected an identifier, or an assignment target here - ┌─ property_assignment_target_err.js:4:4 - │ - 4 │ ({:=} = {}); - │ ^ + 2 │ ({=y} = {}); + 3 │ ({:="test"} = {}); + > 4 │ ({:=} = {}); + │ ^ + 5 │ ({ a b } = {}); + 6 │ -- property_assignment_target_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -359,10 +368,12 @@ property_assignment_target_err.js:4:5 parse ━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ property_assignment_target_err.js:4:5 - │ - 4 │ ({:=} = {}); - │ ^ + 2 │ ({=y} = {}); + 3 │ ({:="test"} = {}); + > 4 │ ({:=} = {}); + │ ^ + 5 │ ({ a b } = {}); + 6 │ -- property_assignment_target_err.js:5:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -371,10 +382,11 @@ property_assignment_target_err.js:5:6 parse ━━━━━━━━━━━━ × unexpected - ┌─ property_assignment_target_err.js:5:6 - │ - 5 │ ({ a b } = {}); - │ ^ + 3 │ ({:="test"} = {}); + 4 │ ({:=} = {}); + > 5 │ ({ a b } = {}); + │ ^ + 6 │ -- ({:y} = {}); diff --git a/crates/rome_js_parser/test_data/inline/err/rest_property_assignment_target_err.rast b/crates/rome_js_parser/test_data/inline/err/rest_property_assignment_target_err.rast index 8514407b7e5..75e74e9c110 100644 --- a/crates/rome_js_parser/test_data/inline/err/rest_property_assignment_target_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/rest_property_assignment_target_err.rast @@ -281,10 +281,10 @@ rest_property_assignment_target_err.js:1:8 parse ━━━━━━━━━━ × Expected an identifier, or an assignment target here - ┌─ rest_property_assignment_target_err.js:1:8 - │ - 1 │ ({ ... } = a); - │ ^ + > 1 │ ({ ... } = a); + │ ^ + 2 │ ({ ...c = "default" } = a); + 3 │ ({ ...{a} } = b); -- rest_property_assignment_target_err.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -293,27 +293,31 @@ rest_property_assignment_target_err.js:2:9 parse ━━━━━━━━━━ × Remove the default value here - ┌─ rest_property_assignment_target_err.js:2:9 - │ - 2 │ ({ ...c = "default" } = a); - │ ^^^^^^^^^^^^ + 1 │ ({ ... } = a); + > 2 │ ({ ...c = "default" } = a); + │ ^^^^^^^^^^^^ + 3 │ ({ ...{a} } = b); + 4 │ ({ ...rest, other_assignment } = a); i Rest element - ┌─ rest_property_assignment_target_err.js:2:4 - │ - 2 │ ({ ...c = "default" } = a); - │ ^^^^ + 1 │ ({ ... } = a); + > 2 │ ({ ...c = "default" } = a); + │ ^^^^ + 3 │ ({ ...{a} } = b); + 4 │ ({ ...rest, other_assignment } = a); -- rest_property_assignment_target_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × object and array assignment targets are not allowed in rest patterns - ┌─ rest_property_assignment_target_err.js:3:7 - │ - 3 │ ({ ...{a} } = b); - │ ^^^ + 1 │ ({ ... } = a); + 2 │ ({ ...c = "default" } = a); + > 3 │ ({ ...{a} } = b); + │ ^^^ + 4 │ ({ ...rest, other_assignment } = a); + 5 │ ({ ...rest, } = a); -- rest_property_assignment_target_err.js:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -322,10 +326,12 @@ rest_property_assignment_target_err.js:4:4 parse ━━━━━━━━━━ × Move the rest element to the end of the pattern, right before the closing '}' - ┌─ rest_property_assignment_target_err.js:4:4 - │ - 4 │ ({ ...rest, other_assignment } = a); - │ ^^^^^^^ + 2 │ ({ ...c = "default" } = a); + 3 │ ({ ...{a} } = b); + > 4 │ ({ ...rest, other_assignment } = a); + │ ^^^^^^^ + 5 │ ({ ...rest, } = a); + 6 │ -- rest_property_assignment_target_err.js:5:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -334,17 +340,19 @@ rest_property_assignment_target_err.js:5:11 parse ━━━━━━━━━━ × Remove the trailing comma here - ┌─ rest_property_assignment_target_err.js:5:11 - │ - 5 │ ({ ...rest, } = a); - │ ^ + 3 │ ({ ...{a} } = b); + 4 │ ({ ...rest, other_assignment } = a); + > 5 │ ({ ...rest, } = a); + │ ^ + 6 │ i Rest element - ┌─ rest_property_assignment_target_err.js:5:4 - │ - 5 │ ({ ...rest, } = a); - │ ^^^^^^^ + 3 │ ({ ...{a} } = b); + 4 │ ({ ...rest, other_assignment } = a); + > 5 │ ({ ...rest, } = a); + │ ^^^^^^^ + 6 │ -- ({ ... } = a); diff --git a/crates/rome_js_parser/test_data/inline/err/rest_property_binding_err.rast b/crates/rome_js_parser/test_data/inline/err/rest_property_binding_err.rast index 52255153c85..15923d89994 100644 --- a/crates/rome_js_parser/test_data/inline/err/rest_property_binding_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/rest_property_binding_err.rast @@ -403,10 +403,10 @@ rest_property_binding_err.js:1:11 parse ━━━━━━━━━━━━━ × Expected an identifier here - ┌─ rest_property_binding_err.js:1:11 - │ - 1 │ let { ... } = a; - │ ^ + > 1 │ let { ... } = a; + │ ^ + 2 │ let { ...c = "default" } = a; + 3 │ let { ...{a} } = b; -- rest_property_binding_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -415,17 +415,19 @@ rest_property_binding_err.js:2:12 parse ━━━━━━━━━━━━━ × Remove the default value here - ┌─ rest_property_binding_err.js:2:12 - │ - 2 │ let { ...c = "default" } = a; - │ ^^^^^^^^^^^^ + 1 │ let { ... } = a; + > 2 │ let { ...c = "default" } = a; + │ ^^^^^^^^^^^^ + 3 │ let { ...{a} } = b; + 4 │ let { ...rest, other_assignment } = a; i Rest element - ┌─ rest_property_binding_err.js:2:7 - │ - 2 │ let { ...c = "default" } = a; - │ ^^^^ + 1 │ let { ... } = a; + > 2 │ let { ...c = "default" } = a; + │ ^^^^ + 3 │ let { ...{a} } = b; + 4 │ let { ...rest, other_assignment } = a; -- rest_property_binding_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -434,10 +436,12 @@ rest_property_binding_err.js:3:10 parse ━━━━━━━━━━━━━ × Object rest patterns must bind to an identifier, other patterns are not allowed. - ┌─ rest_property_binding_err.js:3:10 - │ - 3 │ let { ...{a} } = b; - │ ^^^ + 1 │ let { ... } = a; + 2 │ let { ...c = "default" } = a; + > 3 │ let { ...{a} } = b; + │ ^^^ + 4 │ let { ...rest, other_assignment } = a; + 5 │ let { ...rest2, } = a; -- rest_property_binding_err.js:4:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -446,10 +450,12 @@ rest_property_binding_err.js:4:7 parse ━━━━━━━━━━━━━ × Move the rest element to the end of the pattern, right before the closing '}' - ┌─ rest_property_binding_err.js:4:7 - │ - 4 │ let { ...rest, other_assignment } = a; - │ ^^^^^^^ + 2 │ let { ...c = "default" } = a; + 3 │ let { ...{a} } = b; + > 4 │ let { ...rest, other_assignment } = a; + │ ^^^^^^^ + 5 │ let { ...rest2, } = a; + 6 │ async function test() { -- rest_property_binding_err.js:5:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -458,27 +464,33 @@ rest_property_binding_err.js:5:15 parse ━━━━━━━━━━━━━ × Remove the trailing comma here - ┌─ rest_property_binding_err.js:5:15 - │ - 5 │ let { ...rest2, } = a; - │ ^ + 3 │ let { ...{a} } = b; + 4 │ let { ...rest, other_assignment } = a; + > 5 │ let { ...rest2, } = a; + │ ^ + 6 │ async function test() { + 7 │ let { ...await } = a; i Rest element - ┌─ rest_property_binding_err.js:5:7 - │ - 5 │ let { ...rest2, } = a; - │ ^^^^^^^^ + 3 │ let { ...{a} } = b; + 4 │ let { ...rest, other_assignment } = a; + > 5 │ let { ...rest2, } = a; + │ ^^^^^^^^ + 6 │ async function test() { + 7 │ let { ...await } = a; -- rest_property_binding_err.js:7:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context - ┌─ rest_property_binding_err.js:7:12 - │ - 7 │ let { ...await } = a; - │ ^^^^^ + 5 │ let { ...rest2, } = a; + 6 │ async function test() { + > 7 │ let { ...await } = a; + │ ^^^^^ + 8 │ } + 9 │ -- let { ... } = a; diff --git a/crates/rome_js_parser/test_data/inline/err/return_stmt_err.rast b/crates/rome_js_parser/test_data/inline/err/return_stmt_err.rast index 58b833e23ed..257db701753 100644 --- a/crates/rome_js_parser/test_data/inline/err/return_stmt_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/return_stmt_err.rast @@ -42,20 +42,20 @@ return_stmt_err.js:1:1 parse ━━━━━━━━━━━━━━━━━ × Illegal return statement outside of a function - ┌─ return_stmt_err.js:1:1 - │ - 1 │ return; - │ ^^^^^^^ + > 1 │ return; + │ ^^^^^^^ + 2 │ return foo; + 3 │ -- return_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal return statement outside of a function - ┌─ return_stmt_err.js:2:1 - │ - 2 │ return foo; - │ ^^^^^^^^^^^ + 1 │ return; + > 2 │ return foo; + │ ^^^^^^^^^^^ + 3 │ -- return; diff --git a/crates/rome_js_parser/test_data/inline/err/semicolons_err.rast b/crates/rome_js_parser/test_data/inline/err/semicolons_err.rast index eab3cc892c7..d4e03bd9df9 100644 --- a/crates/rome_js_parser/test_data/inline/err/semicolons_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/semicolons_err.rast @@ -69,17 +69,15 @@ semicolons_err.js:1:15 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ semicolons_err.js:1:15 - │ - 1 │ let foo = bar throw foo - │ ^^^^^ + > 1 │ let foo = bar throw foo + │ ^^^^^ + 2 │ i ...Which is required to end this statement - ┌─ semicolons_err.js:1:1 - │ - 1 │ let foo = bar throw foo - │ ^^^^^^^^^^^^^^ + > 1 │ let foo = bar throw foo + │ ^^^^^^^^^^^^^^ + 2 │ -- let foo = bar throw foo diff --git a/crates/rome_js_parser/test_data/inline/err/sequence_expr.rast b/crates/rome_js_parser/test_data/inline/err/sequence_expr.rast index 937045f8ab9..1c601317b14 100644 --- a/crates/rome_js_parser/test_data/inline/err/sequence_expr.rast +++ b/crates/rome_js_parser/test_data/inline/err/sequence_expr.rast @@ -55,10 +55,9 @@ sequence_expr.js:1:7 parse ━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ sequence_expr.js:1:7 - │ - 1 │ 1, 2, , 4 - │ ^ + > 1 │ 1, 2, , 4 + │ ^ + 2 │ -- 1, 2, , 4 diff --git a/crates/rome_js_parser/test_data/inline/err/setter_class_member.rast b/crates/rome_js_parser/test_data/inline/err/setter_class_member.rast index 48c5789bc95..bab7d695c52 100644 --- a/crates/rome_js_parser/test_data/inline/err/setter_class_member.rast +++ b/crates/rome_js_parser/test_data/inline/err/setter_class_member.rast @@ -72,10 +72,11 @@ setter_class_member.js:2:11 parse ━━━━━━━━━━━━━━━ × Expected a parameter here - ┌─ setter_class_member.js:2:11 - │ - 2 │ set foo() {} - │ ^ + 1 │ class Setters { + > 2 │ set foo() {} + │ ^ + 3 │ } + 4 │ -- class Setters { diff --git a/crates/rome_js_parser/test_data/inline/err/setter_class_no_body.rast b/crates/rome_js_parser/test_data/inline/err/setter_class_no_body.rast index b86284a9230..d980076e643 100644 --- a/crates/rome_js_parser/test_data/inline/err/setter_class_no_body.rast +++ b/crates/rome_js_parser/test_data/inline/err/setter_class_no_body.rast @@ -75,10 +75,11 @@ setter_class_no_body.js:3:1 parse ━━━━━━━━━━━━━━━ × Expected a class method body here - ┌─ setter_class_no_body.js:3:1 - │ - 3 │ } - │ ^ + 1 │ class Setters { + 2 │ set foo(a) + > 3 │ } + │ ^ + 4 │ -- class Setters { diff --git a/crates/rome_js_parser/test_data/inline/err/spread.rast b/crates/rome_js_parser/test_data/inline/err/spread.rast index d0dcfbd6d94..42bceaf8397 100644 --- a/crates/rome_js_parser/test_data/inline/err/spread.rast +++ b/crates/rome_js_parser/test_data/inline/err/spread.rast @@ -40,10 +40,9 @@ spread.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ spread.js:1:5 - │ - 1 │ [...] - │ ^ + > 1 │ [...] + │ ^ + 2 │ -- [...] diff --git a/crates/rome_js_parser/test_data/inline/err/statements_closing_curly.rast b/crates/rome_js_parser/test_data/inline/err/statements_closing_curly.rast index 078540d437a..8c11a3941c8 100644 --- a/crates/rome_js_parser/test_data/inline/err/statements_closing_curly.rast +++ b/crates/rome_js_parser/test_data/inline/err/statements_closing_curly.rast @@ -63,17 +63,19 @@ statements_closing_curly.js:2:7 parse ━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ statements_closing_curly.js:2:7 - │ - 2 │ "name": "troublesome-lib", - │ ^ + 1 │ { + > 2 │ "name": "troublesome-lib", + │ ^ + 3 │ "typings": "lib/index.d.ts", + 4 │ "version": "0.0.1" i ...Which is required to end this statement - ┌─ statements_closing_curly.js:2:1 - │ - 2 │ "name": "troublesome-lib", - │ ^^^^^^^ + 1 │ { + > 2 │ "name": "troublesome-lib", + │ ^^^^^^^ + 3 │ "typings": "lib/index.d.ts", + 4 │ "version": "0.0.1" -- { diff --git a/crates/rome_js_parser/test_data/inline/err/subscripts_err.rast b/crates/rome_js_parser/test_data/inline/err/subscripts_err.rast index 22017f1de39..65fecee89e1 100644 --- a/crates/rome_js_parser/test_data/inline/err/subscripts_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/subscripts_err.rast @@ -105,10 +105,10 @@ subscripts_err.js:1:12 parse ━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ subscripts_err.js:1:12 - │ - 1 │ foo()?.baz[].; - │ ^ + > 1 │ foo()?.baz[].; + │ ^ + 2 │ BAR`b + 3 │ -- subscripts_err.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -117,22 +117,21 @@ subscripts_err.js:1:14 parse ━━━━━━━━━━━━━━━━━ × Expected an identifier here - ┌─ subscripts_err.js:1:14 - │ - 1 │ foo()?.baz[].; - │ ^ + > 1 │ foo()?.baz[].; + │ ^ + 2 │ BAR`b + 3 │ -- subscripts_err.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unterminated template literal - ┌─ subscripts_err.js:2:5 - │ - 2 │ BAR`b - │ ┌─────^ - 3 │ │ - │ └^ + 1 │ foo()?.baz[].; + > 2 │ BAR`b + │ ^ + > 3 │ + │ -- foo()?.baz[].; diff --git a/crates/rome_js_parser/test_data/inline/err/super_expression_err.rast b/crates/rome_js_parser/test_data/inline/err/super_expression_err.rast index 68fe2887821..1551575ff1c 100644 --- a/crates/rome_js_parser/test_data/inline/err/super_expression_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/super_expression_err.rast @@ -189,30 +189,35 @@ super_expression_err.js:3:5 parse ━━━━━━━━━━━━━━━ × `super` is only valid inside of a class constructor of a subclass. - ┌─ super_expression_err.js:3:5 - │ - 3 │ super(); - │ ^^^^^ + 1 │ class Test extends B { + 2 │ test() { + > 3 │ super(); + │ ^^^^^ + 4 │ super?.test(); + 5 │ } -- super_expression_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Super doesn't support optional chaining as super can never be null - ┌─ super_expression_err.js:4:5 - │ - 4 │ super?.test(); - │ ^^^^^ + 2 │ test() { + 3 │ super(); + > 4 │ super?.test(); + │ ^^^^^ + 5 │ } + 6 │ } -- super_expression_err.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `super` is only valid inside of a class constructor of a subclass. - ┌─ super_expression_err.js:7:1 - │ - 7 │ super(); - │ ^^^^^ + 5 │ } + 6 │ } + > 7 │ super(); + │ ^^^^^ + 8 │ -- class Test extends B { diff --git a/crates/rome_js_parser/test_data/inline/err/switch_stmt_err.rast b/crates/rome_js_parser/test_data/inline/err/switch_stmt_err.rast index 91b91bbbcd0..eb77ef62aba 100644 --- a/crates/rome_js_parser/test_data/inline/err/switch_stmt_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/switch_stmt_err.rast @@ -274,10 +274,10 @@ switch_stmt_err.js:1:8 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ switch_stmt_err.js:1:8 - │ - 1 │ switch foo {} - │ ^^^ + > 1 │ switch foo {} + │ ^^^ + 2 │ switch {} + 3 │ switch { var i = 0 } -- switch_stmt_err.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -286,10 +286,10 @@ switch_stmt_err.js:1:12 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ switch_stmt_err.js:1:12 - │ - 1 │ switch foo {} - │ ^ + > 1 │ switch foo {} + │ ^ + 2 │ switch {} + 3 │ switch { var i = 0 } -- switch_stmt_err.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -298,10 +298,11 @@ switch_stmt_err.js:2:8 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ switch_stmt_err.js:2:8 - │ - 2 │ switch {} - │ ^ + 1 │ switch foo {} + > 2 │ switch {} + │ ^ + 3 │ switch { var i = 0 } + 4 │ switch { var i = 0; case "bar": {} } -- switch_stmt_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -310,10 +311,12 @@ switch_stmt_err.js:3:8 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ switch_stmt_err.js:3:8 - │ - 3 │ switch { var i = 0 } - │ ^ + 1 │ switch foo {} + 2 │ switch {} + > 3 │ switch { var i = 0 } + │ ^ + 4 │ switch { var i = 0; case "bar": {} } + 5 │ switch (foo) { -- switch_stmt_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -322,10 +325,12 @@ switch_stmt_err.js:3:10 parse ━━━━━━━━━━━━━━━━ × Expected a default, or a case here - ┌─ switch_stmt_err.js:3:10 - │ - 3 │ switch { var i = 0 } - │ ^^^^^^^^^ + 1 │ switch foo {} + 2 │ switch {} + > 3 │ switch { var i = 0 } + │ ^^^^^^^^^ + 4 │ switch { var i = 0; case "bar": {} } + 5 │ switch (foo) { -- switch_stmt_err.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -334,10 +339,12 @@ switch_stmt_err.js:4:8 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ switch_stmt_err.js:4:8 - │ - 4 │ switch { var i = 0; case "bar": {} } - │ ^ + 2 │ switch {} + 3 │ switch { var i = 0 } + > 4 │ switch { var i = 0; case "bar": {} } + │ ^ + 5 │ switch (foo) { + 6 │ default: {} -- switch_stmt_err.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -346,10 +353,12 @@ switch_stmt_err.js:4:10 parse ━━━━━━━━━━━━━━━━ × Expected a default, or a case here - ┌─ switch_stmt_err.js:4:10 - │ - 4 │ switch { var i = 0; case "bar": {} } - │ ^^^^^^^^^^ + 2 │ switch {} + 3 │ switch { var i = 0 } + > 4 │ switch { var i = 0; case "bar": {} } + │ ^^^^^^^^^^ + 5 │ switch (foo) { + 6 │ default: {} -- switch_stmt_err.js:7:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -358,17 +367,21 @@ switch_stmt_err.js:7:3 parse ━━━━━━━━━━━━━━━━━ × a second clause here is not allowed - ┌─ switch_stmt_err.js:7:3 - │ - 7 │ default: {} - │ ^^^^^^^^^^^ + 5 │ switch (foo) { + 6 │ default: {} + > 7 │ default: {} + │ ^^^^^^^^^^^ + 8 │ } + 9 │ switch (foo) { case : } i the first default clause is defined here - ┌─ switch_stmt_err.js:6:3 - │ - 6 │ default: {} - │ ^^^^^^^^^^^ + 4 │ switch { var i = 0; case "bar": {} } + 5 │ switch (foo) { + > 6 │ default: {} + │ ^^^^^^^^^^^ + 7 │ default: {} + 8 │ } -- switch_stmt_err.js:9:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -377,10 +390,11 @@ switch_stmt_err.js:9:21 parse ━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ switch_stmt_err.js:9:21 - │ - 9 │ switch (foo) { case : } - │ ^ + 7 │ default: {} + 8 │ } + > 9 │ switch (foo) { case : } + │ ^ + 10 │ -- switch foo {} diff --git a/crates/rome_js_parser/test_data/inline/err/template_after_optional_chain.rast b/crates/rome_js_parser/test_data/inline/err/template_after_optional_chain.rast index 6e97379d32c..696ff6e7d23 100644 --- a/crates/rome_js_parser/test_data/inline/err/template_after_optional_chain.rast +++ b/crates/rome_js_parser/test_data/inline/err/template_after_optional_chain.rast @@ -188,30 +188,32 @@ template_after_optional_chain.js:1:1 parse ━━━━━━━━━━━━ × Tagged template expressions are not permitted in an optional chain. - ┌─ template_after_optional_chain.js:1:1 - │ - 1 │ obj.val?.prop`template` - │ ^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ obj.val?.prop`template` + │ ^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ obj.val?.[expr]`template` + 3 │ obj.func?.(args)`template` -- template_after_optional_chain.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Tagged template expressions are not permitted in an optional chain. - ┌─ template_after_optional_chain.js:2:1 - │ - 2 │ obj.val?.[expr]`template` - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ obj.val?.prop`template` + > 2 │ obj.val?.[expr]`template` + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ obj.func?.(args)`template` + 4 │ -- template_after_optional_chain.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Tagged template expressions are not permitted in an optional chain. - ┌─ template_after_optional_chain.js:3:1 - │ - 3 │ obj.func?.(args)`template` - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ obj.val?.prop`template` + 2 │ obj.val?.[expr]`template` + > 3 │ obj.func?.(args)`template` + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ -- obj.val?.prop`template` diff --git a/crates/rome_js_parser/test_data/inline/err/template_literal.rast b/crates/rome_js_parser/test_data/inline/err/template_literal.rast index f339b261678..683b5441a46 100644 --- a/crates/rome_js_parser/test_data/inline/err/template_literal.rast +++ b/crates/rome_js_parser/test_data/inline/err/template_literal.rast @@ -140,10 +140,10 @@ template_literal.js:1:16 parse ━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ template_literal.js:1:16 - │ - 1 │ let a = `foo ${}` - │ ^ + > 1 │ let a = `foo ${}` + │ ^ + 2 │ let b = `${a a}` + 3 │ -- template_literal.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -152,10 +152,10 @@ template_literal.js:2:14 parse ━━━━━━━━━━━━━━━━ × unexpected - ┌─ template_literal.js:2:14 - │ - 2 │ let b = `${a a}` - │ ^ + 1 │ let a = `foo ${}` + > 2 │ let b = `${a a}` + │ ^ + 3 │ -- let a = `foo ${}` diff --git a/crates/rome_js_parser/test_data/inline/err/template_literal_unterminated.rast b/crates/rome_js_parser/test_data/inline/err/template_literal_unterminated.rast index fd85827e7c9..7eb11c03362 100644 --- a/crates/rome_js_parser/test_data/inline/err/template_literal_unterminated.rast +++ b/crates/rome_js_parser/test_data/inline/err/template_literal_unterminated.rast @@ -78,12 +78,10 @@ template_literal_unterminated.js:1:16 parse ━━━━━━━━━━━━ × unterminated template literal - ┌─ template_literal_unterminated.js:1:16 - │ - 1 │ let a = `${foo} bar - │ ┌────────────────^ - 2 │ │ - │ └^ + > 1 │ let a = `${foo} bar + │ ^^^^ + > 2 │ + │ -- let a = `${foo} bar diff --git a/crates/rome_js_parser/test_data/inline/err/throw_stmt_err.rast b/crates/rome_js_parser/test_data/inline/err/throw_stmt_err.rast index 6233a476f31..b1f999d9f01 100644 --- a/crates/rome_js_parser/test_data/inline/err/throw_stmt_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/throw_stmt_err.rast @@ -71,17 +71,19 @@ throw_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━ × A linebreak is not allowed here - ┌─ throw_stmt_err.js:2:1 - │ - 2 │ new Error("oh no :(") - │ ^^^ + 1 │ throw + > 2 │ new Error("oh no :(") + │ ^^^ + 3 │ throw; + 4 │ i Help: did you mean to throw this? - ┌─ throw_stmt_err.js:2:1 - │ - 2 │ new Error("oh no :(") - │ ^^^ + 1 │ throw + > 2 │ new Error("oh no :(") + │ ^^^ + 3 │ throw; + 4 │ -- throw_stmt_err.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -90,10 +92,11 @@ throw_stmt_err.js:3:6 parse ━━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ throw_stmt_err.js:3:6 - │ - 3 │ throw; - │ ^ + 1 │ throw + 2 │ new Error("oh no :(") + > 3 │ throw; + │ ^ + 4 │ -- throw diff --git a/crates/rome_js_parser/test_data/inline/err/ts_abstract_member_ansi.rast b/crates/rome_js_parser/test_data/inline/err/ts_abstract_member_ansi.rast index a5859c7d305..8d6974deda4 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_abstract_member_ansi.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_abstract_member_ansi.rast @@ -191,50 +191,45 @@ ts_abstract_member_ansi.ts:1:43 parse ━━━━━━━━━━━━━━ × Expected a class method body here - ┌─ ts_abstract_member_ansi.ts:1:43 - │ - 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } - │ ^^^^^^^^ + > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } + │ ^^^^^^^^ + 2 │ -- ts_abstract_member_ansi.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' cannot appear on a constructor declaration. - ┌─ ts_abstract_member_ansi.ts:1:20 - │ - 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } - │ ^^^^^^^^ + > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } + │ ^^^^^^^^ + 2 │ -- ts_abstract_member_ansi.ts:1:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the method declaration, but found none - ┌─ ts_abstract_member_ansi.ts:1:43 - │ - 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } - │ ^^^^^^^^^^^^^^^^^ + > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } + │ ^^^^^^^^^^^^^^^^^ + 2 │ -- ts_abstract_member_ansi.ts:1:61 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the method declaration, but found none - ┌─ ts_abstract_member_ansi.ts:1:61 - │ - 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } - │ ^^^^^^^^^^^^^^^^^^^^^ + > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } + │ ^^^^^^^^^^^^^^^^^^^^^ + 2 │ -- ts_abstract_member_ansi.ts:1:83 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the method declaration, but found none - ┌─ ts_abstract_member_ansi.ts:1:83 - │ - 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ -- abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } diff --git a/crates/rome_js_parser/test_data/inline/err/ts_abstract_property_cannot_be_definite.rast b/crates/rome_js_parser/test_data/inline/err/ts_abstract_property_cannot_be_definite.rast index 4caf3ca59a8..63b7b2d66d9 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_abstract_property_cannot_be_definite.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_abstract_property_cannot_be_definite.rast @@ -78,10 +78,11 @@ ts_abstract_property_cannot_be_definite.ts:2:19 parse ━━━━━━━━ × A definite assignment operator '!' cannot appear on an 'abstract' property. - ┌─ ts_abstract_property_cannot_be_definite.ts:2:19 - │ - 2 │ abstract name!: string; - │ ^ + 1 │ abstract class A { + > 2 │ abstract name!: string; + │ ^ + 3 │ } + 4 │ -- abstract class A { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.rast b/crates/rome_js_parser/test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.rast index 9f489ceffa9..b5c38083426 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.rast @@ -81,10 +81,11 @@ ts_abstract_property_cannot_have_initiliazers.ts:2:27 parse ━━━━━━ × Property cannot have an initializer because it is marked abstract. - ┌─ ts_abstract_property_cannot_have_initiliazers.ts:2:27 - │ - 2 │ abstract name: string = ""; - │ ^^^^ + 1 │ abstract class A { + > 2 │ abstract name: string = ""; + │ ^^^^ + 3 │ } + 4 │ -- abstract class A { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_ambient_async_method.rast b/crates/rome_js_parser/test_data/inline/err/ts_ambient_async_method.rast index 207767ff39a..676e989e5f3 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_ambient_async_method.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_ambient_async_method.rast @@ -69,10 +69,9 @@ ts_ambient_async_method.ts:1:19 parse ━━━━━━━━━━━━━━ × 'async' modifier cannot be used in an ambient context. - ┌─ ts_ambient_async_method.ts:1:19 - │ - 1 │ declare class A { async method(); } - │ ^^^^^^^^^^^^^^^ + > 1 │ declare class A { async method(); } + │ ^^^^^^^^^^^^^^^ + 2 │ -- declare class A { async method(); } diff --git a/crates/rome_js_parser/test_data/inline/err/ts_ambient_context_semi.rast b/crates/rome_js_parser/test_data/inline/err/ts_ambient_context_semi.rast index 0421ac0e48f..60a588b9bb3 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_ambient_context_semi.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_ambient_context_semi.rast @@ -133,20 +133,18 @@ ts_ambient_context_semi.ts:1:19 parse ━━━━━━━━━━━━━━ × expected a semicolon to end the method declaration, but found none - ┌─ ts_ambient_context_semi.ts:1:19 - │ - 1 │ declare class A { method() method2() method3() } - │ ^^^^^^^^ + > 1 │ declare class A { method() method2() method3() } + │ ^^^^^^^^ + 2 │ -- ts_ambient_context_semi.ts:1:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the method declaration, but found none - ┌─ ts_ambient_context_semi.ts:1:28 - │ - 1 │ declare class A { method() method2() method3() } - │ ^^^^^^^^^ + > 1 │ declare class A { method() method2() method3() } + │ ^^^^^^^^^ + 2 │ -- declare class A { method() method2() method3() } diff --git a/crates/rome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.rast b/crates/rome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.rast index 09086fbc798..de3f79d9d8c 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.rast @@ -93,10 +93,9 @@ ts_arrow_function_this_parameter.ts:1:10 parse ━━━━━━━━━━━ × An arrow function cannot have a 'this' parameter. - ┌─ ts_arrow_function_this_parameter.ts:1:10 - │ - 1 │ let a = (this: string) => {} - │ ^^^^^^^^^^^^ + > 1 │ let a = (this: string) => {} + │ ^^^^^^^^^^^^ + 2 │ -- let a = (this: string) => {} diff --git a/crates/rome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.rast b/crates/rome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.rast index 346c0ca7b37..d7d065c4e67 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.rast @@ -172,10 +172,12 @@ ts_as_assignment_no_parenthesize.ts:3:2 parse ━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ ts_as_assignment_no_parenthesize.ts:3:2 - │ - 3 │ (a() as string) = "string"; - │ ^^^ + 1 │ let a: any; + 2 │ a as string = "string"; + > 3 │ (a() as string) = "string"; + │ ^^^ + 4 │ a = 3; + 5 │ -- ts_as_assignment_no_parenthesize.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -184,10 +186,11 @@ ts_as_assignment_no_parenthesize.ts:4:1 parse ━━━━━━━━━━━ × This expression cannot be assigned to - ┌─ ts_as_assignment_no_parenthesize.ts:4:1 - │ - 4 │ a = 3; - │ ^^^^^^^^^^ + 2 │ a as string = "string"; + 3 │ (a() as string) = "string"; + > 4 │ a = 3; + │ ^^^^^^^^^^ + 5 │ -- let a: any; diff --git a/crates/rome_js_parser/test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.rast b/crates/rome_js_parser/test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.rast index e6e2c2fc869..40b9e0bce77 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.rast @@ -71,10 +71,9 @@ ts_catch_declaration_non_any_unknown_type_annotation.ts:1:22 parse ━━━━ × Catch clause variable type annotation must be 'any' or 'unknown' if specified. - ┌─ ts_catch_declaration_non_any_unknown_type_annotation.ts:1:22 - │ - 1 │ try {} catch (error: Error) {} - │ ^^^^^ + > 1 │ try {} catch (error: Error) {} + │ ^^^^^ + 2 │ -- try {} catch (error: Error) {} diff --git a/crates/rome_js_parser/test_data/inline/err/ts_class_declare_modifier_error.rast b/crates/rome_js_parser/test_data/inline/err/ts_class_declare_modifier_error.rast index f3092d28cca..45e5bb870cb 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_class_declare_modifier_error.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_class_declare_modifier_error.rast @@ -315,60 +315,71 @@ ts_class_declare_modifier_error.ts:2:5 parse ━━━━━━━━━━━ × 'declare' modifier is only allowed on properties. - ┌─ ts_class_declare_modifier_error.ts:2:5 - │ - 2 │ declare method(): string; - │ ^^^^^^^ + 1 │ class Test { + > 2 │ declare method(): string; + │ ^^^^^^^ + 3 │ declare constructor(declare readonly prop) {} + 4 │ declare get test() { return "a" } -- ts_class_declare_modifier_error.ts:3:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' cannot appear on a parameter. - ┌─ ts_class_declare_modifier_error.ts:3:25 - │ - 3 │ declare constructor(declare readonly prop) {} - │ ^^^^^^^ + 1 │ class Test { + 2 │ declare method(): string; + > 3 │ declare constructor(declare readonly prop) {} + │ ^^^^^^^ + 4 │ declare get test() { return "a" } + 5 │ declare set test(value: string) {} -- ts_class_declare_modifier_error.ts:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' cannot appear on a constructor declaration. - ┌─ ts_class_declare_modifier_error.ts:3:5 - │ - 3 │ declare constructor(declare readonly prop) {} - │ ^^^^^^^ + 1 │ class Test { + 2 │ declare method(): string; + > 3 │ declare constructor(declare readonly prop) {} + │ ^^^^^^^ + 4 │ declare get test() { return "a" } + 5 │ declare set test(value: string) {} -- ts_class_declare_modifier_error.ts:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' modifier is only allowed on properties. - ┌─ ts_class_declare_modifier_error.ts:4:5 - │ - 4 │ declare get test() { return "a" } - │ ^^^^^^^ + 2 │ declare method(): string; + 3 │ declare constructor(declare readonly prop) {} + > 4 │ declare get test() { return "a" } + │ ^^^^^^^ + 5 │ declare set test(value: string) {} + 6 │ declare [name: string]: string; -- ts_class_declare_modifier_error.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' modifier is only allowed on properties. - ┌─ ts_class_declare_modifier_error.ts:5:5 - │ - 5 │ declare set test(value: string) {} - │ ^^^^^^^ + 3 │ declare constructor(declare readonly prop) {} + 4 │ declare get test() { return "a" } + > 5 │ declare set test(value: string) {} + │ ^^^^^^^ + 6 │ declare [name: string]: string; + 7 │ } -- ts_class_declare_modifier_error.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' modifier cannot appear on an index signature. - ┌─ ts_class_declare_modifier_error.ts:6:5 - │ - 6 │ declare [name: string]: string; - │ ^^^^^^^ + 4 │ declare get test() { return "a" } + 5 │ declare set test(value: string) {} + > 6 │ declare [name: string]: string; + │ ^^^^^^^ + 7 │ } + 8 │ -- class Test { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_class_heritage_clause_errors.rast b/crates/rome_js_parser/test_data/inline/err/ts_class_heritage_clause_errors.rast index a74ee362fca..34263e4cd2d 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_class_heritage_clause_errors.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_class_heritage_clause_errors.rast @@ -260,62 +260,75 @@ ts_class_heritage_clause_errors.ts:3:24 parse ━━━━━━━━━━━ × 'extends' clause must precede 'implements' clause. - ┌─ ts_class_heritage_clause_errors.ts:3:24 - │ - 3 │ class B implements Int extends A {} - │ ^^^^^^^^^ + 1 │ class A {} + 2 │ interface Int {} + > 3 │ class B implements Int extends A {} + │ ^^^^^^^^^ + 4 │ class C implements Int implements Int {} + 5 │ class D implements {} - ┌─ ts_class_heritage_clause_errors.ts:3:9 - │ - 3 │ class B implements Int extends A {} - │ ^^^^^^^^^^^^^^ + 1 │ class A {} + 2 │ interface Int {} + > 3 │ class B implements Int extends A {} + │ ^^^^^^^^^^^^^^ + 4 │ class C implements Int implements Int {} + 5 │ class D implements {} -- ts_class_heritage_clause_errors.ts:4:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'implements' clause already seen. - ┌─ ts_class_heritage_clause_errors.ts:4:24 - │ - 4 │ class C implements Int implements Int {} - │ ^^^^^^^^^^^^^^ + 2 │ interface Int {} + 3 │ class B implements Int extends A {} + > 4 │ class C implements Int implements Int {} + │ ^^^^^^^^^^^^^^ + 5 │ class D implements {} + 6 │ class E extends {} i first 'implements' clause - ┌─ ts_class_heritage_clause_errors.ts:4:9 - │ - 4 │ class C implements Int implements Int {} - │ ^^^^^^^^^^^^^^ + 2 │ interface Int {} + 3 │ class B implements Int extends A {} + > 4 │ class C implements Int implements Int {} + │ ^^^^^^^^^^^^^^ + 5 │ class D implements {} + 6 │ class E extends {} -- ts_class_heritage_clause_errors.ts:5:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'implements' list cannot be empty. - ┌─ ts_class_heritage_clause_errors.ts:5:20 - │ - 5 │ class D implements {} - │ ^ + 3 │ class B implements Int extends A {} + 4 │ class C implements Int implements Int {} + > 5 │ class D implements {} + │ + 6 │ class E extends {} + 7 │ class F extends E, {} -- ts_class_heritage_clause_errors.ts:6:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'extends' list cannot be empty. - ┌─ ts_class_heritage_clause_errors.ts:6:16 - │ - 6 │ class E extends {} - │ ^ + 4 │ class C implements Int implements Int {} + 5 │ class D implements {} + > 6 │ class E extends {} + │ + 7 │ class F extends E, {} + 8 │ -- ts_class_heritage_clause_errors.ts:7:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Trailing comma not allowed. - ┌─ ts_class_heritage_clause_errors.ts:7:18 - │ - 7 │ class F extends E, {} - │ ^ + 5 │ class D implements {} + 6 │ class E extends {} + > 7 │ class F extends E, {} + │ ^ + 8 │ -- class A {} diff --git a/crates/rome_js_parser/test_data/inline/err/ts_class_initializer_with_modifiers.rast b/crates/rome_js_parser/test_data/inline/err/ts_class_initializer_with_modifiers.rast index 021ba068e7e..9ccac3c55f3 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_class_initializer_with_modifiers.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_class_initializer_with_modifiers.rast @@ -59,10 +59,11 @@ ts_class_initializer_with_modifiers.ts:2:3 parse ━━━━━━━━━━ × Static class blocks cannot have any modifier. - ┌─ ts_class_initializer_with_modifiers.ts:2:3 - │ - 2 │ public static { } - │ ^^^^^^ + 1 │ class A { + > 2 │ public static { } + │ ^^^^^^ + 3 │ } + 4 │ -- class A { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_class_invalid_modifier_combinations.rast b/crates/rome_js_parser/test_data/inline/err/ts_class_invalid_modifier_combinations.rast index c8f54cebbfd..28a05459eab 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_class_invalid_modifier_combinations.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_class_invalid_modifier_combinations.rast @@ -523,17 +523,21 @@ ts_class_invalid_modifier_combinations.ts:3:14 parse ━━━━━━━━━ × duplicate modifier - ┌─ ts_class_invalid_modifier_combinations.ts:3:14 - │ - 3 │ override override base1; - │ ^^^^^^^^ + 1 │ class Base { base1; base2; } + 2 │ abstract class Test extends Base { + > 3 │ override override base1; + │ ^^^^^^^^ + 4 │ declare declare a; + 5 │ private protected public c; i first seen here - ┌─ ts_class_invalid_modifier_combinations.ts:3:5 - │ - 3 │ override override base1; - │ ^^^^^^^^ + 1 │ class Base { base1; base2; } + 2 │ abstract class Test extends Base { + > 3 │ override override base1; + │ ^^^^^^^^ + 4 │ declare declare a; + 5 │ private protected public c; -- ts_class_invalid_modifier_combinations.ts:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -542,17 +546,21 @@ ts_class_invalid_modifier_combinations.ts:4:13 parse ━━━━━━━━━ × duplicate modifier - ┌─ ts_class_invalid_modifier_combinations.ts:4:13 - │ - 4 │ declare declare a; - │ ^^^^^^^ + 2 │ abstract class Test extends Base { + 3 │ override override base1; + > 4 │ declare declare a; + │ ^^^^^^^ + 5 │ private protected public c; + 6 │ private private d; i first seen here - ┌─ ts_class_invalid_modifier_combinations.ts:4:5 - │ - 4 │ declare declare a; - │ ^^^^^^^ + 2 │ abstract class Test extends Base { + 3 │ override override base1; + > 4 │ declare declare a; + │ ^^^^^^^ + 5 │ private protected public c; + 6 │ private private d; -- ts_class_invalid_modifier_combinations.ts:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -561,17 +569,21 @@ ts_class_invalid_modifier_combinations.ts:5:13 parse ━━━━━━━━━ × duplicate modifier - ┌─ ts_class_invalid_modifier_combinations.ts:5:13 - │ - 5 │ private protected public c; - │ ^^^^^^^^^ + 3 │ override override base1; + 4 │ declare declare a; + > 5 │ private protected public c; + │ ^^^^^^^^^ + 6 │ private private d; + 7 │ protected protected e; i first modifier - ┌─ ts_class_invalid_modifier_combinations.ts:5:5 - │ - 5 │ private protected public c; - │ ^^^^^^^ + 3 │ override override base1; + 4 │ declare declare a; + > 5 │ private protected public c; + │ ^^^^^^^ + 6 │ private private d; + 7 │ protected protected e; -- ts_class_invalid_modifier_combinations.ts:5:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -580,17 +592,21 @@ ts_class_invalid_modifier_combinations.ts:5:23 parse ━━━━━━━━━ × duplicate modifier - ┌─ ts_class_invalid_modifier_combinations.ts:5:23 - │ - 5 │ private protected public c; - │ ^^^^^^ + 3 │ override override base1; + 4 │ declare declare a; + > 5 │ private protected public c; + │ ^^^^^^ + 6 │ private private d; + 7 │ protected protected e; i first modifier - ┌─ ts_class_invalid_modifier_combinations.ts:5:5 - │ - 5 │ private protected public c; - │ ^^^^^^^ + 3 │ override override base1; + 4 │ declare declare a; + > 5 │ private protected public c; + │ ^^^^^^^ + 6 │ private private d; + 7 │ protected protected e; -- ts_class_invalid_modifier_combinations.ts:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -599,17 +615,21 @@ ts_class_invalid_modifier_combinations.ts:6:13 parse ━━━━━━━━━ × duplicate modifier - ┌─ ts_class_invalid_modifier_combinations.ts:6:13 - │ - 6 │ private private d; - │ ^^^^^^^ + 4 │ declare declare a; + 5 │ private protected public c; + > 6 │ private private d; + │ ^^^^^^^ + 7 │ protected protected e; + 8 │ public public f; i first modifier - ┌─ ts_class_invalid_modifier_combinations.ts:6:5 - │ - 6 │ private private d; - │ ^^^^^^^ + 4 │ declare declare a; + 5 │ private protected public c; + > 6 │ private private d; + │ ^^^^^^^ + 7 │ protected protected e; + 8 │ public public f; -- ts_class_invalid_modifier_combinations.ts:7:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -618,17 +638,21 @@ ts_class_invalid_modifier_combinations.ts:7:15 parse ━━━━━━━━━ × duplicate modifier - ┌─ ts_class_invalid_modifier_combinations.ts:7:15 - │ - 7 │ protected protected e; - │ ^^^^^^^^^ + 5 │ private protected public c; + 6 │ private private d; + > 7 │ protected protected e; + │ ^^^^^^^^^ + 8 │ public public f; + 9 │ abstract abstract g; i first modifier - ┌─ ts_class_invalid_modifier_combinations.ts:7:5 - │ - 7 │ protected protected e; - │ ^^^^^^^^^ + 5 │ private protected public c; + 6 │ private private d; + > 7 │ protected protected e; + │ ^^^^^^^^^ + 8 │ public public f; + 9 │ abstract abstract g; -- ts_class_invalid_modifier_combinations.ts:8:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -637,17 +661,21 @@ ts_class_invalid_modifier_combinations.ts:8:12 parse ━━━━━━━━━ × duplicate modifier - ┌─ ts_class_invalid_modifier_combinations.ts:8:12 - │ - 8 │ public public f; - │ ^^^^^^ + 6 │ private private d; + 7 │ protected protected e; + > 8 │ public public f; + │ ^^^^^^ + 9 │ abstract abstract g; + 10 │ static static h; i first modifier - ┌─ ts_class_invalid_modifier_combinations.ts:8:5 - │ - 8 │ public public f; - │ ^^^^^^ + 6 │ private private d; + 7 │ protected protected e; + > 8 │ public public f; + │ ^^^^^^ + 9 │ abstract abstract g; + 10 │ static static h; -- ts_class_invalid_modifier_combinations.ts:9:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -656,17 +684,21 @@ ts_class_invalid_modifier_combinations.ts:9:14 parse ━━━━━━━━━ × duplicate modifier - ┌─ ts_class_invalid_modifier_combinations.ts:9:14 - │ - 9 │ abstract abstract g; - │ ^^^^^^^^ + 7 │ protected protected e; + 8 │ public public f; + > 9 │ abstract abstract g; + │ ^^^^^^^^ + 10 │ static static h; + 11 │ readonly readonly i; i first seen here - ┌─ ts_class_invalid_modifier_combinations.ts:9:5 - │ - 9 │ abstract abstract g; - │ ^^^^^^^^ + 7 │ protected protected e; + 8 │ public public f; + > 9 │ abstract abstract g; + │ ^^^^^^^^ + 10 │ static static h; + 11 │ readonly readonly i; -- ts_class_invalid_modifier_combinations.ts:10:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -675,17 +707,21 @@ ts_class_invalid_modifier_combinations.ts:10:12 parse ━━━━━━━━ × duplicate modifier - ┌─ ts_class_invalid_modifier_combinations.ts:10:12 - │ - 10 │ static static h; - │ ^^^^^^ + 8 │ public public f; + 9 │ abstract abstract g; + > 10 │ static static h; + │ ^^^^^^ + 11 │ readonly readonly i; + 12 │ override declare base2; i first seen here - ┌─ ts_class_invalid_modifier_combinations.ts:10:5 - │ - 10 │ static static h; - │ ^^^^^^ + 8 │ public public f; + 9 │ abstract abstract g; + > 10 │ static static h; + │ ^^^^^^ + 11 │ readonly readonly i; + 12 │ override declare base2; -- ts_class_invalid_modifier_combinations.ts:11:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -694,108 +730,132 @@ ts_class_invalid_modifier_combinations.ts:11:14 parse ━━━━━━━━ × duplicate modifier - ┌─ ts_class_invalid_modifier_combinations.ts:11:14 - │ - 11 │ readonly readonly i; - │ ^^^^^^^^ + 9 │ abstract abstract g; + 10 │ static static h; + > 11 │ readonly readonly i; + │ ^^^^^^^^ + 12 │ override declare base2; + 13 │ private abstract j; i first seen here - ┌─ ts_class_invalid_modifier_combinations.ts:11:5 - │ - 11 │ readonly readonly i; - │ ^^^^^^^^ + 9 │ abstract abstract g; + 10 │ static static h; + > 11 │ readonly readonly i; + │ ^^^^^^^^ + 12 │ override declare base2; + 13 │ private abstract j; -- ts_class_invalid_modifier_combinations.ts:12:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' cannot be used with 'override' modifier. - ┌─ ts_class_invalid_modifier_combinations.ts:12:14 - │ - 12 │ override declare base2; - │ ^^^^^^^ + 10 │ static static h; + 11 │ readonly readonly i; + > 12 │ override declare base2; + │ ^^^^^^^ + 13 │ private abstract j; + 14 │ abstract #j; i 'override' modifier - ┌─ ts_class_invalid_modifier_combinations.ts:12:5 - │ - 12 │ override declare base2; - │ ^^^^^^^^ + 10 │ static static h; + 11 │ readonly readonly i; + > 12 │ override declare base2; + │ ^^^^^^^^ + 13 │ private abstract j; + 14 │ abstract #j; -- ts_class_invalid_modifier_combinations.ts:13:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'private' cannot be used with 'abstract' modifier. - ┌─ ts_class_invalid_modifier_combinations.ts:13:5 - │ - 13 │ private abstract j; - │ ^^^^^^^ + 11 │ readonly readonly i; + 12 │ override declare base2; + > 13 │ private abstract j; + │ ^^^^^^^ + 14 │ abstract #j; + 15 │ abstract static k; i 'abstract' modifier - ┌─ ts_class_invalid_modifier_combinations.ts:13:13 - │ - 13 │ private abstract j; - │ ^^^^^^^^ + 11 │ readonly readonly i; + 12 │ override declare base2; + > 13 │ private abstract j; + │ ^^^^^^^^ + 14 │ abstract #j; + 15 │ abstract static k; -- ts_class_invalid_modifier_combinations.ts:14:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' modifier cannot be used with a private identifier'. - ┌─ ts_class_invalid_modifier_combinations.ts:14:5 - │ - 14 │ abstract #j; - │ ^^^^^^^^ + 12 │ override declare base2; + 13 │ private abstract j; + > 14 │ abstract #j; + │ ^^^^^^^^ + 15 │ abstract static k; + 16 │ abstract async l(); -- ts_class_invalid_modifier_combinations.ts:15:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' cannot be used with 'static' modifier. - ┌─ ts_class_invalid_modifier_combinations.ts:15:5 - │ - 15 │ abstract static k; - │ ^^^^^^^^ + 13 │ private abstract j; + 14 │ abstract #j; + > 15 │ abstract static k; + │ ^^^^^^^^ + 16 │ abstract async l(); + 17 │ declare async m(); i 'static' modifier - ┌─ ts_class_invalid_modifier_combinations.ts:15:14 - │ - 15 │ abstract static k; - │ ^^^^^^ + 13 │ private abstract j; + 14 │ abstract #j; + > 15 │ abstract static k; + │ ^^^^^^ + 16 │ abstract async l(); + 17 │ declare async m(); -- ts_class_invalid_modifier_combinations.ts:16:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × async members cannot be abstract - ┌─ ts_class_invalid_modifier_combinations.ts:16:5 - │ - 16 │ abstract async l(); - │ ^^^^^^^^ + 14 │ abstract #j; + 15 │ abstract static k; + > 16 │ abstract async l(); + │ ^^^^^^^^ + 17 │ declare async m(); + 18 │ declare #l; -- ts_class_invalid_modifier_combinations.ts:17:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' modifier is only allowed on properties. - ┌─ ts_class_invalid_modifier_combinations.ts:17:5 - │ - 17 │ declare async m(); - │ ^^^^^^^ + 15 │ abstract static k; + 16 │ abstract async l(); + > 17 │ declare async m(); + │ ^^^^^^^ + 18 │ declare #l; + 19 │ } -- ts_class_invalid_modifier_combinations.ts:18:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' modifier cannot be used with a private identifier'. - ┌─ ts_class_invalid_modifier_combinations.ts:18:5 - │ - 18 │ declare #l; - │ ^^^^^^^ + 16 │ abstract async l(); + 17 │ declare async m(); + > 18 │ declare #l; + │ ^^^^^^^ + 19 │ } + 20 │ -- class Base { base1; base2; } diff --git a/crates/rome_js_parser/test_data/inline/err/ts_class_modifier_precedence.rast b/crates/rome_js_parser/test_data/inline/err/ts_class_modifier_precedence.rast index 11a14094fed..ee5d9d0dc9e 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_class_modifier_precedence.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_class_modifier_precedence.rast @@ -415,17 +415,21 @@ ts_class_modifier_precedence.ts:4:14 parse ━━━━━━━━━━━━ × move this modifier - ┌─ ts_class_modifier_precedence.ts:4:14 - │ - 4 │ readonly private a: string; - │ ^^^^^^^ + 2 │ abstract class Test extends Base { + 3 │ // Accessibility + > 4 │ readonly private a: string; + │ ^^^^^^^ + 5 │ override protected base1; + 6 │ static private b: string; i before this modifier - ┌─ ts_class_modifier_precedence.ts:4:5 - │ - 4 │ readonly private a: string; - │ ^^^^^^^^ + 2 │ abstract class Test extends Base { + 3 │ // Accessibility + > 4 │ readonly private a: string; + │ ^^^^^^^^ + 5 │ override protected base1; + 6 │ static private b: string; -- ts_class_modifier_precedence.ts:5:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -434,17 +438,21 @@ ts_class_modifier_precedence.ts:5:14 parse ━━━━━━━━━━━━ × move this modifier - ┌─ ts_class_modifier_precedence.ts:5:14 - │ - 5 │ override protected base1; - │ ^^^^^^^^^ + 3 │ // Accessibility + 4 │ readonly private a: string; + > 5 │ override protected base1; + │ ^^^^^^^^^ + 6 │ static private b: string; + 7 │ abstract protected d: string; i before this modifier - ┌─ ts_class_modifier_precedence.ts:5:5 - │ - 5 │ override protected base1; - │ ^^^^^^^^ + 3 │ // Accessibility + 4 │ readonly private a: string; + > 5 │ override protected base1; + │ ^^^^^^^^ + 6 │ static private b: string; + 7 │ abstract protected d: string; -- ts_class_modifier_precedence.ts:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -453,17 +461,21 @@ ts_class_modifier_precedence.ts:6:12 parse ━━━━━━━━━━━━ × move this modifier - ┌─ ts_class_modifier_precedence.ts:6:12 - │ - 6 │ static private b: string; - │ ^^^^^^^ + 4 │ readonly private a: string; + 5 │ override protected base1; + > 6 │ static private b: string; + │ ^^^^^^^ + 7 │ abstract protected d: string; + 8 │ // Static i before this modifier - ┌─ ts_class_modifier_precedence.ts:6:5 - │ - 6 │ static private b: string; - │ ^^^^^^ + 4 │ readonly private a: string; + 5 │ override protected base1; + > 6 │ static private b: string; + │ ^^^^^^ + 7 │ abstract protected d: string; + 8 │ // Static -- ts_class_modifier_precedence.ts:7:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -472,17 +484,21 @@ ts_class_modifier_precedence.ts:7:14 parse ━━━━━━━━━━━━ × move this modifier - ┌─ ts_class_modifier_precedence.ts:7:14 - │ - 7 │ abstract protected d: string; - │ ^^^^^^^^^ + 5 │ override protected base1; + 6 │ static private b: string; + > 7 │ abstract protected d: string; + │ ^^^^^^^^^ + 8 │ // Static + 9 │ readonly static c: string; i before this modifier - ┌─ ts_class_modifier_precedence.ts:7:5 - │ - 7 │ abstract protected d: string; - │ ^^^^^^^^ + 5 │ override protected base1; + 6 │ static private b: string; + > 7 │ abstract protected d: string; + │ ^^^^^^^^ + 8 │ // Static + 9 │ readonly static c: string; -- ts_class_modifier_precedence.ts:9:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -491,17 +507,21 @@ ts_class_modifier_precedence.ts:9:14 parse ━━━━━━━━━━━━ × move this modifier - ┌─ ts_class_modifier_precedence.ts:9:14 - │ - 9 │ readonly static c: string; - │ ^^^^^^ + 7 │ abstract protected d: string; + 8 │ // Static + > 9 │ readonly static c: string; + │ ^^^^^^ + 10 │ override static base2: string; + 11 │ // abstract i before this modifier - ┌─ ts_class_modifier_precedence.ts:9:5 - │ - 9 │ readonly static c: string; - │ ^^^^^^^^ + 7 │ abstract protected d: string; + 8 │ // Static + > 9 │ readonly static c: string; + │ ^^^^^^^^ + 10 │ override static base2: string; + 11 │ // abstract -- ts_class_modifier_precedence.ts:10:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -510,17 +530,21 @@ ts_class_modifier_precedence.ts:10:14 parse ━━━━━━━━━━━━ × move this modifier - ┌─ ts_class_modifier_precedence.ts:10:14 - │ - 10 │ override static base2: string; - │ ^^^^^^ + 8 │ // Static + 9 │ readonly static c: string; + > 10 │ override static base2: string; + │ ^^^^^^ + 11 │ // abstract + 12 │ override abstract base3: string; i before this modifier - ┌─ ts_class_modifier_precedence.ts:10:5 - │ - 10 │ override static base2: string; - │ ^^^^^^^^ + 8 │ // Static + 9 │ readonly static c: string; + > 10 │ override static base2: string; + │ ^^^^^^^^ + 11 │ // abstract + 12 │ override abstract base3: string; -- ts_class_modifier_precedence.ts:12:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -529,17 +553,21 @@ ts_class_modifier_precedence.ts:12:14 parse ━━━━━━━━━━━━ × move this modifier - ┌─ ts_class_modifier_precedence.ts:12:14 - │ - 12 │ override abstract base3: string; - │ ^^^^^^^^ + 10 │ override static base2: string; + 11 │ // abstract + > 12 │ override abstract base3: string; + │ ^^^^^^^^ + 13 │ // override + 14 │ readonly override base4: string; i before this modifier - ┌─ ts_class_modifier_precedence.ts:12:5 - │ - 12 │ override abstract base3: string; - │ ^^^^^^^^ + 10 │ override static base2: string; + 11 │ // abstract + > 12 │ override abstract base3: string; + │ ^^^^^^^^ + 13 │ // override + 14 │ readonly override base4: string; -- ts_class_modifier_precedence.ts:14:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -548,17 +576,21 @@ ts_class_modifier_precedence.ts:14:14 parse ━━━━━━━━━━━━ × move this modifier - ┌─ ts_class_modifier_precedence.ts:14:14 - │ - 14 │ readonly override base4: string; - │ ^^^^^^^^ + 12 │ override abstract base3: string; + 13 │ // override + > 14 │ readonly override base4: string; + │ ^^^^^^^^ + 15 │ } + 16 │ i before this modifier - ┌─ ts_class_modifier_precedence.ts:14:5 - │ - 14 │ readonly override base4: string; - │ ^^^^^^^^ + 12 │ override abstract base3: string; + 13 │ // override + > 14 │ readonly override base4: string; + │ ^^^^^^^^ + 15 │ } + 16 │ -- class Base { base1; base2; base3; base4;} diff --git a/crates/rome_js_parser/test_data/inline/err/ts_concrete_class_with_abstract_members.rast b/crates/rome_js_parser/test_data/inline/err/ts_concrete_class_with_abstract_members.rast index d3e3d1cb45e..d2b8c866fa4 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_concrete_class_with_abstract_members.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_concrete_class_with_abstract_members.rast @@ -186,40 +186,47 @@ ts_concrete_class_with_abstract_members.ts:2:4 parse ━━━━━━━━━ × Only abstract classes can have abstract members - ┌─ ts_concrete_class_with_abstract_members.ts:2:4 - │ - 2 │ abstract my_age: number; - │ ^^^^^^^^ + 1 │ class A { + > 2 │ abstract my_age: number; + │ ^^^^^^^^ + 3 │ abstract name(): string; + 4 │ abstract get age(): number; -- ts_concrete_class_with_abstract_members.ts:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Only abstract classes can have abstract members - ┌─ ts_concrete_class_with_abstract_members.ts:3:4 - │ - 3 │ abstract name(): string; - │ ^^^^^^^^ + 1 │ class A { + 2 │ abstract my_age: number; + > 3 │ abstract name(): string; + │ ^^^^^^^^ + 4 │ abstract get age(): number; + 5 │ abstract set age(v); -- ts_concrete_class_with_abstract_members.ts:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Only abstract classes can have abstract members - ┌─ ts_concrete_class_with_abstract_members.ts:4:4 - │ - 4 │ abstract get age(): number; - │ ^^^^^^^^ + 2 │ abstract my_age: number; + 3 │ abstract name(): string; + > 4 │ abstract get age(): number; + │ ^^^^^^^^ + 5 │ abstract set age(v); + 6 │ } -- ts_concrete_class_with_abstract_members.ts:5:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Only abstract classes can have abstract members - ┌─ ts_concrete_class_with_abstract_members.ts:5:4 - │ - 5 │ abstract set age(v); - │ ^^^^^^^^ + 3 │ abstract name(): string; + 4 │ abstract get age(): number; + > 5 │ abstract set age(v); + │ ^^^^^^^^ + 6 │ } + 7 │ -- class A { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_constructor_this_parameter.rast b/crates/rome_js_parser/test_data/inline/err/ts_constructor_this_parameter.rast index 66ae7d681a0..2497469a3e7 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_constructor_this_parameter.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_constructor_this_parameter.rast @@ -79,10 +79,9 @@ ts_constructor_this_parameter.ts:1:23 parse ━━━━━━━━━━━━ × A constructor cannot have a 'this' parameter. - ┌─ ts_constructor_this_parameter.ts:1:23 - │ - 1 │ class C { constructor(this) {} } - │ ^^^^ + > 1 │ class C { constructor(this) {} } + │ ^^^^ + 2 │ -- class C { constructor(this) {} } diff --git a/crates/rome_js_parser/test_data/inline/err/ts_constructor_type_parameters.rast b/crates/rome_js_parser/test_data/inline/err/ts_constructor_type_parameters.rast index e14f16d8222..1b7ca6c42d3 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_constructor_type_parameters.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_constructor_type_parameters.rast @@ -110,10 +110,9 @@ ts_constructor_type_parameters.ts:1:22 parse ━━━━━━━━━━━ × constructors cannot have type parameters. - ┌─ ts_constructor_type_parameters.ts:1:22 - │ - 1 │ class A { constructor(b) {} } - │ ^^^ + > 1 │ class A { constructor(b) {} } + │ ^^^ + 2 │ -- class A { constructor(b) {} } diff --git a/crates/rome_js_parser/test_data/inline/err/ts_declare_async_function.rast b/crates/rome_js_parser/test_data/inline/err/ts_declare_async_function.rast index 703ac69185a..3e942dd12b4 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_declare_async_function.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_declare_async_function.rast @@ -48,10 +48,9 @@ ts_declare_async_function.ts:1:9 parse ━━━━━━━━━━━━━ × 'async' modifier cannot be used in an ambient context. - ┌─ ts_declare_async_function.ts:1:9 - │ - 1 │ declare async function test(); - │ ^^^^^ + > 1 │ declare async function test(); + │ ^^^^^ + 2 │ -- declare async function test(); diff --git a/crates/rome_js_parser/test_data/inline/err/ts_declare_function_with_body.rast b/crates/rome_js_parser/test_data/inline/err/ts_declare_function_with_body.rast index b0c2b9e4450..409237cb549 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_declare_function_with_body.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_declare_function_with_body.rast @@ -130,10 +130,9 @@ ts_declare_function_with_body.ts:1:40 parse ━━━━━━━━━━━━ × remove this body - ┌─ ts_declare_function_with_body.ts:1:40 - │ - 1 │ declare function test(a: A): string { return "ambient function with a body"; } - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ declare function test(a: A): string { return "ambient function with a body"; } + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ -- declare function test(a: A): string { return "ambient function with a body"; } diff --git a/crates/rome_js_parser/test_data/inline/err/ts_declare_property_private_name.rast b/crates/rome_js_parser/test_data/inline/err/ts_declare_property_private_name.rast index 4eb52aabeb3..ffc5effccd7 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_declare_property_private_name.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_declare_property_private_name.rast @@ -79,10 +79,9 @@ ts_declare_property_private_name.ts:1:11 parse ━━━━━━━━━━━ × 'declare' modifier is only allowed on properties. - ┌─ ts_declare_property_private_name.ts:1:11 - │ - 1 │ class A { declare #name(); }; - │ ^^^^^^^ + > 1 │ class A { declare #name(); }; + │ ^^^^^^^ + 2 │ -- class A { declare #name(); }; diff --git a/crates/rome_js_parser/test_data/inline/err/ts_definite_assignment_in_ambient_context.rast b/crates/rome_js_parser/test_data/inline/err/ts_definite_assignment_in_ambient_context.rast index 24e6649125c..71f71698994 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_definite_assignment_in_ambient_context.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_definite_assignment_in_ambient_context.rast @@ -131,20 +131,20 @@ ts_definite_assignment_in_ambient_context.ts:1:23 parse ━━━━━━━━ × Definite assignment operators '!' aren't allowed in ambient contexts. - ┌─ ts_definite_assignment_in_ambient_context.ts:1:23 - │ - 1 │ declare class A { prop!: string } - │ ^ + > 1 │ declare class A { prop!: string } + │ ^ + 2 │ class B { declare prop!: string } + 3 │ -- ts_definite_assignment_in_ambient_context.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Definite assignment operators '!' aren't allowed in ambient contexts. - ┌─ ts_definite_assignment_in_ambient_context.ts:2:23 - │ - 2 │ class B { declare prop!: string } - │ ^ + 1 │ declare class A { prop!: string } + > 2 │ class B { declare prop!: string } + │ ^ + 3 │ -- declare class A { prop!: string } diff --git a/crates/rome_js_parser/test_data/inline/err/ts_definite_variable_with_initializer.rast b/crates/rome_js_parser/test_data/inline/err/ts_definite_variable_with_initializer.rast index 07a3b6de9b1..2c17841d4ab 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_definite_variable_with_initializer.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_definite_variable_with_initializer.rast @@ -74,10 +74,9 @@ ts_definite_variable_with_initializer.js:1:6 parse ━━━━━━━━━ × TypeScript only syntax - ┌─ ts_definite_variable_with_initializer.js:1:6 - │ - 1 │ let a!: string = "test"; - │ ^^^^^^^^^ + > 1 │ let a!: string = "test"; + │ ^^^^^^^^^ + 2 │ -- let a!: string = "test"; diff --git a/crates/rome_js_parser/test_data/inline/err/ts_export_default_enum.rast b/crates/rome_js_parser/test_data/inline/err/ts_export_default_enum.rast index 1c944f88e17..ce233101369 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_export_default_enum.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_export_default_enum.rast @@ -83,10 +83,9 @@ ts_export_default_enum.ts:1:16 parse ━━━━━━━━━━━━━━ × 'export default' isn't allowed for 'enum's. Move the 'enum' declaration in its own statement and then export the enum's name. - ┌─ ts_export_default_enum.ts:1:16 - │ - 1 │ export default enum A { X, Y, Z } - │ ^^^^^^^^^^^^^^^^^^ + > 1 │ export default enum A { X, Y, Z } + │ ^^^^^^^^^^^^^^^^^^ + 2 │ -- export default enum A { X, Y, Z } diff --git a/crates/rome_js_parser/test_data/inline/err/ts_export_syntax_in_js.rast b/crates/rome_js_parser/test_data/inline/err/ts_export_syntax_in_js.rast index e3e66be159f..dd66f202fc7 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_export_syntax_in_js.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_export_syntax_in_js.rast @@ -317,10 +317,11 @@ ts_export_syntax_in_js.js:2:8 parse ━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ ts_export_syntax_in_js.js:2:8 - │ - 2 │ export type { a }; - │ ^^^^^^^^^^^ + 1 │ let a, b, c; + > 2 │ export type { a }; + │ ^^^^^^^^^^^ + 3 │ export { type b }; + 4 │ export { type c as cc }; -- ts_export_syntax_in_js.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -329,10 +330,12 @@ ts_export_syntax_in_js.js:3:10 parse ━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ ts_export_syntax_in_js.js:3:10 - │ - 3 │ export { type b }; - │ ^^^^^^ + 1 │ let a, b, c; + 2 │ export type { a }; + > 3 │ export { type b }; + │ ^^^^^^ + 4 │ export { type c as cc }; + 5 │ export type { d } from "./d"; -- ts_export_syntax_in_js.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -341,10 +344,12 @@ ts_export_syntax_in_js.js:4:10 parse ━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ ts_export_syntax_in_js.js:4:10 - │ - 4 │ export { type c as cc }; - │ ^^^^^^^^^^^^ + 2 │ export type { a }; + 3 │ export { type b }; + > 4 │ export { type c as cc }; + │ ^^^^^^^^^^^^ + 5 │ export type { d } from "./d"; + 6 │ export { type e } from "./e"; -- ts_export_syntax_in_js.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -353,10 +358,12 @@ ts_export_syntax_in_js.js:5:8 parse ━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ ts_export_syntax_in_js.js:5:8 - │ - 5 │ export type { d } from "./d"; - │ ^^^^^^^^^^^^^^^^^^^^^^ + 3 │ export { type b }; + 4 │ export { type c as cc }; + > 5 │ export type { d } from "./d"; + │ ^^^^^^^^^^^^^^^^^^^^^^ + 6 │ export { type e } from "./e"; + 7 │ export { type e as ee } from "./e"; -- ts_export_syntax_in_js.js:6:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -365,10 +372,12 @@ ts_export_syntax_in_js.js:6:10 parse ━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ ts_export_syntax_in_js.js:6:10 - │ - 6 │ export { type e } from "./e"; - │ ^^^^^^ + 4 │ export { type c as cc }; + 5 │ export type { d } from "./d"; + > 6 │ export { type e } from "./e"; + │ ^^^^^^ + 7 │ export { type e as ee } from "./e"; + 8 │ -- ts_export_syntax_in_js.js:7:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -377,10 +386,11 @@ ts_export_syntax_in_js.js:7:10 parse ━━━━━━━━━━━━━━ × TypeScript only syntax - ┌─ ts_export_syntax_in_js.js:7:10 - │ - 7 │ export { type e as ee } from "./e"; - │ ^^^^^^^^^^^^ + 5 │ export type { d } from "./d"; + 6 │ export { type e } from "./e"; + > 7 │ export { type e as ee } from "./e"; + │ ^^^^^^^^^^^^ + 8 │ -- let a, b, c; diff --git a/crates/rome_js_parser/test_data/inline/err/ts_export_type.rast b/crates/rome_js_parser/test_data/inline/err/ts_export_type.rast index fbc26870422..4efbf47ca9b 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_export_type.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_export_type.rast @@ -38,10 +38,9 @@ ts_export_type.ts:1:8 parse ━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration here - ┌─ ts_export_type.ts:1:8 - │ - 1 │ export type - │ ^^^^ + > 1 │ export type + │ ^^^^ + 2 │ -- export type diff --git a/crates/rome_js_parser/test_data/inline/err/ts_extends_trailing_comma.rast b/crates/rome_js_parser/test_data/inline/err/ts_extends_trailing_comma.rast index ae743c375cd..02dca6b0457 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_extends_trailing_comma.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_extends_trailing_comma.rast @@ -76,10 +76,10 @@ ts_extends_trailing_comma.ts:2:22 parse ━━━━━━━━━━━━━ × Trailing comma not allowed. - ┌─ ts_extends_trailing_comma.ts:2:22 - │ - 2 │ interface B extends A, {} - │ ^ + 1 │ interface A {} + > 2 │ interface B extends A, {} + │ ^ + 3 │ -- interface A {} diff --git a/crates/rome_js_parser/test_data/inline/err/ts_formal_parameter_error.rast b/crates/rome_js_parser/test_data/inline/err/ts_formal_parameter_error.rast index 3f1aa53dc95..bd73001bf4c 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_formal_parameter_error.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_formal_parameter_error.rast @@ -238,30 +238,32 @@ ts_formal_parameter_error.ts:1:23 parse ━━━━━━━━━━━━━ × Parameter cannot have question mark and initializer - ┌─ ts_formal_parameter_error.ts:1:23 - │ - 1 │ function a(x?: string = "test") {} - │ ^^^^^^^^ + > 1 │ function a(x?: string = "test") {} + │ ^^^^^^^^ + 2 │ function b(...rest: string[] = "init") {} + 3 │ function c(...rest, b: string) {} -- ts_formal_parameter_error.ts:2:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest elements may not have default initializers - ┌─ ts_formal_parameter_error.ts:2:30 - │ - 2 │ function b(...rest: string[] = "init") {} - │ ^^^^^^^^ + 1 │ function a(x?: string = "test") {} + > 2 │ function b(...rest: string[] = "init") {} + │ ^^^^^^^^ + 3 │ function c(...rest, b: string) {} + 4 │ -- ts_formal_parameter_error.ts:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest elements may not have trailing commas - ┌─ ts_formal_parameter_error.ts:3:12 - │ - 3 │ function c(...rest, b: string) {} - │ ^^^^^^^ + 1 │ function a(x?: string = "test") {} + 2 │ function b(...rest: string[] = "init") {} + > 3 │ function c(...rest, b: string) {} + │ ^^^^^^^ + 4 │ -- function a(x?: string = "test") {} diff --git a/crates/rome_js_parser/test_data/inline/err/ts_function_overload_generator.rast b/crates/rome_js_parser/test_data/inline/err/ts_function_overload_generator.rast index 2905ba38188..c2808b251f5 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_function_overload_generator.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_function_overload_generator.rast @@ -125,10 +125,10 @@ ts_function_overload_generator.ts:1:9 parse ━━━━━━━━━━━━ × An overload signature cannot be declared as a generator. - ┌─ ts_function_overload_generator.ts:1:9 - │ - 1 │ function* test(a: string); - │ ^ + > 1 │ function* test(a: string); + │ ^ + 2 │ function* test(a: string) {} + 3 │ -- function* test(a: string); diff --git a/crates/rome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.rast b/crates/rome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.rast index eb045723393..db06d11e080 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.rast @@ -185,20 +185,23 @@ ts_getter_setter_type_parameters.ts:2:7 parse ━━━━━━━━━━━ × An accessor cannot have type parameters. - ┌─ ts_getter_setter_type_parameters.ts:2:7 - │ - 2 │ get a(): A {} - │ ^^^ + 1 │ class Test { + > 2 │ get a(): A {} + │ ^^^ + 3 │ set a(value: A) {} + 4 │ } -- ts_getter_setter_type_parameters.ts:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An accessor cannot have type parameters. - ┌─ ts_getter_setter_type_parameters.ts:3:7 - │ - 3 │ set a(value: A) {} - │ ^^^ + 1 │ class Test { + 2 │ get a(): A {} + > 3 │ set a(value: A) {} + │ ^^^ + 4 │ } + 5 │ -- class Test { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.rast b/crates/rome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.rast index 17b281d14da..4213b26dc1d 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.rast @@ -90,10 +90,11 @@ ts_index_signature_class_member_cannot_be_abstract.ts:2:5 parse ━━━━━ × 'abstract' modifier cannot appear on an index signature. - ┌─ ts_index_signature_class_member_cannot_be_abstract.ts:2:5 - │ - 2 │ abstract [a: number]: string; - │ ^^^^^^^^ + 1 │ abstract class A { + > 2 │ abstract [a: number]: string; + │ ^^^^^^^^ + 3 │ } + 4 │ -- abstract class A { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.rast b/crates/rome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.rast index 14f9ffd7e0f..a2191c22e30 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.rast @@ -238,30 +238,35 @@ ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:2:5 parse × 'public' modifier cannot appear on an index signature. - ┌─ ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:2:5 - │ - 2 │ public [a: number]: string; - │ ^^^^^^ + 1 │ class A { + > 2 │ public [a: number]: string; + │ ^^^^^^ + 3 │ } + 4 │ class B { -- ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━ × 'private' modifier cannot appear on an index signature. - ┌─ ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:5:5 - │ - 5 │ private [a: number]: string; - │ ^^^^^^^ + 3 │ } + 4 │ class B { + > 5 │ private [a: number]: string; + │ ^^^^^^^ + 6 │ } + 7 │ class C { -- ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:8:5 parse ━━━━━━━━━━━━━━━━━━━━━━ × 'protected' modifier cannot appear on an index signature. - ┌─ ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:8:5 - │ - 8 │ protected [a: number]: string; - │ ^^^^^^^^^ + 6 │ } + 7 │ class C { + > 8 │ protected [a: number]: string; + │ ^^^^^^^^^ + 9 │ } + 10 │ -- class A { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.rast b/crates/rome_js_parser/test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.rast index 36c8b40654d..fb37e61fc32 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.rast @@ -95,17 +95,19 @@ ts_index_signature_class_member_static_readonly_precedence.ts:2:14 parse ━━ × move this modifier - ┌─ ts_index_signature_class_member_static_readonly_precedence.ts:2:14 - │ - 2 │ readonly static [a: number]: string; - │ ^^^^^^ + 1 │ class A { + > 2 │ readonly static [a: number]: string; + │ ^^^^^^ + 3 │ } + 4 │ i before this modifier - ┌─ ts_index_signature_class_member_static_readonly_precedence.ts:2:5 - │ - 2 │ readonly static [a: number]: string; - │ ^^^^^^^^ + 1 │ class A { + > 2 │ readonly static [a: number]: string; + │ ^^^^^^^^ + 3 │ } + 4 │ -- class A { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.rast b/crates/rome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.rast index 2d67ddd1126..ace86ea3b5e 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.rast @@ -196,30 +196,35 @@ ts_index_signature_interface_member_cannot_be_static.ts:2:5 parse ━━━━ × index signature members cannot be static - ┌─ ts_index_signature_interface_member_cannot_be_static.ts:2:5 - │ - 2 │ static [index: string]: string - │ ^^^^^^ + 1 │ interface A { + > 2 │ static [index: string]: string + │ ^^^^^^ + 3 │ } + 4 │ interface B { -- ts_index_signature_interface_member_cannot_be_static.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × index signature members cannot be public - ┌─ ts_index_signature_interface_member_cannot_be_static.ts:5:5 - │ - 5 │ public [index: string]: string - │ ^^^^^^ + 3 │ } + 4 │ interface B { + > 5 │ public [index: string]: string + │ ^^^^^^ + 6 │ } + 7 │ interface C { -- ts_index_signature_interface_member_cannot_be_static.ts:8:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × index signature members cannot be private - ┌─ ts_index_signature_interface_member_cannot_be_static.ts:8:5 - │ - 8 │ private [index: string]: string - │ ^^^^^^^ + 6 │ } + 7 │ interface C { + > 8 │ private [index: string]: string + │ ^^^^^^^ + 9 │ } + 10 │ -- interface A { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.rast b/crates/rome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.rast index 60c9af0ede7..68c3c900ac7 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.rast @@ -202,30 +202,35 @@ ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:2:5 pars × index signature members cannot be public - ┌─ ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:2:5 - │ - 2 │ public [a: number]: string; - │ ^^^^^^ + 1 │ interface A { + > 2 │ public [a: number]: string; + │ ^^^^^^ + 3 │ } + 4 │ interface B { -- ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:5:5 parse ━━━━━━━━━━━━━━━━━━ × index signature members cannot be private - ┌─ ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:5:5 - │ - 5 │ private [a: number]: string; - │ ^^^^^^^ + 3 │ } + 4 │ interface B { + > 5 │ private [a: number]: string; + │ ^^^^^^^ + 6 │ } + 7 │ interface C { -- ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:8:5 parse ━━━━━━━━━━━━━━━━━━ × index signature members cannot be protected - ┌─ ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:8:5 - │ - 8 │ protected [a: number]: string; - │ ^^^^^^^^^ + 6 │ } + 7 │ interface C { + > 8 │ protected [a: number]: string; + │ ^^^^^^^^^ + 9 │ } + 10 │ -- interface A { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_instantiation_expressions1.rast b/crates/rome_js_parser/test_data/inline/err/ts_instantiation_expressions1.rast index bec03dcb69f..36e903f6b55 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_instantiation_expressions1.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_instantiation_expressions1.rast @@ -144,10 +144,10 @@ ts_instantiation_expressions1.ts:1:29 parse ━━━━━━━━━━━━ × Expected an expression here - ┌─ ts_instantiation_expressions1.ts:1:29 - │ - 1 │ const a8 = f; // Relational operator error - │ ^ + > 1 │ const a8 = f; // Relational operator error + │ ^ + 2 │ const b1 = f?.; // Error, `(` expected + 3 │ -- ts_instantiation_expressions1.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -156,10 +156,10 @@ ts_instantiation_expressions1.ts:2:23 parse ━━━━━━━━━━━━ × unexpected - ┌─ ts_instantiation_expressions1.ts:2:23 - │ - 2 │ const b1 = f?.; // Error, `(` expected - │ ^ + 1 │ const a8 = f; // Relational operator error + > 2 │ const b1 = f?.; // Error, `(` expected + │ ^ + 3 │ -- const a8 = f; // Relational operator error diff --git a/crates/rome_js_parser/test_data/inline/err/ts_interface_heritage_clause_error.rast b/crates/rome_js_parser/test_data/inline/err/ts_interface_heritage_clause_error.rast index a5f0e5450ba..aa9c6081c4b 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_interface_heritage_clause_error.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_interface_heritage_clause_error.rast @@ -191,47 +191,55 @@ ts_interface_heritage_clause_error.ts:2:13 parse ━━━━━━━━━━ × Interface declaration cannot have 'implements' clause. - ┌─ ts_interface_heritage_clause_error.ts:2:13 - │ - 2 │ interface B implements A {} - │ ^^^^^^^^^^^^ + 1 │ interface A {} + > 2 │ interface B implements A {} + │ ^^^^^^^^^^^^ + 3 │ interface C extends A extends B {} + 4 │ interface D extends {} -- ts_interface_heritage_clause_error.ts:3:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'extends' clause already seen. - ┌─ ts_interface_heritage_clause_error.ts:3:23 - │ - 3 │ interface C extends A extends B {} - │ ^^^^^^^^^ + 1 │ interface A {} + 2 │ interface B implements A {} + > 3 │ interface C extends A extends B {} + │ ^^^^^^^^^ + 4 │ interface D extends {} + 5 │ interface E extends A, {} i first 'extends' clause - ┌─ ts_interface_heritage_clause_error.ts:3:13 - │ - 3 │ interface C extends A extends B {} - │ ^^^^^^^^^ + 1 │ interface A {} + 2 │ interface B implements A {} + > 3 │ interface C extends A extends B {} + │ ^^^^^^^^^ + 4 │ interface D extends {} + 5 │ interface E extends A, {} -- ts_interface_heritage_clause_error.ts:4:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'extends' list cannot be empty. - ┌─ ts_interface_heritage_clause_error.ts:4:21 - │ - 4 │ interface D extends {} - │ ^ + 2 │ interface B implements A {} + 3 │ interface C extends A extends B {} + > 4 │ interface D extends {} + │ + 5 │ interface E extends A, {} + 6 │ -- ts_interface_heritage_clause_error.ts:5:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Trailing comma not allowed. - ┌─ ts_interface_heritage_clause_error.ts:5:22 - │ - 5 │ interface E extends A, {} - │ ^ + 3 │ interface C extends A extends B {} + 4 │ interface D extends {} + > 5 │ interface E extends A, {} + │ ^ + 6 │ -- interface A {} diff --git a/crates/rome_js_parser/test_data/inline/err/ts_invalid_decorated_class_members.rast b/crates/rome_js_parser/test_data/inline/err/ts_invalid_decorated_class_members.rast index aeeb8da2284..83089aa0bf4 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_invalid_decorated_class_members.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_invalid_decorated_class_members.rast @@ -198,10 +198,12 @@ ts_invalid_decorated_class_members.ts:6:29 parse ━━━━━━━━━━ × Expected a parameter here - ┌─ ts_invalid_decorated_class_members.ts:6:29 - │ - 6 │ @test abstract set setter(); - │ ^ + 4 │ @test abstract method2(); + 5 │ @test abstract get getter(); + > 6 │ @test abstract set setter(); + │ ^ + 7 │ } + 8 │ -- abstract class Test { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_method_members_with_missing_body.rast b/crates/rome_js_parser/test_data/inline/err/ts_method_members_with_missing_body.rast index 06444d1ff2d..60cf613aa34 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_method_members_with_missing_body.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_method_members_with_missing_body.rast @@ -147,10 +147,11 @@ ts_method_members_with_missing_body.ts:2:20 parse ━━━━━━━━━━ × Expected a class method body here - ┌─ ts_method_members_with_missing_body.ts:2:20 - │ - 2 │ constructor() method() get test() - │ ^^^^^^ + 1 │ class Test { + > 2 │ constructor() method() get test() + │ ^^^^^^ + 3 │ set test(value) + 4 │ } -- ts_method_members_with_missing_body.ts:2:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -159,10 +160,11 @@ ts_method_members_with_missing_body.ts:2:29 parse ━━━━━━━━━━ × Expected a class method body here - ┌─ ts_method_members_with_missing_body.ts:2:29 - │ - 2 │ constructor() method() get test() - │ ^^^ + 1 │ class Test { + > 2 │ constructor() method() get test() + │ ^^^ + 3 │ set test(value) + 4 │ } -- ts_method_members_with_missing_body.ts:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -171,10 +173,12 @@ ts_method_members_with_missing_body.ts:3:6 parse ━━━━━━━━━━ × Expected a class method body here - ┌─ ts_method_members_with_missing_body.ts:3:6 - │ - 3 │ set test(value) - │ ^^^ + 1 │ class Test { + 2 │ constructor() method() get test() + > 3 │ set test(value) + │ ^^^ + 4 │ } + 5 │ -- ts_method_members_with_missing_body.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -183,10 +187,11 @@ ts_method_members_with_missing_body.ts:4:1 parse ━━━━━━━━━━ × Expected a class method body here - ┌─ ts_method_members_with_missing_body.ts:4:1 - │ - 4 │ } - │ ^ + 2 │ constructor() method() get test() + 3 │ set test(value) + > 4 │ } + │ ^ + 5 │ -- class Test { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_method_signature_generator.rast b/crates/rome_js_parser/test_data/inline/err/ts_method_signature_generator.rast index c3c2c4110e0..a2cd8f1918e 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_method_signature_generator.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_method_signature_generator.rast @@ -217,30 +217,33 @@ ts_method_signature_generator.ts:1:19 parse ━━━━━━━━━━━━ × A method signature cannot be declared as a generator. - ┌─ ts_method_signature_generator.ts:1:19 - │ - 1 │ declare class A { * method(); } - │ ^^^^^^^^^^^ + > 1 │ declare class A { * method(); } + │ ^^^^^^^^^^^ + 2 │ abstract class B { abstract * method(); } + 3 │ class C { -- ts_method_signature_generator.ts:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A method signature cannot be declared as a generator. - ┌─ ts_method_signature_generator.ts:2:20 - │ - 2 │ abstract class B { abstract * method(); } - │ ^^^^^^^^^^^^^^^^^^^^ + 1 │ declare class A { * method(); } + > 2 │ abstract class B { abstract * method(); } + │ ^^^^^^^^^^^^^^^^^^^^ + 3 │ class C { + 4 │ * overload(); -- ts_method_signature_generator.ts:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A method signature cannot be declared as a generator. - ┌─ ts_method_signature_generator.ts:4:6 - │ - 4 │ * overload(); - │ ^^^^^^^^^^^^^ + 2 │ abstract class B { abstract * method(); } + 3 │ class C { + > 4 │ * overload(); + │ ^^^^^^^^^^^^^ + 5 │ * overload() {} + 6 │ } -- declare class A { * method(); } diff --git a/crates/rome_js_parser/test_data/inline/err/ts_module_err.rast b/crates/rome_js_parser/test_data/inline/err/ts_module_err.rast index aa6e6584d28..c0d57e94c52 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_module_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_module_err.rast @@ -80,10 +80,10 @@ ts_module_err.ts:1:17 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ ts_module_err.ts:1:17 - │ - 1 │ declare module a; // missing body - │ ^ + > 1 │ declare module a; // missing body + │ ^ + 2 │ declare module "a" declare module "b"; // missing semi + 3 │ -- ts_module_err.ts:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -92,17 +92,17 @@ ts_module_err.ts:2:20 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ ts_module_err.ts:2:20 - │ - 2 │ declare module "a" declare module "b"; // missing semi - │ ^^^^^^^ + 1 │ declare module a; // missing body + > 2 │ declare module "a" declare module "b"; // missing semi + │ ^^^^^^^ + 3 │ i ...Which is required to end this statement - ┌─ ts_module_err.ts:2:1 - │ - 2 │ declare module "a" declare module "b"; // missing semi - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ declare module a; // missing body + > 2 │ declare module "a" declare module "b"; // missing semi + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ -- declare module a; // missing body diff --git a/crates/rome_js_parser/test_data/inline/err/ts_named_import_specifier_error.rast b/crates/rome_js_parser/test_data/inline/err/ts_named_import_specifier_error.rast index b2b590eed09..3bf4bfec33d 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_named_import_specifier_error.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_named_import_specifier_error.rast @@ -235,10 +235,10 @@ ts_named_import_specifier_error.ts:1:18 parse ━━━━━━━━━━━ × unexpected - ┌─ ts_named_import_specifier_error.ts:1:18 - │ - 1 │ import { default } from "./mod"; - │ ^ + > 1 │ import { default } from "./mod"; + │ ^ + 2 │ import { type default } from "./mod"; + 3 │ import { "literal-name" } from "./mod"; -- ts_named_import_specifier_error.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -247,10 +247,11 @@ ts_named_import_specifier_error.ts:2:23 parse ━━━━━━━━━━━ × unexpected - ┌─ ts_named_import_specifier_error.ts:2:23 - │ - 2 │ import { type default } from "./mod"; - │ ^ + 1 │ import { default } from "./mod"; + > 2 │ import { type default } from "./mod"; + │ ^ + 3 │ import { "literal-name" } from "./mod"; + 4 │ import { type "literal-name" } from "./mod"; -- ts_named_import_specifier_error.ts:3:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -259,10 +260,12 @@ ts_named_import_specifier_error.ts:3:25 parse ━━━━━━━━━━━ × unexpected - ┌─ ts_named_import_specifier_error.ts:3:25 - │ - 3 │ import { "literal-name" } from "./mod"; - │ ^ + 1 │ import { default } from "./mod"; + 2 │ import { type default } from "./mod"; + > 3 │ import { "literal-name" } from "./mod"; + │ ^ + 4 │ import { type "literal-name" } from "./mod"; + 5 │ import { -- ts_named_import_specifier_error.ts:4:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -271,10 +274,12 @@ ts_named_import_specifier_error.ts:4:30 parse ━━━━━━━━━━━ × unexpected - ┌─ ts_named_import_specifier_error.ts:4:30 - │ - 4 │ import { type "literal-name" } from "./mod"; - │ ^ + 2 │ import { type default } from "./mod"; + 3 │ import { "literal-name" } from "./mod"; + > 4 │ import { type "literal-name" } from "./mod"; + │ ^ + 5 │ import { + 6 │ -- ts_named_import_specifier_error.ts:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -283,10 +288,10 @@ ts_named_import_specifier_error.ts:6:1 parse ━━━━━━━━━━━ × the file ends here - ┌─ ts_named_import_specifier_error.ts:6:1 - │ - 6 │ - │ ^ + 4 │ import { type "literal-name" } from "./mod"; + 5 │ import { + > 6 │ + │ -- import { default } from "./mod"; diff --git a/crates/rome_js_parser/test_data/inline/err/ts_new_operator.rast b/crates/rome_js_parser/test_data/inline/err/ts_new_operator.rast index 02acd19ac34..7a27c1a5f29 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_new_operator.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_new_operator.rast @@ -84,10 +84,9 @@ ts_new_operator.ts:1:19 parse ━━━━━━━━━━━━━━━━ × Expected an expression here - ┌─ ts_new_operator.ts:1:19 - │ - 1 │ new A(); - │ ^ + > 1 │ new A(); + │ ^ + 2 │ -- new A(); diff --git a/crates/rome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.rast b/crates/rome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.rast index 88537b60231..3447b1c452b 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.rast @@ -102,10 +102,9 @@ ts_object_getter_type_parameters.ts:1:9 parse ━━━━━━━━━━━ × An accessor cannot have type parameters. - ┌─ ts_object_getter_type_parameters.ts:1:9 - │ - 1 │ ({ get a(): A {} }); - │ ^^^ + > 1 │ ({ get a(): A {} }); + │ ^^^ + 2 │ -- ({ get a(): A {} }); diff --git a/crates/rome_js_parser/test_data/inline/err/ts_object_setter_return_type.rast b/crates/rome_js_parser/test_data/inline/err/ts_object_setter_return_type.rast index 23465009ea7..d03d01650b5 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_object_setter_return_type.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_object_setter_return_type.rast @@ -97,10 +97,9 @@ ts_object_setter_return_type.ts:1:24 parse ━━━━━━━━━━━━ × A 'set' accessor cannot have a return type annotation. - ┌─ ts_object_setter_return_type.ts:1:24 - │ - 1 │ ({ set a(value: string): void {} }); - │ ^^^^^^ + > 1 │ ({ set a(value: string): void {} }); + │ ^^^^^^ + 2 │ -- ({ set a(value: string): void {} }); diff --git a/crates/rome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.rast b/crates/rome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.rast index 30fae445b55..e04de939448 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.rast @@ -114,10 +114,9 @@ ts_object_setter_type_parameters.ts:1:9 parse ━━━━━━━━━━━ × An accessor cannot have type parameters. - ┌─ ts_object_setter_type_parameters.ts:1:9 - │ - 1 │ ({ set a(value: A) {} }); - │ ^^^ + > 1 │ ({ set a(value: A) {} }); + │ ^^^ + 2 │ -- ({ set a(value: A) {} }); diff --git a/crates/rome_js_parser/test_data/inline/err/ts_property_initializer_ambient_context.rast b/crates/rome_js_parser/test_data/inline/err/ts_property_initializer_ambient_context.rast index 4930043f301..c2b558fda01 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_property_initializer_ambient_context.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_property_initializer_ambient_context.rast @@ -121,20 +121,20 @@ ts_property_initializer_ambient_context.ts:1:24 parse ━━━━━━━━ × Initializers are not allowed in ambient contexts. - ┌─ ts_property_initializer_ambient_context.ts:1:24 - │ - 1 │ declare class A { prop = "test" } - │ ^^^^^^^^ + > 1 │ declare class A { prop = "test" } + │ ^^^^^^^^ + 2 │ class B { declare prop = "test" } + 3 │ -- ts_property_initializer_ambient_context.ts:2:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Initializers are not allowed in ambient contexts. - ┌─ ts_property_initializer_ambient_context.ts:2:24 - │ - 2 │ class B { declare prop = "test" } - │ ^^^^^^^^ + 1 │ declare class A { prop = "test" } + > 2 │ class B { declare prop = "test" } + │ ^^^^^^^^ + 3 │ -- declare class A { prop = "test" } diff --git a/crates/rome_js_parser/test_data/inline/err/ts_property_parameter_pattern.rast b/crates/rome_js_parser/test_data/inline/err/ts_property_parameter_pattern.rast index 754dd6e2d99..bc90162185f 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_property_parameter_pattern.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_property_parameter_pattern.rast @@ -160,20 +160,18 @@ ts_property_parameter_pattern.ts:1:31 parse ━━━━━━━━━━━━ × A parameter property may not be declared using a binding pattern. - ┌─ ts_property_parameter_pattern.ts:1:31 - │ - 1 │ class A { constructor(private { x, y }, protected [a, b]) {} } - │ ^^^^^^^^ + > 1 │ class A { constructor(private { x, y }, protected [a, b]) {} } + │ ^^^^^^^^ + 2 │ -- ts_property_parameter_pattern.ts:1:51 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A parameter property may not be declared using a binding pattern. - ┌─ ts_property_parameter_pattern.ts:1:51 - │ - 1 │ class A { constructor(private { x, y }, protected [a, b]) {} } - │ ^^^^^^ + > 1 │ class A { constructor(private { x, y }, protected [a, b]) {} } + │ ^^^^^^ + 2 │ -- class A { constructor(private { x, y }, protected [a, b]) {} } diff --git a/crates/rome_js_parser/test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.rast b/crates/rome_js_parser/test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.rast index 22e624090ac..10907b6f82d 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.rast @@ -230,40 +230,47 @@ ts_readonly_modifier_non_class_or_indexer.ts:2:3 parse ━━━━━━━━ × 'readonly' cannot appear on a constructor declaration. - ┌─ ts_readonly_modifier_non_class_or_indexer.ts:2:3 - │ - 2 │ readonly constructor() {} - │ ^^^^^^^^ + 1 │ class Test { + > 2 │ readonly constructor() {} + │ ^^^^^^^^ + 3 │ readonly method() {} + 4 │ readonly get test() { return "a"; } -- ts_readonly_modifier_non_class_or_indexer.ts:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Readonly can only appear on a property declaration or index signature. - ┌─ ts_readonly_modifier_non_class_or_indexer.ts:3:3 - │ - 3 │ readonly method() {} - │ ^^^^^^^^ + 1 │ class Test { + 2 │ readonly constructor() {} + > 3 │ readonly method() {} + │ ^^^^^^^^ + 4 │ readonly get test() { return "a"; } + 5 │ readonly set test(value: string) {} -- ts_readonly_modifier_non_class_or_indexer.ts:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Readonly can only appear on a property declaration or index signature. - ┌─ ts_readonly_modifier_non_class_or_indexer.ts:4:3 - │ - 4 │ readonly get test() { return "a"; } - │ ^^^^^^^^ + 2 │ readonly constructor() {} + 3 │ readonly method() {} + > 4 │ readonly get test() { return "a"; } + │ ^^^^^^^^ + 5 │ readonly set test(value: string) {} + 6 │ } -- ts_readonly_modifier_non_class_or_indexer.ts:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Readonly can only appear on a property declaration or index signature. - ┌─ ts_readonly_modifier_non_class_or_indexer.ts:5:3 - │ - 5 │ readonly set test(value: string) {} - │ ^^^^^^^^ + 3 │ readonly method() {} + 4 │ readonly get test() { return "a"; } + > 5 │ readonly set test(value: string) {} + │ ^^^^^^^^ + 6 │ } + 7 │ -- class Test { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_setter_return_type_annotation.rast b/crates/rome_js_parser/test_data/inline/err/ts_setter_return_type_annotation.rast index bae3392cb58..e97924f57ed 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_setter_return_type_annotation.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_setter_return_type_annotation.rast @@ -102,10 +102,11 @@ ts_setter_return_type_annotation.ts:2:25 parse ━━━━━━━━━━━ × A 'set' accessor cannot have a return type annotation. - ┌─ ts_setter_return_type_annotation.ts:2:25 - │ - 2 │ set a(value: string): void {} - │ ^^^^^^ + 1 │ class Test { + > 2 │ set a(value: string): void {} + │ ^^^^^^ + 3 │ } + 4 │ -- class Test { diff --git a/crates/rome_js_parser/test_data/inline/err/ts_template_literal_error.rast b/crates/rome_js_parser/test_data/inline/err/ts_template_literal_error.rast index f6669539926..3a6769067ca 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_template_literal_error.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_template_literal_error.rast @@ -171,10 +171,12 @@ ts_template_literal_error.ts:3:15 parse ━━━━━━━━━━━━━ × unexpected - ┌─ ts_template_literal_error.ts:3:15 - │ - 3 │ type C = `${A B}bcd` - │ ^ + 1 │ type A = "a"; + 2 │ type B = "b" + > 3 │ type C = `${A B}bcd` + │ ^ + 4 │ type D = `${A B` + 5 │ -- ts_template_literal_error.ts:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -183,10 +185,11 @@ ts_template_literal_error.ts:4:15 parse ━━━━━━━━━━━━━ × unexpected - ┌─ ts_template_literal_error.ts:4:15 - │ - 4 │ type D = `${A B` - │ ^ + 2 │ type B = "b" + 3 │ type C = `${A B}bcd` + > 4 │ type D = `${A B` + │ ^ + 5 │ -- type A = "a"; diff --git a/crates/rome_js_parser/test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.rast b/crates/rome_js_parser/test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.rast index e7146c802cc..6410f75112a 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.rast @@ -72,10 +72,9 @@ ts_tuple_type_cannot_be_optional_and_rest.ts:1:12 parse ━━━━━━━━ × A tuple member cannot be both optional and rest. - ┌─ ts_tuple_type_cannot_be_optional_and_rest.ts:1:12 - │ - 1 │ type A = [ ...name?: string[] ] - │ ^^^^^^^^^^^^^^^^^^ + > 1 │ type A = [ ...name?: string[] ] + │ ^^^^^^^^^^^^^^^^^^ + 2 │ -- type A = [ ...name?: string[] ] diff --git a/crates/rome_js_parser/test_data/inline/err/ts_tuple_type_incomplete.rast b/crates/rome_js_parser/test_data/inline/err/ts_tuple_type_incomplete.rast index e224479e5e6..d63684820cc 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_tuple_type_incomplete.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_tuple_type_incomplete.rast @@ -51,10 +51,9 @@ ts_tuple_type_incomplete.ts:2:1 parse ━━━━━━━━━━━━━━ × Expected a type here - ┌─ ts_tuple_type_incomplete.ts:2:1 - │ - 2 │ - │ ^ + 1 │ type A = [string, + > 2 │ + │ -- type A = [string, diff --git a/crates/rome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast b/crates/rome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast index 60683d63dd3..eafe19a81c2 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast @@ -99,10 +99,9 @@ ts_type_assertions_not_valid_at_new_expr.ts:1:17 parse ━━━━━━━━ × Expected an expression here - ┌─ ts_type_assertions_not_valid_at_new_expr.ts:1:17 - │ - 1 │ var test2 = new Test2(); - │ ^ + > 1 │ var test2 = new Test2(); + │ ^ + 2 │ -- var test2 = new Test2(); diff --git a/crates/rome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.rast b/crates/rome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.rast index 7b394e5da52..a95374e7e38 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.rast @@ -56,10 +56,9 @@ ts_type_parameters_incomplete.ts:2:1 parse ━━━━━━━━━━━━ × the file ends here - ┌─ ts_type_parameters_incomplete.ts:2:1 - │ - 2 │ - │ ^ + 1 │ type A 2 │ + │ -- type A 1 │ import type A, { B, C } from './a'; + │ ^^^^^^^^^^^^^^^^ + 2 │ -- import type A, { B, C } from './a'; diff --git a/crates/rome_js_parser/test_data/inline/err/ts_variable_annotation_err.rast b/crates/rome_js_parser/test_data/inline/err/ts_variable_annotation_err.rast index bb7767915d7..abe28005d92 100644 --- a/crates/rome_js_parser/test_data/inline/err/ts_variable_annotation_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/ts_variable_annotation_err.rast @@ -48,10 +48,9 @@ ts_variable_annotation_err.ts:1:7 parse ━━━━━━━━━━━━━ × unexpected - ┌─ ts_variable_annotation_err.ts:1:7 - │ - 1 │ let a!; - │ ^ + > 1 │ let a!; + │ ^ + 2 │ -- let a!; diff --git a/crates/rome_js_parser/test_data/inline/err/type_arguments_incomplete.rast b/crates/rome_js_parser/test_data/inline/err/type_arguments_incomplete.rast index dccbbf96336..942755d6081 100644 --- a/crates/rome_js_parser/test_data/inline/err/type_arguments_incomplete.rast +++ b/crates/rome_js_parser/test_data/inline/err/type_arguments_incomplete.rast @@ -51,10 +51,9 @@ type_arguments_incomplete.ts:2:1 parse ━━━━━━━━━━━━━ × Expected an expression here - ┌─ type_arguments_incomplete.ts:2:1 - │ - 2 │ - │ ^ + 1 │ func 2 │ + │ -- func 2 │ abstract constructor() { } + │ ^^^^^^^^ + 3 │ abstract display(): void { } + 4 │ abstract get my_name() { } -- typescript_abstract_class_member_should_not_have_body.ts:3:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × abstract members should not have a body - ┌─ typescript_abstract_class_member_should_not_have_body.ts:3:30 - │ - 3 │ abstract display(): void { } - │ ^^^ + 1 │ abstract class AbstractMembers { + 2 │ abstract constructor() { } + > 3 │ abstract display(): void { } + │ ^^^ + 4 │ abstract get my_name() { } + 5 │ abstract set my_name(name) { } -- typescript_abstract_class_member_should_not_have_body.ts:4:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × abstract members should not have a body - ┌─ typescript_abstract_class_member_should_not_have_body.ts:4:28 - │ - 4 │ abstract get my_name() { } - │ ^^^ + 2 │ abstract constructor() { } + 3 │ abstract display(): void { } + > 4 │ abstract get my_name() { } + │ ^^^ + 5 │ abstract set my_name(name) { } + 6 │ abstract #private_name() { } -- typescript_abstract_class_member_should_not_have_body.ts:5:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × abstract members should not have a body - ┌─ typescript_abstract_class_member_should_not_have_body.ts:5:32 - │ - 5 │ abstract set my_name(name) { } - │ ^^^ + 3 │ abstract display(): void { } + 4 │ abstract get my_name() { } + > 5 │ abstract set my_name(name) { } + │ ^^^ + 6 │ abstract #private_name() { } + 7 │ } -- typescript_abstract_class_member_should_not_have_body.ts:6:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × abstract members should not have a body - ┌─ typescript_abstract_class_member_should_not_have_body.ts:6:30 - │ - 6 │ abstract #private_name() { } - │ ^^^ + 4 │ abstract get my_name() { } + 5 │ abstract set my_name(name) { } + > 6 │ abstract #private_name() { } + │ ^^^ + 7 │ } + 8 │ -- typescript_abstract_class_member_should_not_have_body.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' modifier cannot be used with a private identifier'. - ┌─ typescript_abstract_class_member_should_not_have_body.ts:6:5 - │ - 6 │ abstract #private_name() { } - │ ^^^^^^^^ + 4 │ abstract get my_name() { } + 5 │ abstract set my_name(name) { } + > 6 │ abstract #private_name() { } + │ ^^^^^^^^ + 7 │ } + 8 │ -- abstract class AbstractMembers { diff --git a/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_incomplete.rast b/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_incomplete.rast index 00c764fce97..a8c7ad93f80 100644 --- a/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_incomplete.rast +++ b/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_incomplete.rast @@ -42,10 +42,9 @@ typescript_abstract_classes_incomplete.ts:1:10 parse ━━━━━━━━━ × class declarations must have a name - ┌─ typescript_abstract_classes_incomplete.ts:1:10 - │ - 1 │ abstract class {}; - │ ^^^^^^ + > 1 │ abstract class {}; + │ ^^^^^^ + 2 │ -- abstract class {}; diff --git a/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.rast b/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.rast index 4be28bded0b..02cdbbeb8d5 100644 --- a/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.rast +++ b/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.rast @@ -69,10 +69,9 @@ typescript_abstract_classes_invalid_abstract_async_member.ts:1:20 parse ━━ × async members cannot be abstract - ┌─ typescript_abstract_classes_invalid_abstract_async_member.ts:1:20 - │ - 1 │ abstract class B { abstract async a(); } - │ ^^^^^^^^ + > 1 │ abstract class B { abstract async a(); } + │ ^^^^^^^^ + 2 │ -- abstract class B { abstract async a(); } diff --git a/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.rast b/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.rast index d48d8859dee..b390a60b9a5 100644 --- a/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.rast +++ b/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.rast @@ -77,10 +77,9 @@ typescript_abstract_classes_invalid_abstract_constructor.ts:1:20 parse ━━━ × 'abstract' cannot appear on a constructor declaration. - ┌─ typescript_abstract_classes_invalid_abstract_constructor.ts:1:20 - │ - 1 │ abstract class A { abstract constructor();}; - │ ^^^^^^^^ + > 1 │ abstract class A { abstract constructor();}; + │ ^^^^^^^^ + 2 │ -- abstract class A { abstract constructor();}; diff --git a/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.rast b/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.rast index 9e44c1c9d96..1751fe60125 100644 --- a/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.rast +++ b/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.rast @@ -77,10 +77,9 @@ typescript_abstract_classes_invalid_abstract_private_member.ts:1:20 parse ━━ × 'abstract' modifier cannot be used with a private identifier'. - ┌─ typescript_abstract_classes_invalid_abstract_private_member.ts:1:20 - │ - 1 │ abstract class A { abstract #name(); }; - │ ^^^^^^^^ + > 1 │ abstract class A { abstract #name(); }; + │ ^^^^^^^^ + 2 │ -- abstract class A { abstract #name(); }; diff --git a/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.rast b/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.rast index 55902b6c570..b0750939444 100644 --- a/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.rast +++ b/crates/rome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.rast @@ -134,34 +134,34 @@ typescript_abstract_classes_invalid_static_abstract_member.ts:1:20 parse ━━ × 'abstract' cannot be used with 'static' modifier. - ┌─ typescript_abstract_classes_invalid_static_abstract_member.ts:1:20 - │ - 1 │ abstract class A { abstract static fn1(); } - │ ^^^^^^^^ + > 1 │ abstract class A { abstract static fn1(); } + │ ^^^^^^^^ + 2 │ abstract class B { static abstract fn1(); } + 3 │ i 'static' modifier - ┌─ typescript_abstract_classes_invalid_static_abstract_member.ts:1:29 - │ - 1 │ abstract class A { abstract static fn1(); } - │ ^^^^^^ + > 1 │ abstract class A { abstract static fn1(); } + │ ^^^^^^ + 2 │ abstract class B { static abstract fn1(); } + 3 │ -- typescript_abstract_classes_invalid_static_abstract_member.ts:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' cannot be used with 'static' modifier. - ┌─ typescript_abstract_classes_invalid_static_abstract_member.ts:2:27 - │ - 2 │ abstract class B { static abstract fn1(); } - │ ^^^^^^^^ + 1 │ abstract class A { abstract static fn1(); } + > 2 │ abstract class B { static abstract fn1(); } + │ ^^^^^^^^ + 3 │ i 'static' modifier - ┌─ typescript_abstract_classes_invalid_static_abstract_member.ts:2:20 - │ - 2 │ abstract class B { static abstract fn1(); } - │ ^^^^^^ + 1 │ abstract class A { abstract static fn1(); } + > 2 │ abstract class B { static abstract fn1(); } + │ ^^^^^^ + 3 │ -- abstract class A { abstract static fn1(); } diff --git a/crates/rome_js_parser/test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.rast b/crates/rome_js_parser/test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.rast index 5cb0c2f7f75..7b46bc639c1 100644 --- a/crates/rome_js_parser/test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.rast +++ b/crates/rome_js_parser/test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.rast @@ -112,30 +112,27 @@ typescript_classes_invalid_accessibility_modifier_private_member.ts:1:11 parse × An accessibility modifier cannot be used with a private identifier. - ┌─ typescript_classes_invalid_accessibility_modifier_private_member.ts:1:11 - │ - 1 │ class A { private #name; protected #other; public #baz; }; - │ ^^^^^^^ + > 1 │ class A { private #name; protected #other; public #baz; }; + │ ^^^^^^^ + 2 │ -- typescript_classes_invalid_accessibility_modifier_private_member.ts:1:26 parse ━━━━━━━━━━━━━━━━━━━━━ × An accessibility modifier cannot be used with a private identifier. - ┌─ typescript_classes_invalid_accessibility_modifier_private_member.ts:1:26 - │ - 1 │ class A { private #name; protected #other; public #baz; }; - │ ^^^^^^^^^ + > 1 │ class A { private #name; protected #other; public #baz; }; + │ ^^^^^^^^^ + 2 │ -- typescript_classes_invalid_accessibility_modifier_private_member.ts:1:44 parse ━━━━━━━━━━━━━━━━━━━━━ × An accessibility modifier cannot be used with a private identifier. - ┌─ typescript_classes_invalid_accessibility_modifier_private_member.ts:1:44 - │ - 1 │ class A { private #name; protected #other; public #baz; }; - │ ^^^^^^ + > 1 │ class A { private #name; protected #other; public #baz; }; + │ ^^^^^^ + 2 │ -- class A { private #name; protected #other; public #baz; }; diff --git a/crates/rome_js_parser/test_data/inline/err/typescript_enum_incomplete.rast b/crates/rome_js_parser/test_data/inline/err/typescript_enum_incomplete.rast index 13e7778d120..d8e5c87d77a 100644 --- a/crates/rome_js_parser/test_data/inline/err/typescript_enum_incomplete.rast +++ b/crates/rome_js_parser/test_data/inline/err/typescript_enum_incomplete.rast @@ -36,10 +36,9 @@ typescript_enum_incomplete.ts:2:1 parse ━━━━━━━━━━━━━ × the file ends here - ┌─ typescript_enum_incomplete.ts:2:1 - │ - 2 │ - │ ^ + 1 │ enum A { + > 2 │ + │ -- enum A { diff --git a/crates/rome_js_parser/test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.rast b/crates/rome_js_parser/test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.rast index e2d61269cee..ad13e4fd7f1 100644 --- a/crates/rome_js_parser/test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.rast @@ -414,80 +414,95 @@ typescript_members_with_body_in_ambient_context_should_err.ts:2:19 parse ━━ × members inside ambient contexts should not have a body - ┌─ typescript_members_with_body_in_ambient_context_should_err.ts:2:19 - │ - 2 │ constructor() {} - │ ^^ + 1 │ declare class Test { + > 2 │ constructor() {} + │ ^^ + 3 │ name() {} + 4 │ get test(): string { return ""; } -- typescript_members_with_body_in_ambient_context_should_err.ts:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body - ┌─ typescript_members_with_body_in_ambient_context_should_err.ts:3:12 - │ - 3 │ name() {} - │ ^^ + 1 │ declare class Test { + 2 │ constructor() {} + > 3 │ name() {} + │ ^^ + 4 │ get test(): string { return ""; } + 5 │ set test(v) {} -- typescript_members_with_body_in_ambient_context_should_err.ts:4:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body - ┌─ typescript_members_with_body_in_ambient_context_should_err.ts:4:24 - │ - 4 │ get test(): string { return ""; } - │ ^^^^^^^^^^^^^^ + 2 │ constructor() {} + 3 │ name() {} + > 4 │ get test(): string { return ""; } + │ ^^^^^^^^^^^^^^ + 5 │ set test(v) {} + 6 │ } -- typescript_members_with_body_in_ambient_context_should_err.ts:5:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body - ┌─ typescript_members_with_body_in_ambient_context_should_err.ts:5:17 - │ - 5 │ set test(v) {} - │ ^^ + 3 │ name() {} + 4 │ get test(): string { return ""; } + > 5 │ set test(v) {} + │ ^^ + 6 │ } + 7 │ declare namespace n { -- typescript_members_with_body_in_ambient_context_should_err.ts:9:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body - ┌─ typescript_members_with_body_in_ambient_context_should_err.ts:9:24 - │ - 9 │ constructor() {} - │ ^^ + 7 │ declare namespace n { + 8 │ class Test { + > 9 │ constructor() {} + │ ^^ + 10 │ name() {} + 11 │ get test(): string { return ""; } -- typescript_members_with_body_in_ambient_context_should_err.ts:10:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body - ┌─ typescript_members_with_body_in_ambient_context_should_err.ts:10:17 - │ - 10 │ name() {} - │ ^^ + 8 │ class Test { + 9 │ constructor() {} + > 10 │ name() {} + │ ^^ + 11 │ get test(): string { return ""; } + 12 │ set test(v) {} -- typescript_members_with_body_in_ambient_context_should_err.ts:11:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body - ┌─ typescript_members_with_body_in_ambient_context_should_err.ts:11:29 - │ - 11 │ get test(): string { return ""; } - │ ^^^^^^^^^^^^^^ + 9 │ constructor() {} + 10 │ name() {} + > 11 │ get test(): string { return ""; } + │ ^^^^^^^^^^^^^^ + 12 │ set test(v) {} + 13 │ } -- typescript_members_with_body_in_ambient_context_should_err.ts:12:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body - ┌─ typescript_members_with_body_in_ambient_context_should_err.ts:12:22 - │ - 12 │ set test(v) {} - │ ^^ + 10 │ name() {} + 11 │ get test(): string { return ""; } + > 12 │ set test(v) {} + │ ^^ + 13 │ } + 14 │ } -- declare class Test { diff --git a/crates/rome_js_parser/test_data/inline/err/unary_delete.rast b/crates/rome_js_parser/test_data/inline/err/unary_delete.rast index f4814298979..53fffd3f790 100644 --- a/crates/rome_js_parser/test_data/inline/err/unary_delete.rast +++ b/crates/rome_js_parser/test_data/inline/err/unary_delete.rast @@ -190,50 +190,56 @@ unary_delete.js:1:8 parse ━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a single identifier - ┌─ unary_delete.js:1:8 - │ - 1 │ delete ident; - │ ^^^^^ + > 1 │ delete ident; + │ ^^^^^ + 2 │ delete obj.#member; + 3 │ delete func().#member; -- unary_delete.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member - ┌─ unary_delete.js:2:8 - │ - 2 │ delete obj.#member; - │ ^^^^^^^^^^^ + 1 │ delete ident; + > 2 │ delete obj.#member; + │ ^^^^^^^^^^^ + 3 │ delete func().#member; + 4 │ delete obj?.#member; -- unary_delete.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member - ┌─ unary_delete.js:3:8 - │ - 3 │ delete func().#member; - │ ^^^^^^^^^^^^^^ + 1 │ delete ident; + 2 │ delete obj.#member; + > 3 │ delete func().#member; + │ ^^^^^^^^^^^^^^ + 4 │ delete obj?.#member; + 5 │ delete obj?.inner.#member; -- unary_delete.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member - ┌─ unary_delete.js:4:8 - │ - 4 │ delete obj?.#member; - │ ^^^^^^^^^^^^ + 2 │ delete obj.#member; + 3 │ delete func().#member; + > 4 │ delete obj?.#member; + │ ^^^^^^^^^^^^ + 5 │ delete obj?.inner.#member; + 6 │ -- unary_delete.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member - ┌─ unary_delete.js:5:8 - │ - 5 │ delete obj?.inner.#member; - │ ^^^^^^^^^^^^^^^^^^ + 3 │ delete func().#member; + 4 │ delete obj?.#member; + > 5 │ delete obj?.inner.#member; + │ ^^^^^^^^^^^^^^^^^^ + 6 │ -- delete ident; diff --git a/crates/rome_js_parser/test_data/inline/err/unary_delete_parenthesized.rast b/crates/rome_js_parser/test_data/inline/err/unary_delete_parenthesized.rast index a5c3ff20636..4134852f964 100644 --- a/crates/rome_js_parser/test_data/inline/err/unary_delete_parenthesized.rast +++ b/crates/rome_js_parser/test_data/inline/err/unary_delete_parenthesized.rast @@ -371,80 +371,92 @@ unary_delete_parenthesized.js:1:9 parse ━━━━━━━━━━━━━ × the target for a delete operator cannot be a single identifier - ┌─ unary_delete_parenthesized.js:1:9 - │ - 1 │ delete (ident); - │ ^^^^^ + > 1 │ delete (ident); + │ ^^^^^ + 2 │ delete ((ident)); + 3 │ delete (obj.key, ident); -- unary_delete_parenthesized.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a single identifier - ┌─ unary_delete_parenthesized.js:2:10 - │ - 2 │ delete ((ident)); - │ ^^^^^ + 1 │ delete (ident); + > 2 │ delete ((ident)); + │ ^^^^^ + 3 │ delete (obj.key, ident); + 4 │ delete (obj.#member); -- unary_delete_parenthesized.js:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a single identifier - ┌─ unary_delete_parenthesized.js:3:18 - │ - 3 │ delete (obj.key, ident); - │ ^^^^^ + 1 │ delete (ident); + 2 │ delete ((ident)); + > 3 │ delete (obj.key, ident); + │ ^^^^^ + 4 │ delete (obj.#member); + 5 │ delete (func().#member); -- unary_delete_parenthesized.js:4:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member - ┌─ unary_delete_parenthesized.js:4:9 - │ - 4 │ delete (obj.#member); - │ ^^^^^^^^^^^ + 2 │ delete ((ident)); + 3 │ delete (obj.key, ident); + > 4 │ delete (obj.#member); + │ ^^^^^^^^^^^ + 5 │ delete (func().#member); + 6 │ delete (obj?.#member); -- unary_delete_parenthesized.js:5:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member - ┌─ unary_delete_parenthesized.js:5:9 - │ - 5 │ delete (func().#member); - │ ^^^^^^^^^^^^^^ + 3 │ delete (obj.key, ident); + 4 │ delete (obj.#member); + > 5 │ delete (func().#member); + │ ^^^^^^^^^^^^^^ + 6 │ delete (obj?.#member); + 7 │ delete (obj?.inner.#member); -- unary_delete_parenthesized.js:6:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member - ┌─ unary_delete_parenthesized.js:6:9 - │ - 6 │ delete (obj?.#member); - │ ^^^^^^^^^^^^ + 4 │ delete (obj.#member); + 5 │ delete (func().#member); + > 6 │ delete (obj?.#member); + │ ^^^^^^^^^^^^ + 7 │ delete (obj?.inner.#member); + 8 │ delete (obj.key, obj.#key); -- unary_delete_parenthesized.js:7:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member - ┌─ unary_delete_parenthesized.js:7:9 - │ - 7 │ delete (obj?.inner.#member); - │ ^^^^^^^^^^^^^^^^^^ + 5 │ delete (func().#member); + 6 │ delete (obj?.#member); + > 7 │ delete (obj?.inner.#member); + │ ^^^^^^^^^^^^^^^^^^ + 8 │ delete (obj.key, obj.#key); + 9 │ -- unary_delete_parenthesized.js:8:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member - ┌─ unary_delete_parenthesized.js:8:18 - │ - 8 │ delete (obj.key, obj.#key); - │ ^^^^^^^^ + 6 │ delete (obj?.#member); + 7 │ delete (obj?.inner.#member); + > 8 │ delete (obj.key, obj.#key); + │ ^^^^^^^^ + 9 │ -- delete (ident); diff --git a/crates/rome_js_parser/test_data/inline/err/unary_expr.rast b/crates/rome_js_parser/test_data/inline/err/unary_expr.rast index d1c1de44507..f305844aacd 100644 --- a/crates/rome_js_parser/test_data/inline/err/unary_expr.rast +++ b/crates/rome_js_parser/test_data/inline/err/unary_expr.rast @@ -54,10 +54,10 @@ unary_expr.js:1:4 parse ━━━━━━━━━━━━━━━━━━ × Expected an identifier, or a member expression here - ┌─ unary_expr.js:1:4 - │ - 1 │ ++ ; - │ ^ + > 1 │ ++ ; + │ ^ + 2 │ -- ; + 3 │ -; -- unary_expr.js:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -66,10 +66,11 @@ unary_expr.js:2:4 parse ━━━━━━━━━━━━━━━━━━ × Expected an identifier, or a member expression here - ┌─ unary_expr.js:2:4 - │ - 2 │ -- ; - │ ^ + 1 │ ++ ; + > 2 │ -- ; + │ ^ + 3 │ -; + 4 │ -- ++ ; diff --git a/crates/rome_js_parser/test_data/inline/err/unterminated_unicode_codepoint.rast b/crates/rome_js_parser/test_data/inline/err/unterminated_unicode_codepoint.rast index 4344a6c0701..3ef3b3a26f4 100644 --- a/crates/rome_js_parser/test_data/inline/err/unterminated_unicode_codepoint.rast +++ b/crates/rome_js_parser/test_data/inline/err/unterminated_unicode_codepoint.rast @@ -59,10 +59,9 @@ unterminated_unicode_codepoint.js:1:16 parse ━━━━━━━━━━━ × expected hex digits for a unicode code point escape, but encountered an invalid character - ┌─ unterminated_unicode_codepoint.js:1:16 - │ - 1 │ let s = "\u{200"; - │ ^ + > 1 │ let s = "\u{200"; + │ ^ + 2 │ -- let s = "\u{200"; diff --git a/crates/rome_js_parser/test_data/inline/err/var_decl_err.rast b/crates/rome_js_parser/test_data/inline/err/var_decl_err.rast index 52ceca335e3..58def6b4f47 100644 --- a/crates/rome_js_parser/test_data/inline/err/var_decl_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/var_decl_err.rast @@ -114,10 +114,10 @@ var_decl_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment here - ┌─ var_decl_err.js:1:8 - │ - 1 │ var a =; - │ ^ + > 1 │ var a =; + │ ^ + 2 │ const b = 5 let c = 5; + 3 │ -- var_decl_err.js:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -126,17 +126,17 @@ var_decl_err.js:2:13 parse ━━━━━━━━━━━━━━━━━ × An explicit or implicit semicolon is expected here... - ┌─ var_decl_err.js:2:13 - │ - 2 │ const b = 5 let c = 5; - │ ^^^ + 1 │ var a =; + > 2 │ const b = 5 let c = 5; + │ ^^^ + 3 │ i ...Which is required to end this statement - ┌─ var_decl_err.js:2:1 - │ - 2 │ const b = 5 let c = 5; - │ ^^^^^^^^^^^^ + 1 │ var a =; + > 2 │ const b = 5 let c = 5; + │ ^^^^^^^^^^^^ + 3 │ -- var a =; diff --git a/crates/rome_js_parser/test_data/inline/err/variable_declaration_statement_err.rast b/crates/rome_js_parser/test_data/inline/err/variable_declaration_statement_err.rast index 760ae62950b..5ddc184b4ff 100644 --- a/crates/rome_js_parser/test_data/inline/err/variable_declaration_statement_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/variable_declaration_statement_err.rast @@ -290,10 +290,12 @@ variable_declaration_statement_err.js:3:7 parse ━━━━━━━━━━ × this variable needs to be initialized - ┌─ variable_declaration_statement_err.js:3:7 - │ - 3 │ const e; - │ ^ + 1 │ let a, { b } = { a: 10 } + 2 │ const c = 1, { d } = { a: 10 } + > 3 │ const e; + │ ^ + 4 │ let [f]; + 5 │ const { g }; -- variable_declaration_statement_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -302,10 +304,12 @@ variable_declaration_statement_err.js:4:5 parse ━━━━━━━━━━ × this pattern is declared, but it is not given an initialized value - ┌─ variable_declaration_statement_err.js:4:5 - │ - 4 │ let [f]; - │ ^^^ + 2 │ const c = 1, { d } = { a: 10 } + 3 │ const e; + > 4 │ let [f]; + │ ^^^ + 5 │ const { g }; + 6 │ -- variable_declaration_statement_err.js:5:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -314,10 +318,11 @@ variable_declaration_statement_err.js:5:7 parse ━━━━━━━━━━ × this pattern is declared, but it is not given an initialized value - ┌─ variable_declaration_statement_err.js:5:7 - │ - 5 │ const { g }; - │ ^^^^^ + 3 │ const e; + 4 │ let [f]; + > 5 │ const { g }; + │ ^^^^^ + 6 │ -- let a, { b } = { a: 10 } diff --git a/crates/rome_js_parser/test_data/inline/err/variable_declarator_list_empty.rast b/crates/rome_js_parser/test_data/inline/err/variable_declarator_list_empty.rast index c92130d504f..c7acc7e7150 100644 --- a/crates/rome_js_parser/test_data/inline/err/variable_declarator_list_empty.rast +++ b/crates/rome_js_parser/test_data/inline/err/variable_declarator_list_empty.rast @@ -52,10 +52,10 @@ variable_declarator_list_empty.js:1:6 parse ━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern here - ┌─ variable_declarator_list_empty.js:1:6 - │ - 1 │ const; - │ ^ + > 1 │ const; + │ ^ + 2 │ const + 3 │ -- variable_declarator_list_empty.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -64,10 +64,10 @@ variable_declarator_list_empty.js:3:1 parse ━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern here - ┌─ variable_declarator_list_empty.js:3:1 - │ - 3 │ - │ ^ + 1 │ const; + 2 │ const + > 3 │ + │ -- const; diff --git a/crates/rome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.rast b/crates/rome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.rast index 423210f83ed..d7e1838a705 100644 --- a/crates/rome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.rast +++ b/crates/rome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.rast @@ -55,10 +55,9 @@ variable_declarator_list_incomplete.js:2:1 parse ━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern here - ┌─ variable_declarator_list_incomplete.js:2:1 - │ - 2 │ - │ ^ + 1 │ const a = 1, + > 2 │ + │ -- const a = 1, diff --git a/crates/rome_js_parser/test_data/inline/err/while_stmt_err.rast b/crates/rome_js_parser/test_data/inline/err/while_stmt_err.rast index ca5feb26cad..e967c6e5595 100644 --- a/crates/rome_js_parser/test_data/inline/err/while_stmt_err.rast +++ b/crates/rome_js_parser/test_data/inline/err/while_stmt_err.rast @@ -107,10 +107,10 @@ while_stmt_err.js:1:7 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ while_stmt_err.js:1:7 - │ - 1 │ while true {} - │ ^^^^ + > 1 │ while true {} + │ ^^^^ + 2 │ while {} + 3 │ while (true {} -- while_stmt_err.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -119,10 +119,10 @@ while_stmt_err.js:1:12 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ while_stmt_err.js:1:12 - │ - 1 │ while true {} - │ ^ + > 1 │ while true {} + │ ^ + 2 │ while {} + 3 │ while (true {} -- while_stmt_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -131,10 +131,11 @@ while_stmt_err.js:2:7 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ while_stmt_err.js:2:7 - │ - 2 │ while {} - │ ^ + 1 │ while true {} + > 2 │ while {} + │ ^ + 3 │ while (true {} + 4 │ while true) } -- while_stmt_err.js:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -143,10 +144,12 @@ while_stmt_err.js:3:13 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ while_stmt_err.js:3:13 - │ - 3 │ while (true {} - │ ^ + 1 │ while true {} + 2 │ while {} + > 3 │ while (true {} + │ ^ + 4 │ while true) } + 5 │ -- while_stmt_err.js:4:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -155,10 +158,11 @@ while_stmt_err.js:4:7 parse ━━━━━━━━━━━━━━━━━ × unexpected - ┌─ while_stmt_err.js:4:7 - │ - 4 │ while true) } - │ ^^^^ + 2 │ while {} + 3 │ while (true {} + > 4 │ while true) } + │ ^^^^ + 5 │ -- while_stmt_err.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -167,10 +171,11 @@ while_stmt_err.js:4:13 parse ━━━━━━━━━━━━━━━━━ × Expected a statement here - ┌─ while_stmt_err.js:4:13 - │ - 4 │ while true) } - │ ^ + 2 │ while {} + 3 │ while (true {} + > 4 │ while true) } + │ ^ + 5 │ -- while true {} diff --git a/crates/rome_js_parser/test_data/inline/err/yield_expr_in_parameter_initializer.rast b/crates/rome_js_parser/test_data/inline/err/yield_expr_in_parameter_initializer.rast index d7cfbbcdf8d..df2989dbf6c 100644 --- a/crates/rome_js_parser/test_data/inline/err/yield_expr_in_parameter_initializer.rast +++ b/crates/rome_js_parser/test_data/inline/err/yield_expr_in_parameter_initializer.rast @@ -166,20 +166,20 @@ yield_expr_in_parameter_initializer.js:1:20 parse ━━━━━━━━━━ × `yield` is only allowed within generator functions. - ┌─ yield_expr_in_parameter_initializer.js:1:20 - │ - 1 │ function* test(a = yield "test") {} - │ ^^^^^^^^^^^^ + > 1 │ function* test(a = yield "test") {} + │ ^^^^^^^^^^^^ + 2 │ function test2(a = yield "test") {} + 3 │ -- yield_expr_in_parameter_initializer.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `yield` as an identifier in strict mode - ┌─ yield_expr_in_parameter_initializer.js:2:20 - │ - 2 │ function test2(a = yield "test") {} - │ ^^^^^ + 1 │ function* test(a = yield "test") {} + > 2 │ function test2(a = yield "test") {} + │ ^^^^^ + 3 │ -- yield_expr_in_parameter_initializer.js:2:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -188,10 +188,10 @@ yield_expr_in_parameter_initializer.js:2:26 parse ━━━━━━━━━━ × unexpected - ┌─ yield_expr_in_parameter_initializer.js:2:26 - │ - 2 │ function test2(a = yield "test") {} - │ ^^^^^^ + 1 │ function* test(a = yield "test") {} + > 2 │ function test2(a = yield "test") {} + │ ^^^^^^ + 3 │ -- function* test(a = yield "test") {} diff --git a/crates/rome_service/src/configuration/linter/mod.rs b/crates/rome_service/src/configuration/linter/mod.rs index af7d020805b..fb6f0fec35c 100644 --- a/crates/rome_service/src/configuration/linter/mod.rs +++ b/crates/rome_service/src/configuration/linter/mod.rs @@ -5,7 +5,7 @@ pub use crate::configuration::linter::rules::Rules; use crate::settings::LinterSettings; use crate::{ConfigurationError, MatchOptions, Matcher, RomeError}; use indexmap::IndexSet; -use rome_console::codespan::Severity; +use rome_diagnostics::Severity; pub use rules::*; #[cfg(feature = "schemars")] use schemars::{gen::SchemaGenerator, schema::Schema, JsonSchema}; diff --git a/crates/rome_service/src/configuration/linter/rules.rs b/crates/rome_service/src/configuration/linter/rules.rs index 4680ea2ab7f..c74c41e2373 100644 --- a/crates/rome_service/src/configuration/linter/rules.rs +++ b/crates/rome_service/src/configuration/linter/rules.rs @@ -3,8 +3,8 @@ use crate::{ConfigurationError, RomeError, RuleConfiguration}; use indexmap::{IndexMap, IndexSet}; use rome_analyze::RuleFilter; -use rome_console::codespan::Severity; use rome_diagnostics::v2::Category; +use rome_diagnostics::Severity; #[cfg(feature = "schemars")] use schemars::JsonSchema; use serde::{Deserialize, Serialize}; diff --git a/crates/rome_service/src/file_handlers/javascript.rs b/crates/rome_service/src/file_handlers/javascript.rs index a560f2226fa..51abec98821 100644 --- a/crates/rome_service/src/file_handlers/javascript.rs +++ b/crates/rome_service/src/file_handlers/javascript.rs @@ -27,7 +27,7 @@ use super::{ }; use crate::file_handlers::{FixAllParams, Language as LanguageId}; use indexmap::IndexSet; -use rome_console::codespan::Severity; +use rome_diagnostics::Severity; use rome_js_analyze::utils::rename::{RenameError, RenameSymbolExtensions}; use std::borrow::Cow; use std::fmt::Debug; diff --git a/crates/rome_service/src/settings.rs b/crates/rome_service/src/settings.rs index 355f72faee2..5a31d175db8 100644 --- a/crates/rome_service/src/settings.rs +++ b/crates/rome_service/src/settings.rs @@ -1,7 +1,7 @@ use crate::{Configuration, MatchOptions, Matcher, RomeError, Rules}; use indexmap::IndexSet; -use rome_console::codespan::Severity; use rome_diagnostics::v2::Category; +use rome_diagnostics::Severity; use rome_formatter::{IndentStyle, LineWidth}; use rome_fs::RomePath; use rome_js_syntax::JsLanguage; diff --git a/website/src/docs/lint/rules/noArguments.md b/website/src/docs/lint/rules/noArguments.md index 42d413e1582..7451ffa4f41 100644 --- a/website/src/docs/lint/rules/noArguments.md +++ b/website/src/docs/lint/rules/noArguments.md @@ -23,10 +23,11 @@ function f() { Use the rest parameters instead of arguments. - correctness/noArguments.js:2:16 - - 2 console.log(arguments); - ^^^^^^^^^ + 1 │ function f() { + > 2 │ console.log(arguments); + ^^^^^^^^^ + 3 │ } + 4 │ arguments does not have Array.prototype methods and can be inconvenient to use. diff --git a/website/src/docs/lint/rules/noArrayIndexKey.md b/website/src/docs/lint/rules/noArrayIndexKey.md index e46644408c5..7054d9b1146 100644 --- a/website/src/docs/lint/rules/noArrayIndexKey.md +++ b/website/src/docs/lint/rules/noArrayIndexKey.md @@ -30,17 +30,18 @@ something.forEach((Element, index) => { Avoid using the index of an array as key property in an element. - nursery/noArrayIndexKey.js:2:21 - - 2 <Component key={index} >foo</Component> - ^^^^^ + 1 │ something.forEach((Element, index) => { + > 2 │ <Component key={index} >foo</Component> + ^^^^^ + 3 │ }); + 4 │ This is the source of the key value. - nursery/noArrayIndexKey.js:1:29 - - 1 something.forEach((Element, index) => { - ^^^^^ + > 1 │ something.forEach((Element, index) => { + ^^^^^ + 2 │ <Component key={index} >foo</Component> + 3 │ }); The order of the items may change, and this also affects performances and component state. @@ -58,17 +59,18 @@ React.Children.map(this.props.children, (child, index) => ( Avoid using the index of an array as key property in an element. - nursery/noArrayIndexKey.js:2:38 - - 2 React.cloneElement(child, { key: index }) - ^^^^^ + 1 │ React.Children.map(this.props.children, (child, index) => ( + > 2 │ React.cloneElement(child, { key: index }) + ^^^^^ + 3 │ )) + 4 │ This is the source of the key value. - nursery/noArrayIndexKey.js:1:49 - - 1 React.Children.map(this.props.children, (child, index) => ( - ^^^^^ + > 1 │ React.Children.map(this.props.children, (child, index) => ( + ^^^^^ + 2 │ React.cloneElement(child, { key: index }) + 3 │ )) The order of the items may change, and this also affects performances and component state. diff --git a/website/src/docs/lint/rules/noAsyncPromiseExecutor.md b/website/src/docs/lint/rules/noAsyncPromiseExecutor.md index 8da219e1b29..299e77507f1 100644 --- a/website/src/docs/lint/rules/noAsyncPromiseExecutor.md +++ b/website/src/docs/lint/rules/noAsyncPromiseExecutor.md @@ -26,10 +26,9 @@ new Promise(async function foo(resolve, reject) {}) Promise executor functions should not be `async`. - correctness/noAsyncPromiseExecutor.js:1:13 - - 1 new Promise(async function foo(resolve, reject) {}) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ new Promise(async function foo(resolve, reject) {}) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ {% endraw %} @@ -41,10 +40,9 @@ new Promise(async function foo(resolve, reject) {}) Promise executor functions should not be `async`. - correctness/noAsyncPromiseExecutor.js:1:15 - - 1 new Promise(async (resolve, reject) => {}) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ new Promise(async (resolve, reject) => {}) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ {% endraw %} @@ -56,10 +54,9 @@ new Promise(async function foo(resolve, reject) {}) Promise executor functions should not be `async`. - correctness/noAsyncPromiseExecutor.js:1:19 - - 1 new Promise(((((async () => {}))))) - ^^^^^^^^^^^^^^ + > 1 │ new Promise(((((async () => {}))))) + ^^^^^^^^^^^^^^ + 2 │ {% endraw %} diff --git a/website/src/docs/lint/rules/noCatchAssign.md b/website/src/docs/lint/rules/noCatchAssign.md index 0802e48e79d..42ec3b6c3d7 100644 --- a/website/src/docs/lint/rules/noCatchAssign.md +++ b/website/src/docs/lint/rules/noCatchAssign.md @@ -26,17 +26,21 @@ try { Do not reassign catch parameters. - correctness/noCatchAssign.js:5:3 - - 5 e = 10; - ^ + 3 │ } catch (e) { + 4 │ e; + > 5 │ e = 10; + ^ + 6 │ } + 7 │ The catch parameter is declared here - correctness/noCatchAssign.js:3:10 - - 3 } catch (e) { - ^ + 1 │ try { + 2 │ + > 3 │ } catch (e) { + ^ + 4 │ e; + 5 │ e = 10; Use a local variable instead. diff --git a/website/src/docs/lint/rules/noCommentText.md b/website/src/docs/lint/rules/noCommentText.md index 626c2b63005..3adab448c47 100644 --- a/website/src/docs/lint/rules/noCommentText.md +++ b/website/src/docs/lint/rules/noCommentText.md @@ -21,10 +21,9 @@ const a3 =
// comment
; Wrap comments inside children within braces. - correctness/noCommentText.js:1:17 - - 1 const a3 = <div>// comment</div>; - ^^^^^^^^^^ + > 1 │ const a3 = <div>// comment</div>; + ^^^^^^^^^^ + 2 │ Suggested fix: Wrap the comments with braces @@ -42,10 +41,9 @@ const a4 =
/* comment */
; Wrap comments inside children within braces. - correctness/noCommentText.js:1:17 - - 1 const a4 = <div>/* comment */</div>; - ^^^^^^^^^^^^^ + > 1 │ const a4 = <div>/* comment */</div>; + ^^^^^^^^^^^^^ + 2 │ Suggested fix: Wrap the comments with braces @@ -63,10 +61,9 @@ const a5 =
/** comment */
; Wrap comments inside children within braces. - correctness/noCommentText.js:1:17 - - 1 const a5 = <div>/** comment */</div>; - ^^^^^^^^^^^^^^ + > 1 │ const a5 = <div>/** comment */</div>; + ^^^^^^^^^^^^^^ + 2 │ Suggested fix: Wrap the comments with braces diff --git a/website/src/docs/lint/rules/noCompareNegZero.md b/website/src/docs/lint/rules/noCompareNegZero.md index 2f2ec3f88dd..cdff048e0dc 100644 --- a/website/src/docs/lint/rules/noCompareNegZero.md +++ b/website/src/docs/lint/rules/noCompareNegZero.md @@ -21,10 +21,9 @@ Disallow comparing against `-0` Do not use the >= operator to compare against -0. - correctness/noCompareNegZero.js:1:2 - - 1 (1 >= -0) - ^^^^^^^ + > 1 │ (1 >= -0) + ^^^^^^^ + 2 │ Safe fix: Replace -0 with 0 diff --git a/website/src/docs/lint/rules/noDangerouslySetInnerHtml.md b/website/src/docs/lint/rules/noDangerouslySetInnerHtml.md index 210523dcdb4..091ee5e3685 100644 --- a/website/src/docs/lint/rules/noDangerouslySetInnerHtml.md +++ b/website/src/docs/lint/rules/noDangerouslySetInnerHtml.md @@ -22,10 +22,11 @@ function createMarkup() { Avoid passing content using the dangerouslySetInnerHTML prop. - nursery/noDangerouslySetInnerHtml.js:4:6 - - 4 <div dangerouslySetInnerHTML={createMarkup()}></div> - ^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ return { __html: 'child' } + 3 │ } + > 4 │ <div dangerouslySetInnerHTML={createMarkup()}></div> + ^^^^^^^^^^^^^^^^^^^^^^^ + 5 │ Setting content using code can expose users to cross-site scripting (XSS) attacks @@ -41,10 +42,11 @@ React.createElement('div', { Avoid passing content using the dangerouslySetInnerHTML prop. - nursery/noDangerouslySetInnerHtml.js:2:5 - - 2 dangerouslySetInnerHTML: { __html: 'child' } - ^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ React.createElement('div', { + > 2 │ dangerouslySetInnerHTML: { __html: 'child' } + ^^^^^^^^^^^^^^^^^^^^^^^ + 3 │ }); + 4 │ Setting content using code can expose users to cross-site scripting (XSS) attacks diff --git a/website/src/docs/lint/rules/noDebugger.md b/website/src/docs/lint/rules/noDebugger.md index abf12bb989e..b275d5636b2 100644 --- a/website/src/docs/lint/rules/noDebugger.md +++ b/website/src/docs/lint/rules/noDebugger.md @@ -21,10 +21,9 @@ debugger; This is an unexpected use of the debugger statement. - correctness/noDebugger.js:1:1 - - 1 debugger; - ^^^^^^^^^ + > 1 │ debugger; + ^^^^^^^^^ + 2 │ Suggested fix: Remove debugger statement diff --git a/website/src/docs/lint/rules/noDelete.md b/website/src/docs/lint/rules/noDelete.md index 15f244604c7..7886c9435d6 100644 --- a/website/src/docs/lint/rules/noDelete.md +++ b/website/src/docs/lint/rules/noDelete.md @@ -22,10 +22,10 @@ delete arr[0][2]; This is an unexpected use of the delete operator. - correctness/noDelete.js:2:1 - - 2 delete arr[0][2]; - ^^^^^^^^^^^^^^^^ + 1 │ const arr = [['a','b','c'], [1, 2, 3]]; + > 2 │ delete arr[0][2]; + ^^^^^^^^^^^^^^^^ + 3 │ Suggested fix: Replace with undefined assignment @@ -45,10 +45,10 @@ delete obj.a.b.c; This is an unexpected use of the delete operator. - correctness/noDelete.js:2:1 - - 2 delete obj.a.b.c; - ^^^^^^^^^^^^^^^^ + 1 │ const obj = {a: {b: {c: 123}}}; + > 2 │ delete obj.a.b.c; + ^^^^^^^^^^^^^^^^ + 3 │ Suggested fix: Replace with undefined assignment diff --git a/website/src/docs/lint/rules/noDoubleEquals.md b/website/src/docs/lint/rules/noDoubleEquals.md index 73a0692f706..3f42f58f26b 100644 --- a/website/src/docs/lint/rules/noDoubleEquals.md +++ b/website/src/docs/lint/rules/noDoubleEquals.md @@ -31,10 +31,9 @@ foo == bar == is only allowed when comparing against null - correctness/noDoubleEquals.js:1:5 - - 1 foo == bar - ^^ + > 1 │ foo == bar + ^^ + 2 │ Using === may be unsafe if you are relying on type coercion diff --git a/website/src/docs/lint/rules/noDupeArgs.md b/website/src/docs/lint/rules/noDupeArgs.md index 84a6d1ef4b1..7c0d50b1303 100644 --- a/website/src/docs/lint/rules/noDupeArgs.md +++ b/website/src/docs/lint/rules/noDupeArgs.md @@ -21,10 +21,9 @@ var f = function(a, b, b) {} Duplicate argument name - correctness/noDupeArgs.js:1:24 - - 1 var f = function(a, b, b) {} - ^ + > 1 │ var f = function(a, b, b) {} + ^ + 2 │ {% endraw %} @@ -36,10 +35,9 @@ function b(a, b, b) {} Duplicate argument name - correctness/noDupeArgs.js:1:18 - - 1 function b(a, b, b) {} - ^ + > 1 │ function b(a, b, b) {} + ^ + 2 │ {% endraw %} diff --git a/website/src/docs/lint/rules/noEmptyPattern.md b/website/src/docs/lint/rules/noEmptyPattern.md index 9a4986d41cb..0544058e497 100644 --- a/website/src/docs/lint/rules/noEmptyPattern.md +++ b/website/src/docs/lint/rules/noEmptyPattern.md @@ -21,10 +21,9 @@ var {} = foo; Unexpected empty object pattern. - correctness/noEmptyPattern.js:1:5 - - 1 var {} = foo; - ^^ + > 1 │ var {} = foo; + ^^ + 2 │ {% endraw %} @@ -36,10 +35,9 @@ var {a: {}} = foo; Unexpected empty object pattern. - correctness/noEmptyPattern.js:1:9 - - 1 var {a: {}} = foo; - ^^ + > 1 │ var {a: {}} = foo; + ^^ + 2 │ {% endraw %} @@ -51,10 +49,9 @@ function foo({}) {} Unexpected empty object pattern. - correctness/noEmptyPattern.js:1:14 - - 1 function foo({}) {} - ^^ + > 1 │ function foo({}) {} + ^^ + 2 │ {% endraw %} diff --git a/website/src/docs/lint/rules/noExtraBooleanCast.md b/website/src/docs/lint/rules/noExtraBooleanCast.md index cdbd7913f7d..c463db0f4aa 100644 --- a/website/src/docs/lint/rules/noExtraBooleanCast.md +++ b/website/src/docs/lint/rules/noExtraBooleanCast.md @@ -22,10 +22,10 @@ if (!Boolean(foo)) { Avoid redundant `Boolean` call - correctness/noExtraBooleanCast.js:1:6 - - 1 if (!Boolean(foo)) { - ^^^^^^^^^^^^ + > 1 │ if (!Boolean(foo)) { + ^^^^^^^^^^^^ + 2 │ } + 3 │ It is not necessary to use `Boolean` call when a value will already be coerced to a boolean. @@ -46,10 +46,9 @@ while (!!foo) {} Avoid redundant double-negation. - correctness/noExtraBooleanCast.js:1:8 - - 1 while (!!foo) {} - ^^^^^ + > 1 │ while (!!foo) {} + ^^^^^ + 2 │ It is not necessary to use double-negation when a value will already be coerced to a boolean. @@ -72,10 +71,11 @@ do { Avoid redundant `Boolean` call - correctness/noExtraBooleanCast.js:4:10 - - 4 } while (Boolean(x)); - ^^^^^^^^^^ + 2 │ do { + 3 │ 1 + 1; + > 4 │ } while (Boolean(x)); + ^^^^^^^^^^ + 5 │ It is not necessary to use `Boolean` call when a value will already be coerced to a boolean. @@ -98,10 +98,9 @@ for (; !!foo; ) {} Avoid redundant double-negation. - correctness/noExtraBooleanCast.js:1:8 - - 1 for (; !!foo; ) {} - ^^^^^ + > 1 │ for (; !!foo; ) {} + ^^^^^ + 2 │ It is not necessary to use double-negation when a value will already be coerced to a boolean. @@ -121,10 +120,9 @@ new Boolean(!!x); Avoid redundant double-negation. - correctness/noExtraBooleanCast.js:1:13 - - 1 new Boolean(!!x); - ^^^ + > 1 │ new Boolean(!!x); + ^^^ + 2 │ It is not necessary to use double-negation when a value will already be coerced to a boolean. diff --git a/website/src/docs/lint/rules/noFunctionAssign.md b/website/src/docs/lint/rules/noFunctionAssign.md index 88a949ba48c..7e34826f4af 100644 --- a/website/src/docs/lint/rules/noFunctionAssign.md +++ b/website/src/docs/lint/rules/noFunctionAssign.md @@ -22,17 +22,17 @@ foo = bar; Do not reassign a function declaration. - correctness/noFunctionAssign.js:1:10 - - 1 function foo() { }; - ^^^ + > 1 │ function foo() { }; + ^^^ + 2 │ foo = bar; + 3 │ Reassigned here. - correctness/noFunctionAssign.js:2:1 - - 2 foo = bar; - ^^^ + 1 │ function foo() { }; + > 2 │ foo = bar; + ^^^ + 3 │ Use a local variable instead. @@ -48,17 +48,18 @@ function foo() { Do not reassign a function declaration. - correctness/noFunctionAssign.js:1:10 - - 1 function foo() { - ^^^ + > 1 │ function foo() { + ^^^ + 2 │ foo = bar; + 3 │ } Reassigned here. - correctness/noFunctionAssign.js:2:5 - - 2 foo = bar; - ^^^ + 1 │ function foo() { + > 2 │ foo = bar; + ^^^ + 3 │ } + 4 │ Use a local variable instead. @@ -73,17 +74,17 @@ function foo() { }; Do not reassign a function declaration. - correctness/noFunctionAssign.js:2:10 - - 2 function foo() { }; - ^^^ + 1 │ foo = bar; + > 2 │ function foo() { }; + ^^^ + 3 │ Reassigned here. - correctness/noFunctionAssign.js:1:1 - - 1 foo = bar; - ^^^ + > 1 │ foo = bar; + ^^^ + 2 │ function foo() { }; + 3 │ Reassignment happens here because the function declaration is hoisted. @@ -100,17 +101,17 @@ function foo() { }; Do not reassign a function declaration. - correctness/noFunctionAssign.js:2:10 - - 2 function foo() { }; - ^^^ + 1 │ [foo] = bar; + > 2 │ function foo() { }; + ^^^ + 3 │ Reassigned here. - correctness/noFunctionAssign.js:1:2 - - 1 [foo] = bar; - ^^^ + > 1 │ [foo] = bar; + ^^^ + 2 │ function foo() { }; + 3 │ Reassignment happens here because the function declaration is hoisted. @@ -127,17 +128,17 @@ function foo() { }; Do not reassign a function declaration. - correctness/noFunctionAssign.js:2:10 - - 2 function foo() { }; - ^^^ + 1 │ ({ x: foo = 0 } = bar); + > 2 │ function foo() { }; + ^^^ + 3 │ Reassigned here. - correctness/noFunctionAssign.js:1:7 - - 1 ({ x: foo = 0 } = bar); - ^^^ + > 1 │ ({ x: foo = 0 } = bar); + ^^^ + 2 │ function foo() { }; + 3 │ Reassignment happens here because the function declaration is hoisted. @@ -155,17 +156,18 @@ function foo() { Do not reassign a function declaration. - correctness/noFunctionAssign.js:1:10 - - 1 function foo() { - ^^^ + > 1 │ function foo() { + ^^^ + 2 │ [foo] = bar; + 3 │ } Reassigned here. - correctness/noFunctionAssign.js:2:6 - - 2 [foo] = bar; - ^^^ + 1 │ function foo() { + > 2 │ [foo] = bar; + ^^^ + 3 │ } + 4 │ Use a local variable instead. @@ -182,17 +184,20 @@ function foo() { Do not reassign a function declaration. - correctness/noFunctionAssign.js:3:14 - - 3 function foo() { }; - ^^^ + 1 │ (function () { + 2 │ ({ x: foo = 0 } = bar); + > 3 │ function foo() { }; + ^^^ + 4 │ })(); + 5 │ Reassigned here. - correctness/noFunctionAssign.js:2:11 - - 2 ({ x: foo = 0 } = bar); - ^^^ + 1 │ (function () { + > 2 │ ({ x: foo = 0 } = bar); + ^^^ + 3 │ function foo() { }; + 4 │ })(); Reassignment happens here because the function declaration is hoisted. diff --git a/website/src/docs/lint/rules/noImplicitBoolean.md b/website/src/docs/lint/rules/noImplicitBoolean.md index 29e6409c269..f81bf3d48ba 100644 --- a/website/src/docs/lint/rules/noImplicitBoolean.md +++ b/website/src/docs/lint/rules/noImplicitBoolean.md @@ -21,10 +21,9 @@ Disallow implicit `true` values on JSX boolean attributes Use explicit boolean values for boolean JSX props. - correctness/noImplicitBoolean.js:1:8 - - 1 <input disabled /> - ^^^^^^^^ + > 1 │ <input disabled /> + ^^^^^^^^ + 2 │ Safe fix: Add explicit `true` literal for this attribute diff --git a/website/src/docs/lint/rules/noImportAssign.md b/website/src/docs/lint/rules/noImportAssign.md index 629e01ac741..624f0754d0e 100644 --- a/website/src/docs/lint/rules/noImportAssign.md +++ b/website/src/docs/lint/rules/noImportAssign.md @@ -22,17 +22,17 @@ x = 1; The imported variable x is read-only - correctness/noImportAssign.js:2:1 - - 2 x = 1; - ^ + 1 │ import x from "y"; + > 2 │ x = 1; + ^ + 3 │ The variable is imported here - correctness/noImportAssign.js:1:8 - - 1 import x from "y"; - ^ + > 1 │ import x from "y"; + ^ + 2 │ x = 1; + 3 │ Use a local variable instead of reassigning an import. @@ -47,17 +47,17 @@ import y from "y"; The imported variable y is read-only - correctness/noImportAssign.js:2:2 - - 2 [y] = 1; - ^ + 1 │ import y from "y"; + > 2 │ [y] = 1; + ^ + 3 │ The variable is imported here - correctness/noImportAssign.js:1:8 - - 1 import y from "y"; - ^ + > 1 │ import y from "y"; + ^ + 2 │ [y] = 1; + 3 │ Use a local variable instead of reassigning an import. @@ -75,14 +75,14 @@ import a from "y"; unterminated template literal - correctness/noImportAssign.js:3:4 - - 3 ```js,expect_diagnostic - ^ - 4 import a from "y"; - 5 [...a] = 1; - 6 - ^ + 1 │ import z from "y"; + 2 │ ({ z } = 1); /// ``` + > 3 │ ```js,expect_diagnostic + ^^^^^^^^^^^^^^^^^^^^ + > 4 │ import a from "y"; + > 5 │ [...a] = 1; + > 6 │ + {% endraw %} @@ -95,17 +95,17 @@ import b from "y"; The imported variable b is read-only - correctness/noImportAssign.js:2:7 - - 2 ({ ...b } = 1); - ^ + 1 │ import b from "y"; + > 2 │ ({ ...b } = 1); + ^ + 3 │ The variable is imported here - correctness/noImportAssign.js:1:8 - - 1 import b from "y"; - ^ + > 1 │ import b from "y"; + ^ + 2 │ ({ ...b } = 1); + 3 │ Use a local variable instead of reassigning an import. @@ -120,17 +120,17 @@ for (c in y) {}; The imported variable c is read-only - correctness/noImportAssign.js:2:6 - - 2 for (c in y) {}; - ^ + 1 │ import c from "y"; + > 2 │ for (c in y) {}; + ^ + 3 │ The variable is imported here - correctness/noImportAssign.js:1:8 - - 1 import c from "y"; - ^ + > 1 │ import c from "y"; + ^ + 2 │ for (c in y) {}; + 3 │ Use a local variable instead of reassigning an import. @@ -145,17 +145,17 @@ d += 1; The imported variable d is read-only - correctness/noImportAssign.js:2:1 - - 2 d += 1; - ^ + 1 │ import d from "y"; + > 2 │ d += 1; + ^ + 3 │ The variable is imported here - correctness/noImportAssign.js:1:8 - - 1 import d from "y"; - ^ + > 1 │ import d from "y"; + ^ + 2 │ d += 1; + 3 │ Use a local variable instead of reassigning an import. @@ -170,17 +170,17 @@ e = 1; The imported variable e is read-only - correctness/noImportAssign.js:2:1 - - 2 e = 1; - ^ + 1 │ import * as e from "y"; + > 2 │ e = 1; + ^ + 3 │ The variable is imported here - correctness/noImportAssign.js:1:13 - - 1 import * as e from "y"; - ^ + > 1 │ import * as e from "y"; + ^ + 2 │ e = 1; + 3 │ Use a local variable instead of reassigning an import. diff --git a/website/src/docs/lint/rules/noLabelVar.md b/website/src/docs/lint/rules/noLabelVar.md index 38051630a33..4ce3d7f41fb 100644 --- a/website/src/docs/lint/rules/noLabelVar.md +++ b/website/src/docs/lint/rules/noLabelVar.md @@ -22,17 +22,17 @@ x1: expr; Do not use the x1 variable name as a label - correctness/noLabelVar.js:2:1 - - 2 x1: expr; - ^^ + 1 │ const x1 = "test"; + > 2 │ x1: expr; + ^^ + 3 │ The variable is declared here - correctness/noLabelVar.js:1:7 - - 1 const x1 = "test"; - ^^ + > 1 │ const x1 = "test"; + ^^ + 2 │ x1: expr; + 3 │ Creating a label with the same name as an in-scope variable leads to confusion. diff --git a/website/src/docs/lint/rules/noMultipleSpacesInRegularExpressionLiterals.md b/website/src/docs/lint/rules/noMultipleSpacesInRegularExpressionLiterals.md index 56fd7a5238e..51bc1b1b878 100644 --- a/website/src/docs/lint/rules/noMultipleSpacesInRegularExpressionLiterals.md +++ b/website/src/docs/lint/rules/noMultipleSpacesInRegularExpressionLiterals.md @@ -21,10 +21,9 @@ Disallow unclear usage of multiple space characters in regular expression litera This regular expression contains unclear uses of multiple spaces. - correctness/noMultipleSpacesInRegularExpressionLiterals.js:1:2 - - 1 / / - ^^^ + > 1 │ / / + ^^^ + 2 │ Suggested fix: It's hard to visually count the amount of spaces, it's clearer if you use a quantifier instead. eg / {3}/ @@ -42,10 +41,9 @@ Disallow unclear usage of multiple space characters in regular expression litera This regular expression contains unclear uses of multiple spaces. - correctness/noMultipleSpacesInRegularExpressionLiterals.js:1:2 - - 1 / foo/ - ^^ + > 1 │ / foo/ + ^^ + 2 │ Suggested fix: It's hard to visually count the amount of spaces, it's clearer if you use a quantifier instead. eg / {2}/ @@ -63,10 +61,9 @@ Disallow unclear usage of multiple space characters in regular expression litera This regular expression contains unclear uses of multiple spaces. - correctness/noMultipleSpacesInRegularExpressionLiterals.js:1:5 - - 1 /foo / - ^^^ + > 1 │ /foo / + ^^^ + 2 │ Suggested fix: It's hard to visually count the amount of spaces, it's clearer if you use a quantifier instead. eg / {3}/ @@ -84,10 +81,9 @@ Disallow unclear usage of multiple space characters in regular expression litera This regular expression contains unclear uses of multiple spaces. - correctness/noMultipleSpacesInRegularExpressionLiterals.js:1:5 - - 1 /foo bar/ - ^^ + > 1 │ /foo bar/ + ^^ + 2 │ Suggested fix: It's hard to visually count the amount of spaces, it's clearer if you use a quantifier instead. eg / {2}/ @@ -105,10 +101,9 @@ Disallow unclear usage of multiple space characters in regular expression litera This regular expression contains unclear uses of multiple spaces. - correctness/noMultipleSpacesInRegularExpressionLiterals.js:1:5 - - 1 /foo bar baz/ - ^^^^^^^^^^ + > 1 │ /foo bar baz/ + ^^^^^^^^^^ + 2 │ Suggested fix: It's hard to visually count the amount of spaces, it's clearer if you use a quantifier instead. eg / {7}/ @@ -126,10 +121,9 @@ Disallow unclear usage of multiple space characters in regular expression litera This regular expression contains unclear uses of multiple spaces. - correctness/noMultipleSpacesInRegularExpressionLiterals.js:1:11 - - 1 /foo [ba]r b(a|z)/ - ^^ + > 1 │ /foo [ba]r b(a|z)/ + ^^ + 2 │ Suggested fix: It's hard to visually count the amount of spaces, it's clearer if you use a quantifier instead. eg / {2}/ diff --git a/website/src/docs/lint/rules/noNegationElse.md b/website/src/docs/lint/rules/noNegationElse.md index 7421a7a600f..f736febc7cc 100644 --- a/website/src/docs/lint/rules/noNegationElse.md +++ b/website/src/docs/lint/rules/noNegationElse.md @@ -21,10 +21,9 @@ if (!true) {consequent;} else {alternate;} Invert blocks when performing a negation test. - style/noNegationElse.js:1:1 - - 1 if (!true) {consequent;} else {alternate;} - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ if (!true) {consequent;} else {alternate;} + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Exchange alternate and consequent of the node @@ -42,10 +41,9 @@ if (!true) {consequent;} else {alternate;} Invert blocks when performing a negation test. - style/noNegationElse.js:1:1 - - 1 !true ? consequent : alternate - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ !true ? consequent : alternate + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Exchange alternate and consequent of the node diff --git a/website/src/docs/lint/rules/noNewSymbol.md b/website/src/docs/lint/rules/noNewSymbol.md index b9fa56cee39..c5bc998b2fb 100644 --- a/website/src/docs/lint/rules/noNewSymbol.md +++ b/website/src/docs/lint/rules/noNewSymbol.md @@ -19,10 +19,9 @@ var foo = new Symbol('foo'); Symbol cannot be called as a constructor. - nursery/noNewSymbol.js:1:11 - - 1 var foo = new Symbol('foo'); - ^^^^^^^^^^^^^^^^^ + > 1 │ var foo = new Symbol('foo'); + ^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Remove new. diff --git a/website/src/docs/lint/rules/noRenderReturnValue.md b/website/src/docs/lint/rules/noRenderReturnValue.md index e7cea96e621..2c8c48336c4 100644 --- a/website/src/docs/lint/rules/noRenderReturnValue.md +++ b/website/src/docs/lint/rules/noRenderReturnValue.md @@ -27,10 +27,9 @@ const foo = ReactDOM.render(
, document.body); Do not depend on the value returned by the function ReactDOM.render(). - nursery/noRenderReturnValue.js:1:13 - - 1 const foo = ReactDOM.render(<div />, document.body); - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ const foo = ReactDOM.render(<div />, document.body); + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ The returned value is legacy and future versions of react might return that value asynchronously. Check the React documentation for more information. diff --git a/website/src/docs/lint/rules/noShadowRestrictedNames.md b/website/src/docs/lint/rules/noShadowRestrictedNames.md index 4db93245cb3..279d7cf0d24 100644 --- a/website/src/docs/lint/rules/noShadowRestrictedNames.md +++ b/website/src/docs/lint/rules/noShadowRestrictedNames.md @@ -21,10 +21,9 @@ function NaN() {} Do not shadow the global "NaN" property. - correctness/noShadowRestrictedNames.js:1:10 - - 1 function NaN() {} - ^^^ + > 1 │ function NaN() {} + ^^^ + 2 │ Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. @@ -38,10 +37,9 @@ let Set; Do not shadow the global "Set" property. - correctness/noShadowRestrictedNames.js:1:5 - - 1 let Set; - ^^^ + > 1 │ let Set; + ^^^ + 2 │ Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. @@ -55,10 +53,9 @@ try { } catch(Object) {} Do not shadow the global "Object" property. - correctness/noShadowRestrictedNames.js:1:15 - - 1 try { } catch(Object) {} - ^^^^^^ + > 1 │ try { } catch(Object) {} + ^^^^^^ + 2 │ Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. @@ -72,10 +69,9 @@ function Array() {} Do not shadow the global "Array" property. - correctness/noShadowRestrictedNames.js:1:10 - - 1 function Array() {} - ^^^^^ + > 1 │ function Array() {} + ^^^^^ + 2 │ Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. @@ -89,10 +85,9 @@ function test(JSON) {console.log(JSON)} Do not shadow the global "JSON" property. - correctness/noShadowRestrictedNames.js:1:15 - - 1 function test(JSON) {console.log(JSON)} - ^^^^ + > 1 │ function test(JSON) {console.log(JSON)} + ^^^^ + 2 │ Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. diff --git a/website/src/docs/lint/rules/noShoutyConstants.md b/website/src/docs/lint/rules/noShoutyConstants.md index a27429a1040..32255d05fe7 100644 --- a/website/src/docs/lint/rules/noShoutyConstants.md +++ b/website/src/docs/lint/rules/noShoutyConstants.md @@ -22,17 +22,17 @@ console.log(FOO); Redundant constant declaration. - style/noShoutyConstants.js:1:7 - - 1 const FOO = "FOO"; - ^^^^^^^^^^^ + > 1 │ const FOO = "FOO"; + ^^^^^^^^^^^ + 2 │ console.log(FOO); + 3 │ Used here. - style/noShoutyConstants.js:2:13 - - 2 console.log(FOO); - ^^^ + 1 │ const FOO = "FOO"; + > 2 │ console.log(FOO); + ^^^ + 3 │ You should avoid declaring constants with a string that's the same value as the variable name. It introduces a level of unnecessary diff --git a/website/src/docs/lint/rules/noSparseArray.md b/website/src/docs/lint/rules/noSparseArray.md index 32ccdc21380..d904e65da1b 100644 --- a/website/src/docs/lint/rules/noSparseArray.md +++ b/website/src/docs/lint/rules/noSparseArray.md @@ -21,10 +21,9 @@ Disallow sparse arrays This array contains an empty slot. - correctness/noSparseArray.js:1:1 - - 1 [1,,2] - ^^^^^^ + > 1 │ [1,,2] + ^^^^^^ + 2 │ Suggested fix: Replace hole with undefined diff --git a/website/src/docs/lint/rules/noUndeclaredVariables.md b/website/src/docs/lint/rules/noUndeclaredVariables.md index c52ed3268af..875d30f2c29 100644 --- a/website/src/docs/lint/rules/noUndeclaredVariables.md +++ b/website/src/docs/lint/rules/noUndeclaredVariables.md @@ -19,10 +19,9 @@ foobar; The foobar variable is undeclared - nursery/noUndeclaredVariables.js:1:1 - - 1 foobar; - ^^^^^^ + > 1 │ foobar; + ^^^^^^ + 2 │ {% endraw %} diff --git a/website/src/docs/lint/rules/noUnnecessaryContinue.md b/website/src/docs/lint/rules/noUnnecessaryContinue.md index 4d47463e29d..dff34d39e69 100644 --- a/website/src/docs/lint/rules/noUnnecessaryContinue.md +++ b/website/src/docs/lint/rules/noUnnecessaryContinue.md @@ -23,10 +23,11 @@ loop: for (let i = 0; i < 5; i++) { Unnecessary continue statement - correctness/noUnnecessaryContinue.js:2:3 - - 2 continue loop; - ^^^^^^^^^^^^^^ + 1 │ loop: for (let i = 0; i < 5; i++) { + > 2 │ continue loop; + ^^^^^^^^^^^^^^ + 3 │ } + 4 │ Suggested fix: Delete the unnecessary continue statement @@ -47,10 +48,11 @@ while (i--) { Unnecessary continue statement - correctness/noUnnecessaryContinue.js:2:3 - - 2 continue; - ^^^^^^^^^ + 1 │ while (i--) { + > 2 │ continue; + ^^^^^^^^^ + 3 │ } + 4 │ Suggested fix: Delete the unnecessary continue statement @@ -71,10 +73,11 @@ while (1) { Unnecessary continue statement - correctness/noUnnecessaryContinue.js:2:3 - - 2 continue; - ^^^^^^^^^ + 1 │ while (1) { + > 2 │ continue; + ^^^^^^^^^ + 3 │ } + 4 │ Suggested fix: Delete the unnecessary continue statement @@ -102,10 +105,12 @@ for (let i = 0; i < 10; i++) { Unnecessary continue statement - correctness/noUnnecessaryContinue.js:4:5 - - 4 continue; - ^^^^^^^^^ + 2 │ if (i > 5) { + 3 │ console.log("foo"); + > 4 │ continue; + ^^^^^^^^^ + 5 │ } else if (i >= 5 && i < 8) { + 6 │ console.log("test"); Suggested fix: Delete the unnecessary continue statement @@ -130,10 +135,11 @@ for (let i = 0; i < 9; i++) { Unnecessary continue statement - correctness/noUnnecessaryContinue.js:2:3 - - 2 continue; - ^^^^^^^^^ + 1 │ for (let i = 0; i < 9; i++) { + > 2 │ continue; + ^^^^^^^^^ + 3 │ } + 4 │ Suggested fix: Delete the unnecessary continue statement @@ -154,10 +160,11 @@ test2: do { Unnecessary continue statement - correctness/noUnnecessaryContinue.js:2:2 - - 2 continue test2; - ^^^^^^^^^^^^^^^ + 1 │ test2: do { + > 2 │ continue test2; + ^^^^^^^^^^^^^^^ + 3 │ } while (true); + 4 │ Suggested fix: Delete the unnecessary continue statement diff --git a/website/src/docs/lint/rules/noUnreachable.md b/website/src/docs/lint/rules/noUnreachable.md index d0232175422..a7658e154a8 100644 --- a/website/src/docs/lint/rules/noUnreachable.md +++ b/website/src/docs/lint/rules/noUnreachable.md @@ -24,17 +24,20 @@ function example() { ... before it can reach this code - nursery/noUnreachable.js:3:5 - - 3 neverCalled(); - ^^^^^^^^^^^^^^ + 1 │ function example() { + 2 │ return; + > 3 │ neverCalled(); + ^^^^^^^^^^^^^^ + 4 │ } + 5 │ This statement will return from the function ... - nursery/noUnreachable.js:2:5 - - 2 return; - ^^^^^^^ + 1 │ function example() { + > 2 │ return; + ^^^^^^^ + 3 │ neverCalled(); + 4 │ } {% endraw %} @@ -52,17 +55,20 @@ function example() { This code will never be reached ... - nursery/noUnreachable.js:2:28 - - 2 for(let i = 0; i < 10; ++i) { - ^^^ + 1 │ function example() { + > 2 │ for(let i = 0; i < 10; ++i) { + ^^^ + 3 │ break; + 4 │ } ... because this statement will break the flow of the code beforehand - nursery/noUnreachable.js:3:9 - - 3 break; - ^^^^^^ + 1 │ function example() { + 2 │ for(let i = 0; i < 10; ++i) { + > 3 │ break; + ^^^^^^ + 4 │ } + 5 │ } {% endraw %} @@ -81,17 +87,21 @@ function example() { ... before it can reach this code - nursery/noUnreachable.js:4:9 - - 4 neverCalled(); - ^^^^^^^^^^^^^^ + 2 │ for(const key in value) { + 3 │ continue; + > 4 │ neverCalled(); + ^^^^^^^^^^^^^^ + 5 │ } + 6 │ } This statement will continue the loop ... - nursery/noUnreachable.js:3:9 - - 3 continue; - ^^^^^^^^^ + 1 │ function example() { + 2 │ for(const key in value) { + > 3 │ continue; + ^^^^^^^^^ + 4 │ neverCalled(); + 5 │ } {% endraw %} diff --git a/website/src/docs/lint/rules/noUnsafeNegation.md b/website/src/docs/lint/rules/noUnsafeNegation.md index df94ebc35e4..85374929a29 100644 --- a/website/src/docs/lint/rules/noUnsafeNegation.md +++ b/website/src/docs/lint/rules/noUnsafeNegation.md @@ -21,10 +21,9 @@ Disallow using unsafe negation. The negation operator is used unsafely on the left side of this binary expression. - correctness/noUnsafeNegation.js:1:1 - - 1 !1 in [1,2]; - ^^^^^^^^^^^ + > 1 │ !1 in [1,2]; + ^^^^^^^^^^^ + 2 │ Suggested fix: Wrap the expression with a parenthesis @@ -42,10 +41,9 @@ Disallow using unsafe negation. The negation operator is used unsafely on the left side of this binary expression. - correctness/noUnsafeNegation.js:1:10 - - 1 /**test*/!/** test*/1 instanceof [1,2]; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ /**test*/!/** test*/1 instanceof [1,2]; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Wrap the expression with a parenthesis diff --git a/website/src/docs/lint/rules/noUnusedTemplateLiteral.md b/website/src/docs/lint/rules/noUnusedTemplateLiteral.md index 2c147c184fa..ea280e35978 100644 --- a/website/src/docs/lint/rules/noUnusedTemplateLiteral.md +++ b/website/src/docs/lint/rules/noUnusedTemplateLiteral.md @@ -21,10 +21,9 @@ const foo = `bar` Do not use template literals if interpolation and special-character handling are not needed. - correctness/noUnusedTemplateLiteral.js:1:13 - - 1 const foo = `bar` - ^^^^^ + > 1 │ const foo = `bar` + ^^^^^ + 2 │ Suggested fix: Replace with string literal @@ -42,10 +41,9 @@ const foo = `bar ` Do not use template literals if interpolation and special-character handling are not needed. - correctness/noUnusedTemplateLiteral.js:1:13 - - 1 const foo = `bar ` - ^^^^^^ + > 1 │ const foo = `bar ` + ^^^^^^ + 2 │ Suggested fix: Replace with string literal diff --git a/website/src/docs/lint/rules/noUnusedVariables.md b/website/src/docs/lint/rules/noUnusedVariables.md index b6bb7790f99..3d04f65a47b 100644 --- a/website/src/docs/lint/rules/noUnusedVariables.md +++ b/website/src/docs/lint/rules/noUnusedVariables.md @@ -31,10 +31,9 @@ const a = 4; This variable is unused. - nursery/noUnusedVariables.js:1:7 - - 1 const a = 4; - ^ + > 1 │ const a = 4; + ^ + 2 │ Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -48,10 +47,9 @@ let a = 4; This variable is unused. - nursery/noUnusedVariables.js:1:5 - - 1 let a = 4; - ^ + > 1 │ let a = 4; + ^ + 2 │ Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -66,10 +64,10 @@ function foo() { This function is unused. - nursery/noUnusedVariables.js:1:10 - - 1 function foo() { - ^^^ + > 1 │ function foo() { + ^^^ + 2 │ }; + 3 │ Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -86,10 +84,10 @@ foo(); This parameter is unused. - nursery/noUnusedVariables.js:1:14 - - 1 function foo(myVar) { - ^^^^^ + > 1 │ function foo(myVar) { + ^^^^^ + 2 │ console.log('foo'); + 3 │ } Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -104,10 +102,10 @@ const foo = () => { This variable is unused. - nursery/noUnusedVariables.js:1:7 - - 1 const foo = () => { - ^^^ + > 1 │ const foo = () => { + ^^^ + 2 │ }; + 3 │ Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -123,10 +121,10 @@ function foo() { This function is unused. - nursery/noUnusedVariables.js:1:10 - - 1 function foo() { - ^^^ + > 1 │ function foo() { + ^^^ + 2 │ foo(); + 3 │ } Unused variables usually are result of incomplete refactoring, typos and other source of bugs. @@ -143,10 +141,10 @@ const foo = () => { This variable is unused. - nursery/noUnusedVariables.js:1:7 - - 1 const foo = () => { - ^^^ + > 1 │ const foo = () => { + ^^^ + 2 │ foo(); + 3 │ console.log(this); Unused variables usually are result of incomplete refactoring, typos and other source of bugs. diff --git a/website/src/docs/lint/rules/noUselessFragments.md b/website/src/docs/lint/rules/noUselessFragments.md index 596542db236..9cb243c1c5b 100644 --- a/website/src/docs/lint/rules/noUselessFragments.md +++ b/website/src/docs/lint/rules/noUselessFragments.md @@ -21,12 +21,12 @@ foo Avoid using unnecessary Fragment. - nursery/noUselessFragments.js:1:1 - - 1 <> - 2 foo - 3 </> - ^ + > 1 │ <> + ^^ + > 2 │ foo + > 3 │ </> + ^^^ + 4 │ Suggested fix: Remove the Fragment @@ -49,12 +49,12 @@ foo Avoid using unnecessary Fragment. - nursery/noUselessFragments.js:1:1 - - 1 <React.Fragment> - 2 foo - 3 </React.Fragment> - ^ + > 1 │ <React.Fragment> + ^^^^^^^^^^^^^^^^ + > 2 │ foo + > 3 │ </React.Fragment> + ^^^^^^^^^^^^^^^^^ + 4 │ Suggested fix: Remove the Fragment @@ -78,10 +78,11 @@ foo Avoid using unnecessary Fragment. - nursery/noUselessFragments.js:2:5 - - 2 <>foo</> - ^^^^^^^^ + 1 │ <> + > 2 │ <>foo</> + ^^^^^^^^ + 3 │ <SomeComponent /> + 4 │ </> Suggested fix: Remove the Fragment @@ -102,10 +103,9 @@ foo Avoid using unnecessary Fragment. - nursery/noUselessFragments.js:1:1 - - 1 <></> - ^^^^^ + > 1 │ <></> + ^^^^^ + 2 │ Suggested fix: Remove the Fragment diff --git a/website/src/docs/lint/rules/noVoidElementsWithChildren.md b/website/src/docs/lint/rules/noVoidElementsWithChildren.md index 59d0d40900b..7c1b362c1ef 100644 --- a/website/src/docs/lint/rules/noVoidElementsWithChildren.md +++ b/website/src/docs/lint/rules/noVoidElementsWithChildren.md @@ -19,10 +19,9 @@ This rules prevents void elements (AKA self-closing elements) from having childr br is a void element tag and must not have children. - nursery/noVoidElementsWithChildren.js:1:1 - - 1 <br>invalid child</br> - ^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ <br>invalid child</br> + ^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Remove the children. @@ -40,10 +39,9 @@ This rules prevents void elements (AKA self-closing elements) from having childr img is a void element tag and must not have children. - nursery/noVoidElementsWithChildren.js:1:1 - - 1 <img alt="some text" children={"some child"} /> - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ <img alt="some text" children={"some child"} /> + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Remove the children. @@ -61,10 +59,9 @@ React.createElement('img', {}, 'child') img is a void element tag and must not have children. - nursery/noVoidElementsWithChildren.js:1:1 - - 1 React.createElement('img', {}, 'child') - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ React.createElement('img', {}, 'child') + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Remove the children. diff --git a/website/src/docs/lint/rules/useBlockStatements.md b/website/src/docs/lint/rules/useBlockStatements.md index b3df4d7b375..d4c800ab2bd 100644 --- a/website/src/docs/lint/rules/useBlockStatements.md +++ b/website/src/docs/lint/rules/useBlockStatements.md @@ -22,10 +22,9 @@ JavaScript allows the omission of curly braces when a block contains only one st Block statements are preferred in this position. - correctness/useBlockStatements.js:1:2 - - 1 if (x) x; - ^^^^^^^^^ + > 1 │ if (x) x; + ^^^^^^^^^ + 2 │ Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -45,10 +44,11 @@ JavaScript allows the omission of curly braces when a block contains only one st Block statements are preferred in this position. - correctness/useBlockStatements.js:3:4 - - 3 } else y; - ^^^^^^^ + 1 │ if (x) { + 2 │ x; + > 3 │ } else y; + ^^^^^^^ + 4 │ Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -70,10 +70,11 @@ if (x) { Block statements are preferred in this position. - correctness/useBlockStatements.js:3:8 - - 3 } else if (y) y; - ^^^^^^^^^ + 1 │ if (x) { + 2 │ x; + > 3 │ } else if (y) y; + ^^^^^^^^^ + 4 │ Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -93,10 +94,9 @@ if (x) { Block statements are preferred in this position. - correctness/useBlockStatements.js:1:4 - - 1 for (;;); - ^^^^^^^^^ + > 1 │ for (;;); + ^^^^^^^^^ + 2 │ Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -114,10 +114,9 @@ if (x) { Block statements are preferred in this position. - correctness/useBlockStatements.js:1:4 - - 1 for (p in obj); - ^^^^^^^^^^^^^^^ + > 1 │ for (p in obj); + ^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -135,10 +134,9 @@ if (x) { Block statements are preferred in this position. - correctness/useBlockStatements.js:1:3 - - 1 for (x of xs); - ^^^^^^^^^^^^^^ + > 1 │ for (x of xs); + ^^^^^^^^^^^^^^ + 2 │ Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -157,11 +155,11 @@ if (x) { Block statements are preferred in this position. - correctness/useBlockStatements.js:1:3 - - 1 do; - 2 while (x); - ^ + > 1 │ do; + ^^^ + > 2 │ while (x); + ^^^^^^^^^^ + 3 │ Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -180,10 +178,9 @@ if (x) { Block statements are preferred in this position. - correctness/useBlockStatements.js:1:4 - - 1 while (x); - ^^^^^^^^^^ + > 1 │ while (x); + ^^^^^^^^^^ + 2 │ Suggested fix: Wrap the statement with a `JsBlockStatement` @@ -201,10 +198,9 @@ if (x) { `with` statements are not allowed in strict mode - correctness/useBlockStatements.js:1:3 - - 1 with (x); - ^^^^^^^^^ + > 1 │ with (x); + ^^^^^^^^^ + 2 │ {% endraw %} diff --git a/website/src/docs/lint/rules/useButtonType.md b/website/src/docs/lint/rules/useButtonType.md index 352bd7f609f..c3db89a009f 100644 --- a/website/src/docs/lint/rules/useButtonType.md +++ b/website/src/docs/lint/rules/useButtonType.md @@ -19,10 +19,9 @@ Enforces the usage of the attribute `type` for the element `button` Provide an explicit type prop for the button element. - nursery/useButtonType.js:1:1 - - 1 <button>Do something</button> - ^^^^^^^^ + > 1 │ <button>Do something</button> + ^^^^^^^^ + 2 │ The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. @@ -38,10 +37,9 @@ Enforces the usage of the attribute `type` for the element `button` Provide a valid type prop for the button element. - nursery/useButtonType.js:1:14 - - 1 <button type="incorrectType">Do something</button> - ^^^^^^^^^^^^^^^ + > 1 │ <button type="incorrectType">Do something</button> + ^^^^^^^^^^^^^^^ + 2 │ The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. @@ -57,10 +55,9 @@ React.createElement('button'); Provide an explicit type prop for the button element. - nursery/useButtonType.js:1:21 - - 1 React.createElement('button'); - ^^^^^^^^ + > 1 │ React.createElement('button'); + ^^^^^^^^ + 2 │ The default type of a button is submit, which causes the submission of a form when placed inside a `form` element. This is likely not the behaviour that you want inside a React application. diff --git a/website/src/docs/lint/rules/useCamelCase.md b/website/src/docs/lint/rules/useCamelCase.md index 9b6ffb0da81..00d779aedb8 100644 --- a/website/src/docs/lint/rules/useCamelCase.md +++ b/website/src/docs/lint/rules/useCamelCase.md @@ -19,10 +19,9 @@ let snake_case; Prefer variables names in camel case. - nursery/useCamelCase.js:1:5 - - 1 let snake_case; - ^^^^^^^^^^ + > 1 │ let snake_case; + ^^^^^^^^^^ + 2 │ Safe fix: Rename this symbol to camel case @@ -40,10 +39,9 @@ let PascalCase; Prefer variables names in camel case. - nursery/useCamelCase.js:1:5 - - 1 let PascalCase; - ^^^^^^^^^^ + > 1 │ let PascalCase; + ^^^^^^^^^^ + 2 │ Safe fix: Rename this symbol to camel case diff --git a/website/src/docs/lint/rules/useFragmentSyntax.md b/website/src/docs/lint/rules/useFragmentSyntax.md index 627c010fd89..3badede23b9 100644 --- a/website/src/docs/lint/rules/useFragmentSyntax.md +++ b/website/src/docs/lint/rules/useFragmentSyntax.md @@ -21,10 +21,9 @@ The shorthand fragment syntax saves keystrokes and is only inapplicable when key Use shorthand syntax for Fragment elements instead of standard syntax. - nursery/useFragmentSyntax.js:1:1 - - 1 <Fragment>child</Fragment> - ^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ <Fragment>child</Fragment> + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Shorthand fragment syntax saves keystrokes and is only inapplicable when keys are required. @@ -44,10 +43,9 @@ The shorthand fragment syntax saves keystrokes and is only inapplicable when key Use shorthand syntax for Fragment elements instead of standard syntax. - nursery/useFragmentSyntax.js:1:1 - - 1 <React.Fragment>child</React.Fragment> - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ <React.Fragment>child</React.Fragment> + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Shorthand fragment syntax saves keystrokes and is only inapplicable when keys are required. diff --git a/website/src/docs/lint/rules/useOptionalChain.md b/website/src/docs/lint/rules/useOptionalChain.md index f74f31fcfed..13566762fe7 100644 --- a/website/src/docs/lint/rules/useOptionalChain.md +++ b/website/src/docs/lint/rules/useOptionalChain.md @@ -24,10 +24,9 @@ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz Change to an optional chain. - nursery/useOptionalChain.js:1:1 - - 1 foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Change to an optional chain. @@ -45,10 +44,9 @@ foo.bar && foo.bar.baz.buzz Change to an optional chain. - nursery/useOptionalChain.js:1:1 - - 1 foo.bar && foo.bar.baz.buzz - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ foo.bar && foo.bar.baz.buzz + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Change to an optional chain. @@ -66,10 +64,9 @@ foo !== undefined && foo.bar != undefined && foo.bar.baz !== null && foo.bar.baz Change to an optional chain. - nursery/useOptionalChain.js:1:1 - - 1 foo !== undefined && foo.bar != undefined && foo.bar.baz !== null && foo.bar.baz.buzz - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ foo !== undefined && foo.bar != undefined && foo.bar.baz !== null && foo.bar.baz.buzz + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Change to an optional chain. @@ -87,10 +84,9 @@ foo !== undefined && foo.bar != undefined && foo.bar.baz !== null && foo.bar.baz Change to an optional chain. - nursery/useOptionalChain.js:1:1 - - 1 ((foo || {}).bar || {}).baz; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ ((foo || {}).bar || {}).baz; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Change to an optional chain. @@ -108,10 +104,9 @@ foo !== undefined && foo.bar != undefined && foo.bar.baz !== null && foo.bar.baz Change to an optional chain. - nursery/useOptionalChain.js:1:1 - - 1 (await (foo1 || {}).foo2 || {}).foo3; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ (await (foo1 || {}).foo2 || {}).foo3; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Change to an optional chain. @@ -129,10 +124,9 @@ foo !== undefined && foo.bar != undefined && foo.bar.baz !== null && foo.bar.baz Change to an optional chain. - nursery/useOptionalChain.js:1:1 - - 1 (((typeof x) as string) || {}).bar; - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ (((typeof x) as string) || {}).bar; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Change to an optional chain. diff --git a/website/src/docs/lint/rules/useSelfClosingElements.md b/website/src/docs/lint/rules/useSelfClosingElements.md index 37dba4a672a..21503a48056 100644 --- a/website/src/docs/lint/rules/useSelfClosingElements.md +++ b/website/src/docs/lint/rules/useSelfClosingElements.md @@ -21,10 +21,9 @@ Prevent extra closing tags for components without children JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing. - style/useSelfClosingElements.js:1:1 - - 1 <div></div> - ^^^^^^^^^^^ + > 1 │ <div></div> + ^^^^^^^^^^^ + 2 │ Suggested fix: Use a SelfClosingElement instead @@ -42,10 +41,9 @@ Prevent extra closing tags for components without children JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing. - style/useSelfClosingElements.js:1:1 - - 1 <Component></Component> - ^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ <Component></Component> + ^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Use a SelfClosingElement instead @@ -63,10 +61,9 @@ Prevent extra closing tags for components without children JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing. - style/useSelfClosingElements.js:1:1 - - 1 <Foo.bar></Foo.bar> - ^^^^^^^^^^^^^^^^^^^ + > 1 │ <Foo.bar></Foo.bar> + ^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Use a SelfClosingElement instead diff --git a/website/src/docs/lint/rules/useShorthandArrayType.md b/website/src/docs/lint/rules/useShorthandArrayType.md index 467da24ac69..33563767e7d 100644 --- a/website/src/docs/lint/rules/useShorthandArrayType.md +++ b/website/src/docs/lint/rules/useShorthandArrayType.md @@ -21,10 +21,9 @@ let valid: Array; Use shorthand T[] syntax instead of Array<T> syntax. - style/useShorthandArrayType.js:1:12 - - 1 let valid: Array<foo>; - ^^^^^^^^^^ + > 1 │ let valid: Array<foo>; + ^^^^^^^^^^ + 2 │ Suggested fix: Use shorthand T[] syntax to replace @@ -42,10 +41,9 @@ let invalid2: Promise>; Use shorthand T[] syntax instead of Array<T> syntax. - style/useShorthandArrayType.js:1:23 - - 1 let invalid2: Promise<Array<string>>; - ^^^^^^^^^^^^^ + > 1 │ let invalid2: Promise<Array<string>>; + ^^^^^^^^^^^^^ + 2 │ Suggested fix: Use shorthand T[] syntax to replace @@ -63,10 +61,9 @@ let invalid3: Array>; Use shorthand T[] syntax instead of Array<T> syntax. - style/useShorthandArrayType.js:1:15 - - 1 let invalid3: Array<Foo<Bar>>; - ^^^^^^^^^^^^^^^ + > 1 │ let invalid3: Array<Foo<Bar>>; + ^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Use shorthand T[] syntax to replace @@ -84,10 +81,9 @@ let invalid: Array<[number, number]>; Use shorthand T[] syntax instead of Array<T> syntax. - style/useShorthandArrayType.js:1:14 - - 1 let invalid: Array<[number, number]>; - ^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ let invalid: Array<[number, number]>; + ^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Use shorthand T[] syntax to replace @@ -105,10 +101,9 @@ let invalid: Array<[number, number]>; Use shorthand T[] syntax instead of Array<T> syntax. - style/useShorthandArrayType.js:1:14 - - 1 let invalid: Array<[number, number]>; - ^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ let invalid: Array<[number, number]>; + ^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Use shorthand T[] syntax to replace diff --git a/website/src/docs/lint/rules/useSimplifiedLogicExpression.md b/website/src/docs/lint/rules/useSimplifiedLogicExpression.md index d740a8fcc6b..491cb5eede1 100644 --- a/website/src/docs/lint/rules/useSimplifiedLogicExpression.md +++ b/website/src/docs/lint/rules/useSimplifiedLogicExpression.md @@ -22,10 +22,10 @@ const r = true && boolExp; Logical expression contains unnecessary complexity. - correctness/useSimplifiedLogicExpression.js:2:11 - - 2 const r = true && boolExp; - ^^^^^^^^^^^^^^^ + 1 │ const boolExp = true; + > 2 │ const r = true && boolExp; + ^^^^^^^^^^^^^^^ + 3 │ Suggested fix: Discard redundant terms from the logical expression. @@ -45,10 +45,10 @@ const r2 = boolExp || true; Logical expression contains unnecessary complexity. - correctness/useSimplifiedLogicExpression.js:2:12 - - 2 const r2 = boolExp || true; - ^^^^^^^^^^^^^^^ + 1 │ const boolExp2 = true; + > 2 │ const r2 = boolExp || true; + ^^^^^^^^^^^^^^^ + 3 │ Suggested fix: Discard redundant terms from the logical expression. @@ -68,10 +68,10 @@ const r3 = null ?? nonNullExp; Logical expression contains unnecessary complexity. - correctness/useSimplifiedLogicExpression.js:2:12 - - 2 const r3 = null ?? nonNullExp; - ^^^^^^^^^^^^^^^^^^ + 1 │ const nonNullExp = 123; + > 2 │ const r3 = null ?? nonNullExp; + ^^^^^^^^^^^^^^^^^^ + 3 │ Suggested fix: Discard redundant terms from the logical expression. @@ -92,10 +92,11 @@ const r4 = !boolExpr1 || !boolExpr2; Logical expression contains unnecessary complexity. - correctness/useSimplifiedLogicExpression.js:3:12 - - 3 const r4 = !boolExpr1 || !boolExpr2; - ^^^^^^^^^^^^^^^^^^^^^^^^ + 1 │ const boolExpr1 = true; + 2 │ const boolExpr2 = false; + > 3 │ const r4 = !boolExpr1 || !boolExpr2; + ^^^^^^^^^^^^^^^^^^^^^^^^ + 4 │ Suggested fix: Reduce the complexity of the logical expression. diff --git a/website/src/docs/lint/rules/useSingleCaseStatement.md b/website/src/docs/lint/rules/useSingleCaseStatement.md index 34dbd001084..5a621269d60 100644 --- a/website/src/docs/lint/rules/useSingleCaseStatement.md +++ b/website/src/docs/lint/rules/useSingleCaseStatement.md @@ -27,11 +27,14 @@ switch (foo) { A switch case should only have a single statement. If you want more, then wrap it in a block. - correctness/useSingleCaseStatement.js:4:9 - - 4 let foo = ''; - 5 foo; - ^ + 2 │ case true: + 3 │ case false: + > 4 │ let foo = ''; + ^^^^^^^^^^^^^ + > 5 │ foo; + ^^^^ + 6 │ } + 7 │ Suggested fix: Wrap the statements in a block diff --git a/website/src/docs/lint/rules/useSingleVarDeclarator.md b/website/src/docs/lint/rules/useSingleVarDeclarator.md index fe7633d10c2..e2d2a5e58b3 100644 --- a/website/src/docs/lint/rules/useSingleVarDeclarator.md +++ b/website/src/docs/lint/rules/useSingleVarDeclarator.md @@ -21,10 +21,9 @@ let foo, bar; Declare variables separately - correctness/useSingleVarDeclarator.js:1:1 - - 1 let foo, bar; - ^^^^^^^^^^^^^ + > 1 │ let foo, bar; + ^^^^^^^^^^^^^ + 2 │ Suggested fix: Break out into multiple declarations diff --git a/website/src/docs/lint/rules/useTemplate.md b/website/src/docs/lint/rules/useTemplate.md index c7a9fedc561..2285d4c2ec7 100644 --- a/website/src/docs/lint/rules/useTemplate.md +++ b/website/src/docs/lint/rules/useTemplate.md @@ -21,10 +21,9 @@ console.log(foo + "baz"); Template literals are preferred over string concatenation. - correctness/useTemplate.js:1:13 - - 1 console.log(foo + "baz"); - ^^^^^^^^^^^ + > 1 │ console.log(foo + "baz"); + ^^^^^^^^^^^ + 2 │ Suggested fix: Use a TemplateLiteral. @@ -42,10 +41,9 @@ console.log(1 * 2 + "foo"); Template literals are preferred over string concatenation. - correctness/useTemplate.js:1:13 - - 1 console.log(1 * 2 + "foo"); - ^^^^^^^^^^^^^ + > 1 │ console.log(1 * 2 + "foo"); + ^^^^^^^^^^^^^ + 2 │ Suggested fix: Use a TemplateLiteral. @@ -63,10 +61,9 @@ console.log(1 + "foo" + 2 + "bar" + "baz" + 3); Template literals are preferred over string concatenation. - correctness/useTemplate.js:1:13 - - 1 console.log(1 + "foo" + 2 + "bar" + "baz" + 3); - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 1 │ console.log(1 + "foo" + 2 + "bar" + "baz" + 3); + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 2 │ Suggested fix: Use a TemplateLiteral. @@ -84,10 +81,9 @@ console.log((1 + "foo") * 2); Template literals are preferred over string concatenation. - correctness/useTemplate.js:1:14 - - 1 console.log((1 + "foo") * 2); - ^^^^^^^^^ + > 1 │ console.log((1 + "foo") * 2); + ^^^^^^^^^ + 2 │ Suggested fix: Use a TemplateLiteral. @@ -105,10 +101,9 @@ console.log("foo" + 1); Template literals are preferred over string concatenation. - correctness/useTemplate.js:1:13 - - 1 console.log("foo" + 1); - ^^^^^^^^^ + > 1 │ console.log("foo" + 1); + ^^^^^^^^^ + 2 │ Suggested fix: Use a TemplateLiteral. diff --git a/website/src/docs/lint/rules/useValidTypeof.md b/website/src/docs/lint/rules/useValidTypeof.md index 8c8593e3d00..8a6437f6c25 100644 --- a/website/src/docs/lint/rules/useValidTypeof.md +++ b/website/src/docs/lint/rules/useValidTypeof.md @@ -25,10 +25,9 @@ typeof foo === "strnig" not a valid type name - correctness/useValidTypeof.js:1:16 - - 1 typeof foo === "strnig" - ^^^^^^^^ + > 1 │ typeof foo === "strnig" + ^^^^^^^^ + 2 │ {% endraw %} @@ -42,10 +41,9 @@ typeof foo == "undefimed" not a valid type name - correctness/useValidTypeof.js:1:15 - - 1 typeof foo == "undefimed" - ^^^^^^^^^^^ + > 1 │ typeof foo == "undefimed" + ^^^^^^^^^^^ + 2 │ {% endraw %} @@ -59,10 +57,9 @@ typeof bar != "nunber" not a valid type name - correctness/useValidTypeof.js:1:15 - - 1 typeof bar != "nunber" - ^^^^^^^^ + > 1 │ typeof bar != "nunber" + ^^^^^^^^ + 2 │ {% endraw %} @@ -76,10 +73,9 @@ typeof bar !== "fucntion" not a valid type name - correctness/useValidTypeof.js:1:16 - - 1 typeof bar !== "fucntion" - ^^^^^^^^^^ + > 1 │ typeof bar !== "fucntion" + ^^^^^^^^^^ + 2 │ {% endraw %} @@ -93,10 +89,9 @@ typeof foo === undefined not a string literal - correctness/useValidTypeof.js:1:16 - - 1 typeof foo === undefined - ^^^^^^^^^ + > 1 │ typeof foo === undefined + ^^^^^^^^^ + 2 │ Suggested fix: Compare the result of `typeof` with a valid type name @@ -116,10 +111,9 @@ typeof bar == Object not a string literal - correctness/useValidTypeof.js:1:15 - - 1 typeof bar == Object - ^^^^^^ + > 1 │ typeof bar == Object + ^^^^^^ + 2 │ Suggested fix: Compare the result of `typeof` with a valid type name @@ -139,10 +133,9 @@ typeof foo === baz not a string literal - correctness/useValidTypeof.js:1:16 - - 1 typeof foo === baz - ^^^ + > 1 │ typeof foo === baz + ^^^ + 2 │ {% endraw %} @@ -156,10 +149,9 @@ typeof foo == 5 not a string literal - correctness/useValidTypeof.js:1:15 - - 1 typeof foo == 5 - ^ + > 1 │ typeof foo == 5 + ^ + 2 │ {% endraw %} @@ -173,10 +165,9 @@ typeof foo == -5 not a string literal - correctness/useValidTypeof.js:1:15 - - 1 typeof foo == -5 - ^^ + > 1 │ typeof foo == -5 + ^^ + 2 │ {% endraw %} diff --git a/website/src/docs/lint/rules/useWhile.md b/website/src/docs/lint/rules/useWhile.md index 5177822996d..98b75b1561c 100644 --- a/website/src/docs/lint/rules/useWhile.md +++ b/website/src/docs/lint/rules/useWhile.md @@ -24,10 +24,10 @@ for (; x.running;) { Use while loops instead of for loops. - correctness/useWhile.js:1:1 - - 1 for (; x.running;) { - ^^^^^^^^^^^^^^^^^^ + > 1 │ for (; x.running;) { + ^^^^^^^^^^^^^^^^^^ + 2 │ x.step(); + 3 │ } Suggested fix: Use a while loop diff --git a/xtask/codegen/src/generate_configuration.rs b/xtask/codegen/src/generate_configuration.rs index 7478c7f6107..e8f16b253d7 100644 --- a/xtask/codegen/src/generate_configuration.rs +++ b/xtask/codegen/src/generate_configuration.rs @@ -225,7 +225,7 @@ pub(crate) fn generate_rules_configuration(mode: Mode) -> Result<()> { use crate::{ConfigurationError, RomeError, RuleConfiguration}; use rome_analyze::RuleFilter; use indexmap::{IndexMap, IndexSet}; - use rome_console::codespan::Severity; + use rome_diagnostics::Severity; use rome_diagnostics::v2::Category; #[derive(Deserialize, Serialize, Debug, Clone)]