Skip to content

eslint/no-self-assign Correctness

This rule is turned on by default.

What it does

Disallow assignments where both sides are exactly the same

Why is this bad?

Self assignments have no effect, so probably those are an error due to incomplete refactoring. Those indicate that what you should do is still remaining.

Example

javascript
foo = foo;
[bar, baz] = [bar, qiz];

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny no-self-assign
json
{
  "rules": {
    "no-self-assign": "error"
  }
}

References

Released under the MIT License.