Skip to content

linter: no-empty-function does not respect the allow option #12161

@rlaffers

Description

@rlaffers

What version of Oxlint are you using?

1.6.0

What command did you run?

oxlint src/index.js

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

{
  "$schema": "./node_modules/oxlint/configuration_schema.json",  
   "categories": {
    "correctness": "off"
  },
  "rules": {
    "no-empty-function": [
      "error",
      {
        "allow": ["arrowFunctions", "functions", "methods"]
      }
    ],
    "no-unused-vars": "off"
  },
  "env": {
    "builtin": true
  },
  "globals": {},
  "ignorePatterns": []
}

What happened?

Oxlint is reporting false positives:

× eslint(no-empty-function): Unexpected empty function `foo`
   ╭─[src/index.js:1:19]
 1 │ const foo = () => {}
   ·                   ──
 2 │ function bar() {}
   ╰────
  help: Consider removing this function or adding logic to it.

  × eslint(no-empty-function): Unexpected empty function `bar`
   ╭─[src/index.js:2:16]
 1 │ const foo = () => {}
 2 │ function bar() {}
   ·                ──
   ╰────
  help: Consider removing this function or adding logic to it.

The config specifies that empty functions and arrow functions are allowed, so there should be no errors.

The options have allegedly been implemented in #10529
The docs list the allow option for this rule as available: https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-empty-function.html

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions