feat(lint): add rules for react/preact (#27162)

This commit updated to deno_lint 0.69.0, which adds a bunch
or new lint rules dedicated for react/preact users.
This commit is contained in:
Bartek Iwańczuk 2025-01-24 13:08:36 +01:00 committed by GitHub
parent ad50c0df34
commit 0697578d3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 51 additions and 21 deletions

View file

@ -13,6 +13,7 @@ use deno_core::error::AnyError;
use deno_graph::ModuleGraph;
use deno_lint::diagnostic::LintDiagnostic;
use deno_lint::rules::LintRule;
use deno_lint::tags;
use crate::resolver::CliSloppyImportsResolver;
@ -25,7 +26,7 @@ pub use no_slow_types::collect_no_slow_type_diagnostics;
pub trait PackageLintRule: std::fmt::Debug + Send + Sync {
fn code(&self) -> &'static str;
fn tags(&self) -> &'static [&'static str] {
fn tags(&self) -> tags::Tags {
&[]
}
@ -78,7 +79,7 @@ impl CliLintRule {
}
}
pub fn tags(&self) -> &'static [&'static str] {
pub fn tags(&self) -> tags::Tags {
use CliLintRuleKind::*;
match &self.0 {
DenoLint(rule) => rule.tags(),
@ -91,7 +92,7 @@ impl CliLintRule {
use CliLintRuleKind::*;
match &self.0 {
DenoLint(rule) => {
Cow::Owned(format!("https://lint.deno.land/rules/{}", rule.code()))
Cow::Owned(format!("https://docs.deno.com/lint/rules/{}", rule.code()))
}
Extended(rule) => rule.help_docs_url(),
Package(rule) => rule.help_docs_url(),
@ -284,7 +285,7 @@ mod test {
.resolve_lint_rules(Default::default(), None)
.rules
.into_iter()
.filter(|r| r.tags().iter().any(|t| *t == "recommended"))
.filter(|r| r.tags().iter().any(|t| *t == tags::RECOMMENDED))
.map(|r| r.code().to_string())
.filter(|n| n != "no-debugger")
.collect::<Vec<_>>();