mirror of
https://github.com/danbulant/oxc
synced 2026-05-20 12:48:38 +00:00
parent
497a0b8462
commit
040278aa50
4 changed files with 13 additions and 32 deletions
|
|
@ -16,7 +16,7 @@ categories.workspace = true
|
|||
workspace = true
|
||||
|
||||
[[bin]]
|
||||
name = "oxc_language_server"
|
||||
name = "oxc_language_server"
|
||||
test = false
|
||||
|
||||
[dependencies]
|
||||
|
|
@ -36,7 +36,7 @@ rayon = { workspace = true }
|
|||
ropey = { workspace = true }
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
tower-lsp = { workspace = true, features = ["proposed"] }
|
||||
log = "0.4.20"
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
globset = "0.4.14"
|
||||
log = "0.4.20"
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
globset = "0.4.14"
|
||||
|
|
|
|||
|
|
@ -14,7 +14,12 @@ use oxc_span::Span;
|
|||
|
||||
use oxc_allocator::Vec;
|
||||
|
||||
use crate::{context::LintContext, rule::Rule, utils::has_jsx_prop_lowercase, AstNode};
|
||||
use crate::{
|
||||
context::LintContext,
|
||||
rule::Rule,
|
||||
utils::{get_prop_value, has_jsx_prop_lowercase},
|
||||
AstNode,
|
||||
};
|
||||
|
||||
#[derive(Debug, Error, Diagnostic)]
|
||||
enum AnchorHasContentDiagnostic {
|
||||
|
|
@ -100,14 +105,6 @@ impl Rule for AnchorHasContent {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_prop_value<'a, 'b>(item: &'b JSXAttributeItem<'a>) -> Option<&'b JSXAttributeValue<'a>> {
|
||||
if let JSXAttributeItem::Attribute(attr) = item {
|
||||
attr.0.value.as_ref()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn match_valid_prop(attr_items: &Vec<JSXAttributeItem>) -> bool {
|
||||
attr_items
|
||||
.into_iter()
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use oxc_span::Span;
|
|||
use crate::{
|
||||
context::LintContext,
|
||||
rule::Rule,
|
||||
utils::{get_element_type, has_jsx_prop_lowercase},
|
||||
utils::{get_element_type, get_prop_value, has_jsx_prop_lowercase},
|
||||
AstNode,
|
||||
};
|
||||
|
||||
|
|
@ -56,14 +56,6 @@ declare_oxc_lint!(
|
|||
correctness
|
||||
);
|
||||
|
||||
fn get_prop_value<'a, 'b>(item: &'b JSXAttributeItem<'a>) -> Option<&'b JSXAttributeValue<'a>> {
|
||||
if let JSXAttributeItem::Attribute(attr) = item {
|
||||
attr.0.value.as_ref()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl Rule for HtmlHasLang {
|
||||
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
|
||||
let AstKind::JSXOpeningElement(jsx_el) = node.kind() else {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use oxc_span::Span;
|
|||
use crate::{
|
||||
context::LintContext,
|
||||
rule::Rule,
|
||||
utils::{get_element_type, has_jsx_prop_lowercase},
|
||||
utils::{get_element_type, get_prop_value, has_jsx_prop_lowercase},
|
||||
AstNode,
|
||||
};
|
||||
|
||||
|
|
@ -92,14 +92,6 @@ impl Rule for Lang {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_prop_value<'a, 'b>(item: &'b JSXAttributeItem<'a>) -> Option<&'b JSXAttributeValue<'a>> {
|
||||
if let JSXAttributeItem::Attribute(attr) = item {
|
||||
attr.0.value.as_ref()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn is_valid_lang_prop(item: &JSXAttributeItem) -> bool {
|
||||
match get_prop_value(item) {
|
||||
Some(JSXAttributeValue::ExpressionContainer(JSXExpressionContainer {
|
||||
|
|
|
|||
Loading…
Reference in a new issue