unnecessaryRenames
Renames that don't change the identifier name are unnecessary.
✅ This rule is included in the ts stylistic presets.
Renaming an identifier to the same name is redundant and adds unnecessary verbosity. This rule reports locations that can be simplified to remove the renaming.
Examples
Section titled “Examples”Import Statements
Section titled “Import Statements”import { value as value } from "module";import { first as first, second } from "module";import { value } from "module";import { first, second } from "module";Export Statements
Section titled “Export Statements”export { data as data };export { default as default };export { data };export { default };Destructuring Assignments
Section titled “Destructuring Assignments”const { key: key } = object;function example({ value: value }: { value: number }) { return value;}const { key } = object;function example({ value }: { value: number }) { return value;}Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If you intentionally prefer explicit renames to the same value for some stylistic or tooling reason, this rule might not be for you. For example, if your codebase uses tooling that relies on renames being present, you might not be able to apply this rule’s fixes. You might consider using Flint disable comments and/or configuration file disables for those specific situations instead of completely disabling this rule.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Biome:
noUselessRename - Deno:
no-useless-rename - ESLint:
no-useless-rename - Oxlint:
eslint/no-useless-rename
Made with ❤️🔥 around the world by
the Flint team and contributors.