Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
camc314 committed Nov 26, 2024
1 parent f8065d9 commit 3ac26f9
Show file tree
Hide file tree
Showing 254 changed files with 739 additions and 267 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -580,5 +580,6 @@ fn test() {
("foo?.filter((function() { return () => { console.log('hello') } })?.())", None),
];

Tester::new(ArrayCallbackReturn::NAME, ArrayCallbackReturn::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(ArrayCallbackReturn::NAME, ArrayCallbackReturn::CATEGORY, pass, fail)
.test_and_snapshot();
}
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/for_direction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,5 +320,7 @@ fn test() {
("for(var ii = 10; ii > 0; ii+=1){}", "for(var ii = 10; ii > 0; ii-=1){}", None),
];

Tester::new(ForDirection::NAME, ForDirection::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(ForDirection::NAME, ForDirection::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/func_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,5 +798,7 @@ fn test() {
),
];

Tester::new(FuncNames::NAME, FuncNames::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(FuncNames::NAME, FuncNames::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/eslint/max_classes_per_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,6 @@ fn test() {
),
];

Tester::new(MaxClassesPerFile::NAME, MaxClassesPerFile::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(MaxClassesPerFile::NAME, MaxClassesPerFile::CATEGORY, pass, fail)
.test_and_snapshot();
}
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_array_constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,6 @@ fn test() {
("Array(0, 1, 2)", None),
];

Tester::new(NoArrayConstructor::NAME, NoArrayConstructor::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoArrayConstructor::NAME, NoArrayConstructor::CATEGORY, pass, fail)
.test_and_snapshot();
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@ fn test() {
("new Promise(((((async () => {})))))", None),
];

Tester::new(NoAsyncPromiseExecutor::NAME, NoAsyncPromiseExecutor::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoAsyncPromiseExecutor::NAME, NoAsyncPromiseExecutor::CATEGORY, pass, fail)
.test_and_snapshot();
}
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_case_declarations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,6 @@ fn test() {
("switch (a) { default: class C {} break; }", None),
];

Tester::new(NoCaseDeclarations::NAME, NoCaseDeclarations::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoCaseDeclarations::NAME, NoCaseDeclarations::CATEGORY, pass, fail)
.test_and_snapshot();
}
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_compare_neg_zero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,7 @@ fn test() {
("-0n <= x", "0n <= x", None),
];

Tester::new(NoCompareNegZero::NAME, NoCompareNegZero::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(NoCompareNegZero::NAME, NoCompareNegZero::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,7 @@ fn test() {
("const x = { foo: console.log(bar) }", "const x = { foo: undefined }", None),
];

Tester::new(NoConsole::NAME, NoConsole::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(NoConsole::NAME, NoConsole::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
Original file line number Diff line number Diff line change
Expand Up @@ -654,5 +654,6 @@ fn test() {
("window.abc ?? 'non-nullish' ?? anything", None),
];

Tester::new(NoConstantBinaryExpression::NAME, NoConstantBinaryExpression::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoConstantBinaryExpression::NAME, NoConstantBinaryExpression::CATEGORY, pass, fail)
.test_and_snapshot();
}
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_constant_condition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,5 +405,6 @@ fn test() {
// ("function* foo() { for (let foo = 1 + 2 + 3 + (yield); true; baz) {}}", None),
];

Tester::new(NoConstantCondition::NAME, NoConstantCondition::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoConstantCondition::NAME, NoConstantCondition::CATEGORY, pass, fail)
.test_and_snapshot();
}
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_constructor_return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,6 @@ fn test() {
"class C { constructor(a) { if (!a) { return '' } else { a() } } }",
];

Tester::new(NoConstructorReturn::NAME, NoConstructorReturn::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoConstructorReturn::NAME, NoConstructorReturn::CATEGORY, pass, fail)
.test_and_snapshot();
}
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_debugger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,7 @@ fn test() {
("if (foo) { debugger }", "if (foo) { }", None),
];

Tester::new(NoDebugger::NAME, NoDebugger::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(NoDebugger::NAME, NoDebugger::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_div_regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,7 @@ fn test() {
None,
)];

Tester::new(NoDivRegex::NAME, NoDivRegex::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(NoDivRegex::NAME, NoDivRegex::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_dupe_class_members.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,6 @@ fn test() {
"class A { foo; foo() {}}",
];

Tester::new(NoDupeClassMembers::NAME, NoDupeClassMembers::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoDupeClassMembers::NAME, NoDupeClassMembers::CATEGORY, pass, fail)
.test_and_snapshot();
}
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_duplicate_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,5 +467,6 @@ fn test() {
),
];

Tester::new(NoDuplicateImports::NAME, NoDuplicateImports::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoDuplicateImports::NAME, NoDuplicateImports::CATEGORY, pass, fail)
.test_and_snapshot();
}
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_else_return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,5 +563,7 @@ fn test() {
("function foo() { if (bar) { if (baz) { return true; } else { let a; } } function a(){} }", "function foo() { if (bar) { if (baz) { return true; } let a; } function a(){} }", None),
("if (foo) { return true; } else { let a; }", "if (foo) { return true; } let a;", None)
];
Tester::new(NoElseReturn::NAME, NoElseReturn::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(NoElseReturn::NAME, NoElseReturn::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,6 @@ fn test() {
("var foo = /[[]&&b]/v;", None), // { "ecmaVersion": 2024 }
];

Tester::new(NoEmptyCharacterClass::NAME, NoEmptyCharacterClass::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoEmptyCharacterClass::NAME, NoEmptyCharacterClass::CATEGORY, pass, fail)
.test_and_snapshot();
}
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_empty_static_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,7 @@ fn test() {
("class Foo { static { bar(); } static {} }", "class Foo { static { bar(); } }"),
];

Tester::new(NoEmptyStaticBlock::NAME, NoEmptyStaticBlock::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(NoEmptyStaticBlock::NAME, NoEmptyStaticBlock::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_extra_boolean_cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,5 +872,6 @@ fn test() {
("if (!Boolean(a as any)) { }", None),
];

Tester::new(NoExtraBooleanCast::NAME, NoExtraBooleanCast::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoExtraBooleanCast::NAME, NoExtraBooleanCast::CATEGORY, pass, fail)
.test_and_snapshot();
}
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_inner_declarations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,6 @@ fn test() {
),
];

Tester::new(NoInnerDeclarations::NAME, NoInnerDeclarations::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoInnerDeclarations::NAME, NoInnerDeclarations::CATEGORY, pass, fail)
.test_and_snapshot();
}
Original file line number Diff line number Diff line change
Expand Up @@ -405,5 +405,6 @@ fn test() {
// (r"<div> </div>;", None),
];

Tester::new(NoIrregularWhitespace::NAME, NoIrregularWhitespace::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoIrregularWhitespace::NAME, NoIrregularWhitespace::CATEGORY, pass, fail)
.test_and_snapshot();
}
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_loss_of_precision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,5 +356,6 @@ fn test() {
("var x = 1e18_446_744_073_709_551_615", None),
];

Tester::new(NoLossOfPrecision::NAME, NoLossOfPrecision::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoLossOfPrecision::NAME, NoLossOfPrecision::CATEGORY, pass, fail)
.test_and_snapshot();
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,6 @@ fn test() {
"function bar() { return function BigInt() {}; } var baz = new BigInt(9007199254740991);",
];

Tester::new(NoNewNativeNonconstructor::NAME, NoNewNativeNonconstructor::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoNewNativeNonconstructor::NAME, NoNewNativeNonconstructor::CATEGORY, pass, fail)
.test_and_snapshot();
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,6 @@ fn test() {
r"'\0\\n\8'",
];

Tester::new(NoNonoctalDecimalEscape::NAME, NoNonoctalDecimalEscape::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoNonoctalDecimalEscape::NAME, NoNonoctalDecimalEscape::CATEGORY, pass, fail)
.test_and_snapshot();
}
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_object_constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,6 @@ fn test() {
}",
];

Tester::new(NoObjectConstructor::NAME, NoObjectConstructor::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoObjectConstructor::NAME, NoObjectConstructor::CATEGORY, pass, fail)
.test_and_snapshot();
}
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_plusplus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,7 @@ fn test() {
),
];

Tester::new(NoPlusplus::NAME, NoPlusplus::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(NoPlusplus::NAME, NoPlusplus::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_prototype_builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,6 @@ fn test() {
"(foo?.[`hasOwnProperty`])('bar')",
];

Tester::new(NoPrototypeBuiltins::NAME, NoPrototypeBuiltins::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoPrototypeBuiltins::NAME, NoPrototypeBuiltins::CATEGORY, pass, fail)
.test_and_snapshot();
}
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_restricted_globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,6 @@ fn test() {
),
];

Tester::new(NoRestrictedGlobals::NAME, NoRestrictedGlobals::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoRestrictedGlobals::NAME, NoRestrictedGlobals::CATEGORY, pass, fail)
.test_and_snapshot();
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,6 @@ fn test() {
("class foo { #undefined(undefined) { } }", None),
];

Tester::new(NoShadowRestrictedNames::NAME, NoShadowRestrictedNames::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoShadowRestrictedNames::NAME, NoShadowRestrictedNames::CATEGORY, pass, fail)
.test_and_snapshot();
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,6 @@ fn test() {
r#"'Hello, ${{foo: "bar"}.foo}'"#,
];

Tester::new(NoTemplateCurlyInString::NAME, NoTemplateCurlyInString::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoTemplateCurlyInString::NAME, NoTemplateCurlyInString::CATEGORY, pass, fail)
.test_and_snapshot();
}
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_this_before_super.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,5 +486,6 @@ fn test() {
),
];

Tester::new(NoThisBeforeSuper::NAME, NoThisBeforeSuper::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoThisBeforeSuper::NAME, NoThisBeforeSuper::CATEGORY, pass, fail)
.test_and_snapshot();
}
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_throw_literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,7 @@ fn test() {
("throw 'error' satisfies Error", "throw new Error('error' satisfies Error)"),
];

Tester::new(NoThrowLiteral::NAME, NoThrowLiteral::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(NoThrowLiteral::NAME, NoThrowLiteral::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
Original file line number Diff line number Diff line change
Expand Up @@ -390,5 +390,7 @@ fn test() {
// TODO: add more fixer tests
let fix = vec![("var a = b\n(x || y).doSomething()", "var a = b\n;(x || y).doSomething()")];

Tester::new(NoUnexpectedMultiline::NAME, NoUnexpectedMultiline::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(NoUnexpectedMultiline::NAME, NoUnexpectedMultiline::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_unsafe_negation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,7 @@ fn test() {
// ("!a <= b", "!(a <= b)"),
];

Tester::new(NoUnsafeNegation::NAME, NoUnsafeNegation::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(NoUnsafeNegation::NAME, NoUnsafeNegation::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
Original file line number Diff line number Diff line change
Expand Up @@ -274,5 +274,6 @@ fn test() {
("(foo ? obj?.foo : obj?.bar).bar", None),
];

Tester::new(NoUnsafeOptionalChaining::NAME, NoUnsafeOptionalChaining::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(NoUnsafeOptionalChaining::NAME, NoUnsafeOptionalChaining::CATEGORY, pass, fail)
.test_and_snapshot();
}
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_unused_labels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,7 @@ fn test() {
),
];

Tester::new(NoUnusedLabels::NAME, NoUnusedLabels::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(NoUnusedLabels::NAME, NoUnusedLabels::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
Original file line number Diff line number Diff line change
Expand Up @@ -445,5 +445,11 @@ fn test() {
}",
];

Tester::new(NoUnusedPrivateClassMembers::NAME, NoUnusedPrivateClassMembers::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(
NoUnusedPrivateClassMembers::NAME,
NoUnusedPrivateClassMembers::CATEGORY,
pass,
fail,
)
.test_and_snapshot();
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ fn fixme() {
), // { "ecmaVersion": 2015 },
];
let fail = vec![];
Tester::new(NoUnusedVars::NAME, NoUnusedVars::CATEGORY, pass, fail).intentionally_allow_no_fix_tests().test();
Tester::new(NoUnusedVars::NAME, NoUnusedVars::CATEGORY, pass, fail)
.intentionally_allow_no_fix_tests()
.test();
}

/// !!!! STOP !!!
Expand Down
12 changes: 9 additions & 3 deletions crates/oxc_linter/src/rules/eslint/no_unused_vars/tests/oxc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ fn test_debug() {
), // { "ecmaVersion": 6 },
];
let fail = vec![];
Tester::new(NoUnusedVars::NAME, NoUnusedVars::CATEGORY, pass, fail).intentionally_allow_no_fix_tests().test();
Tester::new(NoUnusedVars::NAME, NoUnusedVars::CATEGORY, pass, fail)
.intentionally_allow_no_fix_tests()
.test();
}

#[test]
Expand Down Expand Up @@ -858,7 +860,9 @@ fn test_exports() {
let fail = vec!["import { a as b } from 'a'; export { a }"];

// these are mostly pass[] cases, so do not snapshot
Tester::new(NoUnusedVars::NAME, NoUnusedVars::CATEGORY, pass, fail).intentionally_allow_no_fix_tests().test();
Tester::new(NoUnusedVars::NAME, NoUnusedVars::CATEGORY, pass, fail)
.intentionally_allow_no_fix_tests()
.test();
}

#[test]
Expand Down Expand Up @@ -904,7 +908,9 @@ fn test_react() {
",
];

Tester::new(NoUnusedVars::NAME, NoUnusedVars::CATEGORY, pass, fail).intentionally_allow_no_fix_tests().test();
Tester::new(NoUnusedVars::NAME, NoUnusedVars::CATEGORY, pass, fail)
.intentionally_allow_no_fix_tests()
.test();
}

#[test]
Expand Down
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_useless_constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,5 +359,7 @@ class A extends B { foo() { bar(); } }",
),
];

Tester::new(NoUselessConstructor::NAME, NoUselessConstructor::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(NoUselessConstructor::NAME, NoUselessConstructor::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
4 changes: 3 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_useless_escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,5 +670,7 @@ fn test() {
),
];

Tester::new(NoUselessEscape::NAME, NoUselessEscape::CATEGORY, pass, fail).expect_fix(fix).test_and_snapshot();
Tester::new(NoUselessEscape::NAME, NoUselessEscape::CATEGORY, pass, fail)
.expect_fix(fix)
.test_and_snapshot();
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,11 @@ fn test() {
"Math.pow(a, b) as any",
];

Tester::new(PreferExponentiationOperator::NAME, PreferExponentiationOperator::CATEGORY, pass, fail).test_and_snapshot();
Tester::new(
PreferExponentiationOperator::NAME,
PreferExponentiationOperator::CATEGORY,
pass,
fail,
)
.test_and_snapshot();
}
Loading

0 comments on commit 3ac26f9

Please sign in to comment.