mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
chore(linter): add rule name to no-instanceof-array
This commit is contained in:
parent
4032e4799c
commit
dafdc95d81
2 changed files with 9 additions and 10 deletions
|
|
@ -12,7 +12,7 @@ use oxc_syntax::operator::BinaryOperator;
|
|||
use crate::{context::LintContext, fixer::Fix, rule::Rule, AstNode};
|
||||
|
||||
#[derive(Debug, Error, Diagnostic)]
|
||||
#[error("Use `Array.isArray()` instead of `instanceof Array`.")]
|
||||
#[error("eslint-plugin-unicorn(no-instanceof-array): Use `Array.isArray()` instead of `instanceof Array`.")]
|
||||
#[diagnostic(severity(warning), help("The instanceof Array check doesn't work across realms/contexts, for example, frames/windows in browsers or the vm module in Node.js."))]
|
||||
struct NoInstanceofArrayDiagnostic(#[label] pub Span);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,58 +1,57 @@
|
|||
---
|
||||
source: crates/oxc_linter/src/tester.rs
|
||||
assertion_line: 80
|
||||
expression: no_instanceof_array
|
||||
---
|
||||
⚠ Use `Array.isArray()` instead of `instanceof Array`.
|
||||
⚠ eslint-plugin-unicorn(no-instanceof-array): Use `Array.isArray()` instead of `instanceof Array`.
|
||||
╭─[no_instanceof_array.tsx:1:1]
|
||||
1 │ arr instanceof Array
|
||||
· ────────────────────
|
||||
╰────
|
||||
help: The instanceof Array check doesn't work across realms/contexts, for example, frames/windows in browsers or the vm module in Node.js.
|
||||
|
||||
⚠ Use `Array.isArray()` instead of `instanceof Array`.
|
||||
⚠ eslint-plugin-unicorn(no-instanceof-array): Use `Array.isArray()` instead of `instanceof Array`.
|
||||
╭─[no_instanceof_array.tsx:1:1]
|
||||
1 │ [] instanceof Array
|
||||
· ───────────────────
|
||||
╰────
|
||||
help: The instanceof Array check doesn't work across realms/contexts, for example, frames/windows in browsers or the vm module in Node.js.
|
||||
|
||||
⚠ Use `Array.isArray()` instead of `instanceof Array`.
|
||||
⚠ eslint-plugin-unicorn(no-instanceof-array): Use `Array.isArray()` instead of `instanceof Array`.
|
||||
╭─[no_instanceof_array.tsx:1:1]
|
||||
1 │ [1,2,3] instanceof Array === true
|
||||
· ────────────────────────
|
||||
╰────
|
||||
help: The instanceof Array check doesn't work across realms/contexts, for example, frames/windows in browsers or the vm module in Node.js.
|
||||
|
||||
⚠ Use `Array.isArray()` instead of `instanceof Array`.
|
||||
⚠ eslint-plugin-unicorn(no-instanceof-array): Use `Array.isArray()` instead of `instanceof Array`.
|
||||
╭─[no_instanceof_array.tsx:1:1]
|
||||
1 │ fun.call(1, 2, 3) instanceof Array
|
||||
· ──────────────────────────────────
|
||||
╰────
|
||||
help: The instanceof Array check doesn't work across realms/contexts, for example, frames/windows in browsers or the vm module in Node.js.
|
||||
|
||||
⚠ Use `Array.isArray()` instead of `instanceof Array`.
|
||||
⚠ eslint-plugin-unicorn(no-instanceof-array): Use `Array.isArray()` instead of `instanceof Array`.
|
||||
╭─[no_instanceof_array.tsx:1:1]
|
||||
1 │ obj.arr instanceof Array
|
||||
· ────────────────────────
|
||||
╰────
|
||||
help: The instanceof Array check doesn't work across realms/contexts, for example, frames/windows in browsers or the vm module in Node.js.
|
||||
|
||||
⚠ Use `Array.isArray()` instead of `instanceof Array`.
|
||||
⚠ eslint-plugin-unicorn(no-instanceof-array): Use `Array.isArray()` instead of `instanceof Array`.
|
||||
╭─[no_instanceof_array.tsx:1:1]
|
||||
1 │ foo.bar[2] instanceof Array
|
||||
· ───────────────────────────
|
||||
╰────
|
||||
help: The instanceof Array check doesn't work across realms/contexts, for example, frames/windows in browsers or the vm module in Node.js.
|
||||
|
||||
⚠ Use `Array.isArray()` instead of `instanceof Array`.
|
||||
⚠ eslint-plugin-unicorn(no-instanceof-array): Use `Array.isArray()` instead of `instanceof Array`.
|
||||
╭─[no_instanceof_array.tsx:1:1]
|
||||
1 │ (0, array) instanceof Array
|
||||
· ───────────────────────────
|
||||
╰────
|
||||
help: The instanceof Array check doesn't work across realms/contexts, for example, frames/windows in browsers or the vm module in Node.js.
|
||||
|
||||
⚠ Use `Array.isArray()` instead of `instanceof Array`.
|
||||
⚠ eslint-plugin-unicorn(no-instanceof-array): Use `Array.isArray()` instead of `instanceof Array`.
|
||||
╭─[no_instanceof_array.tsx:1:1]
|
||||
1 │ function foo(){return [] instanceof Array}
|
||||
· ───────────────────
|
||||
|
|
|
|||
Loading…
Reference in a new issue