Skip to content

linter: react/exhaustive-deps not fixed as expected #12979

@xyhxx

Description

@xyhxx

What version of Oxlint are you using?

1.11.1

What command did you run?

oxlint --fix-dangerously --fix-suggestions

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

{
  "plugins": ["typescript", "react"],
  "rules": {
    "react/exhaustive-deps": "error"
  },
  "ignorePatterns": ["node_modules"]
}

What happened?

const App = () => {
  let a = 1;
  let b = 2;
  let c = 3;
  let d = 4;

  useEffect(
    function () {
      console.log(a, b, c, d);
    },
    [
      a,
      b,
      ]
  );

  return null;
};

After fix the code, it should be

const App = () => {
  let a = 1;
  let b = 2;
  let c = 3;
  let d = 4;

  useEffect(
    function () {
      console.log(a, b, c, d);
    },
    [a, b, c, d]
  );

  return null;
};

But in reality, it is

const App = () => {
  let a = 1;
  let b = 2;
  let c = 3;
  let d = 4;

  useEffect(
    function () {
      console.log(a, b, c, d);
    },
    [
      a,
      b d, c,
      ]
  );

  return null;
};

miss , between b and d.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions