refactor(oxfmt,oxlint): replace OXC_VERSION with env!("CARGO_PKG_VERSION") (#17458)

I didn't know this env variable existed when I built the first version
of the CLI :-)
This commit is contained in:
Boshen committed 2025-12-29 12:10:42 +00:00
1 parent 797c4bb56b
commit 6766974dd3
4 files changed
+2 -11

No files matched your search

-2
View File
@@ -86,7 +86,6 @@ jobs:
name: Build Oxlint ${{ matrix.code-target }}
runs-on: ${{ matrix.os }}
env:
OXC_VERSION: ${{ needs.check.outputs.oxlint_version }} # Required for `--version` to work.
TARGET_CC: clang # for mimalloc
defaults:
run:
@@ -253,7 +252,6 @@ jobs:
name: Build Oxfmt ${{ matrix.code-target }}
runs-on: ${{ matrix.os }}
env:
OXC_VERSION: ${{ needs.check.outputs.oxfmt_version }} # Required for `--version` to work.
TARGET_CC: clang # for mimalloc
defaults:
run:
-1
View File
@@ -2,5 +2,4 @@
passthrough = [
"CI", # for crates/oxc_traverse/build.rs
"JEMALLOC_SYS_WITH_LG_PAGE",
"OXC_VERSION",
]
+1 -4
View File
@@ -4,10 +4,7 @@ use bpaf::{Bpaf, Parser};
#[cfg(feature = "napi")]
use cow_utils::CowUtils;
const VERSION: &str = match option_env!("OXC_VERSION") {
Some(v) => v,
None => "dev",
};
const VERSION: &str = env!("CARGO_PKG_VERSION");
#[expect(clippy::ptr_arg)]
fn validate_paths(paths: &Vec<PathBuf>) -> bool {
+1 -4
View File
@@ -10,10 +10,7 @@ pub use self::{
lint::{LintCommand, OutputOptions, ReportUnusedDirectives, WarningOptions, lint_command},
};
const VERSION: &str = match option_env!("OXC_VERSION") {
Some(v) => v,
None => "dev",
};
const VERSION: &str = env!("CARGO_PKG_VERSION");
/// Miscellaneous
#[derive(Debug, Clone, Bpaf)]