fix(linter): improve diagnostic messages for various lint rules (#5808)

This is the first of a few PRs to remove "Disallow <x>" from all diagnostic
messages. More to come.
This commit is contained in:
DonIsaac 2024-09-17 05:46:15 +00:00
parent 858f7af2b5
commit b5ad518621
20 changed files with 231 additions and 218 deletions

View file

@ -10,9 +10,9 @@ use oxc_span::{GetSpan, Span};
use crate::{context::LintContext, rule::Rule, AstNode}; use crate::{context::LintContext, rule::Rule, AstNode};
fn no_exports_assign(span: Span) -> OxcDiagnostic { fn no_exports_assign(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Disallow the assignment to `exports`.") OxcDiagnostic::warn("Unexpected assignment to 'exports'.")
.with_label(span) .with_label(span)
.with_help("Unexpected assignment to 'exports' variable. Use 'module.exports' instead.") .with_help("Use 'module.exports' instead.")
} }
fn is_exports(node: &AssignmentTarget, ctx: &LintContext) -> bool { fn is_exports(node: &AssignmentTarget, ctx: &LintContext) -> bool {
@ -40,12 +40,18 @@ pub struct NoExportsAssign;
declare_oxc_lint!( declare_oxc_lint!(
/// ### What it does /// ### What it does
/// /// Disallows assignment to `exports`.
/// This rule is aimed at disallowing `exports = {}`, but allows `module.exports = exports = {}` to avoid conflict with `n/exports-style` rule's `allowBatchAssign` option.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// ///
/// Directly using `exports = {}` can lead to confusion and potential bugs because it reassigns the `exports` object, which may break module exports. It is more predictable and clearer to use `module.exports` directly or in conjunction with `exports`. /// Directly using `exports = {}` can lead to confusion and potential bugs
/// because it reassigns the `exports` object, which may break module
/// exports. It is more predictable and clearer to use `module.exports`
/// directly or in conjunction with `exports`.
///
/// This rule is aimed at disallowing `exports = {}`, but allows
/// `module.exports = exports = {}` to avoid conflict with `n/exports-style`
/// rule's `allowBatchAssign` option.
/// ///
/// ### Examples /// ### Examples
/// ///

View file

@ -6,7 +6,10 @@ use oxc_span::Span;
use crate::{context::LintContext, rule::Rule, utils::PROMISE_STATIC_METHODS, AstNode}; use crate::{context::LintContext, rule::Rule, utils::PROMISE_STATIC_METHODS, AstNode};
fn static_promise_diagnostic(static_name: &str, span: Span) -> OxcDiagnostic { fn static_promise_diagnostic(static_name: &str, span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(format!("Disallow calling `new` on a `Promise.{static_name}`")) OxcDiagnostic::warn(format!("Do not use `new` on `Promise.{static_name}`"))
.with_help(format!(
"`Promise.{static_name}` is not a constructor. Call it as a function instead."
))
.with_label(span) .with_label(span)
} }
@ -16,15 +19,23 @@ pub struct NoNewStatics;
declare_oxc_lint!( declare_oxc_lint!(
/// ### What it does /// ### What it does
/// ///
/// Disallow calling new on a Promise static method. /// Disallows calling new on static `Promise` methods.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// ///
/// Calling a Promise static method with new is invalid, resulting in a TypeError at runtime. /// Calling a static `Promise` method with `new` is invalid and will result
/// in a `TypeError` at runtime.
/// ///
/// ### Example /// ### Example
///
/// Examples of **incorrect** code for this rule:
/// ```javascript /// ```javascript
/// new Promise.resolve(value); /// const x = new Promise.resolve(value);
/// ```
///
/// Examples of **correct** code for this rule:
/// ```javascript
/// const x = Promise.resolve(value);
/// ``` /// ```
NoNewStatics, NoNewStatics,
correctness, correctness,

View file

@ -13,9 +13,7 @@ use crate::{
}; };
fn jsx_no_undef_diagnostic(ident_name: &str, span1: Span) -> OxcDiagnostic { fn jsx_no_undef_diagnostic(ident_name: &str, span1: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Disallow undeclared variables in JSX") OxcDiagnostic::warn(format!("'{ident_name}' is not defined.")).with_label(span1)
.with_help(format!("'{ident_name}' is not defined."))
.with_label(span1)
} }
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, Clone)]

View file

@ -2,7 +2,7 @@ use itertools::Itertools;
use oxc_ast::{ast::JSXAttributeItem, AstKind}; use oxc_ast::{ast::JSXAttributeItem, AstKind};
use oxc_diagnostics::OxcDiagnostic; use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint; use oxc_macros::declare_oxc_lint;
use oxc_span::{Atom, Span}; use oxc_span::{Atom, GetSpan, Span};
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use crate::{ use crate::{
@ -17,14 +17,17 @@ fn jsx_props_no_spread_multiple_identifiers_diagnostic(
spans: Vec<Span>, spans: Vec<Span>,
prop_name: &str, prop_name: &str,
) -> OxcDiagnostic { ) -> OxcDiagnostic {
OxcDiagnostic::warn("Disallow JSX prop spreading the same identifier multiple times.") OxcDiagnostic::warn(format!("Prop '{prop_name}' is spread multiple times."))
.with_help(format!("Prop '{prop_name}' is spread multiple times.")) .with_help("Remove all but one spread.")
.with_labels(spans) .with_labels(spans)
} }
fn jsx_props_no_spread_multiple_member_expressions_diagnostic(spans: Vec<Span>) -> OxcDiagnostic { fn jsx_props_no_spread_multiple_member_expressions_diagnostic(
OxcDiagnostic::warn("Disallow JSX prop spreading the same member expression multiple times.") spans: Vec<Span>,
.with_help("Remove the first spread.") member_name: &str,
) -> OxcDiagnostic {
OxcDiagnostic::warn(format!("'{member_name}' is spread multiple times."))
.with_help("Remove all but one spread.")
.with_labels(spans) .with_labels(spans)
} }
@ -109,11 +112,13 @@ impl Rule for JsxPropsNoSpreadMulti {
member_expressions.iter().tuple_combinations().for_each( member_expressions.iter().tuple_combinations().for_each(
|((left, left_span), (right, right_span))| { |((left, left_span), (right, right_span))| {
if is_same_member_expression(left, right, ctx) { if is_same_member_expression(left, right, ctx) {
// 'foo.bar'
let member_prop_name = ctx.source_range(left.span());
ctx.diagnostic_with_fix( ctx.diagnostic_with_fix(
jsx_props_no_spread_multiple_member_expressions_diagnostic(vec![ jsx_props_no_spread_multiple_member_expressions_diagnostic(
*left_span, vec![*left_span, *right_span],
*right_span, member_prop_name,
]), ),
|fixer| fixer.delete_range(*left_span), |fixer| fixer.delete_range(*left_span),
); );
} }

View file

@ -19,10 +19,8 @@ use crate::{
fn void_dom_elements_no_children_diagnostic(tag: &str, span: Span) -> OxcDiagnostic { fn void_dom_elements_no_children_diagnostic(tag: &str, span: Span) -> OxcDiagnostic {
// TODO: use imperative phrasing // TODO: use imperative phrasing
OxcDiagnostic::warn( OxcDiagnostic::warn(format!("Void DOM element <{tag:?} /> cannot receive children."))
"Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children.", .with_help("Remove this element's children or use a non-void element.")
)
.with_help(format!("Void DOM element <{tag:?} /> cannot receive children."))
.with_label(span) .with_label(span)
} }
@ -31,6 +29,9 @@ pub struct VoidDomElementsNoChildren;
declare_oxc_lint!( declare_oxc_lint!(
/// ### What it does /// ### What it does
/// Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children.
///
/// ### Why is this bad?
/// There are some HTML elements that are only self-closing (e.g. img, br, hr). These are collectively known as void DOM elements. /// There are some HTML elements that are only self-closing (e.g. img, br, hr). These are collectively known as void DOM elements.
/// This rule checks that children are not passed to void DOM elements. /// This rule checks that children are not passed to void DOM elements.
/// ///

View file

@ -28,9 +28,7 @@ declare_oxc_lint!(
); );
fn no_dynamic_delete_diagnostic(span: Span) -> OxcDiagnostic { fn no_dynamic_delete_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Do not delete dynamically computed property keys.") OxcDiagnostic::warn("Do not delete dynamically computed property keys.").with_label(span)
.with_help("Disallow using the `delete` operator on computed key expressions")
.with_label(span)
} }
impl Rule for NoDynamicDelete { impl Rule for NoDynamicDelete {

View file

@ -6,8 +6,8 @@ use oxc_span::Span;
use crate::{context::LintContext, rule::Rule, AstNode}; use crate::{context::LintContext, rule::Rule, AstNode};
fn no_useless_empty_export_diagnostic(span: Span) -> OxcDiagnostic { fn no_useless_empty_export_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Disallow empty exports that don't change anything in a module file") OxcDiagnostic::warn("Empty exports do nothing in module files")
.with_help("Empty export does nothing and can be removed.") .with_help("Remove this empty export.")
.with_label(span) .with_label(span)
} }
@ -19,19 +19,35 @@ declare_oxc_lint!(
/// ///
/// Disallow empty exports that don't change anything in a module file. /// Disallow empty exports that don't change anything in a module file.
/// ///
/// ## Why is this bad?
/// An empty `export {}` statement is sometimes useful in TypeScript code to
/// turn a file that would otherwise be a script file into a module file.
/// Per the [TypeScript Handbook Modules page](https://www.typescriptlang.org/docs/handbook/modules/introduction.html):
///
/// In TypeScript, just as in ECMAScript 2015, any file containing a
/// top-level import or export is considered a module. Conversely, a file
/// without any top-level import or export declarations is treated as a
/// script whose contents are available in the global scope (and therefore
/// to modules as well).
///
/// However, an `export {}` statement does nothing if there are any other
/// top-level import or export statements in a file.
///
/// This rule reports an `export {}` that doesn't do anything in a file
/// already using ES modules.
///
/// ### Example /// ### Example
/// ///
/// ### Bad /// Examples of **incorrect** code for this rule:
/// ```ts /// ```ts
/// export const value = 'Hello, world!'; /// export const value = 'Hello, world!';
/// export {}; /// export {};
/// ``` /// ```
/// ///
/// ### Good /// Examples of **correct** code for this rule:
/// ```ts /// ```ts
/// export const value = 'Hello, world!'; /// export const value = 'Hello, world!';
/// ``` /// ```
///
NoUselessEmptyExport, NoUselessEmptyExport,
correctness, correctness,
fix fix

View file

@ -11,8 +11,8 @@ use oxc_span::Span;
use crate::{context::LintContext, rule::Rule, AstNode}; use crate::{context::LintContext, rule::Rule, AstNode};
fn no_anonymous_default_export_diagnostic(span: Span, kind: ErrorNodeKind) -> OxcDiagnostic { fn no_anonymous_default_export_diagnostic(span: Span, kind: ErrorNodeKind) -> OxcDiagnostic {
OxcDiagnostic::warn("Disallow anonymous functions and classes as the default export") OxcDiagnostic::warn(format!("This {kind} default export is missing a name"))
.with_help(format!("The {kind} should be named.")) // TODO: suggest a name. https://github.com/sindresorhus/eslint-plugin-unicorn/blob/d3e4b805da31c6ed7275e2e2e770b6b0fbcf11c2/rules/no-anonymous-default-export.js#L41
.with_label(span) .with_label(span)
} }
@ -24,7 +24,9 @@ declare_oxc_lint!(
/// Disallow anonymous functions and classes as the default export /// Disallow anonymous functions and classes as the default export
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// Naming default exports improves codebase searchability by ensuring consistent identifier use for a module's default export, both where it's declared and where it's imported. /// Naming default exports improves codebase searchability by ensuring
/// consistent identifier use for a module's default export, both where it's
/// declared and where it's imported.
/// ///
/// ### Example /// ### Example
/// ///

View file

@ -6,8 +6,8 @@ use oxc_span::{GetSpan, Span};
use crate::{context::LintContext, rule::Rule, AstNode}; use crate::{context::LintContext, rule::Rule, AstNode};
fn no_await_expression_member_diagnostic(span: Span) -> OxcDiagnostic { fn no_await_expression_member_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Disallow member access from await expression") OxcDiagnostic::warn("Do not access a member directly from an await expression.")
.with_help("When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable.") .with_help("Assign the result of the await expression to a variable, then access the member from that variable.")
.with_label(span) .with_label(span)
} }
@ -17,12 +17,12 @@ pub struct NoAwaitExpressionMember;
declare_oxc_lint!( declare_oxc_lint!(
/// ### What it does /// ### What it does
/// ///
/// This rule disallows member access from await expression /// Disallows member access from `await` expressions.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// ///
/// When accessing a member from an await expression, /// When accessing a member from an `await` expression,
/// the await expression has to be parenthesized, which is not readable. /// the `await` expression has to be parenthesized, which is not readable.
/// ///
/// ### Example /// ### Example
/// ```javascript /// ```javascript
@ -35,7 +35,8 @@ declare_oxc_lint!(
/// } /// }
/// ``` /// ```
NoAwaitExpressionMember, NoAwaitExpressionMember,
style style,
pending
); );
impl Rule for NoAwaitExpressionMember { impl Rule for NoAwaitExpressionMember {

View file

@ -6,8 +6,7 @@ use oxc_span::Span;
use crate::{context::LintContext, rule::Rule, AstNode}; use crate::{context::LintContext, rule::Rule, AstNode};
fn no_static_only_class_diagnostic(span: Span) -> OxcDiagnostic { fn no_static_only_class_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Disallow classes that only have static members.") OxcDiagnostic::warn("Use an object instead of a class with only static members.")
.with_help("A class with only static members could just be an object instead.")
.with_label(span) .with_label(span)
} }
@ -23,7 +22,6 @@ declare_oxc_lint!(
/// ///
/// A class with only static members could just be an object instead. /// A class with only static members could just be an object instead.
/// ///
///
/// ### Example /// ### Example
/// ///
/// Examples of **incorrect** code for this rule: /// Examples of **incorrect** code for this rule:
@ -41,8 +39,21 @@ declare_oxc_lint!(
/// constructor() {} /// constructor() {}
/// } /// }
/// ``` /// ```
/// ```javascript
/// const X = {
/// foo: false,
/// bar() {}
/// };
/// ```
/// ```javascript
/// class X {
/// static #foo = false; // private field
/// static bar() {}
/// }
/// ```
NoStaticOnlyClass, NoStaticOnlyClass,
pedantic pedantic,
pending
); );
impl Rule for NoStaticOnlyClass { impl Rule for NoStaticOnlyClass {

View file

@ -1,58 +1,50 @@
--- ---
source: crates/oxc_linter/src/tester.rs source: crates/oxc_linter/src/tester.rs
--- ---
⚠ eslint-plugin-react(jsx-no-undef): Disallow undeclared variables in JSX ⚠ eslint-plugin-react(jsx-no-undef): 'App' is not defined.
╭─[jsx_no_undef.tsx:1:26] ╭─[jsx_no_undef.tsx:1:26]
1 │ var React; React.render(<App />); 1 │ var React; React.render(<App />);
· ─── · ───
╰──── ╰────
help: 'App' is not defined.
⚠ eslint-plugin-react(jsx-no-undef): Disallow undeclared variables in JSX ⚠ eslint-plugin-react(jsx-no-undef): 'Appp' is not defined.
╭─[jsx_no_undef.tsx:1:26] ╭─[jsx_no_undef.tsx:1:26]
1 │ var React; React.render(<Appp.Foo />); 1 │ var React; React.render(<Appp.Foo />);
· ──── · ────
╰──── ╰────
help: 'Appp' is not defined.
⚠ eslint-plugin-react(jsx-no-undef): Disallow undeclared variables in JSX ⚠ eslint-plugin-react(jsx-no-undef): 'appp' is not defined.
╭─[jsx_no_undef.tsx:1:26] ╭─[jsx_no_undef.tsx:1:26]
1 │ var React; React.render(<appp.Foo />); 1 │ var React; React.render(<appp.Foo />);
· ──── · ────
╰──── ╰────
help: 'appp' is not defined.
⚠ eslint-plugin-react(jsx-no-undef): Disallow undeclared variables in JSX ⚠ eslint-plugin-react(jsx-no-undef): 'appp' is not defined.
╭─[jsx_no_undef.tsx:1:26] ╭─[jsx_no_undef.tsx:1:26]
1 │ var React; React.render(<appp.foo.Bar />); 1 │ var React; React.render(<appp.foo.Bar />);
· ──── · ────
╰──── ╰────
help: 'appp' is not defined.
⚠ eslint-plugin-react(jsx-no-undef): Disallow undeclared variables in JSX ⚠ eslint-plugin-react(jsx-no-undef): 'Foo' is not defined.
╭─[jsx_no_undef.tsx:1:26] ╭─[jsx_no_undef.tsx:1:26]
1 │ var React; React.render(<Foo />); 1 │ var React; React.render(<Foo />);
· ─── · ───
╰──── ╰────
help: 'Foo' is not defined.
⚠ eslint-plugin-react(jsx-no-undef): Disallow undeclared variables in JSX ⚠ eslint-plugin-react(jsx-no-undef): 'Unknown' is not defined.
╭─[jsx_no_undef.tsx:1:35] ╭─[jsx_no_undef.tsx:1:35]
1 │ var React; Unknown; React.render(<Unknown />) 1 │ var React; Unknown; React.render(<Unknown />)
· ─────── · ───────
╰──── ╰────
help: 'Unknown' is not defined.
⚠ eslint-plugin-react(jsx-no-undef): Disallow undeclared variables in JSX ⚠ eslint-plugin-react(jsx-no-undef): 'App' is not defined.
╭─[jsx_no_undef.tsx:1:49] ╭─[jsx_no_undef.tsx:1:49]
1 │ var React; { const App = null; }; React.render(<App />); 1 │ var React; { const App = null; }; React.render(<App />);
· ─── · ───
╰──── ╰────
help: 'App' is not defined.
⚠ eslint-plugin-react(jsx-no-undef): Disallow undeclared variables in JSX ⚠ eslint-plugin-react(jsx-no-undef): 'App' is not defined.
╭─[jsx_no_undef.tsx:1:42] ╭─[jsx_no_undef.tsx:1:42]
1 │ var React; enum A { App }; React.render(<App />); 1 │ var React; enum A { App }; React.render(<App />);
· ─── · ───
╰──── ╰────
help: 'App' is not defined.

View file

@ -1,47 +1,47 @@
--- ---
source: crates/oxc_linter/src/tester.rs source: crates/oxc_linter/src/tester.rs
--- ---
⚠ eslint-plugin-react(jsx-props-no-spread-multi): Disallow JSX prop spreading the same identifier multiple times. ⚠ eslint-plugin-react(jsx-props-no-spread-multi): Prop 'props' is spread multiple times.
╭─[jsx_props_no_spread_multi.tsx:3:16] ╭─[jsx_props_no_spread_multi.tsx:3:16]
2 │ const props = {}; 2 │ const props = {};
3 │ <App {...props} {...props} /> 3 │ <App {...props} {...props} />
· ────────── ────────── · ────────── ──────────
4 │ 4 │
╰──── ╰────
help: Prop 'props' is spread multiple times. help: Remove all but one spread.
⚠ eslint-plugin-react(jsx-props-no-spread-multi): Disallow JSX prop spreading the same member expression multiple times. ⚠ eslint-plugin-react(jsx-props-no-spread-multi): 'props.foo' is spread multiple times.
╭─[jsx_props_no_spread_multi.tsx:3:16] ╭─[jsx_props_no_spread_multi.tsx:3:16]
2 │ const props = {}; 2 │ const props = {};
3 │ <App {...props.foo} {...props.foo} /> 3 │ <App {...props.foo} {...props.foo} />
· ────────────── ────────────── · ────────────── ──────────────
4 │ 4 │
╰──── ╰────
help: Remove the first spread. help: Remove all but one spread.
⚠ eslint-plugin-react(jsx-props-no-spread-multi): Disallow JSX prop spreading the same member expression multiple times. ⚠ eslint-plugin-react(jsx-props-no-spread-multi): '(props.foo).baz' is spread multiple times.
╭─[jsx_props_no_spread_multi.tsx:3:16] ╭─[jsx_props_no_spread_multi.tsx:3:16]
2 │ const props = {}; 2 │ const props = {};
3 │ <App {...(props.foo).baz} {...(props.foo.baz)} /> 3 │ <App {...(props.foo).baz} {...(props.foo.baz)} />
· ──────────────────── ──────────────────── · ──────────────────── ────────────────────
4 │ 4 │
╰──── ╰────
help: Remove the first spread. help: Remove all but one spread.
⚠ eslint-plugin-react(jsx-props-no-spread-multi): Disallow JSX prop spreading the same identifier multiple times. ⚠ eslint-plugin-react(jsx-props-no-spread-multi): Prop 'props' is spread multiple times.
╭─[jsx_props_no_spread_multi.tsx:3:16] ╭─[jsx_props_no_spread_multi.tsx:3:16]
2 │ const props = {}; 2 │ const props = {};
3 │ <div {...props} a="a" {...props} /> 3 │ <div {...props} a="a" {...props} />
· ────────── ────────── · ────────── ──────────
4 │ 4 │
╰──── ╰────
help: Prop 'props' is spread multiple times. help: Remove all but one spread.
⚠ eslint-plugin-react(jsx-props-no-spread-multi): Disallow JSX prop spreading the same identifier multiple times. ⚠ eslint-plugin-react(jsx-props-no-spread-multi): Prop 'props' is spread multiple times.
╭─[jsx_props_no_spread_multi.tsx:3:16] ╭─[jsx_props_no_spread_multi.tsx:3:16]
2 │ const props = {}; 2 │ const props = {};
3 │ <div {...props} {...props} {...props} /> 3 │ <div {...props} {...props} {...props} />
· ────────── ────────── ────────── · ────────── ────────── ──────────
4 │ 4 │
╰──── ╰────
help: Prop 'props' is spread multiple times. help: Remove all but one spread.

View file

@ -1,58 +1,50 @@
--- ---
source: crates/oxc_linter/src/tester.rs source: crates/oxc_linter/src/tester.rs
--- ---
⚠ eslint-plugin-unicorn(no-anonymous-default-export): Disallow anonymous functions and classes as the default export ⚠ eslint-plugin-unicorn(no-anonymous-default-export): This class default export is missing a name
╭─[no_anonymous_default_export.tsx:1:1] ╭─[no_anonymous_default_export.tsx:1:1]
1 │ export default class {} 1 │ export default class {}
· ─────────────────────── · ───────────────────────
╰──── ╰────
help: The class should be named.
⚠ eslint-plugin-unicorn(no-anonymous-default-export): Disallow anonymous functions and classes as the default export ⚠ eslint-plugin-unicorn(no-anonymous-default-export): This function default export is missing a name
╭─[no_anonymous_default_export.tsx:1:1] ╭─[no_anonymous_default_export.tsx:1:1]
1 │ export default function () {} 1 │ export default function () {}
· ───────────────────────────── · ─────────────────────────────
╰──── ╰────
help: The function should be named.
⚠ eslint-plugin-unicorn(no-anonymous-default-export): Disallow anonymous functions and classes as the default export ⚠ eslint-plugin-unicorn(no-anonymous-default-export): This function default export is missing a name
╭─[no_anonymous_default_export.tsx:1:1] ╭─[no_anonymous_default_export.tsx:1:1]
1 │ export default () => {}; 1 │ export default () => {};
· ──────────────────────── · ────────────────────────
╰──── ╰────
help: The function should be named.
⚠ eslint-plugin-unicorn(no-anonymous-default-export): Disallow anonymous functions and classes as the default export ⚠ eslint-plugin-unicorn(no-anonymous-default-export): This class default export is missing a name
╭─[no_anonymous_default_export.tsx:1:1] ╭─[no_anonymous_default_export.tsx:1:1]
1 │ module.exports = class {} 1 │ module.exports = class {}
· ───────────────────────── · ─────────────────────────
╰──── ╰────
help: The class should be named.
⚠ eslint-plugin-unicorn(no-anonymous-default-export): Disallow anonymous functions and classes as the default export ⚠ eslint-plugin-unicorn(no-anonymous-default-export): This function default export is missing a name
╭─[no_anonymous_default_export.tsx:1:1] ╭─[no_anonymous_default_export.tsx:1:1]
1 │ module.exports = function () {} 1 │ module.exports = function () {}
· ─────────────────────────────── · ───────────────────────────────
╰──── ╰────
help: The function should be named.
⚠ eslint-plugin-unicorn(no-anonymous-default-export): Disallow anonymous functions and classes as the default export ⚠ eslint-plugin-unicorn(no-anonymous-default-export): This function default export is missing a name
╭─[no_anonymous_default_export.tsx:1:1] ╭─[no_anonymous_default_export.tsx:1:1]
1 │ module.exports = () => {} 1 │ module.exports = () => {}
· ───────────────────────── · ─────────────────────────
╰──── ╰────
help: The function should be named.
⚠ eslint-plugin-unicorn(no-anonymous-default-export): Disallow anonymous functions and classes as the default export ⚠ eslint-plugin-unicorn(no-anonymous-default-export): This function default export is missing a name
╭─[no_anonymous_default_export.tsx:1:17] ╭─[no_anonymous_default_export.tsx:1:17]
1 │ export default (async function * () {}) 1 │ export default (async function * () {})
· ────────────────────── · ──────────────────────
╰──── ╰────
help: The function should be named.
⚠ eslint-plugin-unicorn(no-anonymous-default-export): Disallow anonymous functions and classes as the default export ⚠ eslint-plugin-unicorn(no-anonymous-default-export): This class default export is missing a name
╭─[no_anonymous_default_export.tsx:1:17] ╭─[no_anonymous_default_export.tsx:1:17]
1 │ export default (class extends class {} {}) 1 │ export default (class extends class {} {})
· ───────────────────────── · ─────────────────────────
╰──── ╰────
help: The class should be named.

View file

@ -1,177 +1,177 @@
--- ---
source: crates/oxc_linter/src/tester.rs source: crates/oxc_linter/src/tester.rs
--- ---
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:1] ╭─[no_await_expression_member.tsx:1:1]
1 │ (await promise)[0] 1 │ (await promise)[0]
· ────────────────── · ──────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:1] ╭─[no_await_expression_member.tsx:1:1]
1 │ (await promise).property 1 │ (await promise).property
· ──────────────────────── · ────────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:13] ╭─[no_await_expression_member.tsx:1:13]
1 │ const foo = (await promise).bar() 1 │ const foo = (await promise).bar()
· ─────────────────── · ───────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:13] ╭─[no_await_expression_member.tsx:1:13]
1 │ const foo = (await promise).bar?.() 1 │ const foo = (await promise).bar?.()
· ─────────────────── · ───────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:13] ╭─[no_await_expression_member.tsx:1:13]
1 │ const foo = (await promise)?.bar() 1 │ const foo = (await promise)?.bar()
· ──────────────────── · ────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:22] ╭─[no_await_expression_member.tsx:1:22]
1 │ const firstElement = (await getArray())[0] 1 │ const firstElement = (await getArray())[0]
· ───────────────────── · ─────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:23] ╭─[no_await_expression_member.tsx:1:23]
1 │ const secondElement = (await getArray())[1] 1 │ const secondElement = (await getArray())[1]
· ───────────────────── · ─────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:22] ╭─[no_await_expression_member.tsx:1:22]
1 │ const thirdElement = (await getArray())[2] 1 │ const thirdElement = (await getArray())[2]
· ───────────────────── · ─────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:30] ╭─[no_await_expression_member.tsx:1:30]
1 │ const optionalFirstElement = (await getArray())?.[0] 1 │ const optionalFirstElement = (await getArray())?.[0]
· ─────────────────────── · ───────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:34] ╭─[no_await_expression_member.tsx:1:34]
1 │ const {propertyOfFirstElement} = (await getArray())[0] 1 │ const {propertyOfFirstElement} = (await getArray())[0]
· ───────────────────── · ─────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:38] ╭─[no_await_expression_member.tsx:1:38]
1 │ const [firstElementOfFirstElement] = (await getArray())[0] 1 │ const [firstElementOfFirstElement] = (await getArray())[0]
· ───────────────────── · ─────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:25] ╭─[no_await_expression_member.tsx:1:25]
1 │ let foo, firstElement = (await getArray())[0] 1 │ let foo, firstElement = (await getArray())[0]
· ───────────────────── · ─────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:20] ╭─[no_await_expression_member.tsx:1:20]
1 │ var firstElement = (await getArray())[0], bar 1 │ var firstElement = (await getArray())[0], bar
· ───────────────────── · ─────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:18] ╭─[no_await_expression_member.tsx:1:18]
1 │ const property = (await getObject()).property 1 │ const property = (await getObject()).property
· ──────────────────────────── · ────────────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:17] ╭─[no_await_expression_member.tsx:1:17]
1 │ const renamed = (await getObject()).property 1 │ const renamed = (await getObject()).property
· ──────────────────────────── · ────────────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:18] ╭─[no_await_expression_member.tsx:1:18]
1 │ const property = (await getObject())[property] 1 │ const property = (await getObject())[property]
· ───────────────────────────── · ─────────────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:18] ╭─[no_await_expression_member.tsx:1:18]
1 │ const property = (await getObject())?.property 1 │ const property = (await getObject())?.property
· ───────────────────────────── · ─────────────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:30] ╭─[no_await_expression_member.tsx:1:30]
1 │ const {propertyOfProperty} = (await getObject()).property 1 │ const {propertyOfProperty} = (await getObject()).property
· ──────────────────────────── · ────────────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:30] ╭─[no_await_expression_member.tsx:1:30]
1 │ const {propertyOfProperty} = (await getObject()).propertyOfProperty 1 │ const {propertyOfProperty} = (await getObject()).propertyOfProperty
· ────────────────────────────────────── · ──────────────────────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:34] ╭─[no_await_expression_member.tsx:1:34]
1 │ const [firstElementOfProperty] = (await getObject()).property 1 │ const [firstElementOfProperty] = (await getObject()).property
· ──────────────────────────── · ────────────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:34] ╭─[no_await_expression_member.tsx:1:34]
1 │ const [firstElementOfProperty] = (await getObject()).firstElementOfProperty 1 │ const [firstElementOfProperty] = (await getObject()).firstElementOfProperty
· ────────────────────────────────────────── · ──────────────────────────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:16] ╭─[no_await_expression_member.tsx:1:16]
1 │ firstElement = (await getArray())[0] 1 │ firstElement = (await getArray())[0]
· ───────────────────── · ─────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:12] ╭─[no_await_expression_member.tsx:1:12]
1 │ property = (await getArray()).property 1 │ property = (await getArray()).property
· ─────────────────────────── · ───────────────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:19] ╭─[no_await_expression_member.tsx:1:19]
1 │ const foo: Type = (await promise)[0] 1 │ const foo: Type = (await promise)[0]
· ────────────────── · ──────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.
⚠ eslint-plugin-unicorn(no-await-expression-member): Disallow member access from await expression ⚠ eslint-plugin-unicorn(no-await-expression-member): Do not access a member directly from an await expression.
╭─[no_await_expression_member.tsx:1:23] ╭─[no_await_expression_member.tsx:1:23]
1 │ const foo: Type | A = (await promise).foo 1 │ const foo: Type | A = (await promise).foo
· ─────────────────── · ───────────────────
╰──── ╰────
help: When accessing a member from an await expression, the await expression has to be parenthesized, which is not readable. help: Assign the result of the await expression to a variable, then access the member from that variable.

