Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 1 addition & 4 deletions apps/oxlint/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use ignore::{gitignore::Gitignore, overrides::OverrideBuilder};
use rustc_hash::{FxHashMap, FxHashSet};
use serde_json::Value;

use oxc_allocator::AllocatorPool;
use oxc_diagnostics::{DiagnosticSender, DiagnosticService, GraphicalReportHandler, OxcDiagnostic};
use oxc_linter::{
AllowWarnDeny, Config, ConfigStore, ConfigStoreBuilder, ExternalLinter, ExternalPluginStore,
Expand Down Expand Up @@ -338,11 +337,9 @@ impl LintRunner {

let number_of_rules = linter.number_of_rules(self.options.type_aware);

let allocator_pool = AllocatorPool::new(rayon::current_num_threads());

// Spawn linting in another thread so diagnostics can be printed immediately from diagnostic_service.run.
rayon::spawn(move || {
let mut lint_service = LintService::new(linter, allocator_pool, options);
let mut lint_service = LintService::new(linter, options);
lint_service.with_paths(paths);

// Use `RawTransferFileSystem` if `oxlint2` feature is enabled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use tower_lsp_server::{
lsp_types::{self, DiagnosticRelatedInformation, DiagnosticSeverity, Uri},
};

use oxc_allocator::{Allocator, AllocatorPool};
use oxc_allocator::Allocator;
use oxc_linter::{
ConfigStore, LINTABLE_EXTENSIONS, LintOptions, LintService, LintServiceOptions, Linter,
MessageWithPosition, loader::Loader, read_to_arena_str,
Expand Down Expand Up @@ -76,7 +76,7 @@ impl IsolatedLintHandler {
lint_service_options = lint_service_options.with_tsconfig(tsconfig_path);
}

let service = LintService::new(linter, AllocatorPool::default(), lint_service_options);
let service = LintService::new(linter, lint_service_options);

Self { service }
}
Expand Down
8 changes: 2 additions & 6 deletions crates/oxc_linter/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,8 @@ pub struct LintService {
}

impl LintService {
pub fn new(
linter: Linter,
allocator_pool: oxc_allocator::AllocatorPool,
options: LintServiceOptions,
) -> Self {
let runtime = Runtime::new(linter, allocator_pool, options);
pub fn new(linter: Linter, options: LintServiceOptions) -> Self {
let runtime = Runtime::new(linter, options);
Self { runtime }
}

Expand Down
10 changes: 5 additions & 5 deletions crates/oxc_linter/src/service/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,14 @@ mod message_cloner {
use message_cloner::MessageCloner;

impl Runtime {
pub(super) fn new(
linter: Linter,
allocator_pool: AllocatorPool,
options: LintServiceOptions,
) -> Self {
pub(super) fn new(linter: Linter, options: LintServiceOptions) -> Self {
let thread_count = rayon::current_num_threads();
let allocator_pool = AllocatorPool::new(thread_count);

let resolver = options.cross_module.then(|| {
Self::get_resolver(options.tsconfig.or_else(|| Some(options.cwd.join("tsconfig.json"))))
});

Self {
allocator_pool,
cwd: options.cwd,
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_linter/src/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use rustc_hash::FxHashMap;
use serde::Deserialize;
use serde_json::{Value, json};

use oxc_allocator::{Allocator, AllocatorPool};
use oxc_allocator::Allocator;
use oxc_diagnostics::{GraphicalReportHandler, GraphicalTheme, NamedSource};

use crate::{
Expand Down Expand Up @@ -545,7 +545,7 @@ impl Tester {
let cwd = self.current_working_directory.clone();
let paths = vec![Arc::<OsStr>::from(path_to_lint.as_os_str())];
let options = LintServiceOptions::new(cwd).with_cross_module(self.plugins.has_import());
let mut lint_service = LintService::new(linter, AllocatorPool::default(), options);
let mut lint_service = LintService::new(linter, options);
lint_service
.with_file_system(Box::new(TesterFileSystem::new(
path_to_lint,
Expand Down
Loading