diff --git a/apps/oxlint/src/lib.rs b/apps/oxlint/src/lib.rs index c021b856c6772..1599d660ab50a 100644 --- a/apps/oxlint/src/lib.rs +++ b/apps/oxlint/src/lib.rs @@ -1,3 +1,10 @@ +use std::{ffi::OsStr, io::BufWriter}; + +pub use oxc_linter::{ + ExternalLinter, ExternalLinterLintFileCb, ExternalLinterLoadPluginCb, LintFileResult, + PluginLoadResult, +}; + mod command; mod lint; mod output_formatter; @@ -9,10 +16,7 @@ pub mod cli { pub use crate::{command::*, lint::LintRunner, result::CliRunResult}; } -pub use oxc_linter::{ - ExternalLinter, ExternalLinterLintFileCb, ExternalLinterLoadPluginCb, LintFileResult, - PluginLoadResult, -}; +use cli::{CliRunResult, LintRunner}; #[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))] mod raw_fs; @@ -21,9 +25,6 @@ mod raw_fs; #[global_allocator] static GLOBAL: mimalloc_safe::MiMalloc = mimalloc_safe::MiMalloc; -use cli::{CliRunResult, LintRunner}; -use std::{ffi::OsStr, io::BufWriter}; - pub fn lint(external_linter: Option) -> CliRunResult { init_tracing(); init_miette(); diff --git a/apps/oxlint/src/output_formatter/gitlab.rs b/apps/oxlint/src/output_formatter/gitlab.rs index 8914989333e9d..83d494b0da1fe 100644 --- a/apps/oxlint/src/output_formatter/gitlab.rs +++ b/apps/oxlint/src/output_formatter/gitlab.rs @@ -1,10 +1,10 @@ +use std::hash::{DefaultHasher, Hash, Hasher}; + use oxc_diagnostics::{ Error, Severity, reporter::{DiagnosticReporter, DiagnosticResult, Info}, }; -use std::hash::{DefaultHasher, Hash, Hasher}; - use crate::output_formatter::InternalFormatter; #[derive(Debug, Default)] diff --git a/apps/oxlint/src/tester.rs b/apps/oxlint/src/tester.rs index cbaa2a9cccafa..480f4907f35c3 100644 --- a/apps/oxlint/src/tester.rs +++ b/apps/oxlint/src/tester.rs @@ -1,11 +1,14 @@ #[cfg(test)] -use crate::cli::{LintRunner, lint_command}; +use std::{env, path::PathBuf}; + #[cfg(test)] use cow_utils::CowUtils; #[cfg(test)] use lazy_regex::Regex; + #[cfg(test)] -use std::{env, path::PathBuf}; +use crate::cli::{LintRunner, lint_command}; + #[cfg(test)] pub struct Tester { cwd: PathBuf, diff --git a/crates/oxc_codegen/src/comment.rs b/crates/oxc_codegen/src/comment.rs index 35d6f49efdf97..16735868f5fb9 100644 --- a/crates/oxc_codegen/src/comment.rs +++ b/crates/oxc_codegen/src/comment.rs @@ -1,6 +1,7 @@ -use rustc_hash::{FxHashMap, FxHashSet}; use std::borrow::Cow; +use rustc_hash::{FxHashMap, FxHashSet}; + use oxc_ast::{Comment, CommentKind, ast::Program}; use oxc_syntax::identifier::is_line_terminator; diff --git a/crates/oxc_formatter/src/utils/member_chain/groups.rs b/crates/oxc_formatter/src/utils/member_chain/groups.rs index d204e1dd0b95b..4450ce8fcb93d 100644 --- a/crates/oxc_formatter/src/utils/member_chain/groups.rs +++ b/crates/oxc_formatter/src/utils/member_chain/groups.rs @@ -1,3 +1,7 @@ +use std::cell::RefCell; + +use oxc_span::{GetSpan, Span}; + use super::chain_member::ChainMember; use crate::{ formatter::{Format, FormatResult, Formatter, prelude::*}, @@ -5,8 +9,6 @@ use crate::{ parentheses::NeedsParentheses, write, }; -use oxc_span::{GetSpan, Span}; -use std::cell::RefCell; #[derive(Default)] pub(super) struct MemberChainGroupsBuilder<'a, 'b> { diff --git a/crates/oxc_language_server/src/main.rs b/crates/oxc_language_server/src/main.rs index 093fe331eb6b7..8cb4e2c212973 100644 --- a/crates/oxc_language_server/src/main.rs +++ b/crates/oxc_language_server/src/main.rs @@ -1,9 +1,9 @@ +use std::{str::FromStr, sync::Arc}; + use futures::future::join_all; use log::{debug, info, warn}; -use options::{Options, Run, WorkspaceOption}; use rustc_hash::FxBuildHasher; use serde_json::json; -use std::{str::FromStr, sync::Arc}; use tokio::sync::{OnceCell, RwLock, SetError}; use tower_lsp_server::{ Client, LanguageServer, LspService, Server, @@ -17,11 +17,6 @@ use tower_lsp_server::{ ServerInfo, Unregistration, Uri, WorkspaceEdit, }, }; -// # -use capabilities::Capabilities; -use code_actions::CODE_ACTION_KIND_SOURCE_FIX_ALL_OXC; -use commands::{FIX_ALL_COMMAND_ID, FixAllCommandArgs}; -use worker::WorkspaceWorker; mod capabilities; mod code_actions; @@ -32,6 +27,12 @@ mod options; mod tester; mod worker; +use capabilities::Capabilities; +use code_actions::CODE_ACTION_KIND_SOURCE_FIX_ALL_OXC; +use commands::{FIX_ALL_COMMAND_ID, FixAllCommandArgs}; +use options::{Options, Run, WorkspaceOption}; +use worker::WorkspaceWorker; + type ConcurrentHashMap = papaya::HashMap; const OXC_CONFIG_FILE: &str = ".oxlintrc.json"; diff --git a/crates/oxc_linter/src/rules/import/no_absolute_path.rs b/crates/oxc_linter/src/rules/import/no_absolute_path.rs index 1691c2c379a8f..5579ec56f86a2 100644 --- a/crates/oxc_linter/src/rules/import/no_absolute_path.rs +++ b/crates/oxc_linter/src/rules/import/no_absolute_path.rs @@ -1,3 +1,7 @@ +use std::path::Path; + +use serde_json::Value; + use oxc_ast::{ AstKind, ast::{Argument, Expression}, @@ -5,8 +9,6 @@ use oxc_ast::{ use oxc_diagnostics::OxcDiagnostic; use oxc_macros::declare_oxc_lint; use oxc_span::{GetSpan, Span}; -use serde_json::Value; -use std::path::Path; use crate::{AstNode, context::LintContext, rule::Rule}; diff --git a/crates/oxc_linter/src/rules/react/jsx_filename_extension.rs b/crates/oxc_linter/src/rules/react/jsx_filename_extension.rs index 9ed439dff9384..1b75fea329a3f 100644 --- a/crates/oxc_linter/src/rules/react/jsx_filename_extension.rs +++ b/crates/oxc_linter/src/rules/react/jsx_filename_extension.rs @@ -1,9 +1,11 @@ +use std::ffi::OsStr; + +use serde_json::Value; + use oxc_ast::AstKind; use oxc_diagnostics::OxcDiagnostic; use oxc_macros::declare_oxc_lint; use oxc_span::{CompactStr, GetSpan, Span}; -use serde_json::Value; -use std::ffi::OsStr; use crate::{context::LintContext, rule::Rule}; diff --git a/crates/oxc_minifier/src/peephole/replace_known_methods.rs b/crates/oxc_minifier/src/peephole/replace_known_methods.rs index 84095b1946323..2d4602b5c8c0a 100644 --- a/crates/oxc_minifier/src/peephole/replace_known_methods.rs +++ b/crates/oxc_minifier/src/peephole/replace_known_methods.rs @@ -1,6 +1,7 @@ -use cow_utils::CowUtils; use std::borrow::Cow; +use cow_utils::CowUtils; + use oxc_allocator::TakeIn; use oxc_ast::ast::*; use oxc_ecmascript::{ diff --git a/crates/oxc_transformer/src/options/es_features.rs b/crates/oxc_transformer/src/options/es_features.rs index c8b1afde7748b..b731bdfb96aa6 100644 --- a/crates/oxc_transformer/src/options/es_features.rs +++ b/crates/oxc_transformer/src/options/es_features.rs @@ -1,9 +1,13 @@ // Auto generated by `tasks/compat_data/src/lib.rs`. #![allow(clippy::enum_glob_use, clippy::match_same_arms)] -use super::{Engine, EngineTargets}; + +use std::sync::OnceLock; + use browserslist::Version; use rustc_hash::FxHashMap; -use std::sync::OnceLock; + +use super::{Engine, EngineTargets}; + #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] pub enum ESFeature { ES5MemberExpressionLiterals, diff --git a/crates/oxc_transformer/src/typescript/enum.rs b/crates/oxc_transformer/src/typescript/enum.rs index b512830208748..4135263b26a5a 100644 --- a/crates/oxc_transformer/src/typescript/enum.rs +++ b/crates/oxc_transformer/src/typescript/enum.rs @@ -1,6 +1,7 @@ -use rustc_hash::FxHashMap; use std::cell::Cell; +use rustc_hash::FxHashMap; + use oxc_allocator::{StringBuilder, TakeIn, Vec as ArenaVec}; use oxc_ast::{NONE, ast::*}; use oxc_ast_visit::{VisitMut, walk_mut};