View file

@ -8,7 +8,6 @@ source: crates/oxc_linter/src/tester.rs
· ──────────────────────────── · ────────────────────────────
4 │ 4 │
╰──── ╰────
help: Disallow using the `delete` operator on computed key expressions
⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys. ⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys.
╭─[no_dynamic_delete.tsx:3:10] ╭─[no_dynamic_delete.tsx:3:10]
@ -17,7 +16,6 @@ source: crates/oxc_linter/src/tester.rs
· ──────────────────── · ────────────────────
4 │ 4 │
╰──── ╰────
help: Disallow using the `delete` operator on computed key expressions
⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys. ⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys.
╭─[no_dynamic_delete.tsx:3:10] ╭─[no_dynamic_delete.tsx:3:10]
@ -26,7 +24,6 @@ source: crates/oxc_linter/src/tester.rs
· ─────────────────────────── · ───────────────────────────
4 │ 4 │
╰──── ╰────
help: Disallow using the `delete` operator on computed key expressions
⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys. ⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys.
╭─[no_dynamic_delete.tsx:3:10] ╭─[no_dynamic_delete.tsx:3:10]
@ -35,7 +32,6 @@ source: crates/oxc_linter/src/tester.rs
· ─────────────────────────── · ───────────────────────────
4 │ 4 │
╰──── ╰────
help: Disallow using the `delete` operator on computed key expressions
⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys. ⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys.
╭─[no_dynamic_delete.tsx:3:10] ╭─[no_dynamic_delete.tsx:3:10]
@ -44,7 +40,6 @@ source: crates/oxc_linter/src/tester.rs
· ───────────────────── · ─────────────────────
4 │ 4 │
╰──── ╰────
help: Disallow using the `delete` operator on computed key expressions
⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys. ⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys.
╭─[no_dynamic_delete.tsx:4:10] ╭─[no_dynamic_delete.tsx:4:10]
@ -53,7 +48,6 @@ source: crates/oxc_linter/src/tester.rs
· ────────────────────── · ──────────────────────
5 │ 5 │
╰──── ╰────
help: Disallow using the `delete` operator on computed key expressions
⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys. ⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys.
╭─[no_dynamic_delete.tsx:4:10] ╭─[no_dynamic_delete.tsx:4:10]
@ -62,7 +56,6 @@ source: crates/oxc_linter/src/tester.rs
· ─────────────────────────── · ───────────────────────────
5 │ 5 │
╰──── ╰────
help: Disallow using the `delete` operator on computed key expressions
⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys. ⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys.
╭─[no_dynamic_delete.tsx:4:10] ╭─[no_dynamic_delete.tsx:4:10]
@ -71,7 +64,6 @@ source: crates/oxc_linter/src/tester.rs
· ────────────────────────────── · ──────────────────────────────
5 │ 5 │
╰──── ╰────
help: Disallow using the `delete` operator on computed key expressions
⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys. ⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys.
╭─[no_dynamic_delete.tsx:3:10] ╭─[no_dynamic_delete.tsx:3:10]
@ -80,7 +72,6 @@ source: crates/oxc_linter/src/tester.rs
· ───────────────────────────── · ─────────────────────────────
4 │ 4 │
╰──── ╰────
help: Disallow using the `delete` operator on computed key expressions
⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys. ⚠ typescript-eslint(no-dynamic-delete): Do not delete dynamically computed property keys.
╭─[no_dynamic_delete.tsx:3:10] ╭─[no_dynamic_delete.tsx:3:10]
@ -89,4 +80,3 @@ source: crates/oxc_linter/src/tester.rs
· ────────────────────────── · ──────────────────────────
4 │ 4 │
╰──── ╰────
help: Disallow using the `delete` operator on computed key expressions

View file

@ -1,9 +1,9 @@
--- ---
source: crates/oxc_linter/src/tester.rs source: crates/oxc_linter/src/tester.rs
--- ---
⚠ eslint-plugin-node(no-exports-assign): Disallow the assignment to `exports`. ⚠ eslint-plugin-node(no-exports-assign): Unexpected assignment to 'exports'.
╭─[no_exports_assign.tsx:1:1] ╭─[no_exports_assign.tsx:1:1]
1 │ exports = {} 1 │ exports = {}
· ─────── · ───────
╰──── ╰────
help: Unexpected assignment to 'exports' variable. Use 'module.exports' instead. help: Use 'module.exports' instead.

View file

@ -1,53 +1,53 @@
--- ---
source: crates/oxc_linter/src/tester.rs source: crates/oxc_linter/src/tester.rs
--- ---
⚠ eslint-plugin-promise(no-new-statics): Disallow calling `new` on a `Promise.resolve` ⚠ eslint-plugin-promise(no-new-statics): Do not use `new` on `Promise.resolve`
╭─[no_new_statics.tsx:1:1] ╭─[no_new_statics.tsx:1:1]
1 │ new Promise.resolve() 1 │ new Promise.resolve()
· ─── · ───
╰──── ╰────
help: Delete this code. help: `Promise.resolve` is not a constructor. Call it as a function instead.
⚠ eslint-plugin-promise(no-new-statics): Disallow calling `new` on a `Promise.reject` ⚠ eslint-plugin-promise(no-new-statics): Do not use `new` on `Promise.reject`
╭─[no_new_statics.tsx:1:1] ╭─[no_new_statics.tsx:1:1]
1 │ new Promise.reject() 1 │ new Promise.reject()
· ─── · ───
╰──── ╰────
help: Delete this code. help: `Promise.reject` is not a constructor. Call it as a function instead.
⚠ eslint-plugin-promise(no-new-statics): Disallow calling `new` on a `Promise.all` ⚠ eslint-plugin-promise(no-new-statics): Do not use `new` on `Promise.all`
╭─[no_new_statics.tsx:1:1] ╭─[no_new_statics.tsx:1:1]
1 │ new Promise.all() 1 │ new Promise.all()
· ─── · ───
╰──── ╰────
help: Delete this code. help: `Promise.all` is not a constructor. Call it as a function instead.
⚠ eslint-plugin-promise(no-new-statics): Disallow calling `new` on a `Promise.allSettled` ⚠ eslint-plugin-promise(no-new-statics): Do not use `new` on `Promise.allSettled`
╭─[no_new_statics.tsx:1:1] ╭─[no_new_statics.tsx:1:1]
1 │ new Promise.allSettled() 1 │ new Promise.allSettled()
· ─── · ───
╰──── ╰────
help: Delete this code. help: `Promise.allSettled` is not a constructor. Call it as a function instead.
⚠ eslint-plugin-promise(no-new-statics): Disallow calling `new` on a `Promise.any` ⚠ eslint-plugin-promise(no-new-statics): Do not use `new` on `Promise.any`
╭─[no_new_statics.tsx:1:1] ╭─[no_new_statics.tsx:1:1]
1 │ new Promise.any() 1 │ new Promise.any()
· ─── · ───
╰──── ╰────
help: Delete this code. help: `Promise.any` is not a constructor. Call it as a function instead.
⚠ eslint-plugin-promise(no-new-statics): Disallow calling `new` on a `Promise.race` ⚠ eslint-plugin-promise(no-new-statics): Do not use `new` on `Promise.race`
╭─[no_new_statics.tsx:1:1] ╭─[no_new_statics.tsx:1:1]
1 │ new Promise.race() 1 │ new Promise.race()
· ─── · ───
╰──── ╰────
help: Delete this code. help: `Promise.race` is not a constructor. Call it as a function instead.
⚠ eslint-plugin-promise(no-new-statics): Disallow calling `new` on a `Promise.resolve` ⚠ eslint-plugin-promise(no-new-statics): Do not use `new` on `Promise.resolve`
╭─[no_new_statics.tsx:3:13] ╭─[no_new_statics.tsx:3:13]
2 │ var a = getA() 2 │ var a = getA()
3 │ return new Promise.resolve(a) 3 │ return new Promise.resolve(a)
· ─── · ───
4 │ } 4 │ }
╰──── ╰────
help: Delete this code. help: `Promise.resolve` is not a constructor. Call it as a function instead.

