mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
refactor(linter): move away from tuples for test cases (#2011)
closes #1956
This commit is contained in:
parent
1886a5b838
commit
b386177af2
125 changed files with 226 additions and 273 deletions
|
|
@ -354,5 +354,5 @@ fn test() {
|
|||
",
|
||||
];
|
||||
|
||||
Tester::new_without_config("no-debugger", pass, fail).test();
|
||||
Tester::new("no-debugger", pass, fail).test();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,5 +117,5 @@ fn test() {
|
|||
r"a.charAt(4) === '\\ukeff'",
|
||||
];
|
||||
|
||||
Tester::new_without_config(BadCharAtComparison::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(BadCharAtComparison::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,5 +134,5 @@ fn test() {
|
|||
r"if (config != []) { }",
|
||||
];
|
||||
|
||||
Tester::new_without_config(BadObjectLiteralComparison::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(BadObjectLiteralComparison::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,5 +155,5 @@ fn test() {
|
|||
",
|
||||
];
|
||||
|
||||
Tester::new_without_config(BadReplaceAllArg::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(BadReplaceAllArg::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,5 +118,5 @@ fn test() {
|
|||
r"switch (foo) { case 1: default: case 2: }",
|
||||
];
|
||||
|
||||
Tester::new_without_config(DefaultCaseLast::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(DefaultCaseLast::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_hex_literals() {
|
||||
Tester::new_without_config(
|
||||
Tester::new(
|
||||
NoControlRegex::NAME,
|
||||
vec![
|
||||
"x1f", // not a control sequence
|
||||
|
|
@ -268,7 +268,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_unicode_literals() {
|
||||
Tester::new_without_config(
|
||||
Tester::new(
|
||||
NoControlRegex::NAME,
|
||||
vec![
|
||||
r"u00", // not a control sequence
|
||||
|
|
@ -300,7 +300,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_unicode_brackets() {
|
||||
Tester::new_without_config(
|
||||
Tester::new(
|
||||
NoControlRegex::NAME,
|
||||
vec![
|
||||
r"let r = /\u{0}/", // no unicode flag, this is valid
|
||||
|
|
@ -322,7 +322,7 @@ mod tests {
|
|||
fn test() {
|
||||
// test cases taken from eslint. See:
|
||||
// https://github.com/eslint/eslint/blob/main/tests/lib/rules/no-control-regex.js
|
||||
Tester::new_without_config(
|
||||
Tester::new(
|
||||
NoControlRegex::NAME,
|
||||
vec![
|
||||
"var regex = /x1f/;",
|
||||
|
|
|
|||
|
|
@ -221,5 +221,5 @@ fn test() {
|
|||
"class A { foo; foo() {}}",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoDupeClassMembers::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoDupeClassMembers::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,5 +72,5 @@ fn test() {
|
|||
"class Foo { static { bar(); } static {} }",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoEmptyStaticBlock::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoEmptyStaticBlock::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,5 +112,5 @@ fn test() {
|
|||
"(foo?.[`hasOwnProperty`])('bar')",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoPrototypeBuiltins::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoPrototypeBuiltins::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -263,5 +263,5 @@ fn test() {
|
|||
"var foo = new RegExp('[[ ] ] ', 'v');",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoRegexSpaces::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoRegexSpaces::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,5 +106,5 @@ fn test() {
|
|||
, , , , , , , , , , , , , , , , , , , 2];",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoSparseArrays::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoSparseArrays::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -445,5 +445,5 @@ fn test() {
|
|||
}",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoUnusedPrivateClassMembers::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoUnusedPrivateClassMembers::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,5 +214,5 @@ fn test() {
|
|||
",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoUselessCatch::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoUselessCatch::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -418,7 +418,5 @@ fn test() {
|
|||
("var foo = `\\$\\{{${foo}`;", "var foo = `$\\{{${foo}`;", None),
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoUselessEscape::NAME, pass, fail)
|
||||
.expect_fix(fix)
|
||||
.test_and_snapshot();
|
||||
Tester::new(NoUselessEscape::NAME, pass, fail).expect_fix(fix).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ fn test() {
|
|||
// r#"import Foo from "./typescript-export-as-default-namespace""#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(Default::NAME, pass, fail)
|
||||
Tester::new(Default::NAME, pass, fail)
|
||||
.change_rule_path("index.js")
|
||||
.with_import_plugin(true)
|
||||
.test_and_snapshot();
|
||||
|
|
|
|||
|
|
@ -116,8 +116,6 @@ fn walk_exported_recursive(
|
|||
#[test]
|
||||
fn test() {
|
||||
use crate::tester::Tester;
|
||||
let mut tester =
|
||||
Tester::new_without_config::<String>(Export::NAME, vec![], vec![]).with_import_plugin(true);
|
||||
|
||||
{
|
||||
let pass = vec![
|
||||
|
|
@ -198,7 +196,7 @@ fn test() {
|
|||
}
|
||||
}
|
||||
"),
|
||||
("
|
||||
("
|
||||
export class Foo { }
|
||||
export namespace Foo { }
|
||||
export namespace Foo {
|
||||
|
|
@ -251,7 +249,7 @@ fn test() {
|
|||
// (r#"export * from "./malformed.js""#),
|
||||
(r#"export * from "./default-export""#),
|
||||
(r#"let foo; export { foo as "foo" }; export * from "./export-all""#),
|
||||
("
|
||||
("
|
||||
export type Foo = string;
|
||||
export type Foo = number;
|
||||
"),
|
||||
|
|
@ -269,7 +267,7 @@ fn test() {
|
|||
export default Foo;
|
||||
}
|
||||
"),
|
||||
("
|
||||
("
|
||||
export namespace Foo {
|
||||
export namespace Bar {
|
||||
export const Foo = 1;
|
||||
|
|
@ -278,7 +276,7 @@ fn test() {
|
|||
export namespace Baz {
|
||||
export const Bar = 3;
|
||||
export const Bar = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
"),
|
||||
("
|
||||
|
|
@ -327,15 +325,18 @@ fn test() {
|
|||
"#),
|
||||
];
|
||||
|
||||
tester = tester.change_rule_path("index.js").update_expect_pass_fail(pass, fail);
|
||||
tester.test();
|
||||
Tester::new(Export::NAME, pass, fail)
|
||||
.with_import_plugin(true)
|
||||
.change_rule_path("index.js")
|
||||
.test();
|
||||
}
|
||||
|
||||
{
|
||||
let pass = vec!["export * from './module'"];
|
||||
let fail = vec![];
|
||||
tester =
|
||||
tester.change_rule_path("export-star-4/index.js").update_expect_pass_fail(pass, fail);
|
||||
tester.test_and_snapshot();
|
||||
Tester::new(Export::NAME, pass, fail)
|
||||
.with_import_plugin(true)
|
||||
.change_rule_path("export-star-4/index.js")
|
||||
.test();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ fn test() {
|
|||
"import { FooBar } from './typescript-export-assign-object'",
|
||||
];
|
||||
|
||||
Tester::new_without_config(Named::NAME, pass, fail)
|
||||
Tester::new(Named::NAME, pass, fail)
|
||||
.change_rule_path("index.js")
|
||||
.with_import_plugin(true)
|
||||
.test_and_snapshot();
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ fn test() {
|
|||
r#"require(["a"], function(a) { console.log(a); })"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoAmd::NAME, pass, fail)
|
||||
Tester::new(NoAmd::NAME, pass, fail)
|
||||
.change_rule_path("no-amd.js")
|
||||
.with_import_plugin(true)
|
||||
.test_and_snapshot();
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ fn test() {
|
|||
"import { foo } from './ignore'",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoCycle::NAME, pass, fail)
|
||||
Tester::new(NoCycle::NAME, pass, fail)
|
||||
.change_rule_path("cycles/depth-zero.js")
|
||||
.with_import_plugin(true)
|
||||
.test_and_snapshot();
|
||||
|
|
|
|||
|
|
@ -52,9 +52,6 @@ impl Rule for NoSelfImport {
|
|||
fn test() {
|
||||
use crate::tester::Tester;
|
||||
|
||||
let mut tester = Tester::new_without_config::<String>(NoSelfImport::NAME, vec![], vec![])
|
||||
.with_import_plugin(true);
|
||||
|
||||
{
|
||||
let pass = vec![
|
||||
"import _ from 'lodash'",
|
||||
|
|
@ -80,16 +77,20 @@ fn test() {
|
|||
"var bar = require('./no-self-import.js')",
|
||||
];
|
||||
|
||||
tester = tester.change_rule_path("no-self-import.js").update_expect_pass_fail(pass, fail);
|
||||
tester.test();
|
||||
Tester::new(NoSelfImport::NAME, pass, fail)
|
||||
.with_import_plugin(true)
|
||||
.change_rule_path("no-self-import.js")
|
||||
.test();
|
||||
}
|
||||
|
||||
{
|
||||
let pass = vec!["var bar = require('./bar')"];
|
||||
let fail = vec![];
|
||||
|
||||
tester = tester.change_rule_path("bar/index.js").update_expect_pass_fail(pass, fail);
|
||||
tester.test();
|
||||
Tester::new(NoSelfImport::NAME, pass, fail)
|
||||
.with_import_plugin(true)
|
||||
.change_rule_path("bar/index.js")
|
||||
.test();
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -100,17 +101,19 @@ fn test() {
|
|||
"var bar = require('././././')",
|
||||
];
|
||||
|
||||
tester = tester.change_rule_path("index.js").update_expect_pass_fail(pass, fail);
|
||||
tester.test();
|
||||
Tester::new(NoSelfImport::NAME, pass, fail)
|
||||
.with_import_plugin(true)
|
||||
.change_rule_path("index.js")
|
||||
.test();
|
||||
}
|
||||
|
||||
{
|
||||
let pass = vec![];
|
||||
let fail = vec!["var bar = require('../no-self-import-folder')"];
|
||||
|
||||
tester = tester
|
||||
Tester::new(NoSelfImport::NAME, pass, fail)
|
||||
.with_import_plugin(true)
|
||||
.change_rule_path("no-self-import-folder/index.js")
|
||||
.update_expect_pass_fail(pass, fail);
|
||||
tester.test_and_snapshot();
|
||||
.test();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,5 +71,5 @@ fn test() {
|
|||
r#"<div aria-skldjfaria-klajsd="foobar" />"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(AriaProps::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(AriaProps::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,5 +237,5 @@ fn test() {
|
|||
("<Box asChild='div' role='Button' />", None, None, None),
|
||||
];
|
||||
|
||||
Tester::new_with_settings(AriaRole::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(AriaRole::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,5 +208,5 @@ fn test() {
|
|||
("<Input type='text' autocomplete='baz' />;", None, Some(settings()), None),
|
||||
];
|
||||
|
||||
Tester::new_with_settings(AutocompleteValid::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(AutocompleteValid::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,5 @@ fn test() {
|
|||
("<HTMLTop />", None, Some(settings()), None),
|
||||
];
|
||||
|
||||
Tester::new_with_settings(HtmlHasLang::NAME, pass, fail)
|
||||
.with_jsx_a11y_plugin(true)
|
||||
.test_and_snapshot();
|
||||
Tester::new(HtmlHasLang::NAME, pass, fail).with_jsx_a11y_plugin(true).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,5 +146,5 @@ fn test() {
|
|||
("<Box as='html' lang='foo' />", None, Some(settings()), None),
|
||||
];
|
||||
|
||||
Tester::new_with_settings(Lang::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(Lang::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,5 +260,5 @@ fn test() {
|
|||
(r"<Box as='audio'><Track kind='subtitles' /></Box>", None, Some(settings()), None),
|
||||
];
|
||||
|
||||
Tester::new_with_settings(MediaHasCaption::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(MediaHasCaption::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,5 +83,5 @@ fn test() {
|
|||
r"<div accessKey={`${undefined}${undefined}`} />",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoAccessKey::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoAccessKey::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,5 +128,5 @@ fn test() {
|
|||
r#"<p tabIndex="0" aria-hidden="true">text</p>;"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoAriaHiddenOnFocusable::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoAriaHiddenOnFocusable::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,5 +156,5 @@ fn test() {
|
|||
("<Button autoFocus />", Some(config()), Some(settings()), None),
|
||||
];
|
||||
|
||||
Tester::new_with_settings(NoAutofocus::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoAutofocus::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,5 +106,5 @@ fn test() {
|
|||
(r"<Marquee />", Some(config()), Some(settings()), None),
|
||||
];
|
||||
|
||||
Tester::new_with_settings(NoDistractingElements::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoDistractingElements::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,5 +129,5 @@ fn test() {
|
|||
r#"<other role="checkbox" />"#,
|
||||
r#"<div role="banner" />"#,
|
||||
];
|
||||
Tester::new_without_config(PreferTagOverRole::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(PreferTagOverRole::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,5 +132,5 @@ fn test() {
|
|||
("<MyComponent role='combobox' />", None, Some(settings()), None),
|
||||
];
|
||||
|
||||
Tester::new_with_settings(RoleHasRequiredAriaProps::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(RoleHasRequiredAriaProps::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1597,5 +1597,5 @@ fn test() {
|
|||
(r#"<Link href="/" aria-checked />"#, None, Some(settings()), None),
|
||||
];
|
||||
|
||||
Tester::new_with_settings(RoleSupportAriaProps::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(RoleSupportAriaProps::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,7 +211,5 @@ fn test() {
|
|||
"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(GoogleFontDisplay::NAME, pass, fail)
|
||||
.with_nextjs_plugin(true)
|
||||
.test_and_snapshot();
|
||||
Tester::new(GoogleFontDisplay::NAME, pass, fail).with_nextjs_plugin(true).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ fn test() {
|
|||
"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(GoogleFontPreconnect::NAME, pass, fail)
|
||||
Tester::new(GoogleFontPreconnect::NAME, pass, fail)
|
||||
.with_nextjs_plugin(true)
|
||||
.test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,7 +246,5 @@ fn test() {
|
|||
}",
|
||||
];
|
||||
|
||||
Tester::new_without_config(InlineScriptId::NAME, pass, fail)
|
||||
.with_nextjs_plugin(true)
|
||||
.test_and_snapshot();
|
||||
Tester::new(InlineScriptId::NAME, pass, fail).with_nextjs_plugin(true).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -310,7 +310,5 @@ fn test() {
|
|||
}",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NextScriptForGa::NAME, pass, fail)
|
||||
.with_nextjs_plugin(true)
|
||||
.test_and_snapshot();
|
||||
Tester::new(NextScriptForGa::NAME, pass, fail).with_nextjs_plugin(true).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ fn test() {
|
|||
",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoAssignModuleVariable::NAME, pass, fail)
|
||||
Tester::new(NoAssignModuleVariable::NAME, pass, fail)
|
||||
.with_nextjs_plugin(true)
|
||||
.test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ fn test() {
|
|||
"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoAsyncClientComponent::NAME, pass, fail)
|
||||
Tester::new(NoAsyncClientComponent::NAME, pass, fail)
|
||||
.with_nextjs_plugin(true)
|
||||
.test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,5 @@ fn test() {
|
|||
</div>"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoCssTags::NAME, pass, fail)
|
||||
.with_nextjs_plugin(true)
|
||||
.test_and_snapshot();
|
||||
Tester::new(NoCssTags::NAME, pass, fail).with_nextjs_plugin(true).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,12 +80,12 @@ fn test() {
|
|||
let pass = vec![
|
||||
(
|
||||
r"import Document, { Html, Head, Main, NextScript } from 'next/document'
|
||||
|
||||
|
||||
class MyDocument extends Document {
|
||||
static async getInitialProps(ctx) {
|
||||
//...
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Html>
|
||||
|
|
@ -95,7 +95,7 @@ fn test() {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default MyDocument
|
||||
",
|
||||
None,
|
||||
|
|
@ -104,7 +104,7 @@ fn test() {
|
|||
),
|
||||
(
|
||||
r#"import Head from "next/head";
|
||||
|
||||
|
||||
export default function IndexPage() {
|
||||
return (
|
||||
<Head>
|
||||
|
|
@ -125,7 +125,7 @@ fn test() {
|
|||
r"
|
||||
import Document, { Html, Main, NextScript } from 'next/document'
|
||||
import Head from 'next/head'
|
||||
|
||||
|
||||
class MyDocument extends Document {
|
||||
render() {
|
||||
return (
|
||||
|
|
@ -139,7 +139,7 @@ fn test() {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default MyDocument
|
||||
",
|
||||
None,
|
||||
|
|
@ -150,7 +150,7 @@ fn test() {
|
|||
r"
|
||||
import Document, { Html, Main, NextScript } from 'next/document'
|
||||
import Head from 'next/head'
|
||||
|
||||
|
||||
class MyDocument extends Document {
|
||||
render() {
|
||||
return (
|
||||
|
|
@ -164,7 +164,7 @@ fn test() {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default MyDocument
|
||||
",
|
||||
None,
|
||||
|
|
@ -175,7 +175,7 @@ fn test() {
|
|||
r"
|
||||
import Document, { Html, Main, NextScript } from 'next/document'
|
||||
import Head from 'next/head'
|
||||
|
||||
|
||||
class MyDocument extends Document {
|
||||
render() {
|
||||
return (
|
||||
|
|
@ -189,7 +189,7 @@ fn test() {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default MyDocument
|
||||
",
|
||||
None,
|
||||
|
|
@ -200,7 +200,7 @@ fn test() {
|
|||
r"
|
||||
import Document, { Html, Main, NextScript } from 'next/document'
|
||||
import Head from 'next/head'
|
||||
|
||||
|
||||
class MyDocument extends Document {
|
||||
render() {
|
||||
return (
|
||||
|
|
@ -214,7 +214,7 @@ fn test() {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default MyDocument
|
||||
",
|
||||
None,
|
||||
|
|
@ -225,7 +225,7 @@ fn test() {
|
|||
r"
|
||||
import Document, { Html, Main, NextScript } from 'next/document'
|
||||
import Head from 'next/head'
|
||||
|
||||
|
||||
class MyDocument extends Document {
|
||||
render() {
|
||||
return (
|
||||
|
|
@ -239,7 +239,7 @@ fn test() {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default MyDocument
|
||||
",
|
||||
None,
|
||||
|
|
@ -248,5 +248,5 @@ fn test() {
|
|||
),
|
||||
];
|
||||
|
||||
Tester::new_with_settings(NoHeadImportInDocument::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoHeadImportInDocument::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,5 +143,5 @@ fn test() {
|
|||
}"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoImgElement::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoImgElement::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,5 +126,5 @@ fn test() {
|
|||
}"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoScriptComponentInHead::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoScriptComponentInHead::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,5 +135,5 @@ fn test() {
|
|||
}",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoSyncScripts::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoSyncScripts::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,5 +142,5 @@ fn test() {
|
|||
}"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoTitleInDocumentHead::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoTitleInDocumentHead::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,5 +92,5 @@ fn test() {
|
|||
"let sqrt2 = 1.414213", // SQRT2
|
||||
];
|
||||
|
||||
Tester::new_without_config(ApproxConstant::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(ApproxConstant::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -401,5 +401,5 @@ fn test() {
|
|||
"status_code < 500 && response && status_code <= 500;",
|
||||
];
|
||||
|
||||
Tester::new_without_config(ConstComparisons::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(ConstComparisons::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,5 +130,5 @@ fn test() {
|
|||
"x > y || x === y",
|
||||
];
|
||||
|
||||
Tester::new_without_config(DoubleComparisons::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(DoubleComparisons::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,5 +94,5 @@ fn test() {
|
|||
|
||||
let fail = vec!["x * 0;", "0 * x;", "0 & x;", "0 / x;"];
|
||||
|
||||
Tester::new_without_config(ErasingOp::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(ErasingOp::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,5 +214,5 @@ fn test() {
|
|||
//~^ ERROR: variable appears on both sides of an assignment operation
|
||||
];
|
||||
|
||||
Tester::new_without_config(MisrefactoredAssignOp::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(MisrefactoredAssignOp::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -279,5 +279,5 @@ fn test() {
|
|||
"foo.reduceRight((acc, bar) => {return {...acc, ...bar};}, {})",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoAccumulatingSpread::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoAccumulatingSpread::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,5 +273,5 @@ fn test() {
|
|||
",
|
||||
];
|
||||
|
||||
Tester::new_without_config(OnlyUsedInRecursion::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(OnlyUsedInRecursion::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -501,5 +501,5 @@ fn test() {
|
|||
",
|
||||
];
|
||||
|
||||
Tester::new_without_config(JsxKey::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(JsxKey::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,5 +183,5 @@ fn test() {
|
|||
r#"<script>测试 " 测试</script>"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoUnescapedEntities::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoUnescapedEntities::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,5 +239,5 @@ fn test() {
|
|||
",
|
||||
];
|
||||
|
||||
Tester::new_without_config(RequireRenderReturn::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(RequireRenderReturn::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -758,5 +758,5 @@ fn test() {
|
|||
}",
|
||||
];
|
||||
|
||||
Tester::new_without_config(AdjacentOverloadSignatures::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(AdjacentOverloadSignatures::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,5 +87,5 @@ fn test() {
|
|||
"declare module FooBar { type Baz = typeof baz; export interface Bar extends Baz {} }",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoEmptyInterface::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoEmptyInterface::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ mod tests {
|
|||
fn test_simple() {
|
||||
let pass = vec!["let x: number = 1"];
|
||||
let fail = vec!["let x: any = 1"];
|
||||
Tester::new_without_config(NoExplicitAny::NAME, pass, fail).test();
|
||||
Tester::new(NoExplicitAny::NAME, pass, fail).test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -93,5 +93,5 @@ fn test() {
|
|||
"function foo(bar?: { n: number }) { return (bar!)?.(); }",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoExtraNonNullAssertion::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoExtraNonNullAssertion::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,5 +148,5 @@ fn test() {
|
|||
"interface I { constructor(): '';}",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoMisusedNew::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoMisusedNew::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,5 @@ fn test() {
|
|||
"(foo?.bar!)()",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoNonNullAssertedOptionalChain::NAME, pass, fail)
|
||||
.test_and_snapshot();
|
||||
Tester::new(NoNonNullAssertedOptionalChain::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,5 +113,5 @@ fn test() {
|
|||
"type Data<T extends unknown> = {};",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoUnnecessaryTypeConstraint::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoUnnecessaryTypeConstraint::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,5 +116,5 @@ fn test() {
|
|||
",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoVarRequires::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoVarRequires::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,5 +192,5 @@ fn test() {
|
|||
// ("class foo { foo = <'bar'>'bar'; }", "class foo { foo = <const>'bar'; }", None),
|
||||
];
|
||||
|
||||
Tester::new_without_config(PreferAsConst::NAME, pass, fail).expect_fix(fix).test_and_snapshot();
|
||||
Tester::new(PreferAsConst::NAME, pass, fail).expect_fix(fix).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -345,7 +345,5 @@ fn test() {
|
|||
),
|
||||
];
|
||||
|
||||
Tester::new_without_config(EmptyBraceSpaces::NAME, pass, fail)
|
||||
.expect_fix(fix)
|
||||
.test_and_snapshot();
|
||||
Tester::new(EmptyBraceSpaces::NAME, pass, fail).expect_fix(fix).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -277,5 +277,5 @@ fn test() {
|
|||
),
|
||||
];
|
||||
|
||||
Tester::new_without_config(EscapeCase::NAME, pass, fail).expect_fix(fix).test_and_snapshot();
|
||||
Tester::new(EscapeCase::NAME, pass, fail).expect_fix(fix).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -438,7 +438,5 @@ fn test() {
|
|||
("for(const a of!foo.length);", "for(const a of foo.length === 0);", None),
|
||||
("for(const a in!foo.length);", "for(const a in foo.length === 0);", None),
|
||||
];
|
||||
Tester::new::<&'static str>(ExplicitLengthCheck::NAME, pass, fail)
|
||||
.expect_fix(fixes)
|
||||
.test_and_snapshot();
|
||||
Tester::new(ExplicitLengthCheck::NAME, pass, fail).expect_fix(fixes).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,5 +139,5 @@ fn test() {
|
|||
("baz;", None, None, Some(PathBuf::from("foo/bar/baz/foo_bar.tsx"))),
|
||||
];
|
||||
|
||||
Tester::new_with_settings(FilenameCase::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(FilenameCase::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -287,5 +287,5 @@ fn test() {
|
|||
",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NewForBuiltins::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NewForBuiltins::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,5 +137,5 @@ fn test() {
|
|||
",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoAbusiveEslintDisable::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoAbusiveEslintDisable::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,5 +124,5 @@ fn test() {
|
|||
r"return foo.forEach(element => {bar(element)});",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoArrayForEach::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoArrayForEach::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,5 +152,5 @@ fn test() {
|
|||
r#"window.document.cookie = "foo=bar""#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoDocumentCookie::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoDocumentCookie::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,5 +135,5 @@ fn test() {
|
|||
r#""use strict";"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoEmptyFile::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoEmptyFile::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ fn test() {
|
|||
(r"const foo = `\xb1${foo}\xb1${foo}`", r"const foo = `\u00b1${foo}\u00b1${foo}`", None),
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoHexEscape::NAME, pass, fail).expect_fix(fix).test_and_snapshot();
|
||||
Tester::new(NoHexEscape::NAME, pass, fail).expect_fix(fix).test_and_snapshot();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -201,5 +201,5 @@ fn test() {
|
|||
"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoInvalidRemoveEventListener::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoInvalidRemoveEventListener::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,5 +208,5 @@ fn test() {
|
|||
",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoLonelyIf::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoLonelyIf::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,5 +142,5 @@ fn test() {
|
|||
r"(!!a) ? b() : c();",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoNegatedCondition::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoNegatedCondition::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,7 +180,5 @@ fn test() {
|
|||
),
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoNestedTernary::NAME, pass, fail)
|
||||
.expect_fix(fix)
|
||||
.test_and_snapshot();
|
||||
Tester::new(NoNestedTernary::NAME, pass, fail).expect_fix(fix).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,5 +130,5 @@ fn test() {
|
|||
r"const array = new Array(length)",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoNewArray::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoNewArray::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,5 +84,5 @@ fn test() {
|
|||
r"new Buffer(input, encoding);",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoNewBuffer::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoNewBuffer::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,5 +133,5 @@ fn test() {
|
|||
r"function abc([a] = {a: 123}) {}",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoObjectAsDefaultParameter::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoObjectAsDefaultParameter::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,5 +152,5 @@ fn test() {
|
|||
r"class A { static a() {} }",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoStaticOnlyClass::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoStaticOnlyClass::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,5 +143,5 @@ fn test() {
|
|||
r"var foo = (bar), baz = (this);",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoThisAssignment::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoThisAssignment::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,5 +123,5 @@ fn test() {
|
|||
"(async () => (( {bar} )))();",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoUnreadableIife::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoUnreadableIife::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,5 +124,5 @@ fn test() {
|
|||
r"const object = {...(document.all || {})}",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoUselessFallbackInSpread::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoUselessFallbackInSpread::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -292,5 +292,5 @@ fn test() {
|
|||
"array.length === 0 || array.every(Boolean) || array.length === 0",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoUselessLengthCheck::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoUselessLengthCheck::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -448,5 +448,5 @@ fn test() {
|
|||
r"promise.then(() => {}, async () => { return Promise.reject(bar); })",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoUselessPromiseResolveReject::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoUselessPromiseResolveReject::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -571,5 +571,5 @@ fn test() {
|
|||
",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoUselessSpread::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoUselessSpread::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -262,5 +262,5 @@ fn test() {
|
|||
",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoUselessSwitchCase::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoUselessSwitchCase::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,5 +133,5 @@ fn test() {
|
|||
r"function foo(){return.0+.1}",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NoZeroFractions::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(NoZeroFractions::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,7 +246,5 @@ fn test() {
|
|||
),
|
||||
];
|
||||
|
||||
Tester::new_without_config(NumberLiteralCase::NAME, pass, fail)
|
||||
.expect_fix(fix)
|
||||
.test_and_snapshot();
|
||||
Tester::new(NumberLiteralCase::NAME, pass, fail).expect_fix(fix).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ fn test_with_snapshot() {
|
|||
"const foo = -100000_1",
|
||||
];
|
||||
|
||||
Tester::new_without_config(NumericSeparatorsStyle::NAME, vec![], fail).test_and_snapshot();
|
||||
Tester::new(NumericSeparatorsStyle::NAME, vec![], fail).test_and_snapshot();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -384,7 +384,7 @@ fn test_number_binary() {
|
|||
("const foo = 0B10101010101010", "const foo = 0B10_1010_1010_1010", None),
|
||||
];
|
||||
|
||||
Tester::new_without_config(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
Tester::new(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -410,7 +410,7 @@ fn test_number_hexadecimal() {
|
|||
|
||||
let fix = vec![("const foo = 0xA_B_CDE_F0", "const foo = 0xA_BC_DE_F0", None)];
|
||||
|
||||
Tester::new_without_config(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
Tester::new(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -437,7 +437,7 @@ fn test_number_octal() {
|
|||
|
||||
let fix = vec![("const foo = 0o12_34_5670", "const foo = 0o1234_5670", None)];
|
||||
|
||||
Tester::new_without_config(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
Tester::new(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -466,7 +466,7 @@ fn test_bigint_binary() {
|
|||
("const foo = 0B10101010101010n", "const foo = 0B10_1010_1010_1010n", None),
|
||||
];
|
||||
|
||||
Tester::new_without_config(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
Tester::new(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -491,7 +491,7 @@ fn test_bigint() {
|
|||
|
||||
let fix = vec![("const foo = 1_9_223n", "const foo = 19_223n", None)];
|
||||
|
||||
Tester::new_without_config(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
Tester::new(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -533,7 +533,7 @@ fn test_number_decimal_exponential() {
|
|||
("const foo = 3.65432E12000", "const foo = 3.654_32E12_000", None),
|
||||
];
|
||||
|
||||
Tester::new_without_config(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
Tester::new(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -560,7 +560,7 @@ fn test_number_decimal_float() {
|
|||
|
||||
let fix = vec![("const foo = 9807.1234567", "const foo = 9807.123_456_7", None)];
|
||||
|
||||
Tester::new_without_config(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
Tester::new(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -596,7 +596,7 @@ fn test_number_decimal_integer() {
|
|||
("const foo = -100000_1", "const foo = -1_000_001", None),
|
||||
];
|
||||
|
||||
Tester::new_without_config(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
Tester::new(NumericSeparatorsStyle::NAME, pass, fail).expect_fix(fix).test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -644,7 +644,7 @@ fn test_misc() {
|
|||
|
||||
let fail = vec![];
|
||||
|
||||
Tester::new_without_config(NumericSeparatorsStyle::NAME, pass, fail).test();
|
||||
Tester::new(NumericSeparatorsStyle::NAME, pass, fail).test();
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
|||
|
|
@ -412,5 +412,5 @@ fn test() {
|
|||
r"[/**/].concat(some.array)",
|
||||
];
|
||||
|
||||
Tester::new_without_config(PreferArrayFlat::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(PreferArrayFlat::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,5 +260,5 @@ fn test() {
|
|||
r#"a = (( ((foo.find(fn))) == ((null)) )) ? "no" : "yes";"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(PreferArraySome::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(PreferArraySome::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,5 +86,5 @@ fn test() {
|
|||
|
||||
let fail = vec![r"fileReader.readAsArrayBuffer(blob)", r"fileReader.readAsText(blob)"];
|
||||
|
||||
Tester::new_without_config(PreferBlobReadingMethods::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(PreferBlobReadingMethods::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,5 +96,5 @@ fn test() {
|
|||
r"(( (( String )).fromCharCode( ((code)), ) ))",
|
||||
];
|
||||
|
||||
Tester::new_without_config(PreferCodePoint::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(PreferCodePoint::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,5 +221,5 @@ fn test() {
|
|||
r"function foo(){return-new Date}",
|
||||
];
|
||||
|
||||
Tester::new_without_config(PreferDateNow::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(PreferDateNow::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,5 +113,5 @@ fn test() {
|
|||
r"() => node?.appendChild(child)",
|
||||
];
|
||||
|
||||
Tester::new_without_config(PreferDomNodeAppend::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(PreferDomNodeAppend::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -259,5 +259,5 @@ fn test() {
|
|||
r#"element.getAttribute("data-unicorn").toString()"#,
|
||||
];
|
||||
|
||||
Tester::new_without_config(PreferDomNodeDataset::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(PreferDomNodeDataset::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,5 +193,5 @@ fn test() {
|
|||
r"a?.b.parentNode.removeChild(a.b)",
|
||||
];
|
||||
|
||||
Tester::new_without_config(PreferDomNodeRemove::NAME, pass, fail).test_and_snapshot();
|
||||
Tester::new(PreferDomNodeRemove::NAME, pass, fail).test_and_snapshot();
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue