Skip to content

Commit 9a03e7e

Browse files
committed
Fixes + feedback
1 parent 3f166ea commit 9a03e7e

File tree

16 files changed

+92
-57
lines changed

16 files changed

+92
-57
lines changed

Cargo.lock

+3-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ ignore = "0.4.23"
196196
indexmap = { version = "2.7.0" }
197197
insta = "1.41.1"
198198
natord = "1.0.9"
199-
oxc_resolver = { git = "https://github.com/arendjr/oxc-resolver.git", branch = "manifest-traits" } # "3.0.3"
199+
oxc_resolver = "4.0"
200200
papaya = "0.1.8"
201201
proc-macro2 = "1.0.86"
202202
quickcheck = "1.0.3"

crates/biome_dependency_graph/fixtures/frontend/node_modules/shared

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
export function foo() {}

crates/biome_deserialize/src/json.rs

-8
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ impl DeserializableValue for AnyJsonValue {
137137
AnyJsonValue::JsonStringValue(_) => Some(DeserializableType::Str),
138138
}
139139
}
140-
141-
fn into_json_value(self) -> Option<AnyJsonValue> {
142-
Some(self)
143-
}
144140
}
145141

146142
#[cfg(feature = "serde")]
@@ -257,10 +253,6 @@ impl DeserializableValue for JsonMemberName {
257253
fn visitable_type(&self) -> Option<DeserializableType> {
258254
Some(DeserializableType::Str)
259255
}
260-
261-
fn into_json_value(self) -> Option<AnyJsonValue> {
262-
None
263-
}
264256
}
265257

266258
/// Returns `text` with escape sequences processed.

crates/biome_deserialize/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ mod merge;
3636
mod validator;
3737

3838
use biome_diagnostics::{Error, Severity};
39-
use biome_json_syntax::AnyJsonValue;
4039
pub use biome_rowan::TextRange;
4140
pub use diagnostics::{
4241
DeserializableType, DeserializableTypes, DeserializationAdvice, DeserializationDiagnostic,
@@ -143,9 +142,6 @@ pub trait DeserializableValue: Sized {
143142

144143
/// Returns the type of this value.
145144
fn visitable_type(&self) -> Option<DeserializableType>;
146-
147-
/// Returns a JSON representation of the value, if possible.
148-
fn into_json_value(self) -> Option<AnyJsonValue>;
149145
}
150146

151147
/// This trait represents a visitor that walks through a [DeserializableValue].

crates/biome_fs/src/fs/os.rs

+12
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ impl FileSystem for OsFileSystem {
8686
path.exists()
8787
}
8888

89+
fn path_is_file(&self, path: &Utf8Path) -> bool {
90+
path.is_file()
91+
}
92+
93+
fn path_is_dir(&self, path: &Utf8Path) -> bool {
94+
path.is_dir()
95+
}
96+
97+
fn path_is_symlink(&self, path: &Utf8Path) -> bool {
98+
path.is_symlink()
99+
}
100+
89101
fn path_kind(&self, path: &Utf8Path) -> Result<PathKind, FileSystemDiagnostic> {
90102
match path.metadata() {
91103
Ok(metadata) => {

crates/biome_js_analyze/src/lint/correctness/no_undeclared_dependencies.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,7 @@ impl Rule for NoUndeclaredDependencies {
279279
));
280280
};
281281

282-
let mut manifest_path = package_path.clone();
283-
manifest_path.push("package.json");
282+
let manifest_path = package_path.clone();
284283

285284
let diag = RuleDiagnostic::new(
286285
rule_category!(),

crates/biome_js_analyze/src/lint/nursery/use_strict_mode.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use biome_rowan::{AstNode, AstNodeList, BatchMutationExt};
1212
declare_lint_rule! {
1313
/// Enforce the use of the directive `"use strict"` in script files.
1414
///
15-
/// The JavaScript [strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) prohibits some obsolete JavaScript syntaxes and makes some slight semantic chnmages to allow more optimizations by JavaScript engines.
16-
/// EcmaScript modules are always in strict mode, while JavaScript scripts are by default in non-strict mode, also known as _sloppy mode_.
15+
/// The JavaScript [strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) prohibits some obsolete JavaScript syntaxes and makes some slight semantic changes to allow more optimizations by JavaScript engines.
16+
/// EcmaScript modules are always in strict mode, while JavaScript scripts are by default in non-strict mode, also known as _sloppy mode_.
1717
/// A developer can add the `"use strict"` directive at the start of a script file to enable the strict mode in that file.
1818
///
1919
/// Biome considers a CommonJS (`.cjs`) file as a script file.

crates/biome_package/src/node_js_package/package_json.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ impl DeserializationVisitor for PackageJsonVisitor {
383383
result.r#type = Deserializable::deserialize(ctx, &value, &key_text);
384384
}
385385
key => {
386-
if let Some(value) = value.into_json_value() {
387-
result.raw_json.insert(key.into(), value.into());
386+
if let Some(value) = JsonValue::deserialize(ctx, &value, &key_text) {
387+
result.raw_json.insert(key.into(), value);
388388
}
389389
}
390390
}
@@ -410,7 +410,9 @@ impl Deserializable for Version {
410410
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, biome_deserialize_macros::Deserializable)]
411411
pub enum PackageType {
412412
#[default]
413+
#[deserializable(rename = "module")]
413414
Module,
415+
#[deserializable(rename = "commonjs")]
414416
CommonJs,
415417
}
416418

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"baseUrl": 1
3-
}
2+
"compilerOptions": {
3+
"baseUrl": 1
4+
},
5+
}

crates/biome_package/tests/tsconfig/invalid/tsconfig.invalid.baseUrl.json.snap

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
source: crates/biome_package/tests/manifest_spec_tests.rs
33
expression: tsconfig.invalid.baseUrl.json
44
---
5-
tsconfig.invalid.baseUrl.json:2:14 deserialize ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
5+
tsconfig.invalid.baseUrl.json:3:16 deserialize ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
66

77
× baseUrl has an incorrect type, expected a string, but received a number.
88

99
1 │ {
10-
> 2"baseUrl": 1
11-
^
12-
3 │ }
10+
2"compilerOptions": {
11+
> 3"baseUrl": 1
12+
^
13+
4 │ },
14+
5 │ }
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"baseUrl": "src"
3-
}
2+
"compilerOptions": {
3+
"baseUrl": "src"
4+
},
5+
}