View file

@ -1,72 +1,62 @@
--- ---
source: crates/oxc_linter/src/tester.rs source: crates/oxc_linter/src/tester.rs
--- ---
⚠ eslint-plugin-unicorn(no-static-only-class): Disallow classes that only have 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] ╭─[no_static_only_class.tsx:1:1]
1 │ class A { static a() {}; } 1 │ class A { static a() {}; }
· ────────────────────────── · ──────────────────────────
╰──── ╰────
help: A class with only static members could just be an object instead.
⚠ eslint-plugin-unicorn(no-static-only-class): Disallow classes that only have 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] ╭─[no_static_only_class.tsx:1:1]
1 │ class A { static a() {} } 1 │ class A { static a() {} }
· ───────────────────────── · ─────────────────────────
╰──── ╰────
help: A class with only static members could just be an object instead.
⚠ eslint-plugin-unicorn(no-static-only-class): Disallow classes that only have 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] ╭─[no_static_only_class.tsx:1:11]
1 │ const A = class A { static a() {}; } 1 │ const A = class A { static a() {}; }
· ────────────────────────── · ──────────────────────────
╰──── ╰────
help: A class with only static members could just be an object instead.
⚠ eslint-plugin-unicorn(no-static-only-class): Disallow classes that only have 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] ╭─[no_static_only_class.tsx:1:11]
1 │ const A = class { static a() {}; } 1 │ const A = class { static a() {}; }
· ──────────────────────── · ────────────────────────
╰──── ╰────
help: A class with only static members could just be an object instead.
⚠ eslint-plugin-unicorn(no-static-only-class): Disallow classes that only have 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] ╭─[no_static_only_class.tsx:1:1]
1 │ class A { static constructor() {}; } 1 │ class A { static constructor() {}; }
· ──────────────────────────────────── · ────────────────────────────────────
╰──── ╰────
help: A class with only static members could just be an object instead.
⚠ eslint-plugin-unicorn(no-static-only-class): Disallow classes that only have 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] ╭─[no_static_only_class.tsx:1:16]
1 │ export default class A { static a() {}; } 1 │ export default class A { static a() {}; }
· ────────────────────────── · ──────────────────────────
╰──── ╰────
help: A class with only static members could just be an object instead.
⚠ eslint-plugin-unicorn(no-static-only-class): Disallow classes that only have 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] ╭─[no_static_only_class.tsx:1:16]
1 │ export default class { static a() {}; } 1 │ export default class { static a() {}; }
· ──────────────────────── · ────────────────────────
╰──── ╰────
help: A class with only static members could just be an object instead.
⚠ eslint-plugin-unicorn(no-static-only-class): Disallow classes that only have 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] ╭─[no_static_only_class.tsx:1:8]
1 │ export class A { static a() {}; } 1 │ export class A { static a() {}; }
· ────────────────────────── · ──────────────────────────
╰──── ╰────
help: A class with only static members could just be an object instead.
⚠ eslint-plugin-unicorn(no-static-only-class): Disallow classes that only have 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] ╭─[no_static_only_class.tsx:1:1]
1 │ class A {static [this.a] = 1} 1 │ class A {static [this.a] = 1}
· ───────────────────────────── · ─────────────────────────────
╰──── ╰────
help: A class with only static members could just be an object instead.
⚠ eslint-plugin-unicorn(no-static-only-class): Disallow classes that only have 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] ╭─[no_static_only_class.tsx:1:1]
1 │ class A { static a() {} } 1 │ class A { static a() {} }
· ───────────────────────── · ─────────────────────────
╰──── ╰────
help: A class with only static members could just be an object instead.

