fix: skip early error check for ts definition (#219)

This commit is contained in:
Wenzhe Wang 2023-03-28 11:45:32 +08:00 committed by GitHub
parent 3e3cbec1a8
commit 48385f48b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -93,9 +93,12 @@ impl Linter {
#[must_use]
pub fn run<'a>(&self, semantic: &Rc<Semantic<'a>>) -> Vec<Message<'a>> {
let mut ctx = LintContext::new(semantic, self.fix);
let is_check_early_error = !semantic.source_type().is_typescript_definition();
for node in semantic.nodes().iter() {
self.early_error_javascript.run(node, &ctx);
if is_check_early_error {
self.early_error_javascript.run(node, &ctx);
}
for rule in &self.rules {
ctx.with_rule_name(rule.name());
rule.run(node, &ctx);