diff --git a/packages/babel-core/src/tools/build-external-helpers.js b/packages/babel-core/src/tools/build-external-helpers.js index 4f38272b1400..ef9120229aaa 100644 --- a/packages/babel-core/src/tools/build-external-helpers.js +++ b/packages/babel-core/src/tools/build-external-helpers.js @@ -21,7 +21,7 @@ const buildUmdWrapper = replacements => }); `(replacements); -function buildGlobal(whitelist) { +function buildGlobal(allowlist) { const namespace = t.identifier("babelHelpers"); const body = []; @@ -60,14 +60,14 @@ function buildGlobal(whitelist) { ]), ); - buildHelpers(body, namespace, whitelist); + buildHelpers(body, namespace, allowlist); return tree; } -function buildModule(whitelist) { +function buildModule(allowlist) { const body = []; - const refs = buildHelpers(body, null, whitelist); + const refs = buildHelpers(body, null, allowlist); body.unshift( t.exportNamedDeclaration( @@ -81,7 +81,7 @@ function buildModule(whitelist) { return t.program(body, [], "module"); } -function buildUmd(whitelist) { +function buildUmd(allowlist) { const namespace = t.identifier("babelHelpers"); const body = []; @@ -91,7 +91,7 @@ function buildUmd(whitelist) { ]), ); - buildHelpers(body, namespace, whitelist); + buildHelpers(body, namespace, allowlist); return t.program([ buildUmdWrapper({ @@ -109,7 +109,7 @@ function buildUmd(whitelist) { ]); } -function buildVar(whitelist) { +function buildVar(allowlist) { const namespace = t.identifier("babelHelpers"); const body = []; @@ -119,12 +119,12 @@ function buildVar(whitelist) { ]), ); const tree = t.program(body); - buildHelpers(body, namespace, whitelist); + buildHelpers(body, namespace, allowlist); body.push(t.expressionStatement(namespace)); return tree; } -function buildHelpers(body, namespace, whitelist) { +function buildHelpers(body, namespace, allowlist) { const getHelperReference = name => { return namespace ? t.memberExpression(namespace, t.identifier(name)) @@ -133,7 +133,7 @@ function buildHelpers(body, namespace, whitelist) { const refs = {}; helpers.list.forEach(function (name) { - if (whitelist && whitelist.indexOf(name) < 0) return; + if (allowlist && allowlist.indexOf(name) < 0) return; const ref = (refs[name] = getHelperReference(name)); @@ -145,7 +145,7 @@ function buildHelpers(body, namespace, whitelist) { return refs; } export default function ( - whitelist?: Array, + allowlist?: Array, outputType: "global" | "module" | "umd" | "var" = "global", ) { let tree; @@ -158,7 +158,7 @@ export default function ( }[outputType]; if (build) { - tree = build(whitelist); + tree = build(allowlist); } else { throw new Error(`Unsupported output type ${outputType}`); } diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index 8da161d59556..42fb53777862 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -733,13 +733,13 @@ describe("api", function () { expect(script).toEqual(expect.stringContaining("inherits")); }); - it("whitelist", function () { + it("allowlist", function () { const script = babel.buildExternalHelpers(["inherits"]); expect(script).not.toEqual(expect.stringContaining("classCallCheck")); expect(script).toEqual(expect.stringContaining("inherits")); }); - it("empty whitelist", function () { + it("empty allowlist", function () { const script = babel.buildExternalHelpers([]); expect(script).not.toEqual(expect.stringContaining("classCallCheck")); expect(script).not.toEqual(expect.stringContaining("inherits")); diff --git a/packages/babel-helper-fixtures/src/index.js b/packages/babel-helper-fixtures/src/index.js index f0b4cd0914d6..9348fcc79af2 100644 --- a/packages/babel-helper-fixtures/src/index.js +++ b/packages/babel-helper-fixtures/src/index.js @@ -47,8 +47,8 @@ function assertDirectory(loc) { } } -function shouldIgnore(name, blacklist?: Array) { - if (blacklist && blacklist.indexOf(name) >= 0) { +function shouldIgnore(name, ignore?: Array) { + if (ignore && ignore.indexOf(name) >= 0) { return true; } diff --git a/packages/babel-standalone/src/index.js b/packages/babel-standalone/src/index.js index bff8525ae242..f2e218e897b9 100644 --- a/packages/babel-standalone/src/index.js +++ b/packages/babel-standalone/src/index.js @@ -162,12 +162,12 @@ export function registerPresets(newPresets: { } // All the plugins we should bundle -// Want to get rid of this long whitelist of plugins? +// Want to get rid of this long list of allowed plugins? // Wait! Please read https://github.com/babel/babel/pull/6177 first. registerPlugins(all); // All the presets we should bundle -// Want to get rid of this whitelist of presets? +// Want to get rid of this list of allowed presets? // Wait! Please read https://github.com/babel/babel/pull/6177 first. registerPresets({ env: presetEnv, diff --git a/packages/babel-traverse/src/scope/index.js b/packages/babel-traverse/src/scope/index.js index e1ff13ebd1c3..f309baf316e2 100644 --- a/packages/babel-traverse/src/scope/index.js +++ b/packages/babel-traverse/src/scope/index.js @@ -419,7 +419,7 @@ export default class Scope { /** * Determine whether evaluating the specific input `node` is a consequenceless reference. ie. * evaluating it wont result in potentially arbitrary code from being ran. The following are - * whitelisted and determined not to cause side effects: + * allowed and determined not to cause side effects: * * - `this` expressions * - `super` expressions diff --git a/packages/babel-traverse/test/scope.js b/packages/babel-traverse/test/scope.js index dfd4bb2e822a..106c9631e647 100644 --- a/packages/babel-traverse/test/scope.js +++ b/packages/babel-traverse/test/scope.js @@ -471,7 +471,7 @@ describe("scope", () => { }); if (kind1 !== kind2) { - //todo: remove the if whitelist + // todo: remove the if allowed if (kind1 === "const" && (kind2 === "function" || kind2 === "var")) { continue; }