View file

@ -1,56 +1,56 @@
--- ---
source: crates/oxc_linter/src/tester.rs source: crates/oxc_linter/src/tester.rs
--- ---
⚠ typescript-eslint(no-useless-empty-export): Disallow empty exports that don't change anything in a module file ⚠ typescript-eslint(no-useless-empty-export): Empty exports do nothing in module files
╭─[no_useless_empty_export.tsx:3:13] ╭─[no_useless_empty_export.tsx:3:13]
2 │ export const _ = {}; 2 │ export const _ = {};
3 │ export {}; 3 │ export {};
· ────────── · ──────────
4 │ 4 │
╰──── ╰────
help: Empty export does nothing and can be removed. help: Remove this empty export.
⚠ typescript-eslint(no-useless-empty-export): Disallow empty exports that don't change anything in a module file ⚠ typescript-eslint(no-useless-empty-export): Empty exports do nothing in module files
╭─[no_useless_empty_export.tsx:3:13] ╭─[no_useless_empty_export.tsx:3:13]
2 │ export * from '_'; 2 │ export * from '_';
3 │ export {}; 3 │ export {};
· ────────── · ──────────
4 │ 4 │
╰──── ╰────
help: Empty export does nothing and can be removed. help: Remove this empty export.
⚠ typescript-eslint(no-useless-empty-export): Disallow empty exports that don't change anything in a module file ⚠ typescript-eslint(no-useless-empty-export): Empty exports do nothing in module files
╭─[no_useless_empty_export.tsx:2:13] ╭─[no_useless_empty_export.tsx:2:13]
1 │ 1 │
2 │ export {}; 2 │ export {};
· ────────── · ──────────
3 │ export * from '_'; 3 │ export * from '_';
╰──── ╰────
help: Empty export does nothing and can be removed. help: Remove this empty export.
⚠ typescript-eslint(no-useless-empty-export): Disallow empty exports that don't change anything in a module file ⚠ typescript-eslint(no-useless-empty-export): Empty exports do nothing in module files
╭─[no_useless_empty_export.tsx:4:13] ╭─[no_useless_empty_export.tsx:4:13]
3 │ export default _; 3 │ export default _;
4 │ export {}; 4 │ export {};
· ────────── · ──────────
5 │ 5 │
╰──── ╰────
help: Empty export does nothing and can be removed. help: Remove this empty export.
⚠ typescript-eslint(no-useless-empty-export): Disallow empty exports that don't change anything in a module file ⚠ typescript-eslint(no-useless-empty-export): Empty exports do nothing in module files
╭─[no_useless_empty_export.tsx:2:13] ╭─[no_useless_empty_export.tsx:2:13]
1 │ 1 │
2 │ export {}; 2 │ export {};
· ────────── · ──────────
3 │ const _ = {}; 3 │ const _ = {};
╰──── ╰────
help: Empty export does nothing and can be removed. help: Remove this empty export.
⚠ typescript-eslint(no-useless-empty-export): Disallow empty exports that don't change anything in a module file ⚠ typescript-eslint(no-useless-empty-export): Empty exports do nothing in module files
╭─[no_useless_empty_export.tsx:4:13] ╭─[no_useless_empty_export.tsx:4:13]
3 │ export { _ }; 3 │ export { _ };
4 │ export {}; 4 │ export {};
· ────────── · ──────────
5 │ 5 │
╰──── ╰────
help: Empty export does nothing and can be removed. help: Remove this empty export.

