mirror of
https://github.com/danbulant/oxc
synced 2026-05-22 13:48:55 +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(),
|
.unwrap_or_default(),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn should_run(&self, ctx: &crate::rules::ContextHost) -> bool {
|
||||||
|
ctx.source_type().is_typescript()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConsistentGenericConstructors {
|
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(
|
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]
|
#[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>) {
|
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]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue