+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 31 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ biome_grit_formatter = { version = "0.0.0", path = "./crates/biome_grit_
biome_grit_parser = { version = "0.1.0", path = "./crates/biome_grit_parser" }
biome_grit_patterns = { version = "0.0.1", path = "./crates/biome_grit_patterns" }
biome_grit_syntax = { version = "0.5.7", path = "./crates/biome_grit_syntax" }
biome_html_analyze = { version = "0.5.7", path = "./crates/biome_html_analyze" }
biome_html_factory = { version = "0.5.7", path = "./crates/biome_html_factory" }
biome_html_formatter = { version = "0.0.0", path = "./crates/biome_html_formatter" }
biome_html_parser = { version = "0.0.1", path = "./crates/biome_html_parser" }
Expand Down
1 change: 1 addition & 0 deletions crates/biome_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ biome_glob = { workspace = true }
biome_graphql_analyze = { workspace = true }
biome_graphql_syntax = { workspace = true }
biome_grit_patterns = { workspace = true }
biome_html_analyze = { workspace = true }
biome_html_formatter = { workspace = true }
biome_js_analyze = { workspace = true }
biome_js_formatter = { workspace = true }
Expand Down
42 changes: 42 additions & 0 deletions crates/biome_cli/tests/cases/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,45 @@ fn should_apply_fixes_to_embedded_languages() {
result,
));
}

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

let html_file = Utf8Path::new("file.html");
fs.insert(
html_file.into(),
r#"<div scope="col"></div>
"#
.as_bytes(),
);

fs.insert(
Utf8Path::new("biome.json").into(),
r#"{
"html": {
"linter": {
"enabled": true
}
}
}"#
.as_bytes(),
);

let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["lint", html_file.as_str()].as_slice()),
);

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

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

```json
{
"html": {
"linter": {
"enabled": true
}
}
}
```

## `file.html`

```html
<div scope="col"></div>

```

# Termination Message

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

× Some errors were emitted while running checks.



```

# Emitted Messages

```block
file.html:1:6 lint/a11y/noHeaderScope FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Avoid using the scope attribute on elements other than th elements.

> 1 │ <div scope="col"></div>
│ ^^^^^^^^^^^
2 │

i The scope attribute is used to associate a data cell with its corresponding header cell in a data table,
so it should be placed on th elements to provide accessibility to screen readers.

i Follow the links for more information,
WCAG 1.3.1
WCAG 4.1.1

i Unsafe fix: Remove the scope attribute.

1 │ <div·scope="col"></div>
│ -----------

```

```block
Checked 1 file in <TIME>. No fixes applied.
Found 1 error.
```
5 changes: 3 additions & 2 deletions crates/biome_configuration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ version = "0.0.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
biome_analyze = { workspace = true, features = ["serde"] }
biome_console = { workspace = true }
biome_analyze = { workspace = true, features = ["serde"] }
biome_console = { workspace = true }

biome_deserialize = { workspace = true }
biome_deserialize_macros = { workspace = true }
biome_diagnostics = { workspace = true }
Expand Down
38 changes: 38 additions & 0 deletions crates/biome_html_analyze/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[package]
authors.workspace = true
categories.workspace = true
description = "Biome's HTML linter"
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
license.workspace = true
name = "biome_html_analyze"
repository.workspace = true
version = "0.5.7"

[dependencies]
biome_analyze = { workspace = true }
biome_console = { workspace = true }
biome_deserialize = { workspace = true }
biome_deserialize_macros = { workspace = true }
biome_diagnostics = { workspace = true }
biome_html_factory = { workspace = true }
biome_html_syntax = { workspace = true }
biome_rowan = { workspace = true }
biome_string_case = { workspace = true }
biome_suppression = { workspace = true }
schemars = { workspace = true, optional = true }
serde = { workspace = true, features = ["derive"] }

[dev-dependencies]
biome_html_parser = { path = "../biome_html_parser" }
biome_test_utils = { path = "../biome_test_utils" }
camino = { workspace = true }
insta = { workspace = true, features = ["glob"] }
tests_macros = { path = "../tests_macros" }

[features]
schema = ["schemars"]

[lints]
workspace = true
Loading
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载