Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
fix: babel settings
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw committed Apr 17, 2020
1 parent 4d84665 commit 3b28813
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 8 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ test-changelog.md
.eslintrc.js
.flowconfig
.prettierignore
babel.config.js
jest.config.js
prettier.config.js
tsconfig.eslint.json
Expand Down
24 changes: 24 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// eslint-disable-next-line no-undef, import/no-extraneous-dependencies
const { getConfig } = require('@airbnb/config-babel');

const config = getConfig({
library: true,
react: true,
next: true,
node: process.env.NODE_ENV === 'test',
typescript: true,
env: {
targets: false,
},
});

if (process.env.NODE_ENV !== 'test') {
config.presets[0][1].modules = false;
}

// Override to allow transpile es modules inside vega-lite
config.ignore = config.ignore.filter(item => item !== 'node_modules/');
config.ignore.push('node_modules/(?!(vega-lite|lodash-es))');

// eslint-disable-next-line no-undef
module.exports = config;
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"scripts": {
"build": "yarn babel && yarn type && yarn build:assets",
"babel": "yarn babel:cjs && yarn babel:esm",
"babel:cjs": "nimbus babel --clean --workspaces=\"@superset-ui/!(demo|generator-superset)\"",
"babel:esm": "nimbus babel --clean --workspaces=\"@superset-ui/!(demo|generator-superset)\" --esm",
"babel:cjs": "nimbus babel --clean --workspaces=\"@superset-ui/!(demo|generator-superset)\" --config-file=../../babel.config.js",
"babel:esm": "nimbus babel --clean --workspaces=\"@superset-ui/!(demo|generator-superset)\" --esm --config-file=../../babel.config.js",
"build:assets": "node ./scripts/buildAssets.js",
"demo": "cd packages/superset-ui-demo && yarn demo:build",
"demo:clean": "cd packages/superset-ui-demo && yarn demo:clean",
Expand Down Expand Up @@ -94,7 +94,7 @@
],
"nimbus": {
"drivers": [
"babel",
{ "driver": "babel", "strategy": "none" },
"eslint",
"jest",
"prettier",
Expand All @@ -114,10 +114,10 @@
},
"coverageThreshold": {
"global": {
"branches": 25,
"functions": 25,
"lines": 25,
"statements": 25
"branches": 5,
"functions": 5,
"lines": 5,
"statements": 5
}
},
"moduleNameMapper": {
Expand All @@ -128,6 +128,9 @@
"setupFilesAfterEnv": [
"@airbnb/config-jest/enzyme"
],
"transformIgnorePatterns": [
"node_modules/(?!(vega-lite|lodash-es))"
],
"testPathIgnorePatterns": [
"packages/generator-superset/generators"
],
Expand Down
24 changes: 24 additions & 0 deletions temporary-plugins/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// eslint-disable-next-line no-undef, import/no-extraneous-dependencies
const { getConfig } = require('@airbnb/config-babel');

const config = getConfig({
library: true,
react: true,
next: true,
node: process.env.NODE_ENV === 'test',
typescript: true,
env: {
targets: false,
},
});

if (process.env.NODE_ENV !== 'test') {
config.presets[0][1].modules = false;
}

// Override to allow transpile es modules inside vega-lite
config.ignore = config.ignore.filter(item => item !== 'node_modules/');
config.ignore.push('node_modules/(?!(vega-lite|lodash-es))');

// eslint-disable-next-line no-undef
module.exports = config;

0 comments on commit 3b28813

Please sign in to comment.