Skip to content

Commit

Permalink
enable: allowNamespaces by default
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Feb 8, 2021
1 parent 1506c9b commit 3ecbf22
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions packages/babel-plugin-transform-typescript/src/index.js
Expand Up @@ -51,17 +51,15 @@ export default declare((api, opts) => {
const JSX_PRAGMA_REGEX = /\*?\s*@jsx((?:Frag)?)\s+([^\s]+)/;

const {
allowNamespaces = true,
jsxPragma = "React.createElement",
jsxPragmaFrag = "React.Fragment",
onlyRemoveTypeImports = false,
} = opts;

if (!process.env.BABEL_8_BREAKING) {
// eslint-disable-next-line no-var
var { allowDeclareFields = false, allowNamespaces = false } = opts;
} else {
// eslint-disable-next-line no-var,no-redeclare
var { allowNamespaces = true } = opts;
var { allowDeclareFields = false } = opts;
}

const classMemberVisitors = {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-typescript/src/normalize-options.js
Expand Up @@ -2,7 +2,7 @@ import { OptionValidator } from "@babel/helper-validator-option";
const v = new OptionValidator("@babel/preset-typescript");

export default function normalizeOptions(options = {}) {
let { allowNamespaces, jsxPragma, onlyRemoveTypeImports } = options;
let { allowNamespaces = true, jsxPragma, onlyRemoveTypeImports } = options;

if (process.env.BABEL_8_BREAKING) {
const TopLevelOptions = {
Expand Down
Expand Up @@ -78,7 +78,7 @@ describe("normalize options", () => {
expect(normalizeOptions({})).toMatchInlineSnapshot(`
Object {
"allExtensions": false,
"allowNamespaces": undefined,
"allowNamespaces": true,
"isTSX": false,
"jsxPragma": undefined,
"jsxPragmaFrag": "React.Fragment",
Expand Down

0 comments on commit 3ecbf22

Please sign in to comment.