mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 20:28:58 +00:00
fix(linter/default): ignore unsupported files (e.g. .vue)
relates #3157
This commit is contained in:
parent
36f0094400
commit
313fb839b5
2 changed files with 13 additions and 1 deletions
3
crates/oxc_linter/fixtures/import/vue/main.vue
Normal file
3
crates/oxc_linter/fixtures/import/vue/main.vue
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<script setup lang="ts">
|
||||
import * as vue from 'vue'
|
||||
</script>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
use oxc_diagnostics::OxcDiagnostic;
|
||||
|
||||
use oxc_macros::declare_oxc_lint;
|
||||
use oxc_span::Span;
|
||||
use oxc_span::{Span, VALID_EXTENSIONS};
|
||||
use oxc_syntax::module_record::ImportImportName;
|
||||
|
||||
use crate::{context::LintContext, rule::Rule};
|
||||
|
|
@ -51,6 +51,14 @@ impl Rule for Default {
|
|||
if remote_module_record_ref.not_esm {
|
||||
continue;
|
||||
}
|
||||
if !remote_module_record_ref
|
||||
.resolved_absolute_path
|
||||
.extension()
|
||||
.and_then(|ext| ext.to_str())
|
||||
.is_some_and(|ext| VALID_EXTENSIONS.contains(&ext))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if remote_module_record_ref.export_default.is_none()
|
||||
&& !remote_module_record_ref.exported_bindings.contains_key("default")
|
||||
{
|
||||
|
|
@ -104,6 +112,7 @@ fn test() {
|
|||
// r#"import foobar from "./typescript-export-assign-property""#,
|
||||
// r#"import foobar from "./typescript-export-assign-default-reexport""#,
|
||||
// r#"import React from "./typescript-export-assign-default-namespace"#,
|
||||
r#"import Foo from "./vue/main.vue""#,
|
||||
];
|
||||
|
||||
let fail = vec![
|
||||
|
|
|
|||
Loading…
Reference in a new issue