src/language-js/utils/is-node-matches.js/isNodeMatchesNameOrPath
function isNodeMatchesNameOrPath(node, nameOrPath) {
  const names = nameOrPath.split(".");
  for (let index = names.length - 1; index >= 0; index--) {
    const name = names[index];

    if (index === 0) {
      return node.type === "Identifier" && node.name === name;
    }

    if (
      node.type !== "MemberExpression" ||
      node.optional ||
      node.computed ||
      node.property.type !== "Identifier" ||
      node.property.name !== name
    ) {
      return false;
    }

    node = node.object;
  }
}