mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(linter): ban --fix for variety files(vue, astro, svelte) (#2189)
closes: #2122
This commit is contained in:
parent
1de3518046
commit
f039ad6007
1 changed files with 6 additions and 3 deletions
|
|
@ -175,8 +175,10 @@ impl Runtime {
|
|||
}
|
||||
};
|
||||
|
||||
let sources = PartialLoader::parse(ext, &source_text)
|
||||
.unwrap_or_else(|| vec![JavaScriptSource::new(&source_text, source_type, 0)]);
|
||||
let sources = PartialLoader::parse(ext, &source_text);
|
||||
let is_processed_by_partial_loader = sources.is_some();
|
||||
let sources =
|
||||
sources.unwrap_or_else(|| vec![JavaScriptSource::new(&source_text, source_type, 0)]);
|
||||
|
||||
if sources.is_empty() {
|
||||
return;
|
||||
|
|
@ -187,7 +189,8 @@ impl Runtime {
|
|||
let mut messages =
|
||||
self.process_source(path, &allocator, source_text, source_type, true, tx_error);
|
||||
|
||||
if self.linter.options().fix {
|
||||
// TODO: Span is wrong, ban this feature for file process by `PartialLoader`.
|
||||
if !is_processed_by_partial_loader && self.linter.options().fix {
|
||||
let fix_result = Fixer::new(source_text, messages).fix();
|
||||
fs::write(path, fix_result.fixed_code.as_bytes()).unwrap();
|
||||
messages = fix_result.messages;
|
||||
|
|
|
|||
Loading…
Reference in a new issue