mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
perf(linter): run rules which require typescript syntax only when source type is actually typescript (#8166)
This commit is contained in:
parent
9d62284202
commit
d8d2ec6257
5 changed files with 20 additions and 0 deletions
|
|
@ -118,6 +118,10 @@ impl Rule for ConsistentGenericConstructors {
|
|||
.unwrap_or_default(),
|
||||
}))
|
||||
}
|
||||
|
||||
fn should_run(&self, ctx: &crate::rules::ContextHost) -> bool {
|
||||
ctx.source_type().is_typescript()
|
||||
}
|
||||
}
|
||||
|
||||
impl ConsistentGenericConstructors {
|
||||
|
|
|
|||
|
|
@ -140,6 +140,10 @@ impl Rule for NoEmptyObjectType {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn should_run(&self, ctx: &crate::rules::ContextHost) -> bool {
|
||||
ctx.source_type().is_typescript()
|
||||
}
|
||||
}
|
||||
|
||||
fn check_interface_declaration(
|
||||
|
|
|
|||
|
|
@ -113,6 +113,10 @@ impl Rule for NoMisusedNew {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn should_run(&self, ctx: &crate::rules::ContextHost) -> bool {
|
||||
ctx.source_type().is_typescript()
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -76,6 +76,10 @@ impl Rule for NoUnsafeFunctionType {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn should_run(&self, ctx: &crate::rules::ContextHost) -> bool {
|
||||
ctx.source_type().is_typescript()
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_function_type<'a>(identifier: &'a IdentifierReference<'a>, ctx: &LintContext<'a>) {
|
||||
|
|
|
|||
|
|
@ -99,6 +99,10 @@ impl Rule for NoWrapperObjectTypes {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn should_run(&self, ctx: &crate::rules::ContextHost) -> bool {
|
||||
ctx.source_type().is_typescript()
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue