Skip to content

Commit

Permalink
feat(metadata): add link to rules (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperchupuDev committed May 20, 2024
1 parent 64b6211 commit b96b14a
Show file tree
Hide file tree
Showing 2 changed files with 251 additions and 1 deletion.
9 changes: 8 additions & 1 deletion codegen/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use biome_analyze::{
use biome_css_syntax::CssLanguage;
use biome_js_syntax::JsLanguage;
use biome_json_syntax::JsonLanguage;
use biome_string_case::Case;
use serde::Serialize;
use std::collections::BTreeMap;
use std::fs;
Expand Down Expand Up @@ -68,11 +69,13 @@ struct JsonMetadata {
pub version: String,
/// The name of this rule, displayed in the diagnostics it emits
pub name: String,
/// The rule's documentation URL
pub link: String,
/// Whether a rule is recommended or not
pub recommended: bool,
/// The kind of fix
pub fix_kind: FixKind,
/// The source URL of the rule
/// The source metadata of the rule
#[serde(skip_serializing_if = "Vec::is_empty")]
pub sources: Vec<RuleSource>,
/// The source kind of the rule
Expand All @@ -90,6 +93,10 @@ impl From<RuleMetadata> for JsonMetadata {
source_kind: value.source_kind,
name: value.name.to_string(),
sources: value.sources.to_vec(),
link: format!(
"https://biomejs.dev/linter/rules/{}",
Case::Kebab.convert(value.name)
),
recommended: value.recommended,
fix_kind: value.fix_kind,
docs: value.docs.to_string(),
Expand Down
Loading

0 comments on commit b96b14a

Please sign in to comment.