mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
chore: Rust v1.77.0 (#2781)
This commit is contained in:
parent
2c0a7d6c23
commit
ef1108a749
16 changed files with 90 additions and 99 deletions
|
|
@ -43,7 +43,7 @@ oxc_span = { workspace = true }
|
||||||
|
|
||||||
ignore = { workspace = true, features = ["simd-accel"] }
|
ignore = { workspace = true, features = ["simd-accel"] }
|
||||||
miette = { workspace = true }
|
miette = { workspace = true }
|
||||||
tempfile = {workspace=true}
|
tempfile = { workspace = true }
|
||||||
rayon = { workspace = true }
|
rayon = { workspace = true }
|
||||||
bpaf = { workspace = true, features = ["derive", "autocomplete", "bright-color"] }
|
bpaf = { workspace = true, features = ["derive", "autocomplete", "bright-color"] }
|
||||||
tracing-subscriber = { workspace = true, features = ["env-filter"] }
|
tracing-subscriber = { workspace = true, features = ["env-filter"] }
|
||||||
|
|
|
||||||
|
|
@ -126,8 +126,14 @@ fn default_true() -> bool {
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
enum TagNamePreference {
|
enum TagNamePreference {
|
||||||
TagNameOnly(String),
|
TagNameOnly(String),
|
||||||
ObjectWithMessageAndReplacement { message: String, replacement: String },
|
ObjectWithMessageAndReplacement {
|
||||||
ObjectWithMessage { message: String },
|
message: String,
|
||||||
|
replacement: String,
|
||||||
|
},
|
||||||
|
ObjectWithMessage {
|
||||||
|
message: String,
|
||||||
|
},
|
||||||
|
#[allow(dead_code)]
|
||||||
FalseOnly(bool), // Should care `true`...?
|
FalseOnly(bool), // Should care `true`...?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -206,9 +206,7 @@ pub fn get_array_method_name<'a>(
|
||||||
}
|
}
|
||||||
|
|
||||||
// "methods",
|
// "methods",
|
||||||
let Some(method) = callee.static_property_name() else {
|
let method = callee.static_property_name()?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
if let Some(&array_method) = TARGET_METHODS.get_key(method) {
|
if let Some(&array_method) = TARGET_METHODS.get_key(method) {
|
||||||
// Check that current node is parent's first argument
|
// Check that current node is parent's first argument
|
||||||
if call.arguments.len() == 1 && is_nth_argument(call, current_node_arg, 0) {
|
if call.arguments.len() == 1 && is_nth_argument(call, current_node_arg, 0) {
|
||||||
|
|
|
||||||
|
|
@ -121,9 +121,7 @@ fn filter_and_process_jest_result<'a>(
|
||||||
possible_jest_node: &PossibleJestNode<'a, '_>,
|
possible_jest_node: &PossibleJestNode<'a, '_>,
|
||||||
ctx: &LintContext<'a>,
|
ctx: &LintContext<'a>,
|
||||||
) -> Option<(Span, &'a Atom<'a>, JestFnKind, AstNodeId)> {
|
) -> Option<(Span, &'a Atom<'a>, JestFnKind, AstNodeId)> {
|
||||||
let Some(result) = parse_general_jest_fn_call(call_expr, possible_jest_node, ctx) else {
|
let result = parse_general_jest_fn_call(call_expr, possible_jest_node, ctx)?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
let kind = result.kind;
|
let kind = result.kind;
|
||||||
// we only need check `describe` or `test` block
|
// we only need check `describe` or `test` block
|
||||||
if !matches!(kind, JestFnKind::General(JestGeneralFnKind::Describe | JestGeneralFnKind::Test)) {
|
if !matches!(kind, JestFnKind::General(JestGeneralFnKind::Describe | JestGeneralFnKind::Test)) {
|
||||||
|
|
@ -134,9 +132,7 @@ fn filter_and_process_jest_result<'a>(
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(parent_id) = get_closest_block(possible_jest_node.node, ctx) else {
|
let parent_id = get_closest_block(possible_jest_node.node, ctx)?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
|
|
||||||
match call_expr.arguments.first() {
|
match call_expr.arguments.first() {
|
||||||
Some(Argument::Expression(Expression::StringLiteral(string_lit))) => {
|
Some(Argument::Expression(Expression::StringLiteral(string_lit))) => {
|
||||||
|
|
|
||||||
|
|
@ -134,9 +134,7 @@ fn get_jasmine_property_name<'a>(member_expr: &'a MemberExpression<'a>) -> Optio
|
||||||
if !is_jasmine_object {
|
if !is_jasmine_object {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let Some((span, property_name)) = member_expr.static_property_info() else {
|
let (span, property_name) = member_expr.static_property_info()?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
Some((span, property_name))
|
Some((span, property_name))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,9 +85,7 @@ fn is_in_array_or_iter<'a, 'b>(
|
||||||
let mut is_explicit_return = false;
|
let mut is_explicit_return = false;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let Some(parent) = ctx.nodes().parent_node(node.id()) else {
|
let parent = ctx.nodes().parent_node(node.id())?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
|
|
||||||
match parent.kind() {
|
match parent.kind() {
|
||||||
AstKind::ArrowFunctionExpression(arrow_expr) => {
|
AstKind::ArrowFunctionExpression(arrow_expr) => {
|
||||||
|
|
@ -99,9 +97,7 @@ fn is_in_array_or_iter<'a, 'b>(
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(parent) = ctx.nodes().parent_node(parent.id()) else {
|
let parent = ctx.nodes().parent_node(parent.id())?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
|
|
||||||
if let AstKind::ObjectProperty(_) = parent.kind() {
|
if let AstKind::ObjectProperty(_) = parent.kind() {
|
||||||
return None;
|
return None;
|
||||||
|
|
@ -112,9 +108,7 @@ fn is_in_array_or_iter<'a, 'b>(
|
||||||
is_outside_containing_function = true;
|
is_outside_containing_function = true;
|
||||||
}
|
}
|
||||||
AstKind::Function(_) => {
|
AstKind::Function(_) => {
|
||||||
let Some(parent) = ctx.nodes().parent_node(parent.id()) else {
|
let parent = ctx.nodes().parent_node(parent.id())?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
|
|
||||||
if let AstKind::ObjectProperty(_) = parent.kind() {
|
if let AstKind::ObjectProperty(_) = parent.kind() {
|
||||||
return None;
|
return None;
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,9 @@ fn main() {
|
||||||
let ast = ast_rx.recv().unwrap();
|
let ast = ast_rx.recv().unwrap();
|
||||||
let index = ast.borrow_index();
|
let index = ast.borrow_index();
|
||||||
println!("received ast({index}) in {:?} at {}", thread::current().id(), timestamp());
|
println!("received ast({index}) in {:?} at {}", thread::current().id(), timestamp());
|
||||||
|
ast.with_ast(|bumpalo_program| {
|
||||||
|
println!("AST span: {:?}", bumpalo_program.0.span);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,9 @@ pub(super) fn print_variable_declarator<'a>(
|
||||||
pub(super) enum AssignmentLikeNode<'a, 'b> {
|
pub(super) enum AssignmentLikeNode<'a, 'b> {
|
||||||
AssignmentExpression(&'b AssignmentExpression<'a>),
|
AssignmentExpression(&'b AssignmentExpression<'a>),
|
||||||
VariableDeclarator(&'b VariableDeclarator<'a>),
|
VariableDeclarator(&'b VariableDeclarator<'a>),
|
||||||
|
#[allow(dead_code)]
|
||||||
PropertyDefinition(&'b PropertyDefinition<'a>),
|
PropertyDefinition(&'b PropertyDefinition<'a>),
|
||||||
|
#[allow(dead_code)]
|
||||||
AccessorProperty(&'b AccessorProperty<'a>),
|
AccessorProperty(&'b AccessorProperty<'a>),
|
||||||
ObjectProperty(&'b ObjectProperty<'a>),
|
ObjectProperty(&'b ObjectProperty<'a>),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,7 @@ impl<'a> JSDocFinder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_one_by_node<'b>(&'b self, node: &AstNode<'a>) -> Option<JSDoc<'a>> {
|
pub fn get_one_by_node<'b>(&'b self, node: &AstNode<'a>) -> Option<JSDoc<'a>> {
|
||||||
let Some(jsdocs) = self.get_all_by_node(node) else {
|
let jsdocs = self.get_all_by_node(node)?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
|
|
||||||
// If flagged, at least 1 JSDoc is attached
|
// If flagged, at least 1 JSDoc is attached
|
||||||
// If multiple JSDocs are attached, return the last = nearest
|
// If multiple JSDocs are attached, return the last = nearest
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
pub fn trim_multiline_comment(s: &str) -> String {
|
pub fn trim_multiline_comment(s: &str) -> String {
|
||||||
s.trim()
|
s.trim()
|
||||||
.split('\n')
|
.lines()
|
||||||
.map(|line| line.trim().trim_start_matches('*').trim())
|
.map(|line| line.trim().trim_start_matches('*').trim())
|
||||||
.filter(|line| !line.is_empty())
|
.filter(|line| !line.is_empty())
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
|
|
|
||||||
|
|
@ -270,14 +270,10 @@ impl<'a> TypeScript<'a> {
|
||||||
fn has_value_references(&self, name: &Atom) -> bool {
|
fn has_value_references(&self, name: &Atom) -> bool {
|
||||||
let root_scope_id = self.ctx.scopes().root_scope_id();
|
let root_scope_id = self.ctx.scopes().root_scope_id();
|
||||||
|
|
||||||
self.ctx
|
self.ctx.scopes().get_binding(root_scope_id, name).is_some_and(|symbol_id| {
|
||||||
.scopes()
|
|
||||||
.get_binding(root_scope_id, name)
|
|
||||||
.map(|symbol_id| {
|
|
||||||
self.ctx.symbols().get_flag(symbol_id).is_export()
|
self.ctx.symbols().get_flag(symbol_id).is_export()
|
||||||
|| self.ctx.symbols().get_resolved_references(symbol_id).any(|x| !x.is_type())
|
|| self.ctx.symbols().get_resolved_references(symbol_id).any(|x| !x.is_type())
|
||||||
})
|
})
|
||||||
.unwrap_or_default()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
justfile
2
justfile
|
|
@ -17,7 +17,7 @@ init:
|
||||||
ready:
|
ready:
|
||||||
git diff --exit-code --quiet
|
git diff --exit-code --quiet
|
||||||
typos
|
typos
|
||||||
cargo fmt
|
just fmt
|
||||||
just check
|
just check
|
||||||
just test
|
just test
|
||||||
just lint
|
just lint
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.76.0"
|
channel = "1.77.0"
|
||||||
profile = "default"
|
profile = "default"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue