Skip to content

linter: eslint/no-lone-blocks errors on empty catch block #8515

@drvn-mr

Description

@drvn-mr

What version of Oxlint are you using?

0.15.6

What command did you run?

oxlint -c .oxlintrc.json test.js

What does your .oxlint.json config file look like?

{
  "rules": {
    "no-lone-blocks": "error"
  }
}

What happened?

Cannot have an empty catch block, even with a comment.
This is not reported as an error by ESLint.

Code:

try {
  let a = 1;
  console.log(a);
} catch {}
oxlint -c .oxlintrc.json test.js

  × eslint(no-lone-blocks): Block is unnecessary.
   ╭─[test.js:4:9]
 3 │   console.log(a);
 4 │ } catch {}
   ·         ──
   ╰────

Finished in 10ms on 1 file with 98 rules using 8 threads.
Found 0 warnings and 1 error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linterArea - LinterC-bugCategory - Buggood first issueExperience Level - Good for newcomers

    Type

    No type

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions