Skip to content
Draft
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
2 changes: 0 additions & 2 deletions crates/oxc_linter/src/rules/eslint/block_scoped_var.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ fn test() {
"function f() { } f(); var exports = { f: f };",
"var f = () => {}; f(); var exports = { f: f };",
"!function f(){ f; }",
"function f() { } f(); var exports = { f: f };",
"function f() { var a, b; { a = true; } b = a; }",
"var a; function f() { var b = a; }",
"function f(a) { }",
Expand Down Expand Up @@ -288,7 +287,6 @@ fn test() {
"class C { static { foo; var foo; } }",
"class C { static { var foo; foo; } }",
"(function () { foo(); })(); function foo() {}",
"(function () { foo(); })(); function foo() {}",
"foo: while (true) { bar: for (var i = 0; i < 13; ++i) {if (i === 7) break foo; } }",
"foo: while (true) { bar: for (var i = 0; i < 13; ++i) {if (i === 7) continue foo; } }",
"var a = { foo: bar };",
Expand Down
5 changes: 0 additions & 5 deletions crates/oxc_linter/src/rules/eslint/capitalized_comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,6 @@ fn test() {
"/*
*/", None,
),
(
"/*
*/",
None,
),
("/*
*/", None),
("/*
*/", None),
("//123", None),
Expand Down
8 changes: 0 additions & 8 deletions crates/oxc_linter/src/rules/eslint/curly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,14 +960,6 @@ fn test() {
"const isIterable = (obj: any): obj is Iterable<IgnoreRule> => {\r\n if (obj === null) return false;\r\n else if (typeof obj === 'string') return false;\r\n else return typeof value[Symbol.iterator] === 'function';\r\n};\r\n",
Some(serde_json::json!(["multi-line"])),
),
(
" const isIterable = (obj: any) : obj is Iterable<IgnoreRule> => {
if (obj === null) return false;
else if (typeof obj === 'string') return false;
else return typeof value[Symbol.iterator] === 'function';
};",
Some(serde_json::json!(["multi"])),
),
("if (foo) /* comment */ bar()", Some(serde_json::json!(["multi-line"]))),
("while (foo) /* comment */ bar()", Some(serde_json::json!(["multi-line"]))),
("for (;;) /* comment */ bar()", Some(serde_json::json!(["multi-line"]))),
Expand Down
2 changes: 0 additions & 2 deletions crates/oxc_linter/src/rules/eslint/eqeqeq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,7 @@ fn test() {
("a === b", Some(serde_json::json!(["always"]))),
("typeof a == 'number'", Some(serde_json::json!(["smart"]))),
("'string' != typeof a", Some(serde_json::json!(["smart"]))),
("'hello' != 'world'", Some(serde_json::json!(["smart"]))),
("2 == 3", Some(serde_json::json!(["smart"]))),
("true == true", Some(serde_json::json!(["smart"]))),
("null == a", Some(serde_json::json!(["smart"]))),
("a == null", Some(serde_json::json!(["smart"]))),
// We intentionally do not support this option because it is deprecated in ESLint.
Expand Down
10 changes: 0 additions & 10 deletions crates/oxc_linter/src/rules/eslint/max_lines_per_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,6 @@ fn test() {



var x = 2;
}",
Some(serde_json::json!([{ "max": 6, "skipComments": false, "skipBlankLines": false }])),
),
(
"function name() {
var x = 5;



var x = 2;
}",
Some(serde_json::json!([{ "max": 6, "skipComments": true, "skipBlankLines": false }])),
Expand Down
5 changes: 0 additions & 5 deletions crates/oxc_linter/src/rules/eslint/no_dupe_class_members.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,11 @@ fn test() {
"class A { foo; #foo; }",
"class A { '#foo'; #foo; }",
// typescript-eslint
"class A { foo() {} bar() {} }",
"class A { static foo() {} foo() {} }",
"class A { get foo() {} set foo(value) {} }",
"class A { static foo() {} get foo() {} set foo(value) {} }",
"class A { foo() {} } class B { foo() {} }",
"class A { [foo]() {} foo() {} } ",
"class A { foo() {} bar() {} baz() {} }",
"class A { *foo() {} *bar() {} *baz() {} }",
"class A { get foo() {} get bar() {} get baz() {} }",
"class A { 1() {} 2() {} }",
"class Foo { foo(a: string): string; foo(a: number): number; foo(a: any): any {} }",
];

Expand Down
5 changes: 0 additions & 5 deletions crates/oxc_linter/src/rules/eslint/no_duplicate_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,11 +815,6 @@ fn test() {
export * from "os";"#,
Some(serde_json::json!([{ "includeExports": true }])),
),
(
r#"import "fs";
import "fs""#,
None,
),
(
r#"import { type Merge } from "lodash-es";
import { type Find } from "lodash-es";"#,
Expand Down
6 changes: 2 additions & 4 deletions crates/oxc_linter/src/rules/eslint/no_else_return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,6 @@ fn test() {
),
("function foo() { var a; if (bar) { return true; } else { var a; } }", None),
("function foo() { if (bar) { var a; if (baz) { return true; } else { var a; } } }", None),
("function foo() { var a; if (bar) { return true; } else { var a; } }", None), // { "ecmaVersion": 6 },
("function foo() { if (bar) { var a; if (baz) { return true; } else { var a; } } }", None), // { "ecmaVersion": 6 },
("function foo() { let a; if (bar) { return true; } else { let a; } }", None), // { "ecmaVersion": 6 },
("class foo { bar() { let a; if (baz) { return true; } else { let a; } } }", None), // { "ecmaVersion": 6 },
("function foo() { if (bar) { let a; if (baz) { return true; } else { let a; } } }", None), // { "ecmaVersion": 6 },
Expand Down Expand Up @@ -709,15 +707,15 @@ fn test() {
"function foo14() { if (foo) return bar
else { baz(); }
[1, 2, 3].map(foo) }",
"function foo14() { if (foo) return bar\n baz();
"function foo14() { if (foo) return bar\n baz();
[1, 2, 3].map(foo) }",
None,
),
(
"function foo17() { if (foo) return bar
else { baz() }
qaz() }",
"function foo17() { if (foo) return bar\n baz()
"function foo17() { if (foo) return bar\n baz()
qaz() }",
None,
),
Expand Down
1 change: 0 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_empty_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,6 @@ fn test() {
("class Person { otherMethod(name: string) {} }", None),
("class Foo { private constructor() {} }", None),
("class Foo { protected constructor() {} }", None),
("function foo() {}", None),
(
"
class Foo {
Expand Down
3 changes: 0 additions & 3 deletions crates/oxc_linter/src/rules/eslint/no_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,6 @@ fn test() {
];

let fail = vec![
("eval(foo)", None, None, None),
("eval('foo')", None, None, None),
("function foo(eval) { eval('foo') }", None, None, None),
("eval(foo)", None, None, None),
("eval('foo')", None, None, None),
("function foo(eval) { eval('foo') }", None, None, None),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,6 @@ fn test() {
("!!foo", None),
("!!(foo + bar)", None),
("!!(foo + bar); var Boolean = null", None),
("!!(foo + bar)", None),
("~foo.indexOf(1)", None),
("~foo.bar.indexOf(2)", None),
("~foo.lastIndexOf(1)", None),
Expand Down
6 changes: 0 additions & 6 deletions crates/oxc_linter/src/rules/eslint/no_inner_declarations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ fn test() {
("function decl(arg) { var fn; if (arg) { fn = function() { }; } }", None),
("var x = {doSomething() {function doSomethingElse() {}}}", None), // { "ecmaVersion": 6 },
("function decl(arg) { var fn; if (arg) { fn = function expr() { }; } }", None), // { "ecmaVersion": 6 },
("function decl(arg) { var fn; if (arg) { fn = function expr() { }; } }", None),
("if (test) { var foo; }", None),
("if (test) { let x = 1; }", Some(serde_json::json!(["both"]))), // { "ecmaVersion": 6 },
("if (test) { const x = 1; }", Some(serde_json::json!(["both"]))), // { "ecmaVersion": 6 },
Expand Down Expand Up @@ -303,11 +302,6 @@ fn test() {
if (test) { function doSomething() { } }",
Some(serde_json::json!(["both", { "blockScopedFunctions": "disallow" }])),
), // { "ecmaVersion": 2022 },
(
"'use strict'
if (test) { function doSomething() { } }",
Some(serde_json::json!(["both", { "blockScopedFunctions": "disallow" }])),
), // { "ecmaVersion": 5 },
(
"'use strict'
if (test) { function doSomething() { } }",
Expand Down
65 changes: 0 additions & 65 deletions crates/oxc_linter/src/rules/eslint/no_irregular_whitespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,73 +351,8 @@ fn test() {
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true } } },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true } } },
("console.log('hello BOM');", None),
("// ", None),
("// ", None),
("// …", None),
("//  ", None),
("// ᠎", None),
("// ", None),
("//  ", None),
("//  ", None),
("//  ", None),
("//  ", None),
("//  ", None),
("//  ", None),
("//  ", None),
("//  ", None),
("//  ", None),
("//  ", None),
("//  ", None),
("// ​", None),
("//  ", None),
("//  ", None),
("//  ", None),
("/* */", None),
("/* */", None),
("/* … */", None),
("/*   */", None),
("/* ᠎ */", None),
("/*  */", None),
("/*   */", None),
("/*   */", None),
("/*   */", None),
("/*   */", None),
("/*   */", None),
("/*   */", None),
("/*   */", None),
("/*   */", None),
("/*   */", None),
("/*   */", None),
("/*   */", None),
("/* ​ */", None),
("/* 
 */", None),
("/* 
 */", None),
("/*   */", None),
("/*   */", None),
("/*   */", None),
("var any = / /, other = / /;", None),
("var any = ` `, other = ` `;", None), // { "ecmaVersion": 6 },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div>…</div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div>᠎</div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div></div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div>​</div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
("<div> </div>;", None), // { "parserOptions": { "ecmaFeatures": { "jsx": true, }, }, },
];

let fail = vec![
Expand Down
1 change: 0 additions & 1 deletion crates/oxc_linter/src/rules/eslint/no_lone_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ fn test() {
"while (foo) { {} }",
// MEMO: Currently, this rule always analyzes in strict mode (as it cannot retrieve ecmaFeatures).
// "{ function bar() {} }", // { "ecmaVersion": 6 },
"{var x = 1;}", // { "ecmaVersion": 6 },
"{
{var x = 1;}
let y = 2; } {let z = 1;}", // { "ecmaVersion": 6 },
Expand Down
12 changes: 0 additions & 12 deletions crates/oxc_linter/src/rules/eslint/no_loop_func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,18 +603,6 @@ fn test() {
}
}
",
"
let someArray: MyType[] = [];
for (let i = 0; i < 10; i += 1) {
someArray = someArray.filter((item: MyType) => !!item);
}
",
"
let someArray: MyType[] = [];
for (let i = 0; i < 10; i += 1) {
someArray = someArray.filter((item: MyType) => !!item);
}
",
"
let someArray: MyType[] = [];
for (let i = 0; i < 10; i += 1) {
Expand Down
Loading