lib/rules/no-useless-rename.js
function checkDestructured(node) {
            if (ignoreDestructuring) {
                return;
            }

            const properties = node.properties;

            for (let i = 0; i < properties.length; i++) {
                if (properties[i].shorthand) {
                    continue;
                }

                /**
                 * If an ObjectPattern property is computed, we have no idea
                 * if a rename is useless or not. If an ObjectPattern property
                 * lacks a key, it is likely an ExperimentalRestProperty and
                 * so there is no "renaming" occurring here.
                 */
                if (properties[i].computed || !properties[i].key) {
                    continue;
                }

                if (properties[i].key.type === "Identifier" && properties[i].key.name === properties[i].value.name ||
                        properties[i].key.type === "Literal" && properties[i].key.value === properties[i].value.name) {
                    reportError(properties[i], properties[i].key, properties[i].value, "Destructuring assignment");
                }
            }
        }
function checkDestructured(node) {
            if (ignoreDestructuring) {
                return;
            }

            const properties = node.properties;

            for (let i = 0; i < properties.length; i++) {
                if (properties[i].shorthand) {
                    continue;
                }

                /**
                 * If an ObjectPattern property is computed, we have no idea
                 * if a rename is useless or not. If an ObjectPattern property
                 * lacks a key, it is likely an ExperimentalRestProperty and
                 * so there is no "renaming" occurring here.
                 */
                if (properties[i].computed || !properties[i].key) {
                    continue;
                }

                if (properties[i].key.type === "Identifier" && properties[i].key.name === properties[i].value.name ||
                        properties[i].key.type === "Literal" && properties[i].key.value === properties[i].value.name) {
                    reportError(properties[i], properties[i].key, properties[i].value, "Destructuring assignment");
                }
            }
        }
function checkDestructured ( node ) { if ( ignoreDestructuring ) { return ; } const properties = node . properties ; for ( let i = 0 ; i < properties . length ; i ++ ) { if ( properties [ i ] . shorthand ) { continue ; } /**
                 * If an ObjectPattern property is computed, we have no idea
                 * if a rename is useless or not. If an ObjectPattern property
                 * lacks a key, it is likely an ExperimentalRestProperty and
                 * so there is no "renaming" occurring here.
                 */ if ( properties [ i ] . computed || ! properties [ i ] . key ) { continue ; } if ( properties [ i ] . key . type === "Identifier" && properties [ i ] . key . name === properties [ i ] . value . name || properties [ i ] . key . type === "Literal" && properties [ i ] . key . value === properties [ i ] . value . name ) { reportError ( properties [ i ] , properties [ i ] . key , properties [ i ] . value , "Destructuring assignment" ) ; } } }
Checks whether a destructured assignment is unnecessarily renamed
@param {ASTNode} node - node to check
@returns {void}
Checks whether a destructured assignment is unnecessarily renamed