Chore: Upgrade babel packages (#736)

Chore: Upgrade babel
This commit is contained in:
Pranav Raj S 2020-04-17 18:49:14 +05:30 committed by GitHub
parent e3ccfc4662
commit 0817414957
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 362 additions and 695 deletions

View file

@ -1,8 +1,8 @@
module.exports = {
extends: ['airbnb/base', 'prettier', 'plugin:vue/recommended'],
extends: ['airbnb-base/legacy', 'prettier', 'plugin:vue/recommended'],
parserOptions: {
parser: 'babel-eslint',
ecmaVersion: 2017,
ecmaVersion: 2020,
sourceType: 'module',
},
plugins: ['html', 'prettier', 'babel'],

View file

@ -1,5 +1,3 @@
import '@babel/polyfill';
/* eslint no-console: 0 */
/* eslint-env browser */
/* eslint-disable no-new */

View file

@ -1,64 +1,18 @@
/* eslint-disable global-require */
const plugins = isTestEnv => [
const plugins = () => [
require('babel-plugin-macros'),
require('@babel/plugin-syntax-dynamic-import').default,
isTestEnv && require('babel-plugin-dynamic-import-node'),
require('@babel/plugin-transform-destructuring').default,
[
require('@babel/plugin-proposal-class-properties').default,
{
loose: true,
},
],
[
require('@babel/plugin-proposal-object-rest-spread').default,
{
useBuiltIns: true,
},
],
[
require('@babel/plugin-transform-runtime').default,
{
helpers: false,
regenerator: true,
corejs: false,
},
],
[
require('@babel/plugin-transform-regenerator').default,
{
async: false,
},
],
[require('babel-plugin-transform-vue-jsx')],
];
const presets = (isTestEnv, isProductionEnv, isDevelopmentEnv) => [
isTestEnv && [
require('@babel/preset-env').default,
{
targets: {
node: 'current',
},
},
],
(isProductionEnv || isDevelopmentEnv) && [
require('@babel/preset-env').default,
{
forceAllTransforms: true,
useBuiltIns: 'entry',
modules: false,
exclude: ['transform-typeof-symbol'],
},
],
];
module.exports = api => {
const validEnv = ['development', 'test', 'production'];
const currentEnv = api.env();
const isDevelopmentEnv = api.env('development');
const isProductionEnv = api.env('production');
const isTestEnv = api.env('test');
if (!validEnv.includes(currentEnv)) {
throw new Error(
@ -71,9 +25,12 @@ module.exports = api => {
}
return {
presets: presets(isTestEnv, isProductionEnv, isDevelopmentEnv).filter(
Boolean
),
plugins: plugins(isTestEnv).filter(Boolean),
presets: [
[
require('@babel/preset-env').default,
{ useBuiltIns: 'usage', corejs: 3 },
],
],
plugins: plugins(),
};
};

View file

@ -20,7 +20,7 @@
"bourbon": "^6.0.0",
"chart.js": "~2.5.0",
"copy-text-to-clipboard": "^2.1.1",
"core-js": "2",
"core-js": "3",
"dotenv": "^8.0.0",
"emojione": "~2.2.7",
"foundation-sites": "~6.5.3",
@ -54,17 +54,17 @@
"vuex-router-sync": "~4.1.2"
},
"devDependencies": {
"@babel/core": "^7.8.6",
"@babel/polyfill": "^7.6.0",
"@babel/preset-env": "~7.8.4",
"@vue/babel-preset-app": "^3.11.0",
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.9.5",
"@vue/test-utils": "^1.0.0-beta.29",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.3",
"babel-eslint": "^10.1.0",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-jest": "^25.1.0",
"babel-jest": "^25.3.0",
"babel-loader": "^8.1.0",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-config-prettier": "^4.0.0",
"eslint-import-resolver-webpack": "^0.11.1",
"eslint-plugin-babel": "^5.3.0",
@ -72,8 +72,6 @@
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^2.5.1",
"eslint-plugin-vue": "^6.2.2",
"expect-more-jest": "^2.4.2",
"husky": ">=1",

974
yarn.lock

File diff suppressed because it is too large Load diff