Skip to content

Commit 7a98679

Browse files
committed
Merge branch 'main' into feat/no-react-forward-ref
# Conflicts: # crates/biome_configuration/src/analyzer/linter/rules.rs # crates/biome_diagnostics_categories/src/categories.rs # crates/biome_js_analyze/src/lint/nursery.rs # packages/@biomejs/backend-jsonrpc/src/workspace.ts
2 parents d75d879 + 3f06e19 commit 7a98679

51 files changed

Lines changed: 3371 additions & 440 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
Added new nursery rule [`noDeprecatedImports`](https://biomejs.dev/linter/rules/no-deprecated-imports/) to flag imports of deprecated symbols.
6+
7+
#### Invalid example
8+
9+
```js
10+
// foo.js
11+
import { oldUtility } from "./utils.js";
12+
```
13+
14+
```js
15+
// utils.js
16+
/**
17+
* @deprecated
18+
*/
19+
export function oldUtility() {}
20+
```
21+
22+
#### Valid examples
23+
24+
```js
25+
// foo.js
26+
import { newUtility, oldUtility } from "./utils.js";
27+
```
28+
29+
```js
30+
// utils.js
31+
export function newUtility() {}
32+
33+
// @deprecated (this is not a JSDoc comment)
34+
export function oldUtility() {}
35+
```

.changeset/fruity-towns-repair.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
Implements [#7339](https://github.com/biomejs/biome/discussions/7339). GritQL patterns can now use native Biome AST nodes using their `PascalCase` names, in addition to the existing TreeSitter-compatible `snake_case` names.
6+
7+
```grit
8+
engine biome(1.0)
9+
language js(typescript,jsx)
10+
11+
or {
12+
// TreeSitter-compatible pattern
13+
if_statement(),
14+
15+
// Native Biome AST node pattern
16+
JsIfStatement()
17+
} as $stmt where {
18+
register_diagnostic(
19+
span=$stmt,
20+
message="Found an if statement"
21+
)
22+
}
23+
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
Added nursery rule [`noUnusedExpressions`](https://biomejs.dev/linter/rules/no-unused-expressions/) to flag expressions used as a statement that is neither an assignment nor a function call.
6+
7+
#### Invalid examples
8+
9+
```js
10+
f // intended to call `f()` instead
11+
```
12+
13+
```js
14+
function foo() {
15+
0 // intended to `return 0` instead
16+
}
17+
```
18+
19+
#### Valid examples
20+
21+
```js
22+
f()
23+
```
24+
25+
```js
26+
function foo() {
27+
return 0;
28+
}
29+
```

crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/biome_configuration/src/analyzer/linter/rules.rs

Lines changed: 102 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/biome_diagnostics_categories/src/categories.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ define_categories! {
162162
"lint/correctness/useValidTypeof": "https://biomejs.dev/linter/rules/use-valid-typeof",
163163
"lint/correctness/useYield": "https://biomejs.dev/linter/rules/use-yield",
164164
"lint/nursery/noColorInvalidHex": "https://biomejs.dev/linter/rules/no-color-invalid-hex",
165+
"lint/nursery/noDeprecatedImports": "https://biomejs.dev/linter/rules/no-deprecated-imports",
165166
"lint/nursery/noDuplicateDependencies": "https://biomejs.dev/linter/rules/no-duplicate-dependencies",
166167
"lint/nursery/noFloatingPromises": "https://biomejs.dev/linter/rules/no-floating-promises",
167168
"lint/nursery/noImplicitCoercion": "https://biomejs.dev/linter/rules/no-implicit-coercion",
@@ -177,6 +178,7 @@ define_categories! {
177178
"lint/nursery/noShadow": "https://biomejs.dev/linter/rules/no-shadow",
178179
"lint/nursery/noUnnecessaryConditions": "https://biomejs.dev/linter/rules/no-unnecessary-conditions",
179180
"lint/nursery/noUnresolvedImports": "https://biomejs.dev/linter/rules/no-unresolved-imports",
181+
"lint/nursery/noUnusedExpressions": "https://biomejs.dev/linter/rules/no-unused-expressions",
180182
"lint/nursery/noUnwantedPolyfillio": "https://biomejs.dev/linter/rules/no-unwanted-polyfillio",
181183
"lint/nursery/noUselessBackrefInRegex": "https://biomejs.dev/linter/rules/no-useless-backref-in-regex",
182184
"lint/nursery/noUselessCatchBinding": "https://biomejs.dev/linter/rules/no-useless-catch-binding",

crates/biome_grit_patterns/src/grit_target_language/css_target_language.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
mod constants;
2+
pub mod generated_mappings;
23

34
use super::{
45
DisregardedSlotCondition, GritTargetLanguageImpl, LeafEquivalenceClass, LeafNormalizer,
@@ -11,6 +12,7 @@ use crate::{
1112
use biome_css_syntax::{CssLanguage, CssSyntaxKind};
1213
use biome_rowan::{RawSyntaxKind, SyntaxKindSet};
1314
use constants::DISREGARDED_SNIPPET_SLOTS;
15+
use generated_mappings::kind_by_name;
1416

1517
const COMMENT_KINDS: SyntaxKindSet<CssLanguage> =
1618
SyntaxKindSet::from_raw(RawSyntaxKind(CssSyntaxKind::COMMENT as u16)).union(
@@ -30,12 +32,9 @@ impl GritTargetLanguageImpl for CssTargetLanguage {
3032

3133
/// Returns the syntax kind for a node by name.
3234
///
33-
/// For compatibility with existing Grit snippets (as well as the online
34-
/// Grit playground), node names should be aligned with TreeSitter's
35-
/// `ts_language_symbol_for_name()`.
36-
fn kind_by_name(&self, _node_name: &str) -> Option<CssSyntaxKind> {
37-
// TODO: See [super::JsTargetLanguage::kind_by_name()].
38-
None
35+
/// Supports native Biome AST patterns for full language coverage.
36+
fn kind_by_name(&self, node_name: &str) -> Option<CssSyntaxKind> {
37+
kind_by_name(node_name)
3938
}
4039

4140
/// Returns the node name for a given syntax kind.

0 commit comments

Comments
 (0)