Skip to content

Commit

Permalink
Merge branch 'main' into feat/use-consistent-grid-areas
Browse files Browse the repository at this point in the history
  • Loading branch information
chansuke authored May 28, 2024
2 parents 28b190e + 72a702c commit 0bf01ba
Show file tree
Hide file tree
Showing 101 changed files with 6,178 additions and 1,524 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish_wasm_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: wasm-pack build --out-dir ../../packages/@biomejs/wasm-web --target web --release --scope biomejs crates/biome_wasm

- run: corepack enable
- uses: actions/setup-node@v4
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
cache: "pnpm"
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

#### Enhancements

- Assume `Astro` object is always a global when processing `.astro` files. Contributed by @minht11
- Assume Vue compiler macros are globals when processing `.vue` files. ([#2771](https://github.com/biomejs/biome/pull/2771)) Contributed by @dyc3

### CLI
Expand Down Expand Up @@ -228,6 +229,7 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

#### New features

- Add [nursery/useDateNow](https://biomejs.dev/linter/rules/use-date-now/). Contributed by @minht11
- Add [nursery/useErrorMessage](https://biomejs.dev/linter/rules/use_error_message/). Contributed by @minht11
- Add [nursery/useThrowOnlyError](https://biomejs.dev/linter/rules/use_throw_only_error/). Contributed by @minht11
- Add [nursery/useImportExtensions](https://biomejs.dev/linter/rules/use-import-extensions/). Contributed by @minht11
Expand Down Expand Up @@ -295,6 +297,13 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b
The diagnosis is also clearer.

Contributed by @Conaclos
- Improve code action for [nursery/noUselessUndefinedInitialization](https://biomejs.dev/linter/rules/no-useless-undefined-initialization/) to handle comments.

The rule now places inline comments after the declaration statement, instead of removing them.
The code action is now safe to apply.

Contributed by @lutaok


#### Bug fixes

Expand Down Expand Up @@ -323,6 +332,18 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

Contributed by @Conaclos

- [noUndeclaredVariables](https://biomejs.dev/linter/rules/no-undeclared-variables/) now correctly handle ambient computed member names ([#2975](https://github.com/biomejs/biome/issues/2975)).

A constant can be imported as a type and used in a computed member name of a member signature.
Previously, Biome was unable to bind the value imported as a type to the computed member name.

```ts
import type { NAME } from "./constants.js";
type X = { [NAME]: number };
```

Contributed by @Conaclos

- [noUndeclaredVariables](https://biomejs.dev/linter/rules/no-undeclared-variables/) now ignores `this` in JSX components ([#2636](https://github.com/biomejs/biome/issues/2636)).

The rule no longer reports `this` as undeclared in following code.
Expand Down
28 changes: 16 additions & 12 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ biome_ungrammar = { path = "./crates/biome_ungrammar" }
tests_macros = { path = "./crates/tests_macros" }

# Crates needed in the workspace
anyhow = "1.0.83"
anyhow = "1.0.86"
bitflags = "2.5.0"
bpaf = { version = "0.9.9", features = ["derive"] }
countme = "3.0.1"
Expand All @@ -166,15 +166,15 @@ indexmap = { version = "2.2.6", features = ["serde"] }
insta = "1.38.0"
lazy_static = "1.4.0"
oxc_resolver = "1.7.0"
proc-macro2 = "1.0.82"
proc-macro2 = "1.0.84"
quickcheck = "1.0.3"
quickcheck_macros = "1.0.0"
quote = "1.0.36"
rayon = "1.10.0"
regex = "1.10.4"
rustc-hash = "1.1.0"
schemars = { version = "0.8.19", features = ["indexmap2", "smallvec"] }
serde = { version = "1.0.201", features = ["derive"] }
schemars = { version = "0.8.21", features = ["indexmap2", "smallvec"] }
serde = { version = "1.0.203", features = ["derive"] }
serde_ini = "0.2.0"
serde_json = "1.0.117"
similar = "2.5.0"
Expand Down

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

38 changes: 38 additions & 0 deletions crates/biome_cli/tests/cases/biome_json_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,41 @@ fn biome_json_is_not_ignored() {
result,
));
}

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

let file_path = Path::new("biome.json");
let config = r#"{
"formatter": {
"indentStyle": "space",
"indentWidth": 4
},
"json": {
"formatter": {
"trailingCommas": "all"
}
}
}
"#;
fs.insert(file_path.into(), config);

let result = run_cli(
DynRef::Borrowed(&mut fs),
&mut console,
Args::from(["check", "--write", "."].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");

assert_file_contents(&fs, file_path, config);
assert_cli_snapshot(SnapshotPayload::new(
module_path!(),
"always_disable_trailing_commas_biome_json",
fs,
console,
result,
));
}
35 changes: 35 additions & 0 deletions crates/biome_cli/tests/cases/handle_astro_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ const foo = "";
---
<div></div>"#;

const ASTRO_FILE_ASTRO_GLOBAL_OBJECT: &str = r#"---
const { some } = Astro.props
---
<div>{some}</div>"#;

#[test]
fn format_astro_files() {
let mut fs = MemoryFileSystem::default();
Expand Down Expand Up @@ -685,3 +690,33 @@ fn check_stdin_write_unsafe_successfully() {
result,
));
}

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

let astro_file_path = Path::new("file.astro");
fs.insert(
astro_file_path.into(),
ASTRO_FILE_ASTRO_GLOBAL_OBJECT.as_bytes(),
);

let result = run_cli(
DynRef::Borrowed(&mut fs),
&mut console,
Args::from([("lint"), astro_file_path.as_os_str().to_str().unwrap()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");

assert_file_contents(&fs, astro_file_path, ASTRO_FILE_ASTRO_GLOBAL_OBJECT);

assert_cli_snapshot(SnapshotPayload::new(
module_path!(),
"astro_global",
fs,
console,
result,
));
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
source: crates/biome_cli/tests/snap_test.rs
expression: content
---
## `biome.json`

```json
{
"formatter": {
"indentStyle": "space",
"indentWidth": 4
},
"json": {
"formatter": {
"trailingCommas": "all"
}
}
}
```

# Emitted Messages

```block
Checked 1 file in <TIME>. No fixes needed.
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
source: crates/biome_cli/tests/snap_test.rs
expression: content
---
## `file.astro`

```astro
---
const { some } = Astro.props
---
<div>{some}</div>
```

# Emitted Messages

```block
Checked 1 file in <TIME>. No fixes needed.
```
4 changes: 4 additions & 0 deletions crates/biome_configuration/src/css.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ pub struct CssParser {
/// Allow comments to appear on incorrect lines in `.css` files
#[partial(bpaf(hide))]
pub allow_wrong_line_comments: bool,

/// Enables parsing of CSS Modules specific features.
#[partial(bpaf(hide))]
pub css_modules: bool,
}

/// Options that changes how the CSS formatter behaves
Expand Down
Loading

0 comments on commit 0bf01ba

Please sign in to comment.