diff --git a/.gitignore b/.gitignore index 7e6cc155..72b23e92 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -node_modules +node_modules/ +po/ .idea .DS_Store .eslintcache diff --git a/babel.config.js b/babel.config.js index f9abc014..c4c636b0 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,4 +1,4 @@ -module.exports = { - presets: ['@babel/preset-env'], - plugins: ['@babel/plugin-proposal-object-rest-spread', '@babel/plugin-transform-runtime'] -}; +// eslint-disable-next-line @typescript-eslint/no-var-requires +const baseConfig = require('./configs/babel.config.base'); + +module.exports = baseConfig; diff --git a/configs/babel.config.base.js b/configs/babel.config.base.js new file mode 100644 index 00000000..e3558a95 --- /dev/null +++ b/configs/babel.config.base.js @@ -0,0 +1,8 @@ +module.exports = { + presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'], + plugins: [ + '@babel/plugin-proposal-object-rest-spread', + '@babel/plugin-transform-runtime', + 'transform-require-context' // this plugin is here only to make Jest tests run + ] +}; diff --git a/configs/jest.config.base.js b/configs/jest.config.base.js new file mode 100644 index 00000000..1063d8e8 --- /dev/null +++ b/configs/jest.config.base.js @@ -0,0 +1,14 @@ +module.exports = { + globals: { + FEATURE_FLAGS: '' + }, + setupFilesAfterEnv: ['./rtl.setup.js'], + verbose: true, + moduleDirectories: ['node_modules'], + transform: { + '^.+\\.(js|tsx?)$': 'babel-jest' + }, + collectCoverage: true, + collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'], + transformIgnorePatterns: ['node_modules/(?!(proton-shared)/)'] +}; diff --git a/tsconfig.base.json b/configs/tsconfig.base.json similarity index 100% rename from tsconfig.base.json rename to configs/tsconfig.base.json diff --git a/package.json b/package.json index bb158a56..476bc0d6 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "@babel/plugin-transform-runtime": "^7.6.2", "@typescript-eslint/eslint-plugin": "^1.13.0", "@typescript-eslint/parser": "^1.13.0", + "babel-plugin-transform-require-context": "^0.1.1", "eslint": "^6.7.2", "eslint-config-airbnb-base": "^14.0.0", "eslint-plugin-import": "^2.18.2", diff --git a/tsconfig.json b/tsconfig.json index 3ee7a6c6..7356b152 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,3 +1,3 @@ { - "extends": "./tsconfig.base.json" + "extends": "./configs/tsconfig.base.json" }