Skip to content

eslint/no-useless-rename Correctness

This rule is turned on by default.

What it does

Disallow renaming import, export, and destructured assignments to the same name.

Why is this bad?

It is unnecessary to rename a variable to the same name.

Example

Examples of incorrect code for this rule:

javascript
import { foo as foo } from "foo";
const { bar: bar } = obj;
export { baz as baz };

Examples of correct code for this rule:

javascript
import { foo } from "foo";
const { bar: renamed } = obj;
export { baz };

References

Released under the MIT License.