crates/biome_package/tests/tsconfig/valid/tsconfig.valid.baseUrl.json.snap

+15-5
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,24 @@ expression: tsconfig.valid.baseUrl.json
55
## Input
66

77
{
8-
"baseUrl": "src"
8+
"compilerOptions": {
9+
"baseUrl": "src"
10+
},
911
}
1012

13+
1114
## Data structure
1215

1316
TsConfigJson {
14-
base_url: Some(
15-
"src",
16-
),
17-
paths: {},
17+
root: false,
18+
path: "",
19+
extends: None,
20+
compiler_options: CompilerOptions {
21+
base_url: Some(
22+
"src",
23+
),
24+
paths: None,
25+
paths_base: "",
26+
},
27+
references: [],
1828
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
2-
"baseUrl": "src",
3-
"paths": {
4-
"@/services": [
5-
"services",
6-
"vendor/services"
7-
]
8-
}
9-
}
2+
"compilerOptions": {
3+
"baseUrl": "src",
4+
"paths": {
5+
"@/services": [
6+
"services",
7+
"vendor/services"
8+
]
9+
}
10+
},
11+
}

crates/biome_package/tests/tsconfig/valid/tsconfig.valid.paths.json.snap

+27-15
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,37 @@ expression: tsconfig.valid.paths.json
55
## Input
66

77
{
8-
"baseUrl": "src",
9-
"paths": {
10-
"@/services": [
11-
"services",
12-
"vendor/services"
13-
]
14-
}
8+
"compilerOptions": {
9+
"baseUrl": "src",
10+
"paths": {
11+
"@/services": [
12+
"services",
13+
"vendor/services"
14+
]
15+
}
16+
},
1517
}
1618

19+
1720
## Data structure
1821

1922
TsConfigJson {
20-
base_url: Some(
21-
"src",
22-
),
23-
paths: {
24-
"@/services": [
25-
"services",
26-
"vendor/services",
27-
],
23+
root: false,
24+
path: "",
25+
extends: None,
26+
compiler_options: CompilerOptions {
27+
base_url: Some(
28+
"src",
29+
),
30+
paths: Some(
31+
{
32+
"@/services": [
33+
"services",
34+
"vendor/services",
35+
],
36+
},
37+
),
38+
paths_base: "",
2839
},
40+
references: [],
2941
}

0 commit comments

Comments
 (0)