Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge next to main #4760

Merged
merged 192 commits into from
Feb 12, 2025
Merged
Changes from 1 commit
Commits
Show all changes
192 commits
Select commit Hold shift + click to select a range
36b4b1c
feat: remove support for rome-ignore (#4252)
ematipico Oct 11, 2024
0425b90
feat: remove `--apply` and `--apply-unsafe` (#4268)
ematipico Oct 13, 2024
72ef826
fix: reduce accepted values for options (#4271)
ematipico Oct 14, 2024
1accca5
feat: remove `trailingComma` option (#4266)
ematipico Oct 14, 2024
1be9494
feat: remove `--indent-size` (#4270)
ematipico Oct 14, 2024
17ff3f6
feat: remove environment variable `BIOME_LOG_DIR` (#4289)
ematipico Oct 14, 2024
8e950b6
refactor: remove dead code (#4291)
Conaclos Oct 14, 2024
82ef3ce
feat: rename biome_rowan methods (#4297)
ematipico Oct 14, 2024
b0bf177
fix: use new methods
ematipico Oct 18, 2024
8b129ea
feat: plugin loader (#4234)
arendjr Oct 19, 2024
63eece0
update snapshots
ematipico Oct 21, 2024
9733e34
chore: update other snapshots
ematipico Oct 21, 2024
0680ba5
feat(analyzer): top level suppression (#4306)
ematipico Oct 21, 2024
d912491
chore: normalize Windows paths in plugin tests (#4362)
arendjr Oct 21, 2024
6a8ad85
feat(parser/js): remove assert syntax (#4360)
ematipico Oct 22, 2024
889cd5e
refactor(biome_deserialize): add deserilization context (#4166)
Conaclos Oct 22, 2024
57c64b4
chore: fix merge issues
ematipico Oct 23, 2024
74eaf89
feat: useExhaustiveDependencies not recommended (#4294)
ematipico Oct 23, 2024
da6d229
refactor(parser/js): rename import assertions to import attributes (#…
dyc3 Oct 25, 2024
d469189
feat(workspace): make types camel case (#4368)
ematipico Oct 25, 2024
b2ca29e
chore: update code and diagnostics (#4397)
ematipico Oct 27, 2024
bb66d05
refactor(biome_deserialize): add `indexmap` Cargo feature and remove …
Conaclos Oct 27, 2024
b5b6caa
feat(linter): analyzer plugin (#4396)
arendjr Oct 29, 2024
e955488
feat(grit): support `until` clause in `within` patterns (#4399)
arendjr Oct 29, 2024
3a28618
fix regressions
ematipico Oct 31, 2024
8c6e9b4
ci: fix errors and update snapshots (#4441)
Conaclos Oct 31, 2024
59f7e10
refactor: reduce dependency on indexmap (#4439)
Conaclos Nov 1, 2024
63201a9
feat(grit): support Grit queries targeting CSS (#4444)
arendjr Nov 1, 2024
7f0bb2a
feat(grit): implement CSS plugins (#4448)
arendjr Nov 2, 2024
3936022
feat(cli): change how behaves with large files (#4474)
ematipico Nov 6, 2024
00ddf2a
chore: fix merge conflicts
ematipico Nov 7, 2024
0d75b28
refactor: drop `DynRef` and move `fs` into `Workspace` (#4493)
arendjr Nov 11, 2024
39edbf2
refactor: move `useImportRestrictions` into `noRestrictedImports` (#4…
arendjr Nov 11, 2024
f281e8a
feat: better assist (#4508)
ematipico Nov 12, 2024
381aefd
refactor: use `biome-ignore-all` for top level suppressions (#4548)
ematipico Nov 18, 2024
0466823
chore: fix tests
ematipico Nov 18, 2024
ab5f0cd
refactor(analyzer): severity in metadata (#4634)
ematipico Nov 26, 2024
36ce68e
chore: fix incorrect rebase with `main`
ematipico Nov 27, 2024
b9d6bd1
rules check seems to not work anymore
ematipico Nov 27, 2024
aa9582f
fix test regression
ematipico Nov 27, 2024
7e13636
chore: add missing snapshot tests
ematipico Nov 28, 2024
f6009f0
fix options inside rules check
ematipico Nov 28, 2024
d8f91ba
chore: extract `noPackagePrivateImports` rule (#4651)
arendjr Nov 28, 2024
e5e83bb
fix warnings
ematipico Nov 28, 2024
4dd23c5
fix regressions around formatting
ematipico Nov 28, 2024
0bb9768
fix regression in parsing tests
ematipico Nov 28, 2024
f1973f8
docs: how to write a changeset (#4654)
ematipico Nov 29, 2024
c1b2e7b
feat(linter): rule `noTsIgnore` (#4650)
ematipico Nov 29, 2024
ad84856
refactor: use `papaya` instead of DashMap for workspace documents (#4…
arendjr Nov 29, 2024
7fc5346
feat(analyzer): range suppressions (#4649)
ematipico Dec 1, 2024
d2016ae
chore: use `papaya` in `PathInterner` (#4669)
arendjr Dec 1, 2024
55acffe
refactor: remove the `all` option (#4664)
ematipico Dec 3, 2024
3c1c017
refactor: get rule severity from metadata severity (#4687)
ematipico Dec 4, 2024
f5ba162
refactor: add `Workspace` scanner (#4682)
arendjr Dec 5, 2024
3914be8
chore: drop `slotmap` and simplify locking (#4696)
arendjr Dec 5, 2024
21ef4aa
feat(parser): better control on JSX parsing (#4718)
ematipico Dec 12, 2024
0a9d85a
feat(linter): domains and deps (#4713)
ematipico Dec 12, 2024
a478377
refactor: style recommendation and new recommended severity (#4730)
ematipico Dec 13, 2024
54ad2a3
fix(analyzer): don't use organize imports implicitly (#4724)
ematipico Dec 13, 2024
e77fb9d
refactor: protect scanned files against closing by LSP (#4735)
arendjr Dec 15, 2024
5c3e3e1
feat(lint): add `noUnwantedPolyfillio` (#4731)
unvalley Dec 17, 2024
8c73d11
Merge remote-tracking branch 'origin/main' into next
ematipico Dec 17, 2024
632e705
fix rebase
ematipico Dec 17, 2024
7d535da
refactor: track too large files inside workspace server (#4738)
arendjr Dec 17, 2024
21a6b2d
fix regression where some code was removed during merge
ematipico Dec 19, 2024
956b186
Merge remote-tracking branch 'origin/main' into next
ematipico Dec 19, 2024
ead17ca
more fixes!
ematipico Dec 19, 2024
d1ed7ae
update snapshot
ematipico Dec 19, 2024
a451b31
fix rule name
ematipico Dec 19, 2024
0590fe0
update snapshots
ematipico Dec 19, 2024
8d1062f
fix(json): treat `tsconfig.*.json` files as well known, allow comment…
dyc3 Dec 21, 2024
258f33f
perf: use `AppendOnlyVec` for `file_sources` (#4772)
arendjr Dec 21, 2024
9568041
feat: add migration for styling rules (#4759)
ematipico Dec 22, 2024
1907096
refactor: remove deprecated rules (#4766)
ematipico Dec 22, 2024
4f4cafb
feat: move `useWhile` to `complexity` (#4777)
ematipico Dec 23, 2024
93d1e23
refactor: remove `organizeImports` (#4788)
ematipico Dec 26, 2024
3704321
refactor: use camino for paths (#4797)
ematipico Dec 27, 2024
67df8b2
feat(html): plumbing for new HTML options, make `bracket_same_line` g…
dyc3 Dec 28, 2024
164dc85
refactor: cargo features (#4801)
ematipico Dec 29, 2024
f342128
feat(cli): better header in diagnostics (#4814)
ematipico Dec 30, 2024
f86999d
refactor(formatter): no trailing commas in JSON files (#4803)
ematipico Jan 1, 2025
562b249
Merge branch 'main' into next
ematipico Jan 2, 2025
3240f3d
chore: remove schema tests, to avoid future failings
ematipico Jan 2, 2025
d3b7b2d
refactor: resolve paths and globs from the configuration path (#4823)
ematipico Jan 2, 2025
17cf8f7
feat: add GritQL formatting options (#4824)
ematipico Jan 2, 2025
78c8910
feat(formatter): add `expand` (#4819)
ematipico Jan 3, 2025
2fee2a8
feat(html): set up HTML configuration (#4831)
dyc3 Jan 5, 2025
37296a2
refactor: drop "current" project from workspace and cleanup workspace…
arendjr Jan 6, 2025
24c8256
feat(format/html): implement whitespace sensitivity (#4818)
dyc3 Jan 6, 2025
262caf8
refactor(formatter): don't allocate strings, and use try operator ear…
ematipico Jan 7, 2025
01044aa
refactor: initial project layout (#4846)
arendjr Jan 7, 2025
2ae40a7
refactor: expose ProjectLayout as service (#4851)
arendjr Jan 8, 2025
dac3882
refactor: remove `ROME_BINARY` (#4853)
SuperchupuDev Jan 8, 2025
bb065c4
refactor(core): configuration, settings and capabilities (#4845)
ematipico Jan 8, 2025
f064fd4
fix(js_parser): parse huge binary expressions (#4856)
arendjr Jan 8, 2025
ec02891
fix(parser/html): misc minor parsing fixes (#4852)
dyc3 Jan 8, 2025
7da0e9a
fix(core): scan files in order (#4860)
arendjr Jan 9, 2025
074ac53
fix(core): print diagnostic for scanner panics (#4861)
arendjr Jan 9, 2025
12e3936
fix(css_parser): don't panic on unexpected EOF (#4862)
arendjr Jan 9, 2025
846e4a4
fix(lint): don't panic on incomplete code in noFallthroughSwitchClaus…
arendjr Jan 9, 2025
016046e
fix(lint): don't report missing dependency on incomplete statement (#…
arendjr Jan 9, 2025
1edc35f
feat(parser,format/html): add CDATA sections (#4859)
dyc3 Jan 9, 2025
9064d92
fix(parser/html): strictly detect tag starts, `<pre>` tag fixes (#4869)
dyc3 Jan 9, 2025
94bf15e
feat(linter): assign severity to groups (#4867)
ematipico Jan 10, 2025
7f0e969
fix(noUselessFragments): check Fragment when it under JSX Element or …
fireairforce Jan 13, 2025
46b41fa
fix(biome_diagnostics): fix JetBrains relative file URLs should be cl…
Andrew-Chen-Wang Jan 13, 2025
c9d0ba8
fix(js_parser): don't crash on malformed `for` statement (#4889)
arendjr Jan 13, 2025
d43aa7e
refactor(editorconfig): remove support for `max_line_length` (#4894)
ematipico Jan 13, 2025
4f07cc8
chore(core): better debug logging (#4891)
ematipico Jan 14, 2025
c377f6b
build: upgrade rust v1.84.0 (#4912)
unvalley Jan 20, 2025
e3ec2e2
fix(analyzer): suppression comment fails with inner comments in funct…
fireairforce Jan 20, 2025
2a80687
fix(parser): export_named_type should parse default as normal (#4903)
fireairforce Jan 20, 2025
db75863
Merge remote-tracking branch 'origin/main' into next
ematipico Jan 22, 2025
c10068b
chore: merge and fix merge changes
ematipico Jan 22, 2025
7dc32e6
fix(lint): don't crash on malformed JSX (#4939)
arendjr Jan 22, 2025
2452edb
chore: stabilize parser tests (#4940)
arendjr Jan 22, 2025
481ad24
feat(core): implement `DependencyGraph` (#4929)
arendjr Jan 22, 2025
66823f7
fix(core): raise an error when invalid config extension is passed (#4…
ematipico Jan 22, 2025
069cbb4
refactor(js_analyze): turn on `requireAscii` (#4945)
Conaclos Jan 23, 2025
d400d69
feat(lint): implement `noFloatingPromises` rule for reguler `async` f…
kaykdm Jan 23, 2025
0bf4eaa
refactor(useNamingConvention): preserve capitalization (#4955)
Conaclos Jan 24, 2025
b8c57d2
feat(lint): new rule: `noImportCycles` (#4948)
arendjr Jan 24, 2025
f15bd91
feat(lint): support assigned functions in `noFloatingPromises` (#4958)
kaykdm Jan 24, 2025
2960d93
fix(core): fix symlink handling (#4954)
arendjr Jan 24, 2025
ba26e90
fix(useStrictMode): strict directive insertion logic (#4901)
bushuai Jan 24, 2025
44d3f81
fix(core): don't build control flow graph inside bogus nodes (#4963)
arendjr Jan 24, 2025
e750523
fix(lint): support some of wrapped hook calls in useExhaustiveDepende…
siketyan Jan 24, 2025
7b91d19
fix(core): raise an error when invalid config extension is passed (#4…
ematipico Jan 25, 2025
c047886
feat(config): add the includes field (#4899)
Conaclos Jan 25, 2025
bdc34a1
refactor(noFloatingPromises): update functions to return Option (#4970)
kaykdm Jan 25, 2025
5184067
refactor: replace `map_or` with `is_ok_and` and `is_some_and` (#4969)
unvalley Jan 26, 2025
e5d99df
refactor: enable `needless_lifetimes` clippy rule (#4973)
unvalley Jan 27, 2025
3538867
feat(migrate): migrate to `includes` (#4974)
Conaclos Jan 27, 2025
6315375
chore(migrate): remove version check (#4987)
ematipico Jan 28, 2025
000405e
fix(migrate): fix a typo in organizeImports migration message (#4985)
dyc3 Jan 28, 2025
d76e8d3
feat(format/html): apply line break with multiple attributes in multi…
Geun-Oh Jan 28, 2025
b9a023e
chore(migrate): remove version check (#4990)
ematipico Jan 30, 2025
f0e6521
feat(lint): make useSelfClosingElements safe and improve error messag…
mehm8128 Jan 30, 2025
e589261
feat(lint): support promise expression in noFloatingPromises (#4977)
kaykdm Jan 31, 2025
bdf44d0
Merge remote-tracking branch 'origin/main' into next
ematipico Jan 31, 2025
0b4723f
chore: move CSS rule to source
ematipico Jan 31, 2025
3d10e9d
clippy
ematipico Jan 31, 2025
3dfd7f8
use latest crates
ematipico Jan 31, 2025
ac88775
formatting
ematipico Jan 31, 2025
8aea879
Merge remote-tracking branch 'origin/main' into next
ematipico Feb 1, 2025
0681bcc
fix(css): fix css codegen (#5011)
dyc3 Feb 1, 2025
320a1c4
fix(css): fix css lint/assist registry codegen (#5013)
dyc3 Feb 1, 2025
99f27a2
fix(biome_css_analyze): false positive of container name in `noMissin…
bushuai Feb 2, 2025
703bff0
refactor(migrate): use includes when migrating from eslint and pretti…
Conaclos Feb 2, 2025
93dda40
feat(format/html): implement bracketSameLine (#4968)
dyc3 Feb 2, 2025
ea84e0c
feat(format/html): add `css` option for whitespace sensitivity (#5016)
dyc3 Feb 3, 2025
feda489
fix(format/html): enforce whitespace sensitivity for siblings in Html…
dyc3 Feb 3, 2025
4d0a797
chore: use `@changesets` for changelog automation (#5023)
ematipico Feb 4, 2025
2cdbc17
chore: print diagnostics using relative paths (#5009)
ematipico Feb 4, 2025
028af9c
fix(css_formatter): insert a whitespace after first selector in compl…
vohoanglong0107 Feb 4, 2025
a00d6d5
fix(grit): broaden GritQL parser support (#4978)
morgante Feb 4, 2025
48eab5b
fix: repair explosive memory leak in GritQL parser (#5033)
morgante Feb 4, 2025
a17ca7d
fix(grit): patch more parser incompatibilities for complex patterns (…
morgante Feb 5, 2025
71c825e
fix(js-api): fix type definition for IFileFeaturesResult (#5040)
dyc3 Feb 5, 2025
76167db
ci: publish workflow via changesets (#5038)
ematipico Feb 6, 2025
bff5068
chore: move changes to changesets (#5044)
ematipico Feb 6, 2025
3868597
fix(lint): add react domain to `useJsxKeyInIterable` (#5043)
Jayllyz Feb 6, 2025
141f858
chore: fix windows specific script errors (#5051)
dy0gu Feb 7, 2025
2696970
fix(format/html): make element children break if attributes break (#5…
dyc3 Feb 7, 2025
1bebf34
ci: rebrand nightly releases as preview releases (#5047)
ematipico Feb 7, 2025
13869c0
Merge remote-tracking branch 'origin/main' into next
ematipico Feb 7, 2025
de27f6f
fix(format/html): fix long content failing to print if element has <=…
dyc3 Feb 7, 2025
7d5ae45
fix(lint): add missing domain to next.js rules (#5046)
Jayllyz Feb 8, 2025
1099147
fix(css_formatter): improve CSS numeric formatting (#5052)
ah-yu Feb 9, 2025
56527db
fix(linter): `noConsole` inside arrow function expressions (#5066)
ematipico Feb 9, 2025
8379a60
test(format/html): add prettier tests (#5056)
dyc3 Feb 10, 2025
4de5de8
fix: patch js-api openProject() (#5000)
ianzone Feb 10, 2025
f2b3539
fix(formatter): handling of comments in js holes with newlines (#5072)
ematipico Feb 10, 2025
0e33f14
fix(lsp): better error message when editorconfig is broken (#5073)
ematipico Feb 10, 2025
7243cce
fix(editorconfig): fix `insert_final_newline` being unable to parse v…
dyc3 Feb 10, 2025
9a5280e
feat(biome_js_formatter): introduce the new objectWrap option (#5068)
siketyan Feb 10, 2025
e1e164d
feat(biome_js_formatter): introduce the new objectWrap option (#5068)
siketyan Feb 10, 2025
9edb402
chore(format/js): fix missing snapshot update (#5075)
dyc3 Feb 10, 2025
112d43e
feat(analyzer): useAltText don't check object spread (#4935)
fireairforce Feb 11, 2025
e7f33e5
chore(lsp): add more logging when running the daemon (#5086)
ematipico Feb 11, 2025
7aa79e7
feat(formatter): support `bracketSpacing` option in JSON (#5083)
siketyan Feb 11, 2025
2f31686
ci: use `pkg.pr.new` for preview releases (#5092)
ematipico Feb 11, 2025
71c8906
Merge remote-tracking branch 'origin/main' into next
ematipico Feb 11, 2025
5b00fc1
chore: update lock file:
ematipico Feb 11, 2025
8704e56
ci: fix incorrect syntax
ematipico Feb 11, 2025
bf4e980
feat(lint): support class methods in noFloatingPromises (#5028)
kaykdm Feb 11, 2025
a41878d
ci: fix incorrect syntax (#5094)
ematipico Feb 11, 2025
279311a
feat(lint): add noConstantBinaryExpression lint rule for JS (#5076)
siketyan Feb 11, 2025
dec6140
test(lint): add test cases for unnamed class expression in noFloating…
kaykdm Feb 12, 2025
a6686e1
refactor(formatter): remove non-printing related options from `Format…
ah-yu Feb 12, 2025
65c5b7a
fix(lint): ignore multiline literals in useTemplate rule (#5085)
siketyan Feb 12, 2025
79a7d5c
chore: add major changeset for @biomejs/backend-jsonrpc
ematipico Feb 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(core): don't build control flow graph inside bogus nodes (#4963)
arendjr authored Jan 24, 2025
commit 44d3f816510e4ce8a709970bc1d374a932059e4e
27 changes: 27 additions & 0 deletions crates/biome_cli/tests/commands/lint.rs
Original file line number Diff line number Diff line change
@@ -4047,3 +4047,30 @@ fn linter_doesnt_crash_on_malformed_code_from_issue_4623() {
result,
));
}

#[test]
fn linter_doesnt_crash_on_malformed_code_from_issue_4723() {
let mut console = BufferConsole::default();
let mut fs = MemoryFileSystem::default();

fs.insert(
Utf8PathBuf::from("issue4723.js"),
r#" if ndpato{ (){ if asCmesnen{ }
if '&
else"#
.as_bytes(),
);

let (fs, result) = run_cli_with_server_workspace(
fs,
&mut console,
Args::from(["lint", "issue4723.js"].as_slice()),
);
assert_cli_snapshot(SnapshotPayload::new(
module_path!(),
"linter_doesnt_crash_on_malformed_code_from_issue_4723",
fs,
console,
result,
));
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
---
source: crates/biome_cli/tests/snap_test.rs
expression: redactor(content)
---
## `issue4723.js`

```js
if ndpato{ (){ if asCmesnen{ }
if '&
else
```

# Termination Message

```block
lint ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Some errors were emitted while running checks.



```

# Emitted Messages

```block
issue4723.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× expected `(` but instead found `ndpato`

> 1 │ if ndpato{ (){ if asCmesnen{ }
│ ^^^^^^
2 │ if '&
3 │ else

i Remove ndpato


```

```block
issue4723.js:1:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× expected `)` but instead found `{`

> 1 │ if ndpato{ (){ if asCmesnen{ }
│ ^
2 │ if '&
3 │ else

i Remove {


```

```block
issue4723.js:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× expected `=>` but instead found `{`

> 1 │ if ndpato{ (){ if asCmesnen{ }
│ ^
2 │ if '&
3 │ else

i Remove {


```

```block
issue4723.js:1:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× expected `(` but instead found `asCmesnen`

> 1 │ if ndpato{ (){ if asCmesnen{ }
│ ^^^^^^^^^
2 │ if '&
3 │ else

i Remove asCmesnen


```

```block
issue4723.js:1:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× expected `)` but instead found `{`

> 1 │ if ndpato{ (){ if asCmesnen{ }
│ ^
2 │ if '&
3 │ else

i Remove {


```

```block
issue4723.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× unterminated string literal

1 │ if ndpato{ (){ if asCmesnen{ }
> 2 │ if '&
│ ^^
3 │ else

i

1 │ if ndpato{ (){ if asCmesnen{ }
> 2 │ if '&
│ ^^
3 │ else

i The closing quote must be on the same line.


```

```block
issue4723.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× expected `)` but instead found `else`

1 │ if ndpato{ (){ if asCmesnen{ }
2 │ if '&
> 3 │ else
│ ^^^^

i Remove else


```

```block
issue4723.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Expected a statement but instead found the end of the file.

1 │ if ndpato{ (){ if asCmesnen{ }
2 │ if '&
> 3 │ else

i Expected a statement here.

1 │ if ndpato{ (){ if asCmesnen{ }
2 │ if '&
> 3 │ else


```

```block
Checked 1 file in <TIME>. No fixes applied.
Found 8 errors.
```
1 change: 1 addition & 0 deletions crates/biome_css_syntax/src/generated/nodes.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions crates/biome_formatter/src/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -55,9 +55,9 @@ impl From<SyntaxError> for FormatError {
impl From<&SyntaxError> for FormatError {
fn from(syntax_error: &SyntaxError) -> Self {
match syntax_error {
SyntaxError::MissingRequiredChild | SyntaxError::UnexpectedMetavariable => {
FormatError::SyntaxError
}
SyntaxError::MissingRequiredChild
| SyntaxError::UnexpectedBogusNode
| SyntaxError::UnexpectedMetavariable => FormatError::SyntaxError,
}
}
}
1 change: 1 addition & 0 deletions crates/biome_graphql_syntax/src/generated/nodes.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 10 additions & 13 deletions crates/biome_grit_patterns/src/errors.rs
Original file line number Diff line number Diff line change
@@ -12,15 +12,12 @@ pub enum CompileError {
/// Indicates the (top-level) pattern could not be parsed.
ParsePatternError(ParseDiagnostic),

/// Used for missing syntax nodes.
MissingSyntaxNode,
/// Used for syntax errors.
SyntaxError(SyntaxError),

/// A built-in function call was discovered in an unexpected context.
UnexpectedBuiltinCall(String),

/// A metavariables was discovered in an unexpected context.
UnexpectedMetavariable,

/// If a function with the same name is defined multiple times.
DuplicateFunctionDefinition(String),

@@ -95,15 +92,18 @@ impl Diagnostic for CompileError {
fmt.write_markup(markup! { "Error parsing pattern: " })?;
diagnostic.message(fmt)
}
CompileError::MissingSyntaxNode => {
CompileError::SyntaxError(SyntaxError::MissingRequiredChild) => {
fmt.write_markup(markup! { "A syntax node was missing" })
}
CompileError::UnexpectedBuiltinCall(name) => {
fmt.write_markup(markup! { "Unexpected call to built-in: "{{name}}"()" })
CompileError::SyntaxError(SyntaxError::UnexpectedBogusNode) => {
fmt.write_markup(markup! { "Unexpected bogus node" })
}
CompileError::UnexpectedMetavariable => {
CompileError::SyntaxError(SyntaxError::UnexpectedMetavariable) => {
fmt.write_markup(markup! { "Unexpected metavariable" })
}
CompileError::UnexpectedBuiltinCall(name) => {
fmt.write_markup(markup! { "Unexpected call to built-in: "{{name}}"()" })
}
CompileError::DuplicateFunctionDefinition(name) => {
fmt.write_markup(markup! { "Duplicate function definition: "{{name}} })
}
@@ -202,10 +202,7 @@ impl Diagnostic for CompileError {

impl From<SyntaxError> for CompileError {
fn from(error: SyntaxError) -> Self {
match error {
SyntaxError::MissingRequiredChild => Self::MissingSyntaxNode,
SyntaxError::UnexpectedMetavariable => Self::UnexpectedMetavariable,
}
Self::SyntaxError(error)
}
}

1 change: 1 addition & 0 deletions crates/biome_grit_syntax/src/generated/nodes.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/biome_html_syntax/src/generated/nodes.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/biome_js_analyze/src/services/control_flow/nodes.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mod block;
mod bogus;
mod break_stmt;
mod continue_stmt;
mod do_while;
@@ -15,6 +16,7 @@ mod variable;
mod while_stmt;

pub(super) use block::*;
pub(super) use bogus::*;
pub(super) use break_stmt::*;
pub(super) use continue_stmt::*;
pub(super) use do_while::*;
22 changes: 22 additions & 0 deletions crates/biome_js_analyze/src/services/control_flow/nodes/bogus.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use biome_js_syntax::AnyJsBogusNode;
use biome_rowan::{SyntaxError, SyntaxResult};

use crate::services::control_flow::{
visitor::{NodeVisitor, StatementStack},
FunctionBuilder,
};

/// Bogus visitor.
///
/// The bogus visitor merely acts to abort control flow analysis inside broken
/// code, which could otherwise mess with assumptions made inside other
/// visitors.
pub(in crate::services::control_flow) struct BogusVisitor;

impl NodeVisitor for BogusVisitor {
type Node = AnyJsBogusNode;

fn enter(_: Self::Node, _: &mut FunctionBuilder, _: StatementStack) -> SyntaxResult<Self> {
Err(SyntaxError::UnexpectedBogusNode)
}
}
Original file line number Diff line number Diff line change
@@ -125,6 +125,7 @@ declare_visitor! {
return_stmt: ReturnVisitor,
throw: ThrowVisitor,
variable: VariableVisitor,
bogus: BogusVisitor,
}
}

1 change: 1 addition & 0 deletions crates/biome_js_syntax/src/generated/nodes.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/biome_json_syntax/src/generated/nodes.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/biome_markdown_syntax/src/generated/nodes.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion crates/biome_rowan/src/ast/mod.rs
Original file line number Diff line number Diff line change
@@ -747,6 +747,9 @@ pub enum SyntaxError {
/// Error thrown when a mandatory node is not found
MissingRequiredChild,

/// Error thrown when a bogus node is encountered in an unexpected position
UnexpectedBogusNode,

/// Error thrown when a metavariable node is found in an unexpected context
UnexpectedMetavariable,
}
@@ -755,7 +758,8 @@ impl Display for SyntaxError {
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
match self {
SyntaxError::MissingRequiredChild => fmt.write_str("missing required child"),
SyntaxError::UnexpectedMetavariable => fmt.write_str("unexpectedd metavariable node"),
SyntaxError::UnexpectedBogusNode => fmt.write_str("unexpected bogus node"),
SyntaxError::UnexpectedMetavariable => fmt.write_str("unexpected metavariable node"),
}
}
}
@@ -828,6 +832,7 @@ pub mod support {
match &self.0 {
Ok(node) => std::fmt::Debug::fmt(node, f),
Err(SyntaxError::MissingRequiredChild) => f.write_str("missing (required)"),
Err(SyntaxError::UnexpectedBogusNode) => f.write_str("bogus node"),
Err(SyntaxError::UnexpectedMetavariable) => f.write_str("metavariable"),
}
}
1 change: 1 addition & 0 deletions crates/biome_yaml_syntax/src/generated/nodes.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions xtask/codegen/src/generate_nodes.rs
Original file line number Diff line number Diff line change
@@ -727,6 +727,29 @@ pub fn generate_nodes(ast: &AstSrc, language_kind: LanguageKind) -> Result<Strin
}
});

let any_bogus = {
let kinds = ast.bogus.iter().enumerate().map(|(i, bogus_name)| {
let ident = format_ident!("{bogus_name}");
if i == 0 {
quote! { #ident }
} else {
quote! { | #ident }
}
});
let ident = format_ident!(
"Any{}BogusNode",
ast.bogus
.iter()
.find_map(|bogus_name| bogus_name.strip_suffix("Bogus"))
.expect("expected a plain *Bogus node")
);
quote! {
biome_rowan::declare_node_union! {
pub #ident = #(#kinds)*
}
}
};

let lists = ast.lists().map(|(name, list)| {
let list_name = format_ident!("{}", name);
let list_kind = format_ident!("{}", Case::Constant.convert(name));
@@ -929,6 +952,7 @@ pub fn generate_nodes(ast: &AstSrc, language_kind: LanguageKind) -> Result<Strin
#(#union_boilerplate_impls)*
#(#display_impls)*
#(#bogus)*
#any_bogus
#(#lists)*

#[derive(Clone)]