-
-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lint): add partial loader register
- Loading branch information
1 parent
9e02ef1
commit 471b48e
Showing
2 changed files
with
69 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,29 @@ | ||
use oxc_diagnostics::Error; | ||
use oxc_span::SourceType; | ||
|
||
pub const LINT_PARTIAL_LOADER_EXT: &[&str] = &["vue", "astro"]; | ||
|
||
pub enum PartialLoader { | ||
Vue, | ||
Astro, | ||
} | ||
|
||
pub struct PartialLoaderValue { | ||
pub source_text: String, | ||
pub source_type: SourceType, | ||
} | ||
|
||
pub type PartialLoaderResult = Result<PartialLoaderValue, Error>; | ||
|
||
impl PartialLoader { | ||
// TODO: add parser | ||
pub fn parse(&self, _source_text: &str) -> PartialLoaderValue { | ||
PartialLoaderValue { source_text: String::new(), source_type: SourceType::default() } | ||
} | ||
pub fn filter_extension(&self, extension: &str) -> bool { | ||
match self { | ||
Self::Vue => matches!(extension, "vue"), | ||
Self::Astro => matches!(extension, "astro"), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters