mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
refactor(linter): merge deepscan rules into oxc rules (#3327)
This commit is contained in:
parent
95e9b6986c
commit
4f76cb6f38
26 changed files with 161 additions and 180 deletions
|
|
@ -261,7 +261,7 @@ impl LintOptions {
|
|||
"jsx_a11y" => self.jsx_a11y_plugin,
|
||||
"nextjs" => self.nextjs_plugin,
|
||||
"react_perf" => self.react_perf_plugin,
|
||||
"eslint" | "oxc" | "deepscan" | "tree_shaking" => true,
|
||||
"eslint" | "oxc" | "tree_shaking" => true,
|
||||
name => panic!("Unhandled plugin: {name}"),
|
||||
})
|
||||
.cloned()
|
||||
|
|
|
|||
|
|
@ -22,19 +22,6 @@ mod import {
|
|||
// pub mod no_unused_modules;
|
||||
}
|
||||
|
||||
mod deepscan {
|
||||
pub mod bad_array_method_on_arguments;
|
||||
pub mod bad_bitwise_operator;
|
||||
pub mod bad_char_at_comparison;
|
||||
pub mod bad_comparison_sequence;
|
||||
pub mod bad_min_max_func;
|
||||
pub mod bad_object_literal_comparison;
|
||||
pub mod bad_replace_all_arg;
|
||||
pub mod missing_throw;
|
||||
pub mod number_arg_out_of_range;
|
||||
pub mod uninvoked_array_callback;
|
||||
}
|
||||
|
||||
mod eslint {
|
||||
pub mod array_callback_return;
|
||||
pub mod constructor_super;
|
||||
|
|
@ -335,13 +322,23 @@ mod jsx_a11y {
|
|||
|
||||
mod oxc {
|
||||
pub mod approx_constant;
|
||||
pub mod bad_array_method_on_arguments;
|
||||
pub mod bad_bitwise_operator;
|
||||
pub mod bad_char_at_comparison;
|
||||
pub mod bad_comparison_sequence;
|
||||
pub mod bad_min_max_func;
|
||||
pub mod bad_object_literal_comparison;
|
||||
pub mod bad_replace_all_arg;
|
||||
pub mod const_comparisons;
|
||||
pub mod double_comparisons;
|
||||
pub mod erasing_op;
|
||||
pub mod misrefactored_assign_op;
|
||||
pub mod missing_throw;
|
||||
pub mod no_accumulating_spread;
|
||||
pub mod no_barrel_file;
|
||||
pub mod number_arg_out_of_range;
|
||||
pub mod only_used_in_recursion;
|
||||
pub mod uninvoked_array_callback;
|
||||
}
|
||||
|
||||
mod nextjs {
|
||||
|
|
@ -387,16 +384,6 @@ mod tree_shaking {
|
|||
}
|
||||
|
||||
oxc_macros::declare_all_lint_rules! {
|
||||
deepscan::bad_array_method_on_arguments,
|
||||
deepscan::bad_bitwise_operator,
|
||||
deepscan::bad_char_at_comparison,
|
||||
deepscan::bad_comparison_sequence,
|
||||
deepscan::bad_object_literal_comparison,
|
||||
deepscan::bad_min_max_func,
|
||||
deepscan::bad_replace_all_arg,
|
||||
deepscan::missing_throw,
|
||||
deepscan::number_arg_out_of_range,
|
||||
deepscan::uninvoked_array_callback,
|
||||
eslint::array_callback_return,
|
||||
eslint::constructor_super,
|
||||
eslint::default_case_last,
|
||||
|
|
@ -688,13 +675,23 @@ oxc_macros::declare_all_lint_rules! {
|
|||
jsx_a11y::role_supports_aria_props,
|
||||
jsx_a11y::autocomplete_valid,
|
||||
oxc::approx_constant,
|
||||
oxc::bad_array_method_on_arguments,
|
||||
oxc::bad_bitwise_operator,
|
||||
oxc::bad_char_at_comparison,
|
||||
oxc::bad_comparison_sequence,
|
||||
oxc::bad_min_max_func,
|
||||
oxc::bad_object_literal_comparison,
|
||||
oxc::bad_replace_all_arg,
|
||||
oxc::const_comparisons,
|
||||
oxc::double_comparisons,
|
||||
oxc::erasing_op,
|
||||
oxc::misrefactored_assign_op,
|
||||
oxc::missing_throw,
|
||||
oxc::no_accumulating_spread,
|
||||
oxc::no_barrel_file,
|
||||
oxc::number_arg_out_of_range,
|
||||
oxc::only_used_in_recursion,
|
||||
oxc::uninvoked_array_callback,
|
||||
nextjs::google_font_display,
|
||||
nextjs::google_font_preconnect,
|
||||
nextjs::inline_script_id,
|
||||
|
|
|
|||
|
|
@ -10,14 +10,13 @@ use oxc_span::Span;
|
|||
use crate::{context::LintContext, rule::Rule, AstNode};
|
||||
|
||||
fn bad_array_method_on_arguments_diagnostic(x0: &str, span1: Span) -> OxcDiagnostic {
|
||||
OxcDiagnostic::warning("deepscan(bad-array-method-on-arguments): Bad array method on arguments")
|
||||
OxcDiagnostic::warning("oxc(bad-array-method-on-arguments): Bad array method on arguments")
|
||||
.with_help(format!(
|
||||
"The 'arguments' object does not have '{x0}()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead."
|
||||
))
|
||||
.with_labels([span1.into()])
|
||||
}
|
||||
|
||||
/// `https://deepscan.io/docs/rules/bad-array-method-on-arguments`
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct BadArrayMethodOnArguments;
|
||||
|
||||
|
|
@ -79,7 +78,7 @@ impl Rule for BadArrayMethodOnArguments {
|
|||
}
|
||||
}
|
||||
Expression::TemplateLiteral(template) => {
|
||||
// only check template string like "arguments[`METHOD_NAME`]" for Deepscan compatible
|
||||
// only check template string like "arguments[`METHOD_NAME`]" for Oxc compatible
|
||||
if template.expressions.is_empty() && template.quasis.len() == 1 {
|
||||
if let Some(name) =
|
||||
template.quasis.first().and_then(|template_element| {
|
||||
|
|
@ -142,7 +141,6 @@ fn test() {
|
|||
("function fn() {arguments[`${'map'}`]((prev, cur) => prev + cur, 0)}", None),
|
||||
("function fn() {arguments.toLocaleString(() => {})}", None),
|
||||
("function fn() {arguments.toString(() => {})}", None),
|
||||
// keep pass for DeepScan compatible
|
||||
("function fn() {arguments.findLast(() => {})}", None),
|
||||
("function fn() {arguments.group(() => {})}", None),
|
||||
("function fn() {arguments.groupToMap(() => {})}", None),
|
||||
|
|
@ -11,7 +11,7 @@ use oxc_syntax::operator::{AssignmentOperator, BinaryOperator, UnaryOperator};
|
|||
use crate::{context::LintContext, rule::Rule, AstNode};
|
||||
|
||||
fn bad_bitwise_operator_diagnostic(x0: &str, x1: &str, span2: Span) -> OxcDiagnostic {
|
||||
OxcDiagnostic::warning("deepscan(bad-bitwise-operator): Bad bitwise operator")
|
||||
OxcDiagnostic::warning("oxc(bad-bitwise-operator): Bad bitwise operator")
|
||||
.with_help(format!(
|
||||
"Bitwise operator '{x0}' seems unintended. Did you mean logical operator '{x1}'?"
|
||||
))
|
||||
|
|
@ -24,7 +24,6 @@ fn bad_bitwise_or_operator_diagnostic(span0: Span) -> OxcDiagnostic {
|
|||
.with_labels([span0.into()])
|
||||
}
|
||||
|
||||
/// `https://deepscan.io/docs/rules/bad-bitwise-operator`
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct BadBitwiseOperator;
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ use oxc_syntax::operator::BinaryOperator;
|
|||
use crate::{ast_util::is_method_call, context::LintContext, rule::Rule, AstNode};
|
||||
|
||||
fn bad_char_at_comparison_diagnostic(span0: Span, span1: Span, x2: usize) -> OxcDiagnostic {
|
||||
OxcDiagnostic::warning("deepscan(bad-char-at-comparison): Invalid comparison with `charAt` method")
|
||||
OxcDiagnostic::warning("oxc(bad-char-at-comparison): Invalid comparison with `charAt` method")
|
||||
.with_help("`String.prototype.charAt` returns a string of length 1. If the return value is compared with a string of length greater than 1, the comparison will always be false.")
|
||||
.with_labels([LabeledSpan::new_with_span(Some("`charAt` called here".into()), span0), LabeledSpan::new_with_span(Some(format!("And compared with a string of length {x2} here")), span1)])
|
||||
}
|
||||
|
|
@ -10,10 +10,9 @@ use oxc_span::Span;
|
|||
use crate::{context::LintContext, rule::Rule, AstNode};
|
||||
|
||||
fn bad_comparison_sequence_diagnostic(span0: Span) -> OxcDiagnostic {
|
||||
OxcDiagnostic::warning("deepscan(bad-comparison-sequence): Bad comparison sequence").with_help("Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)").with_labels([span0.into()])
|
||||
OxcDiagnostic::warning("oxc(bad-comparison-sequence): Bad comparison sequence").with_help("Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)").with_labels([span0.into()])
|
||||
}
|
||||
|
||||
/// `https://deepscan.io/docs/rules/bad-comparison-sequence`
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct BadComparisonSequence;
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ use crate::{context::LintContext, rule::Rule, AstNode};
|
|||
|
||||
fn bad_min_max_func_diagnostic(x0: f64, span1: Span) -> OxcDiagnostic {
|
||||
OxcDiagnostic::warning(
|
||||
"deepscan(bad-min-max-func): Math.min and Math.max combination leads to constant result",
|
||||
"oxc(bad-min-max-func): Math.min and Math.max combination leads to constant result",
|
||||
)
|
||||
.with_help(format!(
|
||||
"This evaluates to {x0:?} because of the incorrect `Math.min`/`Math.max` combination"
|
||||
|
|
@ -19,7 +19,6 @@ fn bad_min_max_func_diagnostic(x0: f64, span1: Span) -> OxcDiagnostic {
|
|||
.with_labels([span1.into()])
|
||||
}
|
||||
|
||||
/// `https://deepscan.io/docs/rules/bad-min-max-func`
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct BadMinMaxFunc;
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ use oxc_syntax::operator::BinaryOperator;
|
|||
use crate::{context::LintContext, rule::Rule, AstNode};
|
||||
|
||||
fn object_comparison(span0: Span, x1: bool) -> OxcDiagnostic {
|
||||
OxcDiagnostic::warning("deepscan(bad-object-literal-comparison): Unexpected object literal comparison.")
|
||||
OxcDiagnostic::warning("oxc(bad-object-literal-comparison): Unexpected object literal comparison.")
|
||||
.with_help(format!(
|
||||
"This comparison will always return {x1:?} as object literals are never equal to each other. Consider using `Object.entries()` of `Object.keys()` and comparing their lengths."
|
||||
))
|
||||
|
|
@ -15,7 +15,7 @@ fn object_comparison(span0: Span, x1: bool) -> OxcDiagnostic {
|
|||
}
|
||||
|
||||
fn array_comparison(span0: Span, x1: bool) -> OxcDiagnostic {
|
||||
OxcDiagnostic::warning("deepscan(bad-object-literal-comparison): Unexpected array literal comparison.")
|
||||
OxcDiagnostic::warning("oxc(bad-object-literal-comparison): Unexpected array literal comparison.")
|
||||
.with_help(format!("This comparison will always return {x1:?} as array literals are never equal to each other. Consider using `Array.length` if empty checking was intended."))
|
||||
.with_labels([span0.into()])
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ use crate::{
|
|||
};
|
||||
|
||||
fn bad_replace_all_arg_diagnostic(span0: Span, span1: Span) -> OxcDiagnostic {
|
||||
OxcDiagnostic::warning("deepscan(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.")
|
||||
OxcDiagnostic::warning("oxc(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.")
|
||||
.with_help("To replace all occurrences of a string, use the `replaceAll` method with the global flag (g) in the regular expression.")
|
||||
.with_labels([LabeledSpan::new_with_span(Some("`replaceAll` called here".into()), span0), LabeledSpan::new_with_span(Some("RegExp supplied here".into()), span1)])
|
||||
}
|
||||
|
|
@ -140,17 +140,17 @@ fn test() {
|
|||
// resolved vars
|
||||
r"
|
||||
const foo = /\s+/;
|
||||
|
||||
|
||||
withSpaces.replaceAll(foo, ',');
|
||||
",
|
||||
r"
|
||||
const foo = /\s+/i;
|
||||
|
||||
|
||||
withSpaces.replaceAll(foo, ',');
|
||||
",
|
||||
r"
|
||||
const foo = new RegExp('\s+');
|
||||
|
||||
|
||||
withSpaces.replaceAll(foo, ',');
|
||||
",
|
||||
];
|
||||
|
|
@ -7,12 +7,11 @@ use oxc_span::Span;
|
|||
use crate::{context::LintContext, rule::Rule, AstNode};
|
||||
|
||||
fn missing_throw_diagnostic(span0: Span) -> OxcDiagnostic {
|
||||
OxcDiagnostic::warning("deepscan(missing-throw): Missing throw")
|
||||
OxcDiagnostic::warning("oxc(missing-throw): Missing throw")
|
||||
.with_help("The `throw` keyword seems to be missing in front of this 'new' expression")
|
||||
.with_labels([span0.into()])
|
||||
}
|
||||
|
||||
/// `https://deepscan.io/docs/rules/missing-throw`
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct MissingThrow;
|
||||
|
||||
|
|
@ -12,12 +12,11 @@ fn number_arg_out_of_range_diagnostic(
|
|||
x2: usize,
|
||||
span3: Span,
|
||||
) -> OxcDiagnostic {
|
||||
OxcDiagnostic::warning("deepscan(number-arg-out-of-range): Radix or precision arguments of number-related functions should not exceed the limit")
|
||||
OxcDiagnostic::warning("oxc(number-arg-out-of-range): Radix or precision arguments of number-related functions should not exceed the limit")
|
||||
.with_help(format!("The first argument of 'Number.prototype.{x0}' should be a number between {x1} and {x2}"))
|
||||
.with_labels([span3.into()])
|
||||
}
|
||||
|
||||
/// `https://deepscan.io/docs/rules/number-arg-out-of-range`
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct NumberArgOutOfRange;
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ use oxc_span::{GetSpan, Span};
|
|||
use crate::{context::LintContext, rule::Rule, AstNode};
|
||||
|
||||
fn uninvoked_array_callback_diagnostic(span0: Span, span1: Span) -> OxcDiagnostic {
|
||||
OxcDiagnostic::warning("deepscan(uninvoked-array-callback): Uninvoked array callback")
|
||||
OxcDiagnostic::warning("oxc(uninvoked-array-callback): Uninvoked array callback")
|
||||
.with_help(
|
||||
"consider filling the array with `undefined` values using `Array.prototype.fill()`",
|
||||
)
|
||||
|
|
@ -23,7 +23,6 @@ fn uninvoked_array_callback_diagnostic(span0: Span, span1: Span) -> OxcDiagnosti
|
|||
])
|
||||
}
|
||||
|
||||
/// `https://deepscan.io/docs/rules/uninvoked-array-callback`
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct UninvokedArrayCallback;
|
||||
|
||||
|
|
@ -2,231 +2,231 @@
|
|||
source: crates/oxc_linter/src/tester.rs
|
||||
expression: bad_array_method_on_arguments
|
||||
---
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments['map'](() => {})}
|
||||
· ────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'map()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments[`map`](() => {})}
|
||||
· ────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'map()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.at(0)}
|
||||
· ────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'at()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.concat([])}
|
||||
· ────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'concat()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.copyWithin(0)}
|
||||
· ────────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'copyWithin()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.entries()}
|
||||
· ─────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'entries()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.every(() => {})}
|
||||
· ───────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'every()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.fill(() => {})}
|
||||
· ──────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'fill()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.filter(() => {})}
|
||||
· ────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'filter()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.find(() => {})}
|
||||
· ──────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'find()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.findIndex(() => {})}
|
||||
· ───────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'findIndex()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.flat(() => {})}
|
||||
· ──────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'flat()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.flatMap(() => {})}
|
||||
· ─────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'flatMap()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.forEach(() => {})}
|
||||
· ─────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'forEach()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.includes(() => {})}
|
||||
· ──────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'includes()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.indexOf(() => {})}
|
||||
· ─────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'indexOf()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.join()}
|
||||
· ──────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'join()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.keys()}
|
||||
· ──────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'keys()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.lastIndexOf('')}
|
||||
· ─────────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'lastIndexOf()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.map(() => {})}
|
||||
· ─────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'map()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.pop()}
|
||||
· ─────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'pop()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.push('')}
|
||||
· ──────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'push()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.reduce(() => {})}
|
||||
· ────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'reduce()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.reduceRight(() => {})}
|
||||
· ─────────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'reduceRight()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.reverse()}
|
||||
· ─────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'reverse()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.shift()}
|
||||
· ───────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'shift()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.slice()}
|
||||
· ───────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'slice()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.some(() => {})}
|
||||
· ──────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'some()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.sort(() => {})}
|
||||
· ──────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'sort()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.splice(() => {})}
|
||||
· ────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'splice()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.unshift()}
|
||||
· ─────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'unshift()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments.values()}
|
||||
· ────────────────
|
||||
╰────
|
||||
help: The 'arguments' object does not have 'values()' method. If an array method was intended, consider converting the 'arguments' object to an array or using ES6 rest parameter instead.
|
||||
|
||||
⚠ deepscan(bad-array-method-on-arguments): Bad array method on arguments
|
||||
⚠ oxc(bad-array-method-on-arguments): Bad array method on arguments
|
||||
╭─[bad_array_method_on_arguments.tsx:1:16]
|
||||
1 │ function fn() {arguments['@@iterator'](() => {})}
|
||||
· ───────────────────────
|
||||
|
|
|
|||
|
|
@ -2,70 +2,70 @@
|
|||
source: crates/oxc_linter/src/tester.rs
|
||||
expression: bad_bitwise_operator
|
||||
---
|
||||
⚠ deepscan(bad-bitwise-operator): Bad bitwise operator
|
||||
⚠ oxc(bad-bitwise-operator): Bad bitwise operator
|
||||
╭─[bad_bitwise_operator.tsx:1:9]
|
||||
1 │ var a = obj & obj.a
|
||||
· ───────────
|
||||
╰────
|
||||
help: Bitwise operator '&' seems unintended. Did you mean logical operator '&&'?
|
||||
|
||||
⚠ deepscan(bad-bitwise-operator): Bad bitwise operator
|
||||
⚠ oxc(bad-bitwise-operator): Bad bitwise operator
|
||||
╭─[bad_bitwise_operator.tsx:1:9]
|
||||
1 │ var a = options | {}
|
||||
· ────────────
|
||||
╰────
|
||||
help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?
|
||||
|
||||
⚠ deepscan(bad-bitwise-operator): Bad bitwise operator
|
||||
⚠ oxc(bad-bitwise-operator): Bad bitwise operator
|
||||
╭─[bad_bitwise_operator.tsx:1:9]
|
||||
1 │ var a = options | !{}
|
||||
· ─────────────
|
||||
╰────
|
||||
help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?
|
||||
|
||||
⚠ deepscan(bad-bitwise-operator): Bad bitwise operator
|
||||
⚠ oxc(bad-bitwise-operator): Bad bitwise operator
|
||||
╭─[bad_bitwise_operator.tsx:1:9]
|
||||
1 │ var a = options | typeof {}
|
||||
· ───────────────────
|
||||
╰────
|
||||
help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?
|
||||
|
||||
⚠ deepscan(bad-bitwise-operator): Bad bitwise operator
|
||||
⚠ oxc(bad-bitwise-operator): Bad bitwise operator
|
||||
╭─[bad_bitwise_operator.tsx:1:9]
|
||||
1 │ var a = options | ''
|
||||
· ────────────
|
||||
╰────
|
||||
help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?
|
||||
|
||||
⚠ deepscan(bad-bitwise-operator): Bad bitwise operator
|
||||
⚠ oxc(bad-bitwise-operator): Bad bitwise operator
|
||||
╭─[bad_bitwise_operator.tsx:1:9]
|
||||
1 │ var a = options | true
|
||||
· ──────────────
|
||||
╰────
|
||||
help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?
|
||||
|
||||
⚠ deepscan(bad-bitwise-operator): Bad bitwise operator
|
||||
⚠ oxc(bad-bitwise-operator): Bad bitwise operator
|
||||
╭─[bad_bitwise_operator.tsx:1:9]
|
||||
1 │ var a = options | false
|
||||
· ───────────────
|
||||
╰────
|
||||
help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?
|
||||
|
||||
⚠ deepscan(bad-bitwise-operator): Bad bitwise operator
|
||||
⚠ oxc(bad-bitwise-operator): Bad bitwise operator
|
||||
╭─[bad_bitwise_operator.tsx:1:9]
|
||||
1 │ var a = options | (1 + 2 + typeof {})
|
||||
· ─────────────────────────────
|
||||
╰────
|
||||
help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?
|
||||
|
||||
⚠ deepscan(bad-bitwise-operator): Bad bitwise operator
|
||||
⚠ oxc(bad-bitwise-operator): Bad bitwise operator
|
||||
╭─[bad_bitwise_operator.tsx:1:9]
|
||||
1 │ var a = options | (1 + 2 + (3 + ''))
|
||||
· ────────────────────────────
|
||||
╰────
|
||||
help: Bitwise operator '|' seems unintended. Did you mean logical operator '||'?
|
||||
|
||||
⚠ deepscan(bad-bitwise-operator): Bad bitwise operator
|
||||
⚠ oxc(bad-bitwise-operator): Bad bitwise operator
|
||||
╭─[bad_bitwise_operator.tsx:1:9]
|
||||
1 │ var a = options | (1 + 2 + (3 + '4'))
|
||||
· ─────────────────────────────
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
source: crates/oxc_linter/src/tester.rs
|
||||
expression: bad_char_at_comparison
|
||||
---
|
||||
⚠ deepscan(bad-char-at-comparison): Invalid comparison with `charAt` method
|
||||
⚠ oxc(bad-char-at-comparison): Invalid comparison with `charAt` method
|
||||
╭─[bad_char_at_comparison.tsx:1:1]
|
||||
1 │ a.charAt(4) === 'aa'
|
||||
· ─────┬───── ──┬─
|
||||
|
|
@ -11,7 +11,7 @@ expression: bad_char_at_comparison
|
|||
╰────
|
||||
help: `String.prototype.charAt` returns a string of length 1. If the return value is compared with a string of length greater than 1, the comparison will always be false.
|
||||
|
||||
⚠ deepscan(bad-char-at-comparison): Invalid comparison with `charAt` method
|
||||
⚠ oxc(bad-char-at-comparison): Invalid comparison with `charAt` method
|
||||
╭─[bad_char_at_comparison.tsx:1:1]
|
||||
1 │ a.charAt(4) === '/n'
|
||||
· ─────┬───── ──┬─
|
||||
|
|
@ -20,7 +20,7 @@ expression: bad_char_at_comparison
|
|||
╰────
|
||||
help: `String.prototype.charAt` returns a string of length 1. If the return value is compared with a string of length greater than 1, the comparison will always be false.
|
||||
|
||||
⚠ deepscan(bad-char-at-comparison): Invalid comparison with `charAt` method
|
||||
⚠ oxc(bad-char-at-comparison): Invalid comparison with `charAt` method
|
||||
╭─[bad_char_at_comparison.tsx:1:1]
|
||||
1 │ a.charAt(3) === '/t'
|
||||
· ─────┬───── ──┬─
|
||||
|
|
@ -29,7 +29,7 @@ expression: bad_char_at_comparison
|
|||
╰────
|
||||
help: `String.prototype.charAt` returns a string of length 1. If the return value is compared with a string of length greater than 1, the comparison will always be false.
|
||||
|
||||
⚠ deepscan(bad-char-at-comparison): Invalid comparison with `charAt` method
|
||||
⚠ oxc(bad-char-at-comparison): Invalid comparison with `charAt` method
|
||||
╭─[bad_char_at_comparison.tsx:1:1]
|
||||
1 │ a.charAt(4) === 'ac'
|
||||
· ─────┬───── ──┬─
|
||||
|
|
@ -38,7 +38,7 @@ expression: bad_char_at_comparison
|
|||
╰────
|
||||
help: `String.prototype.charAt` returns a string of length 1. If the return value is compared with a string of length greater than 1, the comparison will always be false.
|
||||
|
||||
⚠ deepscan(bad-char-at-comparison): Invalid comparison with `charAt` method
|
||||
⚠ oxc(bad-char-at-comparison): Invalid comparison with `charAt` method
|
||||
╭─[bad_char_at_comparison.tsx:1:1]
|
||||
1 │ a.charAt(822) !== 'foo'
|
||||
· ──────┬────── ──┬──
|
||||
|
|
@ -47,7 +47,7 @@ expression: bad_char_at_comparison
|
|||
╰────
|
||||
help: `String.prototype.charAt` returns a string of length 1. If the return value is compared with a string of length greater than 1, the comparison will always be false.
|
||||
|
||||
⚠ deepscan(bad-char-at-comparison): Invalid comparison with `charAt` method
|
||||
⚠ oxc(bad-char-at-comparison): Invalid comparison with `charAt` method
|
||||
╭─[bad_char_at_comparison.tsx:1:1]
|
||||
1 │ a.charAt(4) === '\\ukeff'
|
||||
· ─────┬───── ────┬────
|
||||
|
|
|
|||
|
|
@ -2,252 +2,252 @@
|
|||
source: crates/oxc_linter/src/tester.rs
|
||||
expression: bad_comparison_sequence
|
||||
---
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a == b == c) { console.log('foo') }
|
||||
· ───────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a == b == c == d) { console.log('foo') }
|
||||
· ────────────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:6]
|
||||
1 │ if ((a == b == c) == d) { console.log('foo') }
|
||||
· ───────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if ((a == b == c) == d == e == f) { console.log('foo') }
|
||||
· ────────────────────────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:6]
|
||||
1 │ if ((a == b == c) == d == e == f) { console.log('foo') }
|
||||
· ───────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a == b === c) { console.log('foo') }
|
||||
· ────────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a == b != c) { console.log('foo') }
|
||||
· ───────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a == b !== c) { console.log('foo') }
|
||||
· ────────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a === b == c) { console.log('foo') }
|
||||
· ────────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a === b === c) { console.log('foo') }
|
||||
· ─────────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a === b != c) { console.log('foo') }
|
||||
· ────────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a === b !== c) { console.log('foo') }
|
||||
· ─────────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a != b == c) { console.log('foo') }
|
||||
· ───────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a != b === c) { console.log('foo') }
|
||||
· ────────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a != b != c) { console.log('foo') }
|
||||
· ───────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a != b !== c) { console.log('foo') }
|
||||
· ────────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a !== b == c) { console.log('foo') }
|
||||
· ────────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a !== b === c) { console.log('foo') }
|
||||
· ─────────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a !== b != c) { console.log('foo') }
|
||||
· ────────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a !== b !== c) { console.log('foo') }
|
||||
· ─────────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a > b > c) { console.log('foo') }
|
||||
· ─────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a > b < c) { console.log('foo') }
|
||||
· ─────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a > b >= c) { console.log('foo') }
|
||||
· ──────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a > b <= c) { console.log('foo') }
|
||||
· ──────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a < b > c) { console.log('foo') }
|
||||
· ─────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a < b < c) { console.log('foo') }
|
||||
· ─────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a < b >= c) { console.log('foo') }
|
||||
· ──────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a < b <= c) { console.log('foo') }
|
||||
· ──────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a >= b > c) { console.log('foo') }
|
||||
· ──────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a >= b < c) { console.log('foo') }
|
||||
· ──────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a >= b >= c) { console.log('foo') }
|
||||
· ───────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a >= b <= c) { console.log('foo') }
|
||||
· ───────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a <= b > c) { console.log('foo') }
|
||||
· ──────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a <= b < c) { console.log('foo') }
|
||||
· ──────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a <= b >= c) { console.log('foo') }
|
||||
· ───────────
|
||||
╰────
|
||||
help: Comparison result should not be used directly as an operand of another comparison. If you need to compare three or more operands, you should connect each comparison operation with logical AND operator (`&&`)
|
||||
|
||||
⚠ deepscan(bad-comparison-sequence): Bad comparison sequence
|
||||
⚠ oxc(bad-comparison-sequence): Bad comparison sequence
|
||||
╭─[bad_comparison_sequence.tsx:1:5]
|
||||
1 │ if (a <= b <= c) { console.log('foo') }
|
||||
· ───────────
|
||||
|
|
|
|||
|
|
@ -2,56 +2,56 @@
|
|||
source: crates/oxc_linter/src/tester.rs
|
||||
expression: bad_min_max_func
|
||||
---
|
||||
⚠ deepscan(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
⚠ oxc(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
╭─[bad_min_max_func.tsx:1:1]
|
||||
1 │ Math.min(Math.max(100, x), 0)
|
||||
· ─────────────────────────────
|
||||
╰────
|
||||
help: This evaluates to 0.0 because of the incorrect `Math.min`/`Math.max` combination
|
||||
|
||||
⚠ deepscan(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
⚠ oxc(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
╭─[bad_min_max_func.tsx:1:1]
|
||||
1 │ Math.max(255.255, Math.min(0, x))
|
||||
· ─────────────────────────────────
|
||||
╰────
|
||||
help: This evaluates to 255.255 because of the incorrect `Math.min`/`Math.max` combination
|
||||
|
||||
⚠ deepscan(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
⚠ oxc(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
╭─[bad_min_max_func.tsx:1:1]
|
||||
1 │ Math.max(Math.min(0, x), 255)
|
||||
· ─────────────────────────────
|
||||
╰────
|
||||
help: This evaluates to 255.0 because of the incorrect `Math.min`/`Math.max` combination
|
||||
|
||||
⚠ deepscan(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
⚠ oxc(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
╭─[bad_min_max_func.tsx:1:1]
|
||||
1 │ Math.max(1000, Math.min(0, z))
|
||||
· ──────────────────────────────
|
||||
╰────
|
||||
help: This evaluates to 1000.0 because of the incorrect `Math.min`/`Math.max` combination
|
||||
|
||||
⚠ deepscan(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
⚠ oxc(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
╭─[bad_min_max_func.tsx:1:1]
|
||||
1 │ Math["min"](0, Math.max(100, x))
|
||||
· ────────────────────────────────
|
||||
╰────
|
||||
help: This evaluates to 0.0 because of the incorrect `Math.min`/`Math.max` combination
|
||||
|
||||
⚠ deepscan(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
⚠ oxc(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
╭─[bad_min_max_func.tsx:1:1]
|
||||
1 │ Math.min(Math.max(1000, x), 100, 3)
|
||||
· ───────────────────────────────────
|
||||
╰────
|
||||
help: This evaluates to 3.0 because of the incorrect `Math.min`/`Math.max` combination
|
||||
|
||||
⚠ deepscan(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
⚠ oxc(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
╭─[bad_min_max_func.tsx:1:1]
|
||||
1 │ Math.min(0, 5, Math['max'](x, 100, 30))
|
||||
· ───────────────────────────────────────
|
||||
╰────
|
||||
help: This evaluates to 0.0 because of the incorrect `Math.min`/`Math.max` combination
|
||||
|
||||
⚠ deepscan(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
⚠ oxc(bad-min-max-func): Math.min and Math.max combination leads to constant result
|
||||
╭─[bad_min_max_func.tsx:1:1]
|
||||
1 │ Math.min(Math.max(1e3, x), 1.55e2)
|
||||
· ──────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -2,70 +2,70 @@
|
|||
source: crates/oxc_linter/src/tester.rs
|
||||
expression: bad_object_literal_comparison
|
||||
---
|
||||
⚠ deepscan(bad-object-literal-comparison): Unexpected object literal comparison.
|
||||
⚠ oxc(bad-object-literal-comparison): Unexpected object literal comparison.
|
||||
╭─[bad_object_literal_comparison.tsx:1:5]
|
||||
1 │ if (y === {}) { }
|
||||
· ────────
|
||||
╰────
|
||||
help: This comparison will always return false as object literals are never equal to each other. Consider using `Object.entries()` of `Object.keys()` and comparing their lengths.
|
||||
|
||||
⚠ deepscan(bad-object-literal-comparison): Unexpected array literal comparison.
|
||||
⚠ oxc(bad-object-literal-comparison): Unexpected array literal comparison.
|
||||
╭─[bad_object_literal_comparison.tsx:1:5]
|
||||
1 │ if (arr !== []) { }
|
||||
· ──────────
|
||||
╰────
|
||||
help: This comparison will always return true as array literals are never equal to each other. Consider using `Array.length` if empty checking was intended.
|
||||
|
||||
⚠ deepscan(bad-object-literal-comparison): Unexpected object literal comparison.
|
||||
⚠ oxc(bad-object-literal-comparison): Unexpected object literal comparison.
|
||||
╭─[bad_object_literal_comparison.tsx:1:32]
|
||||
1 │ if (typeof item == 'object' && item == {}) { }
|
||||
· ──────────
|
||||
╰────
|
||||
help: This comparison will always return false as object literals are never equal to each other. Consider using `Object.entries()` of `Object.keys()` and comparing their lengths.
|
||||
|
||||
⚠ deepscan(bad-object-literal-comparison): Unexpected array literal comparison.
|
||||
⚠ oxc(bad-object-literal-comparison): Unexpected array literal comparison.
|
||||
╭─[bad_object_literal_comparison.tsx:1:5]
|
||||
1 │ if (data === []) { }
|
||||
· ───────────
|
||||
╰────
|
||||
help: This comparison will always return false as array literals are never equal to each other. Consider using `Array.length` if empty checking was intended.
|
||||
|
||||
⚠ deepscan(bad-object-literal-comparison): Unexpected object literal comparison.
|
||||
⚠ oxc(bad-object-literal-comparison): Unexpected object literal comparison.
|
||||
╭─[bad_object_literal_comparison.tsx:1:34]
|
||||
1 │ if (typeof person != 'object' || person != {}) { }
|
||||
· ────────────
|
||||
╰────
|
||||
help: This comparison will always return true as object literals are never equal to each other. Consider using `Object.entries()` of `Object.keys()` and comparing their lengths.
|
||||
|
||||
⚠ deepscan(bad-object-literal-comparison): Unexpected object literal comparison.
|
||||
⚠ oxc(bad-object-literal-comparison): Unexpected object literal comparison.
|
||||
╭─[bad_object_literal_comparison.tsx:1:5]
|
||||
1 │ if (list === {}) { }
|
||||
· ───────────
|
||||
╰────
|
||||
help: This comparison will always return false as object literals are never equal to each other. Consider using `Object.entries()` of `Object.keys()` and comparing their lengths.
|
||||
|
||||
⚠ deepscan(bad-object-literal-comparison): Unexpected object literal comparison.
|
||||
⚠ oxc(bad-object-literal-comparison): Unexpected object literal comparison.
|
||||
╭─[bad_object_literal_comparison.tsx:1:36]
|
||||
1 │ if (typeof response == 'object' && response != {}) { }
|
||||
· ──────────────
|
||||
╰────
|
||||
help: This comparison will always return true as object literals are never equal to each other. Consider using `Object.entries()` of `Object.keys()` and comparing their lengths.
|
||||
|
||||
⚠ deepscan(bad-object-literal-comparison): Unexpected array literal comparison.
|
||||
⚠ oxc(bad-object-literal-comparison): Unexpected array literal comparison.
|
||||
╭─[bad_object_literal_comparison.tsx:1:5]
|
||||
1 │ if (user !== []) { }
|
||||
· ───────────
|
||||
╰────
|
||||
help: This comparison will always return true as array literals are never equal to each other. Consider using `Array.length` if empty checking was intended.
|
||||
|
||||
⚠ deepscan(bad-object-literal-comparison): Unexpected object literal comparison.
|
||||
⚠ oxc(bad-object-literal-comparison): Unexpected object literal comparison.
|
||||
╭─[bad_object_literal_comparison.tsx:1:35]
|
||||
1 │ if (typeof product == 'object' && product === {}) { }
|
||||
· ──────────────
|
||||
╰────
|
||||
help: This comparison will always return false as object literals are never equal to each other. Consider using `Object.entries()` of `Object.keys()` and comparing their lengths.
|
||||
|
||||
⚠ deepscan(bad-object-literal-comparison): Unexpected array literal comparison.
|
||||
⚠ oxc(bad-object-literal-comparison): Unexpected array literal comparison.
|
||||
╭─[bad_object_literal_comparison.tsx:1:5]
|
||||
1 │ if (config != []) { }
|
||||
· ────────────
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
source: crates/oxc_linter/src/tester.rs
|
||||
expression: bad_replace_all_arg
|
||||
---
|
||||
⚠ deepscan(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.
|
||||
⚠ oxc(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.
|
||||
╭─[bad_replace_all_arg.tsx:1:12]
|
||||
1 │ withSpaces.replaceAll(/\s+/, ',');
|
||||
· ─────┬──── ──┬──
|
||||
|
|
@ -11,7 +11,7 @@ expression: bad_replace_all_arg
|
|||
╰────
|
||||
help: To replace all occurrences of a string, use the `replaceAll` method with the global flag (g) in the regular expression.
|
||||
|
||||
⚠ deepscan(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.
|
||||
⚠ oxc(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.
|
||||
╭─[bad_replace_all_arg.tsx:1:12]
|
||||
1 │ withSpaces.replaceAll(/\s+/i, ',');
|
||||
· ─────┬──── ───┬──
|
||||
|
|
@ -20,7 +20,7 @@ expression: bad_replace_all_arg
|
|||
╰────
|
||||
help: To replace all occurrences of a string, use the `replaceAll` method with the global flag (g) in the regular expression.
|
||||
|
||||
⚠ deepscan(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.
|
||||
⚠ oxc(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.
|
||||
╭─[bad_replace_all_arg.tsx:1:12]
|
||||
1 │ withSpaces.replaceAll(new RegExp('\s+'), ',');
|
||||
· ─────┬──── ────────┬────────
|
||||
|
|
@ -29,7 +29,7 @@ expression: bad_replace_all_arg
|
|||
╰────
|
||||
help: To replace all occurrences of a string, use the `replaceAll` method with the global flag (g) in the regular expression.
|
||||
|
||||
⚠ deepscan(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.
|
||||
⚠ oxc(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.
|
||||
╭─[bad_replace_all_arg.tsx:1:12]
|
||||
1 │ withSpaces.replaceAll(new RegExp('\s+','i'), ',');
|
||||
· ─────┬──── ──────────┬──────────
|
||||
|
|
@ -38,13 +38,13 @@ expression: bad_replace_all_arg
|
|||
╰────
|
||||
help: To replace all occurrences of a string, use the `replaceAll` method with the global flag (g) in the regular expression.
|
||||
|
||||
⚠ deepscan(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.
|
||||
⚠ oxc(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.
|
||||
╭─[bad_replace_all_arg.tsx:2:25]
|
||||
1 │
|
||||
2 │ const foo = /\s+/;
|
||||
· ──┬──
|
||||
· ╰── RegExp supplied here
|
||||
3 │
|
||||
3 │
|
||||
4 │ withSpaces.replaceAll(foo, ',');
|
||||
· ─────┬────
|
||||
· ╰── `replaceAll` called here
|
||||
|
|
@ -52,13 +52,13 @@ expression: bad_replace_all_arg
|
|||
╰────
|
||||
help: To replace all occurrences of a string, use the `replaceAll` method with the global flag (g) in the regular expression.
|
||||
|
||||
⚠ deepscan(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.
|
||||
⚠ oxc(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.
|
||||
╭─[bad_replace_all_arg.tsx:2:25]
|
||||
1 │
|
||||
2 │ const foo = /\s+/i;
|
||||
· ───┬──
|
||||
· ╰── RegExp supplied here
|
||||
3 │
|
||||
3 │
|
||||
4 │ withSpaces.replaceAll(foo, ',');
|
||||
· ─────┬────
|
||||
· ╰── `replaceAll` called here
|
||||
|
|
@ -66,13 +66,13 @@ expression: bad_replace_all_arg
|
|||
╰────
|
||||
help: To replace all occurrences of a string, use the `replaceAll` method with the global flag (g) in the regular expression.
|
||||
|
||||
⚠ deepscan(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.
|
||||
⚠ oxc(bad-replace-all-arg): Global flag (g) is missing in the regular expression supplied to the `replaceAll` method.
|
||||
╭─[bad_replace_all_arg.tsx:2:25]
|
||||
1 │
|
||||
2 │ const foo = new RegExp('\s+');
|
||||
· ────────┬────────
|
||||
· ╰── RegExp supplied here
|
||||
3 │
|
||||
3 │
|
||||
4 │ withSpaces.replaceAll(foo, ',');
|
||||
· ─────┬────
|
||||
· ╰── `replaceAll` called here
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
source: crates/oxc_linter/src/tester.rs
|
||||
expression: missing_throw
|
||||
---
|
||||
⚠ deepscan(missing-throw): Missing throw
|
||||
⚠ oxc(missing-throw): Missing throw
|
||||
╭─[missing_throw.tsx:1:18]
|
||||
1 │ function foo() { new Error() }
|
||||
· ───────────
|
||||
╰────
|
||||
help: The `throw` keyword seems to be missing in front of this 'new' expression
|
||||
|
||||
⚠ deepscan(missing-throw): Missing throw
|
||||
⚠ oxc(missing-throw): Missing throw
|
||||
╭─[missing_throw.tsx:1:21]
|
||||
1 │ const foo = () => { new Error() }
|
||||
· ───────────
|
||||
|
|
|
|||
|
|
@ -2,42 +2,42 @@
|
|||
source: crates/oxc_linter/src/tester.rs
|
||||
expression: number_arg_out_of_range
|
||||
---
|
||||
⚠ deepscan(number-arg-out-of-range): Radix or precision arguments of number-related functions should not exceed the limit
|
||||
⚠ oxc(number-arg-out-of-range): Radix or precision arguments of number-related functions should not exceed the limit
|
||||
╭─[number_arg_out_of_range.tsx:1:20]
|
||||
1 │ var x = 42;var s = x.toString(1);
|
||||
· ─────────────
|
||||
╰────
|
||||
help: The first argument of 'Number.prototype.toString' should be a number between 2 and 36
|
||||
|
||||
⚠ deepscan(number-arg-out-of-range): Radix or precision arguments of number-related functions should not exceed the limit
|
||||
⚠ oxc(number-arg-out-of-range): Radix or precision arguments of number-related functions should not exceed the limit
|
||||
╭─[number_arg_out_of_range.tsx:1:20]
|
||||
1 │ var x = 42;var s = x.toString(43);
|
||||
· ──────────────
|
||||
╰────
|
||||
help: The first argument of 'Number.prototype.toString' should be a number between 2 and 36
|
||||
|
||||
⚠ deepscan(number-arg-out-of-range): Radix or precision arguments of number-related functions should not exceed the limit
|
||||
⚠ oxc(number-arg-out-of-range): Radix or precision arguments of number-related functions should not exceed the limit
|
||||
╭─[number_arg_out_of_range.tsx:1:20]
|
||||
1 │ var x = 42;var s = x.toFixed(22);
|
||||
· ─────────────
|
||||
╰────
|
||||
help: The first argument of 'Number.prototype.toFixed' should be a number between 0 and 20
|
||||
|
||||
⚠ deepscan(number-arg-out-of-range): Radix or precision arguments of number-related functions should not exceed the limit
|
||||
⚠ oxc(number-arg-out-of-range): Radix or precision arguments of number-related functions should not exceed the limit
|
||||
╭─[number_arg_out_of_range.tsx:1:20]
|
||||
1 │ var x = 42;var s = x['toExponential'](22);
|
||||
· ──────────────────────
|
||||
╰────
|
||||
help: The first argument of 'Number.prototype.toExponential' should be a number between 0 and 20
|
||||
|
||||
⚠ deepscan(number-arg-out-of-range): Radix or precision arguments of number-related functions should not exceed the limit
|
||||
⚠ oxc(number-arg-out-of-range): Radix or precision arguments of number-related functions should not exceed the limit
|
||||
╭─[number_arg_out_of_range.tsx:1:20]
|
||||
1 │ var x = 42;var s = x.toPrecision(0);
|
||||
· ────────────────
|
||||
╰────
|
||||
help: The first argument of 'Number.prototype.toPrecision' should be a number between 1 and 21
|
||||
|
||||
⚠ deepscan(number-arg-out-of-range): Radix or precision arguments of number-related functions should not exceed the limit
|
||||
⚠ oxc(number-arg-out-of-range): Radix or precision arguments of number-related functions should not exceed the limit
|
||||
╭─[number_arg_out_of_range.tsx:1:20]
|
||||
1 │ var x = 42;var s = x.toPrecision(100);
|
||||
· ──────────────────
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
source: crates/oxc_linter/src/tester.rs
|
||||
expression: uninvoked_array_callback
|
||||
---
|
||||
⚠ deepscan(uninvoked-array-callback): Uninvoked array callback
|
||||
⚠ oxc(uninvoked-array-callback): Uninvoked array callback
|
||||
╭─[uninvoked_array_callback.tsx:1:14]
|
||||
1 │ const list = new Array(5).map(_ => {})
|
||||
· ──────┬───── ─┬─
|
||||
|
|
@ -11,7 +11,7 @@ expression: uninvoked_array_callback
|
|||
╰────
|
||||
help: consider filling the array with `undefined` values using `Array.prototype.fill()`
|
||||
|
||||
⚠ deepscan(uninvoked-array-callback): Uninvoked array callback
|
||||
⚠ oxc(uninvoked-array-callback): Uninvoked array callback
|
||||
╭─[uninvoked_array_callback.tsx:1:14]
|
||||
1 │ const list = new Array(5).filter(function(_) {})
|
||||
· ──────┬───── ───┬──
|
||||
|
|
@ -20,7 +20,7 @@ expression: uninvoked_array_callback
|
|||
╰────
|
||||
help: consider filling the array with `undefined` values using `Array.prototype.fill()`
|
||||
|
||||
⚠ deepscan(uninvoked-array-callback): Uninvoked array callback
|
||||
⚠ oxc(uninvoked-array-callback): Uninvoked array callback
|
||||
╭─[uninvoked_array_callback.tsx:1:14]
|
||||
1 │ const list = new Array(5)['every'](function(_) {})
|
||||
· ──────┬───── ───┬───
|
||||
|
|
|
|||
3
justfile
3
justfile
|
|
@ -103,9 +103,6 @@ javascript-globals:
|
|||
new-rule name:
|
||||
cargo run -p rulegen {{name}}
|
||||
|
||||
new-deepscan-rule name:
|
||||
cargo run -p rulegen {{name}} deepscan
|
||||
|
||||
new-jest-rule name:
|
||||
cargo run -p rulegen {{name}} jest
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ const readAllImplementedRuleNames = async () => {
|
|||
|
||||
// Ignore no reference rules
|
||||
if (prefixedName.startsWith("oxc/")) continue;
|
||||
if (prefixedName.startsWith("deepscan/")) continue;
|
||||
|
||||
rules.add(prefixedName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -516,7 +516,6 @@ pub enum RuleKind {
|
|||
ReactPerf,
|
||||
JSXA11y,
|
||||
Oxc,
|
||||
DeepScan,
|
||||
NextJS,
|
||||
JSDoc,
|
||||
Node,
|
||||
|
|
@ -533,7 +532,6 @@ impl RuleKind {
|
|||
"react-perf" => Self::ReactPerf,
|
||||
"jsx-a11y" => Self::JSXA11y,
|
||||
"oxc" => Self::Oxc,
|
||||
"deepscan" => Self::DeepScan,
|
||||
"nextjs" => Self::NextJS,
|
||||
"jsdoc" => Self::JSDoc,
|
||||
"n" => Self::Node,
|
||||
|
|
@ -553,7 +551,6 @@ impl Display for RuleKind {
|
|||
Self::React => write!(f, "eslint-plugin-react"),
|
||||
Self::ReactPerf => write!(f, "eslint-plugin-react-perf"),
|
||||
Self::JSXA11y => write!(f, "eslint-plugin-jsx-a11y"),
|
||||
Self::DeepScan => write!(f, "deepscan"),
|
||||
Self::Oxc => write!(f, "oxc"),
|
||||
Self::NextJS => write!(f, "eslint-plugin-next"),
|
||||
Self::JSDoc => write!(f, "eslint-plugin-jsdoc"),
|
||||
|
|
@ -585,7 +582,7 @@ fn main() {
|
|||
RuleKind::JSDoc => format!("{JSDOC_TEST_PATH}/{camel_rule_name}.js"),
|
||||
RuleKind::Node => format!("{NODE_TEST_PATH}/{kebab_rule_name}.js"),
|
||||
RuleKind::TreeShaking => format!("{TREE_SHAKING_PATH}/{kebab_rule_name}.test.ts"),
|
||||
RuleKind::Oxc | RuleKind::DeepScan => String::new(),
|
||||
RuleKind::Oxc => String::new(),
|
||||
};
|
||||
|
||||
println!("Reading test file from {rule_test_path}");
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ impl<'a> Template<'a> {
|
|||
RuleKind::ReactPerf => Path::new("crates/oxc_linter/src/rules/react_perf"),
|
||||
RuleKind::JSXA11y => Path::new("crates/oxc_linter/src/rules/jsx_a11y"),
|
||||
RuleKind::Oxc => Path::new("crates/oxc_linter/src/rules/oxc"),
|
||||
RuleKind::DeepScan => Path::new("crates/oxc_linter/src/rules/deepscan"),
|
||||
RuleKind::NextJS => Path::new("crates/oxc_linter/src/rules/nextjs"),
|
||||
RuleKind::JSDoc => Path::new("crates/oxc_linter/src/rules/jsdoc"),
|
||||
RuleKind::Node => Path::new("crates/oxc_linter/src/rules/node"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue