diff --git a/crates/oxc_linter/src/rules/unicorn/consistent_assert.rs b/crates/oxc_linter/src/rules/unicorn/consistent_assert.rs index ee0bb8dea707a..7de526caeb219 100644 --- a/crates/oxc_linter/src/rules/unicorn/consistent_assert.rs +++ b/crates/oxc_linter/src/rules/unicorn/consistent_assert.rs @@ -138,82 +138,82 @@ fn test() { "assert(foo)", r#"import assert from "assert";"#, "import assert from 'node:assert'; - assert;", + assert;", "import customAssert from 'node:assert'; - assert(foo);", + assert(foo);", "function foo (assert) { - assert(bar); - }", + assert(bar); + }", "import assert from 'node:assert'; - function foo (assert) { - assert(bar); - }", + function foo (assert) { + assert(bar); + }", "import {strict} from 'node:assert/strict'; - strict(foo);", + strict(foo);", "import * as assert from 'node:assert'; - assert(foo);", + assert(foo);", "export * as assert from 'node:assert'; - assert(foo);", + assert(foo);", "export {default as assert} from 'node:assert'; - export {assert as strict} from 'node:assert'; - assert(foo);", + export {assert as strict} from 'node:assert'; + assert(foo);", "import assert from 'node:assert/strict'; - console.log(assert)", + console.log(assert)", ]; let fail = vec![ "import assert from 'assert'; - assert(foo)", + assert(foo)", "import assert from 'node:assert'; - assert(foo)", + assert(foo)", "import assert from 'assert/strict'; - assert(foo)", + assert(foo)", "import assert from 'node:assert/strict'; - assert(foo)", + assert(foo)", "import customAssert from 'assert'; - customAssert(foo)", + customAssert(foo)", "import customAssert from 'node:assert'; - customAssert(foo)", + customAssert(foo)", "import assert from 'assert'; - assert(foo) - assert(bar) - assert(baz)", + assert(foo) + assert(bar) + assert(baz)", "import {strict} from 'assert'; - strict(foo)", + strict(foo)", "import {strict as assert} from 'assert'; - assert(foo)", + assert(foo)", "import a, {strict as b, default as c} from 'node:assert'; - import d, {strict as e, default as f} from 'assert'; - import g, {default as h} from 'node:assert/strict'; - import i, {default as j} from 'assert/strict'; - a(foo); - b(foo); - c(foo); - d(foo); - e(foo); - f(foo); - g(foo); - h(foo); - i(foo); - j(foo);", + import d, {strict as e, default as f} from 'assert'; + import g, {default as h} from 'node:assert/strict'; + import i, {default as j} from 'assert/strict'; + a(foo); + b(foo); + c(foo); + d(foo); + e(foo); + f(foo); + g(foo); + h(foo); + i(foo); + j(foo);", "import assert from 'node:assert'; - assert?.(foo)", + assert?.(foo)", "import assert from 'assert'; - (( - /* comment */ (( - /* comment */ - assert - /* comment */ - )) /* comment */ - (/* comment */ typeof foo === 'string', 'foo must be a string' /** after comment */) - ));", + (( + /* comment */ (( + /* comment */ + assert + /* comment */ + )) /* comment */ + (/* comment */ typeof foo === 'string', 'foo must be a string' /** after comment */) + ));", ]; let fix = vec![( "import assert from 'assert'; - assert(foo)", + assert(foo)", "import assert from 'assert'; - assert.ok(foo)", + assert.ok(foo)", ), ( "import assert from 'node:assert'; assert(foo)", diff --git a/crates/oxc_linter/src/rules/unicorn/no_array_sort.rs b/crates/oxc_linter/src/rules/unicorn/no_array_sort.rs index 907afad847c4f..304ea014cbd6c 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_array_sort.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_array_sort.rs @@ -139,10 +139,10 @@ fn test() { use crate::tester::Tester; let pass = vec![ - ("sorted = [...array].toSorted()", None), - ("sorted = array.toSorted()", None), - ("sorted = [...array].sort", None), - ("sorted = [...array].sort?.()", None), + ("sorted =[...array].toSorted()", None), + ("sorted =array.toSorted()", None), + ("sorted =[...array].sort", None), + ("sorted =[...array].sort?.()", None), ("array.sort()", None), ("array.sort?.()", None), ("array?.sort()", None), @@ -152,6 +152,20 @@ fn test() { ("sorted = array.sort(compareFn, extraArgument)", None), (r#"import { Chunk } from "effect"; const sorted = Chunk.sort(compareFn)"#, None), (r#"import { Chunk as C } from "effect"; const sorted = C.sort(compareFn)"#, None), + // TODO: Get these passing? + // ("sorted = collection.sort({field: 1})", None), + // (r#"sorted = query.sort("field")"#, None), + // ("sorted = query.sort(1)", None), + // ("sorted = query.sort(-1)", None), + // ("sorted = query.sort(+1)", None), + // ("sorted = query.sort(`field`)", None), + // ("sorted = query.sort([criteria])", None), + // ("const docs = collection.find({id}).sort({expireAt: -1}).limit(1).toArray()", None), + // ("[...array].sort({field: 1})", None), + // ( + // "collection.sort({field: 1})", + // Some(serde_json::json!([{ "allowExpressionStatement": false }])), + // ), ]; let fail = vec![ diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_add_event_listener.rs b/crates/oxc_linter/src/rules/unicorn/prefer_add_event_listener.rs index 46638726c35f4..a94c963f55c1a 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_add_event_listener.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_add_event_listener.rs @@ -285,38 +285,161 @@ fn test() { use crate::tester::Tester; let pass = vec![ - "foo.addEventListener('click', () => {})", - "foo.removeEventListener('click', onClick)", - "foo.onclick", - "foo[onclick] = () => {}", - r#"foo["onclick"] = () => {}"#, - "foo.onunknown = () => {}", - "foo.setCallBack = () => {console.log('foo')}", - "setCallBack = () => {console.log('foo')}", - "foo.onclick.bar = () => {}", - "foo['x'] = true;", + ("foo.addEventListener('click', () => {})", None), + ("foo.removeEventListener('click', onClick)", None), + ("foo.onclick", None), + ("foo[onclick] = () => {}", None), + (r#"foo["onclick"] = () => {}"#, None), + ("foo.onunknown = () => {}", None), + ("foo.setCallBack = () => {console.log('foo')}", None), + ("setCallBack = () => {console.log('foo')}", None), + ("foo.onclick.bar = () => {}", None), + ("foo['x'] = true;", None), + // TODO: Uncomment these tests after we introduce support for the excludedPackages option. + // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/0bf85e0df741255ac2d347eefc57daf4362ff0a0/docs/rules/prefer-add-event-listener.md#excludedpackages + // ( + // "const Koa = require('koa'); + // const app = new Koa(); + // app.onerror = () => {};", + // None, + // ), + // ( + // "const sax = require('sax'); + // const parser = sax.parser(); + // parser.onerror = () => {};", + // None, + // ), + // ( + // "import Koa from 'koa'; + // const app = new Koa(); + // app.onerror = () => {};", + // None, + // ), + // ( + // "import sax from 'sax'; + // const parser = sax.parser(); + // parser.onerror = () => {};", + // None, + // ), + // ( + // "import {sax as foo} from 'sax'; + // const parser = foo.parser(); + // parser.onerror = () => {};", + // None, + // ), + // ( + // "const foo = require('foo'); + // foo.onerror = () => {};", + // Some(serde_json::json!(excludeFooOptions)), + // ), + // ( + // "import foo from 'foo'; + // foo.onclick = () => {};", + // Some(serde_json::json!(excludeFooOptions)), + // ), ]; let fail = vec![ - "foo.onclick = () => {}", - "foo.onclick = 1", - "foo.bar.onclick = onClick", - "const bar = null; foo.onclick = bar;", - "foo.onkeydown = () => {}", - "foo.ondragend = () => {}", - "foo.onclick = null", - "foo.onclick = undefined", - "window.onbeforeunload = null", - "window.onbeforeunload = undefined", - "window.onbeforeunload = foo", - "window.onbeforeunload = () => 'foo'", - "myWorker.port.onmessage = function(e) {}", - "((foo)).onclick = ((0, listener))", - "window.onload = window.onunload = function() {};", - "window.onunload ??= function() {};", - "window.onunload ||= function() {};", - "window.onunload += function() {};", - "(el as HTMLElement).onmouseenter = onAnchorMouseEnter;", + ("foo.onclick = () => {}", None), + ("foo.onclick = 1", None), + ("foo.bar.onclick = onClick", None), + ("const bar = null; foo.onclick = bar;", None), + ("foo.onkeydown = () => {}", None), + ("foo.ondragend = () => {}", None), + ( + "foo.onclick = function (e) { + console.log(e); + }", + None, + ), + ("foo.onclick = null", None), + ("foo.onclick = undefined", None), + ("window.onbeforeunload = null", None), + ("window.onbeforeunload = undefined", None), + ("window.onbeforeunload = foo", None), + ("window.onbeforeunload = () => 'foo'", None), + ( + "window.onbeforeunload = () => { + return bar; + }", + None, + ), + ( + "window.onbeforeunload = function () { + return 'bar'; + }", + None, + ), + ( + "window.onbeforeunload = function () { + return; + }", + None, + ), + ( + "window.onbeforeunload = function () { + (() => { + return 'foo'; + })(); + }", + None, + ), + ( + "window.onbeforeunload = e => { + console.log(e); + }", + None, + ), + ( + "const foo = require('foo'); + foo.onerror = () => {};", + None, + ), + ( + "import foo from 'foo'; + foo.onerror = () => {};", + None, + ), + ( + "foo.onerror = () => {}; + function bar() { + const koa = require('koa'); + koa.onerror = () => {}; + }", + None, + ), + // ( + // "const Koa = require('koa'); + // const app = new Koa(); + // app.onerror = () => {};", + // Some(serde_json::json!(excludeFooOptions)), + // ), + // ( + // "import {Koa as Foo} from 'koa'; + // const app = new Foo(); + // app.onerror = () => {};", + // Some(serde_json::json!(excludeFooOptions)), + // ), + // ( + // "const sax = require('sax'); + // const parser = sax.parser(); + // parser.onerror = () => {};", + // Some(serde_json::json!(excludeFooOptions)), + // ), + ("myWorker.port.onmessage = function(e) {}", None), + ("((foo)).onclick = ((0, listener))", None), + ("window.onload = window.onunload = function() {};", None), + ("window.onunload ??= function() {};", None), + ("window.onunload ||= function() {};", None), + ("window.onunload += function() {};", None), + ("foo.onclick = true", None), + ("foo.onclick = 'bar'", None), + ("foo.onclick = `bar`", None), + ("foo.onclick = {}", None), + ("foo.onclick = []", None), + ("foo.onclick = void 0", None), + ("foo.onclick = new Handler()", None), + ("(el as HTMLElement).onmouseenter = onAnchorMouseEnter;", None), ]; // TODO: Implement autofix and use these tests. diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_set_size.rs b/crates/oxc_linter/src/rules/unicorn/prefer_set_size.rs index cb67f65731520..fc8f46752ee91 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_set_size.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_set_size.rs @@ -141,33 +141,66 @@ fn test() { use crate::tester::Tester; let pass = vec![ - r"new Set(foo).size", - r"for (const foo of bar) console.log([...foo].length)", - r"[...new Set(array), foo].length", - r"[foo, ...new Set(array), ].length", - r"[...new Set(array)].notLength", - r"[...new Set(array)]?.length", - r"[...new Set(array)][length]", + "new Set(foo).size", + "for (const foo of bar) console.log([...foo].length)", + "[...new Set(array), foo].length", + "[foo, ...new Set(array), ].length", + "[...new Set(array)].notLength", + "[...new Set(array)]?.length", + "[...new Set(array)][length]", r#"[...new Set(array)]["length"]"#, - r"[...new NotSet(array)].length", - r"[...Set(array)].length", - r"const foo = new NotSet([]);[...foo].length;", - r"let foo = new Set([]);[...foo].length;", - r"const {foo} = new Set([]);[...foo].length;", - r"const [foo] = new Set([]);[...foo].length;", - r"[...foo].length", - r"var foo = new Set(); var foo = new Set(); [...foo].length", - r"[,].length", + "[...new NotSet(array)].length", + "[...Set(array)].length", + "const foo = new NotSet([]);[...foo].length;", + "let foo = new Set([]);[...foo].length;", + "const {foo} = new Set([]);[...foo].length;", + "const [foo] = new Set([]);[...foo].length;", + "[...foo].length", + "var foo = new Set(); var foo = new Set(); [...foo].length", + "[,].length", + "Array.from(foo).length", + "Array.from(new NotSet(array)).length", + "Array.from(Set(array)).length", + "Array.from(new Set(array)).notLength", + "Array.from(new Set(array))?.length", + "Array.from(new Set(array))[length]", + r#"Array.from(new Set(array))["length"]"#, + "Array.from(new Set(array), mapFn).length", + "Array?.from(new Set(array)).length", + "Array.from?.(new Set(array)).length", + "const foo = new NotSet([]);Array.from(foo).length;", + "let foo = new Set([]);Array.from(foo).length;", + "const {foo} = new Set([]);Array.from(foo).length;", + "const [foo] = new Set([]);Array.from(foo).length;", + "var foo = new Set(); var foo = new Set(); Array.from(foo).length", + "NotArray.from(new Set(array)).length", ]; let fail = vec![ - r"[...new Set(array)].length", - r"[...new Set(array),].length", - r"[...(( new Set(array) ))].length", - r"(( [...new Set(array)] )).length", - r"[/* comment */...new Set(array)].length", - r"const foo = new Set([]); [...foo].length;", - r"[...new /* comment */ Set(array)].length", + "[...new Set(array)].length", + "const foo = new Set([]); + console.log([...foo].length);", + "function isUnique(array) { + return[...new Set(array)].length === array.length + }", + "[...new Set(array),].length", + "[...(( new Set(array) ))].length", + "(( [...new Set(array)] )).length", + "foo + ;[...new Set(array)].length", + "[/* comment */...new Set(array)].length", + "[...new /* comment */ Set(array)].length", + // TODO: Update the rule to handle Array.from cases. + // "Array.from(new Set(array)).length", + // "const foo = new Set([]); + // console.log(Array.from(foo).length);", + // "Array.from((( new Set(array) ))).length", + // "(( Array.from(new Set(array)) )).length", + // "Array.from(/* comment */ new Set(array)).length", + // "Array.from(new /* comment */ Set(array)).length", + // "function isUnique(array) { + // return Array.from(new Set(array)).length === array.length + // }", ]; let fix = vec![ diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs b/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs index 064a01fffe0e1..3772124c384ea 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs @@ -275,36 +275,36 @@ fn test() { use crate::tester::Tester; let pass = vec![ - r"[...set].map(() => {});", - r"Int8Array.from(set);", - r"Uint8Array.from(set);", - r"Uint8ClampedArray.from(set);", - r"Int16Array.from(set);", - r"Uint16Array.from(set);", - r"Int32Array.from(set);", - r"Uint32Array.from(set);", - r"Float16Array.from(set);", - r"Float32Array.from(set);", - r"Float64Array.from(set);", - r"BigInt64Array.from(set);", - r"BigUint64Array.from(set);", - r"new Array.from(foo);", - r"from(foo);", + "[...set].map(() => {});", + "Int8Array.from(set);", + "Uint8Array.from(set);", + "Uint8ClampedArray.from(set);", + "Int16Array.from(set);", + "Uint16Array.from(set);", + "Int32Array.from(set);", + "Uint32Array.from(set);", + "Float16Array.from(set);", + "Float32Array.from(set);", + "Float64Array.from(set);", + "BigInt64Array.from(set);", + "BigUint64Array.from(set);", + "new Array.from(foo);", + "from(foo);", r#"Array["from"](foo);"#, - r"Array[from](foo);", - r"Array.foo(foo);", - r"foo.from(foo);", - r"lib.Array.from(foo);", - r"Array.from();", - r"Array.from(foo, mapFn, thisArg, extra);", - r"Array.from(...argumentsArray);", - r"Array.from(set, mapFn).reduce(() => {});", - r"Array.from(set, mapFn, thisArg).reduce(() => {});", - r"Array.from(set, () => {}, thisArg).reduce(() => {});", - r"Array.from({length: 10});", - r"new Array.concat(1)", - r"concat(1)", - r"array[concat](1)", + "Array[from](foo);", + "Array.foo(foo);", + "foo.from(foo);", + "lib.Array.from(foo);", + "Array.from();", + "Array.from(foo, mapFn, thisArg, extra);", + "Array.from(...argumentsArray);", + "Array.from(set, mapFn).reduce(() => {});", + "Array.from(set, mapFn, thisArg).reduce(() => {});", + "Array.from(set, () => {}, thisArg).reduce(() => {});", + "Array.from({length: 10});", + "new Array.concat(1)", + "concat(1)", + "array[concat](1)", r#""foo".concat("bar")"#, r#"`${foo}`.concat("bar")"#, r#"const string = 'foo'; @@ -316,68 +316,86 @@ fn test() { r#"["1", "2"].join(",").concat("...")"#, r#"foo.join(",").concat("...")"#, "foo.join().concat(bar)", - //"(a + b).concat(c)", - r"new Array.slice()", - r"slice()", - r"array[slice]()", - r"array.slice", - r"array.slice(1)", - r"array.slice(...[])", - r"array.slice(...[0])", - r"array.slice(0 + 0)", + // "(a + b).concat(c)", + "new Array.slice()", + "slice()", + "array[slice]()", + "array.slice", + "array.slice(1)", + "array.slice(...[])", + "array.slice(...[0])", + "array.slice(0 + 0)", r#"array.slice("")"#, - r"array.slice(null)", - r"const ZERO = 0;array.slice(ZERO)", - r"array.slice(0, array.length)", - r"array.slice(0, 0)", - r"array.notSlice()", - r"[...foo].slice()", - r"[foo].slice()", - r"arrayBuffer.slice()", - r"blob.slice()", - r"buffer.slice()", - r"file.slice()", - r"class A {foo() {this.slice()}}", - r"new Array.toSpliced()", - r"toSpliced()", - r"array[toSpliced]()", - r"array.toSpliced", - r"array.toSpliced(0)", - r"array.toSpliced(...[])", - r"array.toSpliced(...[0])", - r"array.toSpliced(0 + 0)", + "array.slice(null)", + "const ZERO = 0;array.slice(ZERO)", + "array.slice(0, array.length)", + "array.slice(0, 0)", + "array.notSlice()", + "[...foo].slice()", + "[foo].slice()", + "arrayBuffer.slice()", + "blob.slice()", + "buffer.slice()", + "file.slice()", + "class A {foo() {this.slice()}}", + // TODO: Fix. + // "scopeManager?.scopes.slice()", + // "new ArrayBuffer(10).slice()", + // "new ArrayBuffer(10).slice(0)", + // "new SharedArrayBuffer(10).slice()", + // "new SharedArrayBuffer(10).slice(0)", + // "new Int8Array([1, 2, 3]).slice()", + // "new Int8Array([1, 2, 3]).slice(0)", + // "new Uint8Array([10, 20, 30, 40, 50]).slice()", + // "new Uint8Array([10, 20, 30, 40, 50]).slice(0)", + // "new Uint8ClampedArray([1, 2, 3]).slice()", + // "new Int16Array([1, 2, 3]).slice()", + // "new Uint16Array([1, 2, 3]).slice()", + // "new Int32Array([1, 2, 3]).slice()", + // "new Uint32Array([1, 2, 3]).slice()", + // "new Float32Array([1, 2, 3]).slice()", + // "new Float64Array([1, 2, 3]).slice()", + // "new BigInt64Array([1n, 2n, 3n]).slice()", + // "new BigUint64Array([1n, 2n, 3n]).slice()", + "new Array.toSpliced()", + "toSpliced()", + "array[toSpliced]()", + "array.toSpliced", + "array.toSpliced(0)", + "array.toSpliced(...[])", + "array.toSpliced(...[0])", + "array.toSpliced(0 + 0)", r#"array.toSpliced("")"#, - r"array.toSpliced(null)", - r"const ZERO = 0;array.toSpliced(0, ZERO)", - r"array.toSpliced(0, array.length)", - r"array.toSpliced(0, 0)", - r"array.notToSpliced()", - r"[...foo].toSpliced()", - r"[foo].toSpliced()", - r"array.toSpliced(100, 0)", - r"array.toSpliced(-1, 0)", + "array.toSpliced(null)", + "const ZERO = 0;array.toSpliced(0, ZERO)", + "array.toSpliced(0, array.length)", + "array.toSpliced(0, 0)", + "array.notToSpliced()", + "[...foo].toSpliced()", + "[foo].toSpliced()", + "array.toSpliced(100, 0)", + "array.toSpliced(-1, 0)", r#"new foo.split("")"#, r#"split("")"#, r#"string[split]("")"#, - r"string.split", - r"string.split(1)", + "string.split", + "string.split(1)", r#"string.split(..."")"#, r#"string.split(...[""])"#, r#"string.split("" + "")"#, - r"string.split(0)", - r"string.split(false)", - r"string.split(undefined)", - r"string.split(0n)", - r"string.split(null)", + "string.split(0)", + "string.split(false)", + "string.split(undefined)", + "string.split(0n)", + "string.split(null)", r#"string.split(/""/)"#, - r"string.split(``)", + "string.split(``)", r#"const EMPTY_STRING = ""; string.split(EMPTY_STRING)"#, r#"string.split("", limit)"#, r#""".split(string)"#, - r"string.split()", + "string.split()", r#"string.notSplit("")"#, - r#"const x = "foo"; x.concat(x);"#, - r#"const y = "foo"; const x = y; x.concat(x);"#, + // r#"const notString = 0; notString.split("")"#, ]; let fail = vec![ @@ -406,7 +424,7 @@ fn test() { "function* foo() { yield Array.from(arrayLike).forEach(doSomething) }", - "const foo = \\`bar\\` + r"const foo = \\`bar\\` Array.from(arrayLike).forEach(doSomething)", "const foo = []; Array.from(arrayLike).forEach(doSomething)", @@ -514,7 +532,7 @@ fn test() { "for (const a of b) foo.concat(1)", "while (test) foo.concat(1)", "do foo.concat(1); while (test)", - "with (foo) foo.concat(1)", // {"parserOptions": {"ecmaVersion": 6, "sourceType": "script"}}, + "with (foo) foo.concat(1)", // {"parserOptions": {"sourceType": "script"}}, "const baz = [2]; call(foo, ...[bar].concat(baz));", r#"foo.join(foo, bar).concat("...")"#, @@ -528,7 +546,6 @@ fn test() { "bar() foo.slice()", r#""".slice()"#, - "new Uint8Array([10, 20, 30, 40, 50]).slice()", "array.slice(0)", "array.slice(0b0)", "array.slice(0.00)", @@ -538,7 +555,7 @@ fn test() { "const copy = array.toSpliced()", "(( (( (( array )).toSpliced ))() ))", "bar() - foo.toSpliced()", + foo.toSpliced()", r#""".toSpliced()"#, "new Uint8Array([10, 20, 30, 40, 50]).toSpliced()", r#""string".split("")"#, @@ -547,7 +564,7 @@ fn test() { r#"const characters = "string".split("")"#, r#"(( (( (( "string" )).split ))( (("")) ) ))"#, r#"bar() - foo.split("")"#, + foo.split("")"#, r#"unknown.split("")"#, r#""๐Ÿฆ„".split("")"#, r#"const {length} = "๐Ÿฆ„".split("")"#, diff --git a/crates/oxc_linter/src/snapshots/unicorn_consistent_assert.snap b/crates/oxc_linter/src/snapshots/unicorn_consistent_assert.snap index e3cde9ab6c526..2a656cd7094ab 100644 --- a/crates/oxc_linter/src/snapshots/unicorn_consistent_assert.snap +++ b/crates/oxc_linter/src/snapshots/unicorn_consistent_assert.snap @@ -3,7 +3,7 @@ source: crates/oxc_linter/src/tester.rs --- โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:2:10] + โ•ญโ”€[consistent_assert.tsx:2:13] 1 โ”‚ import assert from 'assert'; 2 โ”‚ assert(foo) ยท โ”€โ”€โ”€โ”€โ”€โ”€ @@ -11,7 +11,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer assert.ok(...) over assert(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:2:10] + โ•ญโ”€[consistent_assert.tsx:2:13] 1 โ”‚ import assert from 'node:assert'; 2 โ”‚ assert(foo) ยท โ”€โ”€โ”€โ”€โ”€โ”€ @@ -19,7 +19,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer assert.ok(...) over assert(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:2:10] + โ•ญโ”€[consistent_assert.tsx:2:13] 1 โ”‚ import assert from 'assert/strict'; 2 โ”‚ assert(foo) ยท โ”€โ”€โ”€โ”€โ”€โ”€ @@ -27,7 +27,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer assert.ok(...) over assert(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:2:10] + โ•ญโ”€[consistent_assert.tsx:2:13] 1 โ”‚ import assert from 'node:assert/strict'; 2 โ”‚ assert(foo) ยท โ”€โ”€โ”€โ”€โ”€โ”€ @@ -35,7 +35,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer assert.ok(...) over assert(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:2:10] + โ•ญโ”€[consistent_assert.tsx:2:13] 1 โ”‚ import customAssert from 'assert'; 2 โ”‚ customAssert(foo) ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ @@ -43,7 +43,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer customAssert.ok(...) over customAssert(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:2:10] + โ•ญโ”€[consistent_assert.tsx:2:13] 1 โ”‚ import customAssert from 'node:assert'; 2 โ”‚ customAssert(foo) ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ @@ -51,7 +51,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer customAssert.ok(...) over customAssert(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:2:10] + โ•ญโ”€[consistent_assert.tsx:2:13] 1 โ”‚ import assert from 'assert'; 2 โ”‚ assert(foo) ยท โ”€โ”€โ”€โ”€โ”€โ”€ @@ -60,7 +60,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer assert.ok(...) over assert(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:3:10] + โ•ญโ”€[consistent_assert.tsx:3:13] 2 โ”‚ assert(foo) 3 โ”‚ assert(bar) ยท โ”€โ”€โ”€โ”€โ”€โ”€ @@ -69,7 +69,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer assert.ok(...) over assert(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:4:10] + โ•ญโ”€[consistent_assert.tsx:4:13] 3 โ”‚ assert(bar) 4 โ”‚ assert(baz) ยท โ”€โ”€โ”€โ”€โ”€โ”€ @@ -77,7 +77,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer assert.ok(...) over assert(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:2:10] + โ•ญโ”€[consistent_assert.tsx:2:13] 1 โ”‚ import {strict} from 'assert'; 2 โ”‚ strict(foo) ยท โ”€โ”€โ”€โ”€โ”€โ”€ @@ -85,7 +85,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer strict.ok(...) over strict(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:2:10] + โ•ญโ”€[consistent_assert.tsx:2:13] 1 โ”‚ import {strict as assert} from 'assert'; 2 โ”‚ assert(foo) ยท โ”€โ”€โ”€โ”€โ”€โ”€ @@ -93,7 +93,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer assert.ok(...) over assert(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:5:10] + โ•ญโ”€[consistent_assert.tsx:5:13] 4 โ”‚ import i, {default as j} from 'assert/strict'; 5 โ”‚ a(foo); ยท โ”€ @@ -102,7 +102,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer a.ok(...) over a(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:6:10] + โ•ญโ”€[consistent_assert.tsx:6:13] 5 โ”‚ a(foo); 6 โ”‚ b(foo); ยท โ”€ @@ -111,7 +111,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer b.ok(...) over b(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:7:10] + โ•ญโ”€[consistent_assert.tsx:7:13] 6 โ”‚ b(foo); 7 โ”‚ c(foo); ยท โ”€ @@ -120,7 +120,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer c.ok(...) over c(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:8:10] + โ•ญโ”€[consistent_assert.tsx:8:13] 7 โ”‚ c(foo); 8 โ”‚ d(foo); ยท โ”€ @@ -129,7 +129,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer d.ok(...) over d(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:9:10] + โ•ญโ”€[consistent_assert.tsx:9:13] 8 โ”‚ d(foo); 9 โ”‚ e(foo); ยท โ”€ @@ -138,7 +138,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer e.ok(...) over e(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:10:10] + โ•ญโ”€[consistent_assert.tsx:10:13] 9 โ”‚ e(foo); 10 โ”‚ f(foo); ยท โ”€ @@ -147,7 +147,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer f.ok(...) over f(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:11:10] + โ•ญโ”€[consistent_assert.tsx:11:13] 10 โ”‚ f(foo); 11 โ”‚ g(foo); ยท โ”€ @@ -156,7 +156,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer g.ok(...) over g(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:12:10] + โ•ญโ”€[consistent_assert.tsx:12:13] 11 โ”‚ g(foo); 12 โ”‚ h(foo); ยท โ”€ @@ -165,7 +165,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer h.ok(...) over h(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:13:10] + โ•ญโ”€[consistent_assert.tsx:13:13] 12 โ”‚ h(foo); 13 โ”‚ i(foo); ยท โ”€ @@ -174,7 +174,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer i.ok(...) over i(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:14:10] + โ•ญโ”€[consistent_assert.tsx:14:13] 13 โ”‚ i(foo); 14 โ”‚ j(foo); ยท โ”€ @@ -182,7 +182,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer j.ok(...) over j(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:2:10] + โ•ญโ”€[consistent_assert.tsx:2:13] 1 โ”‚ import assert from 'node:assert'; 2 โ”‚ assert?.(foo) ยท โ”€โ”€โ”€โ”€โ”€โ”€ @@ -190,7 +190,7 @@ source: crates/oxc_linter/src/tester.rs help: Prefer assert.ok(...) over assert(...) โš  eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage - โ•ญโ”€[consistent_assert.tsx:5:6] + โ•ญโ”€[consistent_assert.tsx:5:21] 4 โ”‚ /* comment */ 5 โ”‚ assert ยท โ”€โ”€โ”€โ”€โ”€โ”€ diff --git a/crates/oxc_linter/src/snapshots/unicorn_prefer_add_event_listener.snap b/crates/oxc_linter/src/snapshots/unicorn_prefer_add_event_listener.snap index 6c10d55ba820a..6a7fa0d5a8b9f 100644 --- a/crates/oxc_linter/src/snapshots/unicorn_prefer_add_event_listener.snap +++ b/crates/oxc_linter/src/snapshots/unicorn_prefer_add_event_listener.snap @@ -38,6 +38,13 @@ source: crates/oxc_linter/src/tester.rs ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ•ฐโ”€โ”€โ”€โ”€ + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:1:5] + 1 โ”‚ foo.onclick = function (e) { + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + 2 โ”‚ console.log(e); + โ•ฐโ”€โ”€โ”€โ”€ + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. โ•ญโ”€[prefer_add_event_listener.tsx:1:5] 1 โ”‚ foo.onclick = null @@ -74,6 +81,70 @@ source: crates/oxc_linter/src/tester.rs ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ•ฐโ”€โ”€โ”€โ”€ + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:1:8] + 1 โ”‚ window.onbeforeunload = () => { + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + 2 โ”‚ return bar; + โ•ฐโ”€โ”€โ”€โ”€ + + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:1:8] + 1 โ”‚ window.onbeforeunload = function () { + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + 2 โ”‚ return 'bar'; + โ•ฐโ”€โ”€โ”€โ”€ + + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:1:8] + 1 โ”‚ window.onbeforeunload = function () { + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + 2 โ”‚ return; + โ•ฐโ”€โ”€โ”€โ”€ + + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:1:8] + 1 โ”‚ window.onbeforeunload = function () { + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + 2 โ”‚ (() => { + โ•ฐโ”€โ”€โ”€โ”€ + + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:1:8] + 1 โ”‚ window.onbeforeunload = e => { + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + 2 โ”‚ console.log(e); + โ•ฐโ”€โ”€โ”€โ”€ + + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:2:17] + 1 โ”‚ const foo = require('foo'); + 2 โ”‚ foo.onerror = () => {}; + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + โ•ฐโ”€โ”€โ”€โ”€ + + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:2:17] + 1 โ”‚ import foo from 'foo'; + 2 โ”‚ foo.onerror = () => {}; + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + โ•ฐโ”€โ”€โ”€โ”€ + + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:1:5] + 1 โ”‚ foo.onerror = () => {}; + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + 2 โ”‚ function bar() { + โ•ฐโ”€โ”€โ”€โ”€ + + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:4:21] + 3 โ”‚ const koa = require('koa'); + 4 โ”‚ koa.onerror = () => {}; + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + 5 โ”‚ } + โ•ฐโ”€โ”€โ”€โ”€ + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. โ•ญโ”€[prefer_add_event_listener.tsx:1:15] 1 โ”‚ myWorker.port.onmessage = function(e) {} @@ -116,6 +187,48 @@ source: crates/oxc_linter/src/tester.rs ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ•ฐโ”€โ”€โ”€โ”€ + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:1:5] + 1 โ”‚ foo.onclick = true + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + โ•ฐโ”€โ”€โ”€โ”€ + + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:1:5] + 1 โ”‚ foo.onclick = 'bar' + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + โ•ฐโ”€โ”€โ”€โ”€ + + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:1:5] + 1 โ”‚ foo.onclick = `bar` + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + โ•ฐโ”€โ”€โ”€โ”€ + + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:1:5] + 1 โ”‚ foo.onclick = {} + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + โ•ฐโ”€โ”€โ”€โ”€ + + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:1:5] + 1 โ”‚ foo.onclick = [] + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + โ•ฐโ”€โ”€โ”€โ”€ + + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:1:5] + 1 โ”‚ foo.onclick = void 0 + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + โ•ฐโ”€โ”€โ”€โ”€ + + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. + โ•ญโ”€[prefer_add_event_listener.tsx:1:5] + 1 โ”‚ foo.onclick = new Handler() + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + โ•ฐโ”€โ”€โ”€โ”€ + โš  eslint-plugin-unicorn(prefer-add-event-listener): Prefer `addEventListener()` over their `on`-function counterparts. โ•ญโ”€[prefer_add_event_listener.tsx:1:21] 1 โ”‚ (el as HTMLElement).onmouseenter = onAnchorMouseEnter; diff --git a/crates/oxc_linter/src/snapshots/unicorn_prefer_set_size.snap b/crates/oxc_linter/src/snapshots/unicorn_prefer_set_size.snap index 8ee4484108c48..0e72b01423953 100644 --- a/crates/oxc_linter/src/snapshots/unicorn_prefer_set_size.snap +++ b/crates/oxc_linter/src/snapshots/unicorn_prefer_set_size.snap @@ -9,6 +9,23 @@ source: crates/oxc_linter/src/tester.rs โ•ฐโ”€โ”€โ”€โ”€ help: Remove spread and replace with `Set.size` + โš  eslint-plugin-unicorn(prefer-set-size): Use `Set#size` instead of converting a `Set` to an array and using its `length` property. + โ•ญโ”€[prefer_set_size.tsx:2:34] + 1 โ”‚ const foo = new Set([]); + 2 โ”‚ console.log([...foo].length); + ยท โ”€โ”€โ”€โ”€โ”€โ”€ + โ•ฐโ”€โ”€โ”€โ”€ + help: Remove spread and replace with `Set.size` + + โš  eslint-plugin-unicorn(prefer-set-size): Use `Set#size` instead of converting a `Set` to an array and using its `length` property. + โ•ญโ”€[prefer_set_size.tsx:2:43] + 1 โ”‚ function isUnique(array) { + 2 โ”‚ return[...new Set(array)].length === array.length + ยท โ”€โ”€โ”€โ”€โ”€โ”€ + 3 โ”‚ } + โ•ฐโ”€โ”€โ”€โ”€ + help: Remove spread and replace with `Set.size` + โš  eslint-plugin-unicorn(prefer-set-size): Use `Set#size` instead of converting a `Set` to an array and using its `length` property. โ•ญโ”€[prefer_set_size.tsx:1:22] 1 โ”‚ [...new Set(array),].length @@ -31,16 +48,17 @@ source: crates/oxc_linter/src/tester.rs help: Remove spread and replace with `Set.size` โš  eslint-plugin-unicorn(prefer-set-size): Use `Set#size` instead of converting a `Set` to an array and using its `length` property. - โ•ญโ”€[prefer_set_size.tsx:1:34] - 1 โ”‚ [/* comment */...new Set(array)].length + โ•ญโ”€[prefer_set_size.tsx:2:34] + 1 โ”‚ foo + 2 โ”‚ ;[...new Set(array)].length ยท โ”€โ”€โ”€โ”€โ”€โ”€ โ•ฐโ”€โ”€โ”€โ”€ help: Remove spread and replace with `Set.size` โš  eslint-plugin-unicorn(prefer-set-size): Use `Set#size` instead of converting a `Set` to an array and using its `length` property. - โ•ญโ”€[prefer_set_size.tsx:1:35] - 1 โ”‚ const foo = new Set([]); [...foo].length; - ยท โ”€โ”€โ”€โ”€โ”€โ”€ + โ•ญโ”€[prefer_set_size.tsx:1:34] + 1 โ”‚ [/* comment */...new Set(array)].length + ยท โ”€โ”€โ”€โ”€โ”€โ”€ โ•ฐโ”€โ”€โ”€โ”€ help: Remove spread and replace with `Set.size` diff --git a/crates/oxc_linter/src/snapshots/unicorn_prefer_spread.snap b/crates/oxc_linter/src/snapshots/unicorn_prefer_spread.snap index 48ba811b9109d..199d2ffdae81b 100644 --- a/crates/oxc_linter/src/snapshots/unicorn_prefer_spread.snap +++ b/crates/oxc_linter/src/snapshots/unicorn_prefer_spread.snap @@ -113,18 +113,11 @@ source: crates/oxc_linter/src/tester.rs ร— Invalid Unicode escape sequence โ•ญโ”€[prefer_spread.tsx:1:14] - 1 โ”‚ const foo = \`bar\` + 1 โ”‚ const foo = \\`bar\\` ยท โ”€ 2 โ”‚ Array.from(arrayLike).forEach(doSomething) โ•ฐโ”€โ”€โ”€โ”€ - ร— Invalid Unicode escape sequence - โ•ญโ”€[prefer_spread.tsx:1:19] - 1 โ”‚ const foo = \`bar\` - ยท โ”€ - 2 โ”‚ Array.from(arrayLike).forEach(doSomething) - โ•ฐโ”€โ”€โ”€โ”€ - โš  eslint-plugin-unicorn(prefer-spread): Prefer the spread operator (`...`) over Array.from() โ•ญโ”€[prefer_spread.tsx:2:13] 1 โ”‚ const foo = []; @@ -845,13 +838,6 @@ source: crates/oxc_linter/src/tester.rs โ•ฐโ”€โ”€โ”€โ”€ help: The spread operator (`...`) is more concise and readable. - โš  eslint-plugin-unicorn(prefer-spread): Prefer the spread operator (`...`) over array.slice() - โ•ญโ”€[prefer_spread.tsx:1:1] - 1 โ”‚ new Uint8Array([10, 20, 30, 40, 50]).slice() - ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ - โ•ฐโ”€โ”€โ”€โ”€ - help: The spread operator (`...`) is more concise and readable. - โš  eslint-plugin-unicorn(prefer-spread): Prefer the spread operator (`...`) over array.slice() โ•ญโ”€[prefer_spread.tsx:1:1] 1 โ”‚ array.slice(0) @@ -916,10 +902,10 @@ source: crates/oxc_linter/src/tester.rs help: The spread operator (`...`) is more concise and readable. โš  eslint-plugin-unicorn(prefer-spread): Prefer the spread operator (`...`) over array.toSpliced() - โ•ญโ”€[prefer_spread.tsx:2:9] + โ•ญโ”€[prefer_spread.tsx:2:13] 1 โ”‚ bar() - 2 โ”‚ foo.toSpliced() - ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + 2 โ”‚ foo.toSpliced() + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ•ฐโ”€โ”€โ”€โ”€ help: The spread operator (`...`) is more concise and readable. @@ -973,10 +959,10 @@ source: crates/oxc_linter/src/tester.rs help: The spread operator (`...`) is more concise and readable. โš  eslint-plugin-unicorn(prefer-spread): Prefer the spread operator (`...`) over string.split() - โ•ญโ”€[prefer_spread.tsx:2:9] + โ•ญโ”€[prefer_spread.tsx:2:13] 1 โ”‚ bar() - 2 โ”‚ foo.split("") - ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + 2 โ”‚ foo.split("") + ยท โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ•ฐโ”€โ”€โ”€โ”€ help: The spread operator (`...`) is more concise and readable.