Debian Codegraph @

packages/babel-plugin-transform-reserved-words/src/index.ts

raw symbols SCIP
1 import { declare } from "@babel/helper-plugin-utils";
2 import { types as t } from "@babel/core";
3 import type { NodePath } from "@babel/traverse";
4
5 export default declare(api => {
6 api.assertVersion(7);
7
8 return {
9 name: "transform-reserved-words",
10
11 visitor: {
12 "BindingIdentifier|ReferencedIdentifier"(path: NodePath<t.Identifier>) {
13 if (!t.isValidES3Identifier(path.node.name)) {
14 path.scope.rename(path.node.name);
15 }
16 },
17 },
18 };
19 });