View file

@ -1,78 +1,78 @@
--- ---
source: crates/oxc_linter/src/tester.rs source: crates/oxc_linter/src/tester.rs
--- ---
⚠ eslint-plugin-react(void-dom-elements-no-children): Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children. ⚠ eslint-plugin-react(void-dom-elements-no-children): Void DOM element <"br" /> cannot receive children.
╭─[void_dom_elements_no_children.tsx:1:2] ╭─[void_dom_elements_no_children.tsx:1:2]
1 │ <br>Foo</br>; 1 │ <br>Foo</br>;
· ── · ──
╰──── ╰────
help: Void DOM element <"br" /> cannot receive children. help: Remove this element's children or use a non-void element.
⚠ eslint-plugin-react(void-dom-elements-no-children): Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children. ⚠ eslint-plugin-react(void-dom-elements-no-children): Void DOM element <"br" /> cannot receive children.
╭─[void_dom_elements_no_children.tsx:1:2] ╭─[void_dom_elements_no_children.tsx:1:2]
1 │ <br children='Foo' />; 1 │ <br children='Foo' />;
· ── · ──
╰──── ╰────
help: Void DOM element <"br" /> cannot receive children. help: Remove this element's children or use a non-void element.
⚠ eslint-plugin-react(void-dom-elements-no-children): Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children. ⚠ eslint-plugin-react(void-dom-elements-no-children): Void DOM element <"img" /> cannot receive children.
╭─[void_dom_elements_no_children.tsx:1:2] ╭─[void_dom_elements_no_children.tsx:1:2]
1 │ <img {...props} children='Foo' />; 1 │ <img {...props} children='Foo' />;
· ─── · ───
╰──── ╰────
help: Void DOM element <"img" /> cannot receive children. help: Remove this element's children or use a non-void element.
⚠ eslint-plugin-react(void-dom-elements-no-children): Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children. ⚠ eslint-plugin-react(void-dom-elements-no-children): Void DOM element <"br" /> cannot receive children.
╭─[void_dom_elements_no_children.tsx:1:2] ╭─[void_dom_elements_no_children.tsx:1:2]
1 │ <br dangerouslySetInnerHTML={{ __html: 'Foo' }} />; 1 │ <br dangerouslySetInnerHTML={{ __html: 'Foo' }} />;
· ── · ──
╰──── ╰────
help: Void DOM element <"br" /> cannot receive children. help: Remove this element's children or use a non-void element.
⚠ eslint-plugin-react(void-dom-elements-no-children): Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children. ⚠ eslint-plugin-react(void-dom-elements-no-children): Void DOM element <"br" /> cannot receive children.
╭─[void_dom_elements_no_children.tsx:1:21] ╭─[void_dom_elements_no_children.tsx:1:21]
1 │ React.createElement('br', {}, 'Foo'); 1 │ React.createElement('br', {}, 'Foo');
· ──── · ────
╰──── ╰────
help: Void DOM element <"br" /> cannot receive children. help: Remove this element's children or use a non-void element.
⚠ eslint-plugin-react(void-dom-elements-no-children): Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children. ⚠ eslint-plugin-react(void-dom-elements-no-children): Void DOM element <"br" /> cannot receive children.
╭─[void_dom_elements_no_children.tsx:1:21] ╭─[void_dom_elements_no_children.tsx:1:21]
1 │ React.createElement('br', { children: 'Foo' }); 1 │ React.createElement('br', { children: 'Foo' });
· ──── · ────
╰──── ╰────
help: Void DOM element <"br" /> cannot receive children. help: Remove this element's children or use a non-void element.
⚠ eslint-plugin-react(void-dom-elements-no-children): Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children. ⚠ eslint-plugin-react(void-dom-elements-no-children): Void DOM element <"br" /> cannot receive children.
╭─[void_dom_elements_no_children.tsx:1:21] ╭─[void_dom_elements_no_children.tsx:1:21]
1 │ React.createElement('br', { dangerouslySetInnerHTML: { __html: 'Foo' } }); 1 │ React.createElement('br', { dangerouslySetInnerHTML: { __html: 'Foo' } });
· ──── · ────
╰──── ╰────
help: Void DOM element <"br" /> cannot receive children. help: Remove this element's children or use a non-void element.
⚠ eslint-plugin-react(void-dom-elements-no-children): Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children. ⚠ eslint-plugin-react(void-dom-elements-no-children): Void DOM element <"img" /> cannot receive children.
╭─[void_dom_elements_no_children.tsx:3:31] ╭─[void_dom_elements_no_children.tsx:3:31]
2 │ import React, {createElement} from 'react'; 2 │ import React, {createElement} from 'react';
3 │ createElement('img', {}, 'Foo'); 3 │ createElement('img', {}, 'Foo');
· ───── · ─────
4 │ 4 │
╰──── ╰────
help: Void DOM element <"img" /> cannot receive children. help: Remove this element's children or use a non-void element.
⚠ eslint-plugin-react(void-dom-elements-no-children): Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children. ⚠ eslint-plugin-react(void-dom-elements-no-children): Void DOM element <"img" /> cannot receive children.
╭─[void_dom_elements_no_children.tsx:3:31] ╭─[void_dom_elements_no_children.tsx:3:31]
2 │ import React, {createElement} from 'react'; 2 │ import React, {createElement} from 'react';
3 │ createElement('img', { children: 'Foo' }); 3 │ createElement('img', { children: 'Foo' });
· ───── · ─────
4 │ 4 │
╰──── ╰────
help: Void DOM element <"img" /> cannot receive children. help: Remove this element's children or use a non-void element.
⚠ eslint-plugin-react(void-dom-elements-no-children): Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children. ⚠ eslint-plugin-react(void-dom-elements-no-children): Void DOM element <"img" /> cannot receive children.
╭─[void_dom_elements_no_children.tsx:3:31] ╭─[void_dom_elements_no_children.tsx:3:31]
2 │ import React, {createElement} from 'react'; 2 │ import React, {createElement} from 'react';
3 │ createElement('img', { dangerouslySetInnerHTML: { __html: 'Foo' } }); 3 │ createElement('img', { dangerouslySetInnerHTML: { __html: 'Foo' } });
· ───── · ─────
4 │ 4 │
╰──── ╰────
help: Void DOM element <"img" /> cannot receive children. help: Remove this element's children or use a non-void element.