28 lines
966 B
Plaintext
28 lines
966 B
Plaintext
== Why is this an issue?
|
|
|
|
Renaming imports, exports, or destructuring assignments to the same name is redundant and can be safely removed. You may accidentally end up with such code if you do a refactoring and change the local name in several places.
|
|
|
|
[source,javascript,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
import { foo as foo } from "bar";
|
|
export { foo as foo };
|
|
let { foo: foo } = bar;
|
|
----
|
|
|
|
Fix your code to remove the unnecessary renaming.
|
|
|
|
[source,javascript,diff-id=1,diff-type=compliant]
|
|
----
|
|
import { foo } from "bar";
|
|
export { foo };
|
|
let { foo } = bar;
|
|
----
|
|
|
|
|
|
== Resources
|
|
=== Documentation
|
|
|
|
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import[import]
|
|
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export[export]
|
|
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment[Destructuring assignment]
|