Skip to content

Commit 9a8fcd1

Browse files
committed
Fix lint
1 parent 57b865a commit 9a8fcd1

File tree

2 files changed

+38
-44
lines changed

2 files changed

+38
-44
lines changed

libs/extractor/src/css_utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ mod tests {
578578
#[case("`background-color: ${()=>\"arrow dynamic\"};color: blue;`", vec![("background-color", "(()=>\"arrow dynamic\")(rest)", None), ("color", "blue", None)])]
579579
#[case("`color: blue;background-color: ${()=>\"arrow dynamic\"};`", vec![("color", "blue", None),("background-color", "(()=>\"arrow dynamic\")(rest)", None)])]
580580
#[case("`background-color: ${function(){ return \"arrow dynamic\"}}`", vec![("background-color", "(function(){ return \"arrow dynamic\"})(rest)", None)])]
581+
#[case("`background-color: ${function () { return \"arrow dynamic\"} }`", vec![("background-color", "(function(){ return \"arrow dynamic\"})(rest)", None)])]
581582
#[case("`background-color: ${object.color}`", vec![("background-color", "object.color", None)])]
582583
#[case("`background-color: ${object['color']}`", vec![("background-color", "object['color']", None)])]
583584
#[case("`background-color: ${func()}`", vec![("background-color", "func()", None)])]

libs/extractor/src/extractor/extract_style_from_styled.rs

Lines changed: 37 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,14 @@ fn create_styled_component<'a>(
196196
SPAN,
197197
FormalParameterKind::ArrowFormalParameters,
198198
oxc_allocator::Vec::from_iter_in(
199-
vec![
200-
ast_builder.formal_parameter(
201-
SPAN,
202-
oxc_allocator::Vec::from_iter_in(vec![], ast_builder.allocator),
203-
ast_builder.binding_pattern(
204-
ast_builder.binding_pattern_kind_object_pattern(
205-
SPAN,
206-
oxc_allocator::Vec::from_iter_in(
207-
vec![
199+
vec![ast_builder.formal_parameter(
200+
SPAN,
201+
oxc_allocator::Vec::from_iter_in(vec![], ast_builder.allocator),
202+
ast_builder.binding_pattern(
203+
ast_builder.binding_pattern_kind_object_pattern(
204+
SPAN,
205+
oxc_allocator::Vec::from_iter_in(
206+
vec![
208207
ast_builder.binding_property(
209208
SPAN,
210209
ast_builder.property_key_static_identifier(SPAN, "style"),
@@ -242,28 +241,27 @@ fn create_styled_component<'a>(
242241
false,
243242
),
244243
],
245-
ast_builder.allocator,
246-
),
247-
Some(ast_builder.binding_rest_element(
248-
SPAN,
249-
ast_builder.binding_pattern(
250-
ast_builder.binding_pattern_kind_binding_identifier(
251-
SPAN,
252-
ast_builder.atom("rest"),
253-
),
254-
None::<oxc_allocator::Box<oxc_ast::ast::TSTypeAnnotation<'a>>>,
255-
false,
256-
),
257-
)),
244+
ast_builder.allocator,
258245
),
259-
None::<oxc_allocator::Box<oxc_ast::ast::TSTypeAnnotation<'a>>>,
260-
false,
246+
Some(ast_builder.binding_rest_element(
247+
SPAN,
248+
ast_builder.binding_pattern(
249+
ast_builder.binding_pattern_kind_binding_identifier(
250+
SPAN,
251+
ast_builder.atom("rest"),
252+
),
253+
None::<oxc_allocator::Box<oxc_ast::ast::TSTypeAnnotation<'a>>>,
254+
false,
255+
),
256+
)),
261257
),
262-
None,
263-
false,
258+
None::<oxc_allocator::Box<oxc_ast::ast::TSTypeAnnotation<'a>>>,
264259
false,
265260
),
266-
],
261+
None,
262+
false,
263+
false,
264+
)],
267265
ast_builder.allocator,
268266
),
269267
None::<oxc_allocator::Box<oxc_ast::ast::BindingRestElement<'a>>>,
@@ -272,20 +270,16 @@ fn create_styled_component<'a>(
272270
SPAN,
273271
oxc_allocator::Vec::from_iter_in(vec![], ast_builder.allocator),
274272
oxc_allocator::Vec::from_iter_in(
275-
vec![
276-
ast_builder.statement_expression(
273+
vec![ast_builder.statement_expression(
274+
SPAN,
275+
ast_builder.expression_jsx_element(
277276
SPAN,
278-
ast_builder.expression_jsx_element(
277+
ast_builder.alloc_jsx_opening_element(
279278
SPAN,
280-
ast_builder.alloc_jsx_opening_element(
281-
SPAN,
282-
ast_builder
283-
.jsx_element_name_identifier(SPAN, ast_builder.atom(tag_name)),
284-
None::<
285-
oxc_allocator::Box<oxc_ast::ast::TSTypeParameterInstantiation<'a>>,
286-
>,
287-
oxc_allocator::Vec::from_iter_in(
288-
vec![
279+
ast_builder.jsx_element_name_identifier(SPAN, ast_builder.atom(tag_name)),
280+
None::<oxc_allocator::Box<oxc_ast::ast::TSTypeParameterInstantiation<'a>>>,
281+
oxc_allocator::Vec::from_iter_in(
282+
vec![
289283
ast_builder.jsx_attribute_item_spread_attribute(
290284
SPAN,
291285
ast_builder
@@ -364,14 +358,13 @@ fn create_styled_component<'a>(
364358
),
365359
),
366360
],
367-
ast_builder.allocator,
368-
),
361+
ast_builder.allocator,
369362
),
370-
oxc_allocator::Vec::from_iter_in(vec![], ast_builder.allocator),
371-
None::<oxc_allocator::Box<oxc_ast::ast::JSXClosingElement<'a>>>,
372363
),
364+
oxc_allocator::Vec::from_iter_in(vec![], ast_builder.allocator),
365+
None::<oxc_allocator::Box<oxc_ast::ast::JSXClosingElement<'a>>>,
373366
),
374-
],
367+
)],
375368
ast_builder.allocator,
376369
),
377370
);

0 commit comments

Comments
 (0)