JavaScript

JavaScript

Made by DeepSource

Found redundant naming for modules JS-0238

Style
Minor
Autofix

ES2015 allows for the renaming of references in import and export statements as well as destructuring assignments. This gives programmers a concise syntax for performing these operations while renaming these references.

With this syntax, it is possible to rename a reference to the same name. This is a completely redundant operation, as this is the same as not renaming at all.

Bad Practice

import { module as module } from "module_name";
export { module as module };
export { module as module } from "module_name";
let { module: module } = module_name;
let { 'module': module } = module_name;
function module({ module_name: module_name }) {}
({ module: module }) => {}

Recommended

import * as module from "module";
import { module } from "module_name";
import { module as module_name } from "deepsource";

export { module };
export { module as module_name };
export { module as module_name } from "module";

let { module } = module_name;
let { module: module_name } = deepsource;
let { [module]: module } = module_name;

function module({ module_name }) {}
function module({ module_name: deepsource }) {}

({ module }) => {}
({ module: module_name }) => {}