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
11 changes: 11 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"permissions": {
"allow": [
"Bash(find:*)",
"Bash(cargo check:*)",
"Bash(cargo clippy:*)"
],
"deny": [],
"ask": []
}
}
5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,10 @@ unused_peekable = "warn"
too_long_first_doc_paragraph = "warn"
suspicious_operation_groupings = "warn"
redundant_clone = "warn"
zero_sized_map_values = "allow" # FIXME https://github.com/rust-lang/rust-clippy/issues/15429
zero_sized_map_values = "allow" # FIXME https://github.com/rust-lang/rust-clippy/issues/15429 - False positive with serde skip_serializing
# cargo
cargo = { level = "warn", priority = -1 }
multiple_crate_versions = "allow"
cargo_common_metadata = "allow" # FIXME
doc_lazy_continuation = "allow" # FIXME
ignore_without_reason = "allow" # FIXME

[workspace.dependencies]
# publish = true
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_codegen/tests/integration/esbuild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ fn test_function() {
}

#[test]
#[ignore]
#[ignore = "TODO: Comments and parentheses handling not yet implemented"]
fn test_comments_and_parentheses() {
test("(/* foo */ { x() { foo() } }.x());", "/* foo */\n({ x() {\n foo();\n} }).x();\n");
test(
Expand Down Expand Up @@ -829,7 +829,7 @@ fn test_whitespace() {
}

#[test]
#[ignore]
#[ignore = "TODO: Minification functionality not yet implemented"]
fn minify() {
test_minify("0.1", ".1;");
test_minify("1.2", "1.2;");
Expand Down
5 changes: 3 additions & 2 deletions crates/oxc_data_structures/src/code_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,9 @@ impl CodeBuffer {
/// but only advance `len` by the actual number of bytes. This avoids a `memset` function call.
///
/// Take alternative slow path if either:
/// 1. Total characters to print > 32.
/// 2. Less than 32 bytes spare capacity in buffer (needs to grow).
/// 1. Total characters to print > 32.
/// 2. Less than 32 bytes spare capacity in buffer (needs to grow).
///
/// Both of these cases should be rare.
///
/// We write 32 bytes because both tabs and spaces are supported.
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/loader/partial_loader/svelte.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> SveltePartialLoader<'a> {
/// Each *.svelte file can contain at most
/// * one `<script>` block
/// * one `<script context="module">` or `<script module>` block
/// <https://github.com/sveltejs/svelte.dev/blob/ba7ad256f786aa5bc67eac3a58608f3f50b59e91/apps/svelte.dev/content/tutorial/02-advanced-svelte/08-script-module/02-module-exports/index.md>
/// <https://github.com/sveltejs/svelte.dev/blob/ba7ad256f786aa5bc67eac3a58608f3f50b59e91/apps/svelte.dev/content/tutorial/02-advanced-svelte/08-script-module/02-module-exports/index.md>
fn parse_scripts(&self) -> Vec<JavaScriptSource<'a>> {
let mut pointer = 0;
let Some(result1) = self.parse_script(&mut pointer) else {
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/loader/partial_loader/vue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> VuePartialLoader<'a> {
/// Each *.vue file can contain at most
/// * one `<script>` block (excluding `<script setup>`).
/// * one `<script setup>` block (excluding normal `<script>`).
/// <https://vuejs.org/api/sfc-spec.html#script>
/// <https://vuejs.org/api/sfc-spec.html#script>
fn parse_scripts(&self) -> Vec<JavaScriptSource<'a>> {
let mut pointer = 0;
let Some(result1) = self.parse_script(&mut pointer) else {
Expand Down
8 changes: 4 additions & 4 deletions crates/oxc_linter/src/rules/eslint/no_unused_vars/usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,11 @@ impl<'a> Symbol<'_, 'a> {
/// for code like `let a = 0; a`, but bans code like `let a = 0; a++`;
///
/// - We encounter a node proving that the reference is absolutely used by
/// another variable, we return `false` immediately.
/// another variable, we return `false` immediately.
/// - When we encounter an AST node that updates the value of the symbol this
/// reference is for, such as an [`AssignmentExpression`] with the symbol on
/// the LHS or a mutating [`UnaryExpression`], we mark the reference as not
/// being used by others.
/// reference is for, such as an [`AssignmentExpression`] with the symbol on
/// the LHS or a mutating [`UnaryExpression`], we mark the reference as not
/// being used by others.
/// - When we encounter a node where we are sure the value produced by an
/// expression will no longer be used, such as an [`ExpressionStatement`],
/// we end our search. This is because expression statements produce a
Expand Down
36 changes: 18 additions & 18 deletions crates/oxc_minifier/src/peephole/minimize_conditions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ mod test {

/** Try to minimize assignments */
#[test]
#[ignore]
#[ignore = "TODO: Assignment folding optimization not yet implemented"]
fn test_fold_assignments() {
test("function f(){if(x)y=3;else y=4;}", "function f(){y=x?3:4}");
test("function f(){if(x)y=1+a;else y=2+a;}", "function f(){y=x?1+a:2+a}");
Expand All @@ -436,7 +436,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: Duplicate statement removal not yet implemented"]
fn test_remove_duplicate_statements() {
test("if (a) { x = 1; x++ } else { x = 2; x++ }", "x=(a) ? 1 : 2; x++");
test(
Expand Down Expand Up @@ -505,7 +505,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: Parentheses counting optimization not yet implemented"]
fn test_and_parentheses_count() {
test("function f(){if(x||y)a.foo()}", "function f(){(x||y)&&a.foo()}");
test("function f(){if(x.a)x.a=0}", "function f(){x.a&&(x.a=0)}");
Expand Down Expand Up @@ -567,47 +567,47 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: De Morgan's law optimization not yet implemented"]
fn test_minimize_demorgan_remove_leading_not() {
test("if(!(!a||!b)&&c) foo()", "((a&&b)&&c)&&foo()");
test("if(!(x&&y)) foo()", "x&&y||foo()");
test("if(!(x||y)) foo()", "(x||y)||foo()");
}

#[test]
#[ignore]
#[ignore = "TODO: De Morgan's law optimization not yet implemented"]
fn test_minimize_demorgan1() {
test("if(!a&&!b)foo()", "(a||b)||foo()");
}

#[test]
#[ignore]
#[ignore = "TODO: De Morgan's law optimization not yet implemented"]
fn test_minimize_demorgan2() {
// Make sure trees with cloned functions are marked as changed
test("(!(a&&!((function(){})())))||foo()", "!a||(function(){})()||foo()");
}

#[test]
#[ignore]
#[ignore = "TODO: De Morgan's law optimization not yet implemented"]
fn test_minimize_demorgan2b() {
// Make sure unchanged trees with functions are not marked as changed
test_same("!a||(function(){})()||foo()");
}

#[test]
#[ignore]
#[ignore = "TODO: De Morgan's law optimization not yet implemented"]
fn test_minimize_demorgan3() {
test("if((!a||!b)&&(c||d)) foo()", "(a&&b||!c&&!d)||foo()");
}

#[test]
#[ignore]
#[ignore = "TODO: De Morgan's law optimization not yet implemented"]
fn test_minimize_demorgan5() {
test("if((!a||!b)&&c) foo()", "(a&&b||!c)||foo()");
}

#[test]
#[ignore]
#[ignore = "TODO: De Morgan's law optimization not yet implemented"]
fn test_minimize_demorgan11() {
test(
"if (x && (y===2 || !f()) && (y===3 || !h())) foo()",
Expand All @@ -616,7 +616,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: De Morgan's law optimization not yet implemented"]
fn test_minimize_demorgan20a() {
test(
"if (0===c && (2===a || 1===a)) f(); else g()",
Expand All @@ -625,7 +625,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: De Morgan's law optimization not yet implemented"]
fn test_minimize_demorgan20b() {
test("if (0!==c || 2!==a && 1!==a) g(); else f()", "(0!==c || 2!==a && 1!==a) ? g() : f()");
}
Expand Down Expand Up @@ -676,7 +676,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: Expression result minimization not yet implemented"]
fn test_minimize_expr_result() {
test("!x||!y", "x&&y");
test("if(!(x&&!y)) foo()", "(!x||y)&&foo()");
Expand All @@ -685,13 +685,13 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: De Morgan's law optimization not yet implemented"]
fn test_minimize_demorgan21() {
test("if (0===c && (2===a || 1===a)) f()", "(0!==c || 2!==a && 1!==a) || f()");
}

#[test]
#[ignore]
#[ignore = "TODO: AND/OR minimization not yet implemented"]
fn test_minimize_and_or1() {
test("if ((!a || !b) && (d || e)) f()", "(a&&b || !d&&!e) || f()");
}
Expand Down Expand Up @@ -741,7 +741,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: Conditional variable declaration folding not yet implemented"]
fn test_fold_conditional_var_declaration() {
test("if(x) var y=1;else y=2", "var y=x?1:2");
test("if(x) y=1;else var y=2", "var y=x?1:2");
Expand All @@ -764,7 +764,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: Return statement substitution not yet implemented"]
fn test_substitute_return() {
test("function f() { while(x) { return }}", "function f() { while(x) { break }}");

Expand Down Expand Up @@ -861,7 +861,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: Break/throw substitution not yet implemented"]
fn test_substitute_break_for_throw() {
test_same("function f() { while(x) { throw Error }}");

Expand Down
20 changes: 10 additions & 10 deletions crates/oxc_minifier/src/peephole/replace_known_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,20 +666,20 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: Array.join optimization with sparse arrays not yet implemented"]
fn test_string_join_add_sparse() {
test("x = [,,'a'].join(',')", "x = ',,a'");
}

#[test]
#[ignore]
#[ignore = "TODO: Array.join optimization edge cases not yet implemented"]
fn test_no_string_join() {
test_same("x = [].join(',',2)");
test_same("x = [].join(f)");
}

#[test]
#[ignore]
#[ignore = "TODO: Array.join to string concatenation optimization not yet implemented"]
fn test_string_join_add() {
test("x = ['a', 'b', 'c'].join('')", "x = \"abc\"");
test("x = [].join(',')", "x = \"\"");
Expand Down Expand Up @@ -739,7 +739,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: Array.join single element optimization not yet implemented"]
fn test_string_join_add_b1992789() {
test("x = ['a'].join('')", "x = \"a\"");
test_same("x = [foo()].join('')");
Expand Down Expand Up @@ -890,7 +890,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: String.split optimization not yet implemented"]
fn test_fold_string_split() {
// late = false;
test("x = 'abcde'.split('foo')", "x = ['abcde']");
Expand Down Expand Up @@ -928,7 +928,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: Array.join edge case optimization not yet implemented"]
fn test_join_bug() {
test("var x = [].join();", "var x = '';");
test_same("var x = [x].join();");
Expand All @@ -948,7 +948,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: Array.join with spread syntax optimization not yet implemented"]
fn test_join_spread1() {
test_same("var x = [...foo].join('');");
test_same("var x = [...someMap.keys()].join('');");
Expand All @@ -960,7 +960,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: Array.join with spread syntax optimization not yet implemented"]
fn test_join_spread2() {
test("var x = [...foo].join(',');", "var x = [...foo].join();");
test("var x = [...someMap.keys()].join(',');", "var x = [...someMap.keys()].join();");
Expand Down Expand Up @@ -1219,7 +1219,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: Math.pow optimization not yet implemented"]
fn test_fold_math_functions_pow() {
test("Math.pow(1, 2)", "1");
test("Math.pow(2, 0)", "1");
Expand Down Expand Up @@ -1346,7 +1346,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: String charAt replacement optimization not yet implemented"]
fn test_replace_with_char_at() {
// enableTypeCheck();
// replaceTypesWithColors();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,7 @@ mod test {
}

#[test]
#[ignore]
#[ignore = "TODO: Function.bind to Function.call optimization not yet implemented"]
fn test_bind_to_call() {
test("((function(){}).bind())()", "((function(){}))()");
test("((function(){}).bind(a))()", "((function(){})).call(a)");
Expand Down
Loading
Loading