diff --git a/crates/oxc_linter/src/rules/unicorn/consistent_assert.rs b/crates/oxc_linter/src/rules/unicorn/consistent_assert.rs index d99935d0ce7cc..4f5c659db5f3c 100644 --- a/crates/oxc_linter/src/rules/unicorn/consistent_assert.rs +++ b/crates/oxc_linter/src/rules/unicorn/consistent_assert.rs @@ -10,8 +10,8 @@ use oxc_span::Span; use crate::{AstNode, context::LintContext, rule::Rule}; fn consistent_assert_diagnostic(assert_identifier: &str, span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Inconsistent assert usage") - .with_help(format!("Prefer {assert_identifier}.ok(...) over {assert_identifier}(...)")) + OxcDiagnostic::warn("Inconsistent assert usage.") + .with_help(format!("Prefer `{assert_identifier}.ok(...)` over `{assert_identifier}(...)`.")) .with_label(span) } @@ -25,7 +25,11 @@ declare_oxc_lint!( /// /// ### Why is this bad? /// - /// Inconsistent usage of the `assert` module can lead to confusion and errors. + /// Inconsistent usage of the `assert` module can make code + /// harder to follow and understand. + /// + /// `assert.ok(...)` is preferred as it makes the intent of + /// the assertion clearer. /// /// ### Examples /// diff --git a/crates/oxc_linter/src/rules/unicorn/explicit_length_check.rs b/crates/oxc_linter/src/rules/unicorn/explicit_length_check.rs index 8cafaafd5f46e..bc619e213eb57 100644 --- a/crates/oxc_linter/src/rules/unicorn/explicit_length_check.rs +++ b/crates/oxc_linter/src/rules/unicorn/explicit_length_check.rs @@ -58,10 +58,14 @@ pub struct ExplicitLengthCheck { declare_oxc_lint!( /// ### What it does /// - /// Enforce explicitly comparing the length or size property of a value. + /// Enforce explicitly comparing the `length` or `size` property of a value. /// /// ### Why is this bad? /// + /// Using the explicit `length` or `size` properties can help make code clearer + /// and easier to understand, as it avoids relying on implicit truthy/falsy + /// evaluations. + /// /// ### Examples /// /// Examples of **incorrect** code for this rule: @@ -80,6 +84,10 @@ declare_oxc_lint!( /// Examples of **correct** code for this rule: /// ```javascript /// const isEmpty = foo.length === 0; + /// + /// if (foo.length > 0 || bar.length > 0) {} + /// + /// const unicorn = foo.length > 0 ? 1 : 2; /// ``` ExplicitLengthCheck, unicorn, diff --git a/crates/oxc_linter/src/rules/unicorn/no_accessor_recursion.rs b/crates/oxc_linter/src/rules/unicorn/no_accessor_recursion.rs index 7be798517a13a..d28fb69fd936e 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_accessor_recursion.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_accessor_recursion.rs @@ -29,30 +29,43 @@ pub struct NoAccessorRecursion; declare_oxc_lint!( /// ### What it does /// - /// Disallow recursive access to this within getters and setters + /// Disallow recursive access to `this` within getters and setters. /// /// ### Why is this bad? /// - /// This rule prevents recursive access to this within getter and setter methods in objects and classes, - /// avoiding infinite recursion and stack overflow errors. + /// This rule prevents recursive access to `this` within getter and + /// setter methods in objects and classes, avoiding infinite recursion + /// and stack overflow errors. /// /// ### Examples /// /// Examples of **incorrect** code for this rule: /// ```js /// const foo = { - /// get bar() { - /// return this.bar; - /// } + /// get bar() { + /// return this.bar; + /// } + /// }; + /// + /// const baz = { + /// set bar(value) { + /// this.bar = value; + /// } /// }; /// ``` /// /// Examples of **correct** code for this rule: /// ```js /// const foo = { - /// get bar() { - /// return this.baz; - /// } + /// get bar() { + /// return this.qux; + /// } + /// }; + /// + /// const baz = { + /// set bar(value) { + /// this._bar = value; + /// } /// }; /// ``` NoAccessorRecursion, diff --git a/crates/oxc_linter/src/rules/unicorn/no_console_spaces.rs b/crates/oxc_linter/src/rules/unicorn/no_console_spaces.rs index 71557cd1d507a..40378ce4f818c 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_console_spaces.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_console_spaces.rs @@ -30,7 +30,9 @@ declare_oxc_lint!( /// /// ### Why is this bad? /// - /// The `console.log()` method and similar methods join the parameters with a space so adding a leading/trailing space to a parameter, results in two spaces being added. + /// The `console.log()` method and similar methods join the parameters + /// with a space so adding a leading/trailing space to a parameter, + /// results in two spaces being added. /// /// ### Examples /// diff --git a/crates/oxc_linter/src/rules/unicorn/no_document_cookie.rs b/crates/oxc_linter/src/rules/unicorn/no_document_cookie.rs index bd089f6e75ac4..7628c5e6cfb02 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_document_cookie.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_document_cookie.rs @@ -12,8 +12,9 @@ use crate::{ }; fn no_document_cookie_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Do not use `document.cookie` directly") - .with_help("Use the Cookie Store API or a cookie library instead") + OxcDiagnostic::warn("Do not use `document.cookie` directly.") + .with_help("Use the Cookie Store API or a cookie library instead.") + .with_note("https://developer.mozilla.org/en-US/docs/Web/API/Cookie_Store_API") .with_label(span) } @@ -23,7 +24,7 @@ pub struct NoDocumentCookie; declare_oxc_lint!( /// ### What it does /// - /// Disallow direct use of + /// Disallows direct use of /// [`document.cookie`](https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie). /// /// ### Why is this bad? @@ -33,7 +34,7 @@ declare_oxc_lint!( /// directly as it's easy to get the string wrong. Instead, you should use /// the [Cookie Store /// API](https://developer.mozilla.org/en-US/docs/Web/API/Cookie_Store_API) - /// or a [cookie library](https://www.npmjs.com/search?q=cookie). + /// or a [cookie library](https://npmx.dev/search?q=cookie). /// /// ### Examples /// diff --git a/crates/oxc_linter/src/rules/unicorn/no_hex_escape.rs b/crates/oxc_linter/src/rules/unicorn/no_hex_escape.rs index 124904d29375d..c6ce8affc3d8e 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_hex_escape.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_hex_escape.rs @@ -22,10 +22,15 @@ pub struct NoHexEscape; declare_oxc_lint!( /// ### What it does /// - /// Enforces a convention of using [Unicode escapes](https://mathiasbynens.be/notes/javascript-escapes#unicode) instead of [hexadecimal escapes](https://mathiasbynens.be/notes/javascript-escapes#hexadecimal) for consistency and clarity. + /// Enforces a convention of using [Unicode escapes](https://mathiasbynens.be/notes/javascript-escapes#unicode) + /// instead of [hexadecimal escapes](https://mathiasbynens.be/notes/javascript-escapes#hexadecimal) for + /// consistency and clarity. /// /// ### Why is this bad? /// + /// Using hexadecimal escapes can be less readable and harder to understand + /// when compared to Unicode escapes. + /// /// ### Examples /// /// Examples of **incorrect** code for this rule: diff --git a/crates/oxc_linter/src/rules/unicorn/no_instanceof_array.rs b/crates/oxc_linter/src/rules/unicorn/no_instanceof_array.rs index 5e95047dfc0b0..cb1288974e0c5 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_instanceof_array.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_instanceof_array.rs @@ -22,7 +22,8 @@ declare_oxc_lint!( /// /// ### Why is this bad? /// - /// The instanceof Array check doesn't work across realms/contexts, for example, frames/windows in browsers or the vm module in Node.js. + /// The `instanceof Array` check doesn't work across realms/contexts. + /// For example, frames/windows in browsers or the `vm` module in Node.js. /// /// ### Examples /// diff --git a/crates/oxc_linter/src/rules/unicorn/no_invalid_fetch_options.rs b/crates/oxc_linter/src/rules/unicorn/no_invalid_fetch_options.rs index fe36805481eb0..36452ecfc0f58 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_invalid_fetch_options.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_invalid_fetch_options.rs @@ -40,16 +40,16 @@ declare_oxc_lint!( /// /// Examples of **incorrect** code for this rule: /// ```javascript - /// const response = await fetch('/', {method: 'GET', body: 'foo=bar'}); + /// const response = await fetch('/', { method: 'GET', body: 'foo=bar' }); /// - /// const request = new Request('/', {method: 'GET', body: 'foo=bar'}); + /// const request = new Request('/', { method: 'GET', body: 'foo=bar' }); /// ``` /// /// Examples of **correct** code for this rule: /// ```javascript - /// const response = await fetch('/', {method: 'POST', body: 'foo=bar'}); + /// const response = await fetch('/', { method: 'POST', body: 'foo=bar' }); /// - /// const request = new Request('/', {method: 'POST', body: 'foo=bar'}); + /// const request = new Request('/', { method: 'POST', body: 'foo=bar' }); /// ``` NoInvalidFetchOptions, unicorn, diff --git a/crates/oxc_linter/src/rules/unicorn/no_magic_array_flat_depth.rs b/crates/oxc_linter/src/rules/unicorn/no_magic_array_flat_depth.rs index 17458c7fdde21..17aa07436d38d 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_magic_array_flat_depth.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_magic_array_flat_depth.rs @@ -20,11 +20,15 @@ pub struct NoMagicArrayFlatDepth; declare_oxc_lint!( /// ### What it does /// - /// Disallow magic numbers for `Array.prototype.flat` depth. + /// Disallow magic numbers for [`Array.prototype.flat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat) + /// depth. /// /// ### Why is this bad? /// - /// Magic numbers are hard to understand and maintain. When calling `Array.prototype.flat`, it is usually called with `1` or infinity. If you are using a different number, it is better to add a comment explaining the depth. + /// Magic numbers are hard to understand and maintain. + /// When calling `Array.prototype.flat`, it is usually called with + /// `1` or `Infinity`. If you are using a different number, it is + /// better to add a comment explaining the reason for the depth provided. /// /// ### Examples /// diff --git a/crates/oxc_linter/src/rules/unicorn/no_process_exit.rs b/crates/oxc_linter/src/rules/unicorn/no_process_exit.rs index 8d74356cabba6..d1b7a9068fbd6 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_process_exit.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_process_exit.rs @@ -17,27 +17,34 @@ pub struct NoProcessExit; declare_oxc_lint!( /// ### What it does /// - /// Disallow `process.exit()`. + /// Disallow all usage of `process.exit()`. /// /// ### Why is this bad? /// - /// Only use `process.exit()` in CLI apps. Throw an error instead. + /// `process.exit()` should generally only be used in command-line utilities. In all other + /// types of applications, the code should throw an error instead. /// /// ### Examples /// /// Examples of **incorrect** code for this rule: /// ```javascript - /// if (problem) process.exit(1); + /// if (problem) { + /// process.exit(1); + /// } /// ``` /// /// Examples of **correct** code for this rule: /// ```javascript - /// if (problem) throw new Error("message"); + /// if (problem) { + /// throw new Error("message"); + /// } /// ``` /// /// ``` /// #!/usr/bin/env node - /// if (problem) process.exit(1); + /// if (problem) { + /// process.exit(1); + /// } /// ``` NoProcessExit, unicorn, diff --git a/crates/oxc_linter/src/rules/unicorn/no_single_promise_in_promise_methods.rs b/crates/oxc_linter/src/rules/unicorn/no_single_promise_in_promise_methods.rs index 0a9f6c436b5a3..899474a80f080 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_single_promise_in_promise_methods.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_single_promise_in_promise_methods.rs @@ -23,7 +23,7 @@ pub struct NoSinglePromiseInPromiseMethods; declare_oxc_lint!( /// ### What it does /// - /// Disallow passing single-element arrays to Promise methods + /// Disallow passing single-element arrays to `Promise` methods. /// /// ### Why is this bad? /// @@ -35,21 +35,21 @@ declare_oxc_lint!( /// Examples of **incorrect** code for this rule: /// ```javascript /// async function bad() { - /// const foo = await Promise.all([promise]); - /// const foo = await Promise.any([promise]); - /// const foo = await Promise.race([promise]); - /// const promise = Promise.all([nonPromise]); + /// const foo = await Promise.all([promise]); + /// const foo = await Promise.any([promise]); + /// const foo = await Promise.race([promise]); + /// const promise = Promise.all([nonPromise]); /// } /// ``` /// /// Examples of **correct** code for this rule: /// ```javascript /// async function good() { - /// const foo = await promise; - /// const promise = Promise.resolve(nonPromise); - /// const foo = await Promise.all(promises); - /// const foo = await Promise.any([promise, anotherPromise]); - /// const [{ value: foo, reason: error }] = await Promise.allSettled([promise]); + /// const foo = await promise; + /// const promise = Promise.resolve(nonPromise); + /// const foo = await Promise.all(promises); + /// const foo = await Promise.any([promise, anotherPromise]); + /// const [{ value: foo, reason: error }] = await Promise.allSettled([promise]); /// } /// ``` NoSinglePromiseInPromiseMethods, diff --git a/crates/oxc_linter/src/rules/unicorn/no_static_only_class.rs b/crates/oxc_linter/src/rules/unicorn/no_static_only_class.rs index 4e54d70ba45e6..609d0dfbeb3e5 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_static_only_class.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_static_only_class.rs @@ -6,7 +6,7 @@ use oxc_span::{GetSpan, Span}; use crate::{AstNode, context::LintContext, rule::Rule}; fn no_static_only_class_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Use an object instead of a class with only static members.") + OxcDiagnostic::warn("Use an object instead of a `class` with only `static` members.") .with_label(span) } @@ -16,39 +16,39 @@ pub struct NoStaticOnlyClass; declare_oxc_lint!( /// ### What it does /// - /// Disallow classes that only have static members. + /// Disallow `class` declarations that exclusively contain `static` members. /// /// ### Why is this bad? /// - /// A class with only static members could just be an object instead. + /// A `class` with only `static` members should just be defined as an object instead. /// /// ### Examples /// /// Examples of **incorrect** code for this rule: /// ```javascript /// class A { - /// static a() {} + /// static a() {} /// } /// ``` /// /// Examples of **correct** code for this rule: /// ```javascript /// class A { - /// static a() {} + /// static a() {} /// - /// constructor() {} + /// constructor() {} /// } /// ``` /// ```javascript /// const X = { - /// foo: false, - /// bar() {} + /// foo: false, + /// bar() {} /// }; /// ``` /// ```javascript /// class X { - /// static #foo = false; // private field - /// static bar() {} + /// static #foo = false; // private field + /// static bar() {} /// } /// ``` NoStaticOnlyClass, diff --git a/crates/oxc_linter/src/rules/unicorn/no_thenable.rs b/crates/oxc_linter/src/rules/unicorn/no_thenable.rs index 4be0772e64f36..4624e1b6548f1 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_thenable.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_thenable.rs @@ -35,40 +35,40 @@ pub struct NoThenable; declare_oxc_lint!( /// ### What it does /// - /// Disallow `then` property + /// Disallow defining a `then` property. /// /// ### Why is this bad? /// /// If an object is defined as "thenable", once it's accidentally - /// used in an await expression, it may cause problems: + /// used in an `await` expression, it may cause problems. /// /// ### Examples /// /// Examples of **incorrect** code for this rule: /// ```javascript - /// async function example() { - /// const foo = { - /// unicorn: 1, - /// then() {}, - /// }; + /// async function example() { + /// const foo = { + /// unicorn: 1, + /// then() {}, + /// }; /// - /// const { unicorn } = await foo; + /// const { unicorn } = await foo; /// - /// console.log('after'); //<- This will never execute + /// console.log('after'); // <- This will never execute /// } /// ``` /// /// Examples of **correct** code for this rule: /// ```javascript - /// async function example() { - /// const foo = { - /// unicorn: 1, - /// bar() {}, - /// }; + /// async function example() { + /// const foo = { + /// unicorn: 1, + /// bar() {}, + /// }; /// - /// const { unicorn } = await foo; + /// const { unicorn } = await foo; /// - /// console.log('after'); + /// console.log('after'); /// } /// ``` NoThenable, diff --git a/crates/oxc_linter/src/rules/unicorn/no_unnecessary_slice_end.rs b/crates/oxc_linter/src/rules/unicorn/no_unnecessary_slice_end.rs index 8fec6154965e0..e4c1c221d17d9 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_unnecessary_slice_end.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_unnecessary_slice_end.rs @@ -25,13 +25,14 @@ pub struct NoUnnecessarySliceEnd; declare_oxc_lint!( /// ### What it does /// - /// Omitting the end argument defaults it to the object's .length. - /// Passing it explicitly or using Infinity is unnecessary + /// Disallows unnecessarily passing a second argument to `slice(...)`, for + /// cases where it would not change the result. /// /// ### Why is this bad? /// - /// In JavaScript, omitting the end index already causes .slice() to run to the end of the target, - /// so explicitly passing its length or Infinity is redundant. + /// When using `.slice(...)` without a second argument, the second argument + /// defaults to the object's length. As such, passing the length explicitly + /// - or using `Infinity` - is unnecessary. /// /// ### Examples /// diff --git a/crates/oxc_linter/src/rules/unicorn/no_unreadable_array_destructuring.rs b/crates/oxc_linter/src/rules/unicorn/no_unreadable_array_destructuring.rs index ed6a4b127a027..621785a7d6adc 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_unreadable_array_destructuring.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_unreadable_array_destructuring.rs @@ -17,23 +17,30 @@ pub struct NoUnreadableArrayDestructuring; declare_oxc_lint!( /// ### What it does /// - /// Disallow unreadable array destructuring + /// Disallows destructuring values from an array in ways that are difficult to read. /// /// ### Why is this bad? /// - /// Destructuring is very useful, but it can also make some code harder to read. - /// This rule prevents ignoring consecutive values when destructuring from an array. + /// Destructuring can be very useful, but it can also make some code harder to read. + /// This rule prevents ignoring consecutive values (e.g. `let [,,foo] = array`) + /// when destructuring from an array. /// /// ### Examples /// /// Examples of **incorrect** code for this rule: /// ```javascript /// const [,, foo] = parts; + /// const [,,...rest] = parts; /// ``` /// /// Examples of **correct** code for this rule: /// ```javascript /// const [foo] = parts; + /// const foo = parts[3]; + /// const rest = parts.slice(2); + /// + /// // One is fine + /// const [, foo] = parts; /// ``` NoUnreadableArrayDestructuring, unicorn, diff --git a/crates/oxc_linter/src/rules/unicorn/no_useless_collection_argument.rs b/crates/oxc_linter/src/rules/unicorn/no_useless_collection_argument.rs index a04454a0eaa2b..0fba320061e8a 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_useless_collection_argument.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_useless_collection_argument.rs @@ -26,12 +26,15 @@ pub struct NoUselessCollectionArgument; declare_oxc_lint!( /// ### What it does /// - /// Disallow useless values or fallbacks in Set, Map, WeakSet, or WeakMap + /// Disallow useless values or fallbacks in `Set`, `Map`, `WeakSet`, or `WeakMap`. /// /// ### Why is this bad? /// - /// It's unnecessary to pass an empty array or string when constructing a Set, Map, WeakSet, or WeakMap, since they accept nullish values. - /// It's also unnecessary to provide a fallback for possible nullish values. + /// It is unnecessary to pass an empty array or empty string when + /// constructing a `Set`, `Map`, `WeakSet`, or `WeakMap`, since + /// they accept nullish values. + /// + /// It is also unnecessary to provide a fallback for possible nullish values. /// /// ### Examples /// @@ -45,6 +48,7 @@ declare_oxc_lint!( /// ```js /// const set = new Set(); /// ``` + /// /// Examples of **incorrect** code for this rule: /// ```js /// const set = new Set(foo ?? []); diff --git a/crates/oxc_linter/src/rules/unicorn/no_useless_promise_resolve_reject.rs b/crates/oxc_linter/src/rules/unicorn/no_useless_promise_resolve_reject.rs index ab1795db99e9d..a51d1669dcb18 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_useless_promise_resolve_reject.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_useless_promise_resolve_reject.rs @@ -41,11 +41,19 @@ pub struct NoUselessPromiseResolveRejectOptions { declare_oxc_lint!( /// ### What it does /// - /// Disallows returning values wrapped in `Promise.resolve` or `Promise.reject` in an async function or a `Promise#then`/`catch`/`finally` callback. + /// Disallows returning values wrapped in `Promise.resolve` or `Promise.reject` + /// in an async function or a `Promise#then`/`catch`/`finally` callback. /// /// ### Why is this bad? /// - /// Wrapping a return value in `Promise.resolve` in an async function or a `Promise#then`/`catch`/`finally` callback is unnecessary as all return values in async functions and promise callback functions are already wrapped in a `Promise`. Similarly, returning an error wrapped in `Promise.reject` is equivalent to simply `throw`ing the error. This is the same for `yield`ing in async generators as well. + /// Wrapping a return value in `Promise.resolve` in an async function + /// or a `Promise#then`/`catch`/`finally` callback is unnecessary as all + /// return values in async functions and promise callback functions are + /// already wrapped in a `Promise`. + /// + /// Similarly, returning an error wrapped in `Promise.reject` is equivalent + /// to simply `throw`ing the error. This is the same for `yield`ing in + /// async generators as well. /// /// ### Examples /// diff --git a/crates/oxc_linter/src/rules/unicorn/no_useless_switch_case.rs b/crates/oxc_linter/src/rules/unicorn/no_useless_switch_case.rs index 4bc048fedcb7d..1a7abdfacf67b 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_useless_switch_case.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_useless_switch_case.rs @@ -18,31 +18,32 @@ pub struct NoUselessSwitchCase; declare_oxc_lint!( /// ### What it does /// - /// Disallows useless default cases in switch statements. + /// Disallows useless `default` cases in `switch` statements. /// /// ### Why is this bad? /// - /// An empty case before the last default case is useless. + /// An empty case before the last `default` case is useless, as the + /// `default` case will catch it regardless. /// /// ### Examples /// /// Examples of **incorrect** code for this rule: /// ```javascript /// switch (foo) { - /// case 1: - /// default: - /// handleDefaultCase(); - /// break; + /// case 1: + /// default: + /// handleDefaultCase(); + /// break; /// } /// ``` /// /// Examples of **correct** code for this rule: /// ```javascript /// switch (foo) { - /// case 1: - /// case 2: - /// handleCase1And2(); - /// break; + /// case 1: + /// case 2: + /// handleCase1And2(); + /// break; /// } /// ``` NoUselessSwitchCase, diff --git a/crates/oxc_linter/src/rules/unicorn/no_useless_undefined.rs b/crates/oxc_linter/src/rules/unicorn/no_useless_undefined.rs index d2bc1f60a03f4..310cd18872c7a 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_useless_undefined.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_useless_undefined.rs @@ -33,7 +33,7 @@ fn no_useless_undefined_diagnostic_spans(spans: Vec) -> OxcDiagnostic { pub struct NoUselessUndefined { /// Whether to check for useless `undefined` in function call arguments. check_arguments: bool, - ///Whether to check for useless `undefined` in arrow function bodies. + /// Whether to check for useless `undefined` in arrow function bodies. check_arrow_function_body: bool, } @@ -46,22 +46,32 @@ impl Default for NoUselessUndefined { declare_oxc_lint!( /// ### What it does /// - /// Do not use useless `undefined`. + /// Prevents usage of `undefined` in cases where it would be useless. + /// + /// ::: warning + /// This rule can conflict with the default behaviors of the `eslint/array-callback-return` + /// and `eslint/getter-return` rules. For both rules, you can set + /// the `allowImplicit` option to avoid conflicts. + /// ::: /// /// ### Why is this bad? /// - /// `undefined` is the default value for new variables, parameters, return statements, etc… so specifying it doesn't make any difference. + /// `undefined` is the default value for new variables, parameters, + /// return statements, etc, so specifying `undefined` in these cases + /// is pointless. /// /// ### Examples /// /// Examples of **incorrect** code for this rule: /// ```javascript /// let foo = undefined; + /// const noop = () => undefined; /// ``` /// /// Examples of **correct** code for this rule: /// ```javascript /// let foo; + /// const noop = () => {}; /// ``` NoUselessUndefined, unicorn, diff --git a/crates/oxc_linter/src/rules/unicorn/numeric_separators_style.rs b/crates/oxc_linter/src/rules/unicorn/numeric_separators_style.rs index 206f4dbe6456c..de2f1142b365a 100644 --- a/crates/oxc_linter/src/rules/unicorn/numeric_separators_style.rs +++ b/crates/oxc_linter/src/rules/unicorn/numeric_separators_style.rs @@ -91,10 +91,20 @@ declare_oxc_lint!( /// /// ### Why is this bad? /// - /// Long numbers can become really hard to read, so cutting it into groups of digits, - /// separated with a _, is important to keep your code clear. This rule also enforces - /// a proper usage of the numeric separator, by checking if the groups of digits are - /// of the correct size. + /// A long series of digits can be difficult to read, and + /// it can be difficult to determine the value of the number at a glance. + /// Breaking up the digits with numeric separators (`_`) can greatly + /// improve readability. + /// + /// Compare the following two numbers and how easy it is to understand their magnitude: + /// + /// ```js + /// 1000000000; + /// 1_000_000_000; + /// ``` + /// + /// This rule also enforces proper group size, for example + /// enforcing that the `_` separator is used every 3 digits. /// /// ### Examples /// diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_at.rs b/crates/oxc_linter/src/rules/unicorn/prefer_at.rs index 41bad3fbda636..a57eb5fa164a2 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_at.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_at.rs @@ -24,8 +24,9 @@ use crate::{ }; fn prefer_at_diagnostic(span: Span, method: &str) -> OxcDiagnostic { - OxcDiagnostic::warn(format!("Prefer `.at()` over `{method}`")) - .with_help("Use `.at()` for index access") + OxcDiagnostic::warn(format!("Prefer `.at()` over `{method}`.")) + .with_help("Use `.at()` for index access.") + .with_note("https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at") .with_label(span) } @@ -54,12 +55,16 @@ impl std::ops::Deref for PreferAt { declare_oxc_lint!( /// ### What it does /// - /// Prefer `.at()` method for index access and `String#charAt()`. + /// Prefer the [`Array#at()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at) and + /// [`String#at()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/at) + /// methods for index access. + /// + /// This rule also discourages using [`String#charAt()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt). /// /// ### Why is this bad? /// /// The `.at()` method is more readable and consistent for accessing elements by index, - /// especially for negative indices which access elements from the end. + /// especially for negative indices which access elements from the end of the array or string. /// /// ### Examples /// diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_class_fields.rs b/crates/oxc_linter/src/rules/unicorn/prefer_class_fields.rs index 999b01479efde..340cbbb71a3b8 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_class_fields.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_class_fields.rs @@ -44,18 +44,40 @@ declare_oxc_lint!( /// ### Examples /// /// Examples of **incorrect** code for this rule: - /// ```js + /// ```ts + /// class Foo { + /// constructor() { + /// this.bar = 1; + /// } + /// } + /// + /// class MyError extends Error { + /// constructor(message: string) { + /// super(message); + /// this.name = 'MyError'; + /// } + /// } + /// /// class Foo { - /// constructor() { - /// this.bar = 1; - /// } + /// foo = "foo"; + /// constructor() { + /// this.foo = "bar"; + /// } /// } /// ``` /// /// Examples of **correct** code for this rule: /// ```js /// class Foo { - /// bar = 1; + /// bar = 1; + /// } + /// + /// class MyError extends Error { + /// name = "MyError"; + /// } + /// + /// class Foo { + /// foo = "bar"; /// } /// ``` PreferClassFields, diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_event_target.rs b/crates/oxc_linter/src/rules/unicorn/prefer_event_target.rs index 95310c3c81a52..52745cb1504b2 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_event_target.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_event_target.rs @@ -15,8 +15,9 @@ use crate::{ const IGNORED_PACKAGES: [&str; 2] = ["@angular/core", "eventemitter3"]; fn prefer_event_target_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Prefer `EventTarget` over `EventEmitter`") + OxcDiagnostic::warn("Prefer `EventTarget` over `EventEmitter`.") .with_help("Change `EventEmitter` to `EventTarget`. EventEmitters are only available in Node.js, while EventTargets are also available in browsers.") + .with_note("https://developer.mozilla.org/en-US/docs/Web/API/EventTarget") .with_label(span) } diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_global_this.rs b/crates/oxc_linter/src/rules/unicorn/prefer_global_this.rs index ce5660d2e08f8..b1af97b3e8220 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_global_this.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_global_this.rs @@ -9,6 +9,7 @@ use crate::{AstNode, context::LintContext, rule::Rule}; fn prefer_global_this_diagnostic(span: Span) -> OxcDiagnostic { OxcDiagnostic::warn("Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`.") .with_help("Replace the alias with `globalThis`.") + .with_note("https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis") .with_label(span) } @@ -20,15 +21,17 @@ declare_oxc_lint!( /// /// Enforces the use of [`globalThis`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis) instead of /// environment‑specific global object aliases (`window`, `self`, or `global`). + /// /// Using the standard `globalThis` makes your code portable across browsers, Web Workers, Node.js, /// and future JavaScript runtimes. /// /// ### Why is this bad? /// - /// • **Portability** – `window` is only defined in browser main threads, `self` is used in Web Workers, - /// and `global` is Node‑specific. Choosing the wrong alias causes runtime crashes when the code is + /// **Portability** – `window` is only defined in browser main threads, `self` is used in Web Workers, + /// and `global` is Node‑specific. Choosing the wrong alias causes runtime crashes when the code is /// executed outside of its original environment. - /// • **Clarity** – `globalThis` clearly communicates that you are referring to the global object itself + /// + /// **Clarity** – `globalThis` clearly communicates that you are referring to the global object itself /// rather than a particular platform. /// /// ### Examples diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_keyboard_event_key.rs b/crates/oxc_linter/src/rules/unicorn/prefer_keyboard_event_key.rs index 53a086736a7a0..c39248ab229de 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_keyboard_event_key.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_keyboard_event_key.rs @@ -18,6 +18,7 @@ use crate::{AstNode, context::LintContext, rule::Rule}; fn prefer_keyboard_event_key_diagnostic(span: Span, deprecated_prop: &str) -> OxcDiagnostic { OxcDiagnostic::warn(format!("Use `.key` instead of `.{deprecated_prop}`")) .with_help(format!("The `{deprecated_prop}` property is deprecated.")) + .with_note("https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key") .with_label(span) } @@ -27,38 +28,42 @@ pub struct PreferKeyboardEventKey; declare_oxc_lint!( /// ### What it does /// - /// Enforces the use of [`KeyboardEvent#key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) over [`KeyboardEvent#keyCode`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode) which is deprecated. + /// Enforces the use of [`KeyboardEvent#key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) + /// over [`KeyboardEvent#keyCode`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode), + /// which is deprecated. + /// /// The `.key` property is also more semantic and readable. /// /// ### Why is this bad? /// - /// The `keyCode`, `which`, and `charCode` properties are deprecated and should be avoided in favor of the `key` property. + /// The `keyCode`, `which`, and `charCode` properties are deprecated + /// and should be avoided in favor of the `key` property. /// /// ### Examples /// /// Examples of **incorrect** code for this rule: /// ```js /// window.addEventListener('keydown', event => { - /// if (event.keyCode === 8) { - /// console.log('Backspace was pressed'); - /// } + /// if (event.keyCode === 8) { + /// console.log('Backspace was pressed'); + /// } /// }); /// /// window.addEventListener('keydown', event => { - /// console.log(event.keyCode); + /// console.log(event.keyCode); /// }); /// ``` /// /// Examples of **correct** code for this rule: /// ```js /// window.addEventListener('keydown', event => { - /// if (event.key === 'Backspace') { - /// console.log('Backspace was pressed'); - /// } + /// if (event.key === 'Backspace') { + /// console.log('Backspace was pressed'); + /// } /// }); /// /// window.addEventListener('click', event => { - /// console.log(event.key); + /// console.log(event.key); /// }); /// ``` PreferKeyboardEventKey, diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_negative_index.rs b/crates/oxc_linter/src/rules/unicorn/prefer_negative_index.rs index 585fd2d095867..2ec26647ea2a1 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_negative_index.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_negative_index.rs @@ -31,11 +31,12 @@ enum TypeOptions { declare_oxc_lint!( /// ### What it does /// - /// Prefer negative index over `.length` - index when possible + /// Prefer using a negative index over `.length - index` when possible. /// /// ### Why is this bad? /// - /// Conciseness and readability + /// Using a negative index with `at` or `slice` is generally more readable + /// and concise than using `.length - index`. /// /// ### Examples /// diff --git a/crates/oxc_linter/src/rules/vue/max_props.rs b/crates/oxc_linter/src/rules/vue/max_props.rs index 22cf0d7f63631..a587bd623325d 100644 --- a/crates/oxc_linter/src/rules/vue/max_props.rs +++ b/crates/oxc_linter/src/rules/vue/max_props.rs @@ -23,16 +23,18 @@ use crate::{ }; fn max_props_diagnostic(span: Span, cur: usize, limit: usize) -> OxcDiagnostic { - let msg = format!("Component has too many props ({cur}). Maximum allowed is {limit}."); + let msg = format!("This component has too many props ({cur}). Maximum allowed is {limit}."); OxcDiagnostic::warn(msg) - .with_help("Consider refactoring the component by reducing the number of props.") + .with_help( + "Consider refactoring the component to reduce the number of props that are needed.", + ) .with_label(span) } #[derive(Debug, Clone, JsonSchema, Deserialize)] #[serde(rename_all = "camelCase", default, deny_unknown_fields)] pub struct MaxProps { - /// The maximum number of props allowed in a Vue Single File Component (SFC). + /// The maximum number of props allowed in a Vue SFC. max_props: usize, } @@ -45,12 +47,16 @@ impl Default for MaxProps { declare_oxc_lint!( /// ### What it does /// - /// Enforce maximum number of props in Vue component. + /// Enforce a maximum number of props defined for a given Vue component. /// /// ### Why is this bad? /// - /// This rule enforces a maximum number of props in a Vue SFC, - /// in order to aid in maintainability and reduce complexity. + /// A large number of props on a component can indicate that it is trying + /// to do too much and may be difficult to maintain or understand. + /// + /// By limiting the number of props, developers are encouraged to avoid + /// overly complex components and instead create smaller, more focused + /// components that are easier to reason about. /// /// ### Examples /// diff --git a/crates/oxc_linter/src/snapshots/unicorn_consistent_assert.snap b/crates/oxc_linter/src/snapshots/unicorn_consistent_assert.snap index 2a656cd7094ab..36a460b908825 100644 --- a/crates/oxc_linter/src/snapshots/unicorn_consistent_assert.snap +++ b/crates/oxc_linter/src/snapshots/unicorn_consistent_assert.snap @@ -2,198 +2,198 @@ source: crates/oxc_linter/src/tester.rs --- - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:2:13] 1 │ import assert from 'assert'; 2 │ assert(foo) · ────── ╰──── - help: Prefer assert.ok(...) over assert(...) + help: Prefer `assert.ok(...)` over `assert(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:2:13] 1 │ import assert from 'node:assert'; 2 │ assert(foo) · ────── ╰──── - help: Prefer assert.ok(...) over assert(...) + help: Prefer `assert.ok(...)` over `assert(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:2:13] 1 │ import assert from 'assert/strict'; 2 │ assert(foo) · ────── ╰──── - help: Prefer assert.ok(...) over assert(...) + help: Prefer `assert.ok(...)` over `assert(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:2:13] 1 │ import assert from 'node:assert/strict'; 2 │ assert(foo) · ────── ╰──── - help: Prefer assert.ok(...) over assert(...) + help: Prefer `assert.ok(...)` over `assert(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:2:13] 1 │ import customAssert from 'assert'; 2 │ customAssert(foo) · ──────────── ╰──── - help: Prefer customAssert.ok(...) over customAssert(...) + help: Prefer `customAssert.ok(...)` over `customAssert(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:2:13] 1 │ import customAssert from 'node:assert'; 2 │ customAssert(foo) · ──────────── ╰──── - help: Prefer customAssert.ok(...) over customAssert(...) + help: Prefer `customAssert.ok(...)` over `customAssert(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:2:13] 1 │ import assert from 'assert'; 2 │ assert(foo) · ────── 3 │ assert(bar) ╰──── - help: Prefer assert.ok(...) over assert(...) + help: Prefer `assert.ok(...)` over `assert(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:3:13] 2 │ assert(foo) 3 │ assert(bar) · ────── 4 │ assert(baz) ╰──── - help: Prefer assert.ok(...) over assert(...) + help: Prefer `assert.ok(...)` over `assert(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:4:13] 3 │ assert(bar) 4 │ assert(baz) · ────── ╰──── - help: Prefer assert.ok(...) over assert(...) + help: Prefer `assert.ok(...)` over `assert(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:2:13] 1 │ import {strict} from 'assert'; 2 │ strict(foo) · ────── ╰──── - help: Prefer strict.ok(...) over strict(...) + help: Prefer `strict.ok(...)` over `strict(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:2:13] 1 │ import {strict as assert} from 'assert'; 2 │ assert(foo) · ────── ╰──── - help: Prefer assert.ok(...) over assert(...) + help: Prefer `assert.ok(...)` over `assert(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:5:13] 4 │ import i, {default as j} from 'assert/strict'; 5 │ a(foo); · ─ 6 │ b(foo); ╰──── - help: Prefer a.ok(...) over a(...) + help: Prefer `a.ok(...)` over `a(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:6:13] 5 │ a(foo); 6 │ b(foo); · ─ 7 │ c(foo); ╰──── - help: Prefer b.ok(...) over b(...) + help: Prefer `b.ok(...)` over `b(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:7:13] 6 │ b(foo); 7 │ c(foo); · ─ 8 │ d(foo); ╰──── - help: Prefer c.ok(...) over c(...) + help: Prefer `c.ok(...)` over `c(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:8:13] 7 │ c(foo); 8 │ d(foo); · ─ 9 │ e(foo); ╰──── - help: Prefer d.ok(...) over d(...) + help: Prefer `d.ok(...)` over `d(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:9:13] 8 │ d(foo); 9 │ e(foo); · ─ 10 │ f(foo); ╰──── - help: Prefer e.ok(...) over e(...) + help: Prefer `e.ok(...)` over `e(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:10:13] 9 │ e(foo); 10 │ f(foo); · ─ 11 │ g(foo); ╰──── - help: Prefer f.ok(...) over f(...) + help: Prefer `f.ok(...)` over `f(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:11:13] 10 │ f(foo); 11 │ g(foo); · ─ 12 │ h(foo); ╰──── - help: Prefer g.ok(...) over g(...) + help: Prefer `g.ok(...)` over `g(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:12:13] 11 │ g(foo); 12 │ h(foo); · ─ 13 │ i(foo); ╰──── - help: Prefer h.ok(...) over h(...) + help: Prefer `h.ok(...)` over `h(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:13:13] 12 │ h(foo); 13 │ i(foo); · ─ 14 │ j(foo); ╰──── - help: Prefer i.ok(...) over i(...) + help: Prefer `i.ok(...)` over `i(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:14:13] 13 │ i(foo); 14 │ j(foo); · ─ ╰──── - help: Prefer j.ok(...) over j(...) + help: Prefer `j.ok(...)` over `j(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:2:13] 1 │ import assert from 'node:assert'; 2 │ assert?.(foo) · ────── ╰──── - help: Prefer assert.ok(...) over assert(...) + help: Prefer `assert.ok(...)` over `assert(...)`. - ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage + ⚠ eslint-plugin-unicorn(consistent-assert): Inconsistent assert usage. ╭─[consistent_assert.tsx:5:21] 4 │ /* comment */ 5 │ assert · ────── 6 │ /* comment */ ╰──── - help: Prefer assert.ok(...) over assert(...) + help: Prefer `assert.ok(...)` over `assert(...)`. diff --git a/crates/oxc_linter/src/snapshots/unicorn_no_document_cookie.snap b/crates/oxc_linter/src/snapshots/unicorn_no_document_cookie.snap index e7c0018bcfe55..7624e475fed51 100644 --- a/crates/oxc_linter/src/snapshots/unicorn_no_document_cookie.snap +++ b/crates/oxc_linter/src/snapshots/unicorn_no_document_cookie.snap @@ -2,65 +2,74 @@ source: crates/oxc_linter/src/tester.rs --- - ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly + ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly. ╭─[no_document_cookie.tsx:1:1] 1 │ document.cookie = "foo=bar" · ─────────────── ╰──── - help: Use the Cookie Store API or a cookie library instead + help: Use the Cookie Store API or a cookie library instead. + note: https://developer.mozilla.org/en-US/docs/Web/API/Cookie_Store_API - ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly + ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly. ╭─[no_document_cookie.tsx:1:1] 1 │ document.cookie += ";foo=bar" · ─────────────── ╰──── - help: Use the Cookie Store API or a cookie library instead + help: Use the Cookie Store API or a cookie library instead. + note: https://developer.mozilla.org/en-US/docs/Web/API/Cookie_Store_API - ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly + ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly. ╭─[no_document_cookie.tsx:1:1] 1 │ document.cookie = document.cookie + ";foo=bar" · ─────────────── ╰──── - help: Use the Cookie Store API or a cookie library instead + help: Use the Cookie Store API or a cookie library instead. + note: https://developer.mozilla.org/en-US/docs/Web/API/Cookie_Store_API - ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly + ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly. ╭─[no_document_cookie.tsx:1:1] 1 │ document.cookie &&= true · ─────────────── ╰──── - help: Use the Cookie Store API or a cookie library instead + help: Use the Cookie Store API or a cookie library instead. + note: https://developer.mozilla.org/en-US/docs/Web/API/Cookie_Store_API - ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly + ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly. ╭─[no_document_cookie.tsx:1:7] 1 │ foo = document.cookie = "foo=bar" · ─────────────── ╰──── - help: Use the Cookie Store API or a cookie library instead + help: Use the Cookie Store API or a cookie library instead. + note: https://developer.mozilla.org/en-US/docs/Web/API/Cookie_Store_API - ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly + ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly. ╭─[no_document_cookie.tsx:1:21] 1 │ var doc = document; doc.cookie = "foo=bar" · ────────── ╰──── - help: Use the Cookie Store API or a cookie library instead + help: Use the Cookie Store API or a cookie library instead. + note: https://developer.mozilla.org/en-US/docs/Web/API/Cookie_Store_API - ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly + ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly. ╭─[no_document_cookie.tsx:1:21] 1 │ let doc = document; doc.cookie = "foo=bar" · ────────── ╰──── - help: Use the Cookie Store API or a cookie library instead + help: Use the Cookie Store API or a cookie library instead. + note: https://developer.mozilla.org/en-US/docs/Web/API/Cookie_Store_API - ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly + ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly. ╭─[no_document_cookie.tsx:1:34] 1 │ const doc = globalThis.document; doc.cookie = "foo=bar" · ────────── ╰──── - help: Use the Cookie Store API or a cookie library instead + help: Use the Cookie Store API or a cookie library instead. + note: https://developer.mozilla.org/en-US/docs/Web/API/Cookie_Store_API - ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly + ⚠ eslint-plugin-unicorn(no-document-cookie): Do not use `document.cookie` directly. ╭─[no_document_cookie.tsx:1:1] 1 │ window.document.cookie = "foo=bar" · ────────────────────── ╰──── - help: Use the Cookie Store API or a cookie library instead + help: Use the Cookie Store API or a cookie library instead. + note: https://developer.mozilla.org/en-US/docs/Web/API/Cookie_Store_API diff --git a/crates/oxc_linter/src/snapshots/unicorn_no_static_only_class.snap b/crates/oxc_linter/src/snapshots/unicorn_no_static_only_class.snap index 8d4244f9ccaa1..dd2895323c2e5 100644 --- a/crates/oxc_linter/src/snapshots/unicorn_no_static_only_class.snap +++ b/crates/oxc_linter/src/snapshots/unicorn_no_static_only_class.snap @@ -2,61 +2,61 @@ source: crates/oxc_linter/src/tester.rs --- - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:1] 1 │ class A { static a() {}; } · ────────────────────────── ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:1] 1 │ class A { static a() {} } · ───────────────────────── ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:11] 1 │ const A = class A { static a() {}; } · ────────────────────────── ╰──── - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:11] 1 │ const A = class { static a() {}; } · ──────────────────────── ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:1] 1 │ class A { static constructor() {}; } · ──────────────────────────────────── ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:16] 1 │ export default class A { static a() {}; } · ────────────────────────── ╰──── - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:16] 1 │ export default class { static a() {}; } · ──────────────────────── ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:8] 1 │ export class A { static a() {}; } · ────────────────────────── ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:2:24] 1 │ function a() { 2 │ ╭─▶ return class @@ -67,7 +67,7 @@ source: crates/oxc_linter/src/tester.rs ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:2:24] 1 │ function a() { 2 │ ╭─▶ return class /* comment */ @@ -78,7 +78,7 @@ source: crates/oxc_linter/src/tester.rs ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:2:24] 1 │ function a() { 2 │ ╭─▶ return class // comment @@ -89,7 +89,7 @@ source: crates/oxc_linter/src/tester.rs ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:1] 1 │ class A {static a(){}} · ────────────────────── @@ -97,7 +97,7 @@ source: crates/oxc_linter/src/tester.rs ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:1] 1 │ class A {static a(){}} · ────────────────────── @@ -105,7 +105,7 @@ source: crates/oxc_linter/src/tester.rs ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:1] 1 │ class A {static a(){}} · ────────────────────── @@ -113,7 +113,7 @@ source: crates/oxc_linter/src/tester.rs ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:1] 1 │ ╭─▶ class A { 2 │ │ static a @@ -126,7 +126,7 @@ source: crates/oxc_linter/src/tester.rs ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:1] 1 │ ╭─▶ class A { 2 │ │ static a; @@ -139,7 +139,7 @@ source: crates/oxc_linter/src/tester.rs ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:2:13] 1 │ /* */ 2 │ ╭─▶ class /* */ A /* */ { @@ -154,14 +154,14 @@ source: crates/oxc_linter/src/tester.rs ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:1] 1 │ class A {static [this.a] = 1} · ───────────────────────────── ╰──── help: Convert to an object instead of a class with only static members. - ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a class with only static members. + ⚠ eslint-plugin-unicorn(no-static-only-class): Use an object instead of a `class` with only `static` members. ╭─[no_static_only_class.tsx:1:1] 1 │ class A { static a() {} } · ───────────────────────── diff --git a/crates/oxc_linter/src/snapshots/unicorn_prefer_at.snap b/crates/oxc_linter/src/snapshots/unicorn_prefer_at.snap index ce77d6a4464a1..e447b16e8f2a4 100644 --- a/crates/oxc_linter/src/snapshots/unicorn_prefer_at.snap +++ b/crates/oxc_linter/src/snapshots/unicorn_prefer_at.snap @@ -2,579 +2,661 @@ source: crates/oxc_linter/src/tester.rs --- - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ array[array.length - 1]; · ─────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ array?.[array.length - 1]; · ───────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ array[array.length -1]; · ────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ array[array.length - /* comment */ 1]; · ───────────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ array[array.length - 1.]; · ──────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ array[array.length - 0b1]; · ───────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ array[array.length - 9]; · ─────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ array[0][array[0].length - 1]; · ───────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ array[(( array.length )) - 1]; · ───────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ array[array.length - (( 1 ))]; · ───────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ array[(( array.length - 1 ))]; · ───────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ (( array ))[array.length - 1]; · ───────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:4] 1 │ (( array[array.length - 1] )); · ─────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ array[array.length - 1].pop().shift()[0]; · ─────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:5] 1 │ a = array[array.length - 1] · ─────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:11] 1 │ const a = array[array.length - 1] · ─────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:12] 1 │ const {a = array[array.length - 1]} = {} · ─────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:8] 1 │ typeof array[array.length - 1] · ─────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:24] 1 │ function foo() {return arguments[arguments.length - 1]} · ─────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:31] 1 │ class Foo {bar; baz() {return this.bar[this.bar.length - 1]}} · ───────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:32] 1 │ class Foo {#bar; baz() {return this.#bar[this.#bar.length - 1]}} · ─────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()`. ╭─[prefer_at.tsx:1:1] 1 │ string.charAt(string.length - 1); · ──────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()`. ╭─[prefer_at.tsx:1:1] 1 │ string?.charAt(string.length - 1); · ───────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()`. ╭─[prefer_at.tsx:1:1] 1 │ string.charAt(string.length - 0o11); · ─────────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()`. ╭─[prefer_at.tsx:1:1] 1 │ some.string.charAt(some.string.length - 1); · ────────────────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()`. ╭─[prefer_at.tsx:1:1] 1 │ string.charAt((( string.length )) - 0xFF); · ───────────────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()`. ╭─[prefer_at.tsx:1:1] 1 │ string.charAt(string.length - (( 1 ))); · ────────────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()`. ╭─[prefer_at.tsx:1:1] 1 │ string.charAt((( string.length - 1 ))); · ────────────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()`. ╭─[prefer_at.tsx:1:1] 1 │ (( string )).charAt(string.length - 1); · ────────────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()`. ╭─[prefer_at.tsx:1:1] 1 │ (( string.charAt ))(string.length - 1); · ────────────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `charAt()`. ╭─[prefer_at.tsx:1:4] 1 │ (( string.charAt(string.length - 1) )); · ──────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-1)[0] · ────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-1)[0] · ────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array?.slice(-1)[0] · ─────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array?.slice(-1)[0] · ─────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-1).pop() · ───────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-1.0).shift() · ───────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-1)[(( 0 ))]; · ──────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-1)[(( 0 ))]; · ──────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-(( 1 )))[0]; · ──────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-(( 1 )))[0]; · ──────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice((( -1 )))[0]; · ──────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice((( -1 )))[0]; · ──────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ (( array.slice(-1) ))[0]; · ──────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ (( array )).slice(-1)[0]; · ──────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ (( array )).slice(-1)[0]; · ──────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:4] 1 │ (( array.slice(-1)[0] )); · ────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:4] 1 │ (( array.slice(-1)[0] )); · ────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift`. ╭─[prefer_at.tsx:1:1] 1 │ (( array.slice(-1) )).pop(); · ─────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift`. ╭─[prefer_at.tsx:1:1] 1 │ (( array.slice(-1).pop ))(); · ─────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift`. ╭─[prefer_at.tsx:1:4] 1 │ (( array.slice(-1).pop() )); · ───────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-1)[0].pop().shift().slice(-1) · ────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-1)[0].pop().shift().slice(-1) · ────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-9, -8)[0] · ────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-9, -8)[0] · ────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-9, -0o10)[0] · ───────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-9, -0o10)[0] · ───────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-9, -8).pop() · ───────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-9, -8).shift() · ─────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice((( -9 )), (( -8 )), ).shift() · ───────────────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift`. ╭─[prefer_at.tsx:1:1] 1 │ (( array.slice(-9, -8).shift ))() · ───────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-9, unknown)[0] · ─────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-9, unknown)[0] · ─────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-0o11, -7)[0] · ───────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-0o11, -7)[0] · ───────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-9, unknown).shift() · ──────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift`. ╭─[prefer_at.tsx:1:19] 1 │ const KNOWN = -8; array.slice(-9, KNOWN).shift() · ────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice().pop/shift`. ╭─[prefer_at.tsx:1:4] 1 │ (( (( array.slice( ((-9)), ((unknown)), ).shift ))() )); · ───────────────────────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-9, (a, really, _really, complicated, second) => argument)[0] · ───────────────────────────────────────────────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `slice()[0]`. ╭─[prefer_at.tsx:1:1] 1 │ array.slice(-9, (a, really, _really, complicated, second) => argument)[0] · ───────────────────────────────────────────────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()`. ╭─[prefer_at.tsx:1:1] 1 │ _.last(array) · ───────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `lodash.last()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `lodash.last()`. ╭─[prefer_at.tsx:1:1] 1 │ lodash.last(array) · ────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `underscore.last()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `underscore.last()`. ╭─[prefer_at.tsx:1:1] 1 │ underscore.last(array) · ────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()`. ╭─[prefer_at.tsx:1:1] 1 │ _.last(new Array) · ───────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()`. ╭─[prefer_at.tsx:2:13] 1 │ const foo = [] 2 │ _.last([bar]) · ───────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()`. ╭─[prefer_at.tsx:2:13] 1 │ const foo = [] 2 │ _.last( new Array ) · ─────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()`. ╭─[prefer_at.tsx:2:13] 1 │ const foo = [] 2 │ _.last( (( new Array )) ) · ───────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()`. ╭─[prefer_at.tsx:1:10] 1 │ if (foo) _.last([bar]) · ───────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()`. ╭─[prefer_at.tsx:1:1] 1 │ _.last(getLast(utils.lastOne(array))) · ───────────────────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `_.last()`. ╭─[prefer_at.tsx:1:24] 1 │ function foo() {return _.last(arguments)} · ───────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ array[1] · ──────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at - ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]` + ⚠ eslint-plugin-unicorn(prefer-at): Prefer `.at()` over `[index]`. ╭─[prefer_at.tsx:1:1] 1 │ array[array.length - 1] · ─────────────────────── ╰──── - help: Use `.at()` for index access + help: Use `.at()` for index access. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at diff --git a/crates/oxc_linter/src/snapshots/unicorn_prefer_event_target.snap b/crates/oxc_linter/src/snapshots/unicorn_prefer_event_target.snap index 60e421d37ec82..271f523a39092 100644 --- a/crates/oxc_linter/src/snapshots/unicorn_prefer_event_target.snap +++ b/crates/oxc_linter/src/snapshots/unicorn_prefer_event_target.snap @@ -2,59 +2,67 @@ source: crates/oxc_linter/src/tester.rs --- - ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter` + ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter`. ╭─[prefer_event_target.tsx:1:19] 1 │ class Foo extends EventEmitter {} · ──────────── ╰──── help: Change `EventEmitter` to `EventTarget`. EventEmitters are only available in Node.js, while EventTargets are also available in browsers. + note: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget - ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter` + ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter`. ╭─[prefer_event_target.tsx:1:19] 1 │ class Foo extends EventEmitter { someMethod() {} } · ──────────── ╰──── help: Change `EventEmitter` to `EventTarget`. EventEmitters are only available in Node.js, while EventTargets are also available in browsers. + note: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget - ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter` + ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter`. ╭─[prefer_event_target.tsx:1:27] 1 │ const Foo = class extends EventEmitter {} · ──────────── ╰──── help: Change `EventEmitter` to `EventTarget`. EventEmitters are only available in Node.js, while EventTargets are also available in browsers. + note: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget - ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter` + ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter`. ╭─[prefer_event_target.tsx:1:19] 1 │ class Foo extends EventEmitter { · ──────────── 2 │ addListener() {} ╰──── help: Change `EventEmitter` to `EventTarget`. EventEmitters are only available in Node.js, while EventTargets are also available in browsers. + note: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget - ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter` + ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter`. ╭─[prefer_event_target.tsx:1:5] 1 │ new EventEmitter · ──────────── ╰──── help: Change `EventEmitter` to `EventTarget`. EventEmitters are only available in Node.js, while EventTargets are also available in browsers. + note: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget - ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter` + ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter`. ╭─[prefer_event_target.tsx:1:21] 1 │ const emitter = new EventEmitter; · ──────────── ╰──── help: Change `EventEmitter` to `EventTarget`. EventEmitters are only available in Node.js, while EventTargets are also available in browsers. + note: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget - ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter` + ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter`. ╭─[prefer_event_target.tsx:1:39] 1 │ for (const {EventEmitter} of []) {new EventEmitter} · ──────────── ╰──── help: Change `EventEmitter` to `EventTarget`. EventEmitters are only available in Node.js, while EventTargets are also available in browsers. + note: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget - ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter` + ⚠ eslint-plugin-unicorn(prefer-event-target): Prefer `EventTarget` over `EventEmitter`. ╭─[prefer_event_target.tsx:1:37] 1 │ for (const EventEmitter of []) {new EventEmitter} · ──────────── ╰──── help: Change `EventEmitter` to `EventTarget`. EventEmitters are only available in Node.js, while EventTargets are also available in browsers. + note: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget diff --git a/crates/oxc_linter/src/snapshots/unicorn_prefer_global_this.snap b/crates/oxc_linter/src/snapshots/unicorn_prefer_global_this.snap index f4203910d9336..c5d4652d7fd37 100644 --- a/crates/oxc_linter/src/snapshots/unicorn_prefer_global_this.snap +++ b/crates/oxc_linter/src/snapshots/unicorn_prefer_global_this.snap @@ -8,6 +8,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -15,6 +16,7 @@ source: crates/oxc_linter/src/tester.rs · ──── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -22,6 +24,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -29,6 +32,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -36,6 +40,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -43,6 +48,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:6] @@ -50,6 +56,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -57,6 +64,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:7] @@ -64,6 +72,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -71,6 +80,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -78,6 +88,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:9] @@ -85,6 +96,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:2:21] @@ -94,6 +106,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:2:21] @@ -103,6 +116,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -110,6 +124,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:7] @@ -117,6 +132,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:13] @@ -124,6 +140,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:2:22] @@ -133,6 +150,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:5] @@ -140,6 +158,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:2:22] @@ -149,6 +168,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ bar: window.bar, ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:3:22] @@ -158,6 +178,7 @@ source: crates/oxc_linter/src/tester.rs 4 │ window: window ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:4:25] @@ -167,6 +188,7 @@ source: crates/oxc_linter/src/tester.rs 5 │ } ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:3:37] @@ -176,6 +198,7 @@ source: crates/oxc_linter/src/tester.rs 4 │ console.log(x, y); ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -183,6 +206,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:13] @@ -190,6 +214,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:20] @@ -197,6 +222,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:8] @@ -204,6 +230,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:3] @@ -211,6 +238,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:3] @@ -218,6 +246,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:18] @@ -226,6 +255,7 @@ source: crates/oxc_linter/src/tester.rs 2 │ } ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:6] @@ -234,6 +264,7 @@ source: crates/oxc_linter/src/tester.rs 2 │ } ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:30] @@ -242,6 +273,7 @@ source: crates/oxc_linter/src/tester.rs 2 │ } ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:20] @@ -250,6 +282,7 @@ source: crates/oxc_linter/src/tester.rs 2 │ } ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:20] @@ -258,6 +291,7 @@ source: crates/oxc_linter/src/tester.rs 2 │ } ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:9] @@ -265,6 +299,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:2:22] @@ -274,6 +309,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ break; ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:2:22] @@ -283,6 +319,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ break; ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:8] @@ -291,6 +328,7 @@ source: crates/oxc_linter/src/tester.rs 2 │ } ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:14] @@ -298,6 +336,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:5] @@ -305,6 +344,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:7] @@ -312,6 +352,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:11] @@ -319,6 +360,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:22] @@ -327,6 +369,7 @@ source: crates/oxc_linter/src/tester.rs 2 │ } ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -334,6 +377,7 @@ source: crates/oxc_linter/src/tester.rs · ──── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -341,6 +385,7 @@ source: crates/oxc_linter/src/tester.rs · ──── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -348,6 +393,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -355,6 +401,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -362,6 +409,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:25] @@ -369,6 +417,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:9] @@ -376,6 +425,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:2] @@ -383,6 +433,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:5] @@ -390,6 +441,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:5] @@ -397,6 +449,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:10] @@ -404,6 +457,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:10] @@ -411,6 +465,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:8] @@ -418,6 +473,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:8] @@ -425,6 +481,7 @@ source: crates/oxc_linter/src/tester.rs · ──── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:8] @@ -432,6 +489,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:8] @@ -439,6 +497,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:8] @@ -446,6 +505,7 @@ source: crates/oxc_linter/src/tester.rs · ──── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:8] @@ -453,6 +513,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -460,6 +521,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -467,6 +529,7 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis ⚠ eslint-plugin-unicorn(prefer-global-this): Prefer `globalThis` over environment-specific global aliases like `window`, `self`, and `global`. ╭─[prefer_global_this.tsx:1:1] @@ -474,3 +537,4 @@ source: crates/oxc_linter/src/tester.rs · ──── ╰──── help: Replace the alias with `globalThis`. + note: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis diff --git a/crates/oxc_linter/src/snapshots/unicorn_prefer_keyboard_event_key.snap b/crates/oxc_linter/src/snapshots/unicorn_prefer_keyboard_event_key.snap index 4c58748ea8911..58b151d5f101b 100644 --- a/crates/oxc_linter/src/snapshots/unicorn_prefer_keyboard_event_key.snap +++ b/crates/oxc_linter/src/snapshots/unicorn_prefer_keyboard_event_key.snap @@ -10,6 +10,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ }) ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:1:36] @@ -18,6 +19,7 @@ source: crates/oxc_linter/src/tester.rs 2 │ console.log(keyCode); ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.which` ╭─[prefer_keyboard_event_key.tsx:1:36] @@ -26,6 +28,7 @@ source: crates/oxc_linter/src/tester.rs 2 │ if (which === 23) { ╰──── help: The `which` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.which` ╭─[prefer_keyboard_event_key.tsx:1:36] @@ -34,6 +37,7 @@ source: crates/oxc_linter/src/tester.rs 2 │ if (which === 23) { ╰──── help: The `which` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -43,6 +47,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -52,6 +57,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ }); ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -61,6 +67,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ }); ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:28] @@ -70,6 +77,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ }); ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:23] @@ -79,6 +87,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:23] @@ -88,6 +97,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:23] @@ -97,6 +107,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:23] @@ -106,6 +117,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:24] @@ -115,6 +127,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ }); ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -124,6 +137,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ }); ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:3:28] @@ -133,6 +147,7 @@ source: crates/oxc_linter/src/tester.rs 4 │ console.log(event.key) ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.charCode` ╭─[prefer_keyboard_event_key.tsx:2:31] @@ -142,6 +157,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ }) ╰──── help: The `charCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.charCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -151,6 +167,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `charCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.charCode` ╭─[prefer_keyboard_event_key.tsx:2:23] @@ -160,6 +177,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `charCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.charCode` ╭─[prefer_keyboard_event_key.tsx:2:23] @@ -169,6 +187,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `charCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.charCode` ╭─[prefer_keyboard_event_key.tsx:2:23] @@ -178,6 +197,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `charCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.charCode` ╭─[prefer_keyboard_event_key.tsx:2:23] @@ -187,6 +207,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `charCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.charCode` ╭─[prefer_keyboard_event_key.tsx:2:24] @@ -196,6 +217,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ }); ╰──── help: The `charCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.charCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -205,6 +227,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ }); ╰──── help: The `charCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.which` ╭─[prefer_keyboard_event_key.tsx:2:31] @@ -214,6 +237,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ }) ╰──── help: The `which` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.which` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -223,6 +247,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `which` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.which` ╭─[prefer_keyboard_event_key.tsx:2:23] @@ -232,6 +257,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `which` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.which` ╭─[prefer_keyboard_event_key.tsx:2:23] @@ -241,6 +267,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `which` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.which` ╭─[prefer_keyboard_event_key.tsx:2:23] @@ -250,6 +277,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `which` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.which` ╭─[prefer_keyboard_event_key.tsx:2:23] @@ -259,6 +287,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `which` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.which` ╭─[prefer_keyboard_event_key.tsx:2:24] @@ -268,6 +297,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ }); ╰──── help: The `which` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.which` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -277,6 +307,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ }); ╰──── help: The `which` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.which` ╭─[prefer_keyboard_event_key.tsx:2:23] @@ -286,6 +317,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `which` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:4:24] @@ -295,6 +327,7 @@ source: crates/oxc_linter/src/tester.rs 5 │ if (keyCode === 32) return 4; ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.which` ╭─[prefer_keyboard_event_key.tsx:2:23] @@ -304,6 +337,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `which` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:4:24] @@ -313,6 +347,7 @@ source: crates/oxc_linter/src/tester.rs 5 │ if (keyCode === 32) return 4; ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.charCode` ╭─[prefer_keyboard_event_key.tsx:7:41] @@ -322,6 +357,7 @@ source: crates/oxc_linter/src/tester.rs 8 │ console.log(e.keyCode, charCode); ╰──── help: The `charCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:8:47] @@ -331,6 +367,7 @@ source: crates/oxc_linter/src/tester.rs 9 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -340,6 +377,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -349,6 +387,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -358,6 +397,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -367,6 +407,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -376,6 +417,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -385,6 +427,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -394,6 +437,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -403,6 +447,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -412,6 +457,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -421,6 +467,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -430,6 +477,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -439,6 +487,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -448,6 +497,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -457,6 +507,7 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.which` ╭─[prefer_keyboard_event_key.tsx:1:36] @@ -465,6 +516,7 @@ source: crates/oxc_linter/src/tester.rs 2 │ if (which === 23) { ╰──── help: The `which` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key ⚠ eslint-plugin-unicorn(prefer-keyboard-event-key): Use `.key` instead of `.keyCode` ╭─[prefer_keyboard_event_key.tsx:2:27] @@ -474,3 +526,4 @@ source: crates/oxc_linter/src/tester.rs 3 │ } ╰──── help: The `keyCode` property is deprecated. + note: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key diff --git a/crates/oxc_linter/src/snapshots/vue_max_props.snap b/crates/oxc_linter/src/snapshots/vue_max_props.snap index f5168ee5cea65..052948f6d0981 100644 --- a/crates/oxc_linter/src/snapshots/vue_max_props.snap +++ b/crates/oxc_linter/src/snapshots/vue_max_props.snap @@ -2,16 +2,16 @@ source: crates/oxc_linter/src/tester.rs --- - ⚠ eslint-plugin-vue(max-props): Component has too many props (2). Maximum allowed is 1. + ⚠ eslint-plugin-vue(max-props): This component has too many props (2). Maximum allowed is 1. ╭─[max_props.tsx:3:10] 2 │ ╰──── - help: Consider refactoring the component by reducing the number of props. + help: Consider refactoring the component to reduce the number of props that are needed. - ⚠ eslint-plugin-vue(max-props): Component has too many props (2). Maximum allowed is 1. + ⚠ eslint-plugin-vue(max-props): This component has too many props (2). Maximum allowed is 1. ╭─[max_props.tsx:4:19] 3 │ export default { 4 │ ╭─▶ props: { @@ -20,27 +20,27 @@ source: crates/oxc_linter/src/tester.rs 7 │ ╰─▶ } 8 │ } ╰──── - help: Consider refactoring the component by reducing the number of props. + help: Consider refactoring the component to reduce the number of props that are needed. - ⚠ eslint-plugin-vue(max-props): Component has too many props (3). Maximum allowed is 2. + ⚠ eslint-plugin-vue(max-props): This component has too many props (3). Maximum allowed is 2. ╭─[max_props.tsx:3:10] 2 │ ╰──── - help: Consider refactoring the component by reducing the number of props. + help: Consider refactoring the component to reduce the number of props that are needed. - ⚠ eslint-plugin-vue(max-props): Component has too many props (3). Maximum allowed is 2. + ⚠ eslint-plugin-vue(max-props): This component has too many props (3). Maximum allowed is 2. ╭─[max_props.tsx:3:10] 2 │ ╰──── - help: Consider refactoring the component by reducing the number of props. + help: Consider refactoring the component to reduce the number of props that are needed. - ⚠ eslint-plugin-vue(max-props): Component has too many props (3). Maximum allowed is 2. + ⚠ eslint-plugin-vue(max-props): This component has too many props (3). Maximum allowed is 2. ╭─[max_props.tsx:3:10] 2 │ ╰──── - help: Consider refactoring the component by reducing the number of props. + help: Consider refactoring the component to reduce the number of props that are needed.