Skip to content

Commit

Permalink
fix(noUndeclaredDependencies): Add custom serde::Serialize implementa…
Browse files Browse the repository at this point in the history
…tion

Signed-off-by: Naoki Ikeguchi <me@s6n.jp>
  • Loading branch information
siketyan committed Oct 25, 2024
1 parent 5601759 commit fc2424a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ declare_lint_rule! {
}
}

#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
#[derive(Clone, Debug, Default, serde::Deserialize)]
enum DependencyAvailability {
/// Dependencies are always available.
#[default]
Expand Down Expand Up @@ -133,6 +133,19 @@ impl Deserializable for DependencyAvailability {
}
}

impl serde::Serialize for DependencyAvailability {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Available => true.serialize(serializer),
Self::Unavailable => false.serialize(serializer),
Self::FilesGlob(globs) => globs.serialize(serializer),
}
}
}

#[cfg(feature = "schemars")]
impl schemars::JsonSchema for DependencyAvailability {
fn schema_name() -> String {
Expand Down
6 changes: 3 additions & 3 deletions packages/@biomejs/biome/configuration_schema.json

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

0 comments on commit fc2424a

Please sign in to comment.