Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(linter): fix panic with strip_prefix #1013

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions crates/oxc_linter/src/service.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use dashmap::DashMap;
use std::{
collections::HashMap,
fs,
Expand All @@ -7,16 +6,18 @@ use std::{
sync::{Arc, Condvar, Mutex},
};

use dashmap::DashMap;
use rayon::{iter::ParallelBridge, prelude::ParallelIterator};
use rustc_hash::FxHashSet;

use oxc_allocator::Allocator;
use oxc_diagnostics::{DiagnosticSender, DiagnosticService};
use oxc_parser::Parser;
use oxc_resolver::{ResolveOptions, Resolver};
use oxc_semantic::{ModuleRecord, SemanticBuilder};
use oxc_span::{SourceType, VALID_EXTENSIONS};
use rustc_hash::FxHashSet;

use crate::{Fixer, LintContext, LintOptions, Linter, Message};
use rayon::{iter::ParallelBridge, prelude::ParallelIterator};

#[derive(Clone)]
pub struct LintService {
Expand Down Expand Up @@ -153,7 +154,7 @@ impl Runtime {

if !messages.is_empty() {
let errors = messages.into_iter().map(|m| m.error).collect();
let path = path.strip_prefix(&self.cwd).unwrap();
let path = path.strip_prefix(&self.cwd).unwrap_or(path);
let diagnostics = DiagnosticService::wrap_diagnostics(path, &source_text, errors);
tx_error.send(Some(diagnostics)).unwrap();
}
Expand Down
Loading