Skip to content
Browse files

Update to Babel 6

  • Loading branch information...
1 parent 7a3009c commit 1365498b811ac3f91f6462152cc2dc6f1c6f01e4 @kittens kittens committed
Showing with 64 additions and 31 deletions.
  1. +25 −0 .babelrc
  2. +4 −1 .eslintrc
  3. +3 −11 gulpfile.js
  4. +23 −4 package.json
  5. +9 −15 scripts/jest/preprocessor.js
View
25 .babelrc
@@ -0,0 +1,25 @@
+{
+ "presets": ["react"],
+ "ignore": ["third_party"],
+ "plugins": [
+ "fbjs-scripts/babel-6/dev-expression",
+ "syntax-trailing-function-commas",
+ "transform-es2015-template-literals",
+ "transform-es2015-literals",
+ "transform-es2015-arrow-functions",
+ "transform-es2015-block-scoped-functions",
+ ["transform-es2015-classes", { "loose": true }],
+ "transform-es2015-object-super",
+ "transform-es2015-shorthand-properties",
+ "transform-es2015-computed-properties",
+ "transform-es2015-for-of",
+ "check-es2015-constants",
+ ["transform-es2015-spread", { "loose": true }],
+ "transform-es2015-parameters",
+ ["transform-es2015-destructuring", { "loose": true }],
+ "transform-es2015-block-scoping",
+ "transform-es2015-modules-commonjs",
+ "transform-es3-member-expression-literals",
+ "transform-es3-property-literals"
+ ]
+}
View
5 .eslintrc
@@ -2,12 +2,15 @@
parser: babel-eslint
extends:
- - ./node_modules/fbjs-scripts/eslint/.eslintrc
+ - ./node_modules/fbjs-scripts/eslint/.eslintrc.js
plugins:
- react
- react-internal
+ecmaFeatures:
+ modules: false
+
# We're stricter than the default config, mostly. We'll override a few rules and
# then enable some React specific ones.
rules:
View
14 gulpfile.js
@@ -14,8 +14,7 @@ var babel = require('gulp-babel');
var flatten = require('gulp-flatten');
var del = require('del');
-var babelPluginDEV = require('fbjs-scripts/babel/dev-expression');
-var babelPluginModules = require('fbjs-scripts/babel/rewrite-modules');
+var babelPluginModules = require('fbjs-scripts/babel-6/rewrite-modules');
var paths = {
react: {
@@ -30,16 +29,9 @@ var paths = {
};
var babelOpts = {
- nonStandard: true,
- blacklist: [
- 'spec.functionName',
+ plugins: [
+ [babelPluginModules, { map: require('fbjs/module-map') }],
],
- optional: [
- 'es7.trailingFunctionCommas',
- ],
- plugins: [babelPluginDEV, babelPluginModules],
- ignore: ['third_party'],
- _moduleMap: require('fbjs/module-map'),
};
gulp.task('react:clean', function() {
View
27 package.json
@@ -4,8 +4,27 @@
"version": "0.15.0-alpha.1",
"devDependencies": {
"async": "^1.5.0",
- "babel": "^5.8.29",
- "babel-eslint": "4.1.8",
+ "babel-core": "^6.0.0",
+ "babel-eslint": "^5.0.0",
+ "babel-plugin-check-es2015-constants": "^6.5.0",
+ "babel-plugin-syntax-trailing-function-commas": "^6.5.0",
+ "babel-plugin-transform-es2015-arrow-functions": "^6.5.2",
+ "babel-plugin-transform-es2015-block-scoped-functions": "^6.5.0",
+ "babel-plugin-transform-es2015-block-scoping": "^6.5.0",
+ "babel-plugin-transform-es2015-classes": "^6.5.2",
+ "babel-plugin-transform-es2015-computed-properties": "^6.5.2",
+ "babel-plugin-transform-es2015-destructuring": "^6.5.0",
+ "babel-plugin-transform-es2015-for-of": "^6.5.2",
+ "babel-plugin-transform-es2015-literals": "^6.5.0",
+ "babel-plugin-transform-es2015-modules-commonjs": "^6.5.2",
+ "babel-plugin-transform-es2015-object-super": "^6.5.0",
+ "babel-plugin-transform-es2015-parameters": "^6.5.0",
+ "babel-plugin-transform-es2015-shorthand-properties": "^6.5.0",
+ "babel-plugin-transform-es2015-spread": "^6.5.2",
+ "babel-plugin-transform-es2015-template-literals": "^6.5.2",
+ "babel-plugin-transform-es3-member-expression-literals": "^6.5.0",
+ "babel-plugin-transform-es3-property-literals": "^6.5.0",
+ "babel-preset-react": "^6.5.0",
"browserify": "^12.0.1",
"bundle-collapser": "^1.1.1",
"coffee-script": "^1.8.0",
@@ -17,7 +36,7 @@
"eslint-plugin-react": "3.8.0",
"eslint-plugin-react-internal": "file:eslint-rules",
"fbjs": "^0.6.1",
- "fbjs-scripts": "^0.5.0",
+ "fbjs-scripts": "0.6.0-alpha.2",
"glob": "^6.0.1",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
@@ -25,7 +44,7 @@
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compress": "^0.14.0",
"gulp": "^3.9.0",
- "gulp-babel": "^5.3.0",
+ "gulp-babel": "^6.0.0",
"gulp-flatten": "^0.2.0",
"gzip-js": "~0.3.2",
"jest-cli": "^0.9.0-fb1",
View
24 scripts/jest/preprocessor.js
@@ -6,7 +6,7 @@ process.env.NODE_ENV = 'test';
var path = require('path');
-var babel = require('babel');
+var babel = require('babel-core');
var coffee = require('coffee-script');
var tsPreprocessor = require('./ts-preprocessor');
@@ -14,29 +14,22 @@ var tsPreprocessor = require('./ts-preprocessor');
// This assumes the module map has been built. This might not be safe.
// We should consider consuming this from a built fbjs module from npm.
var moduleMap = require('fbjs/module-map');
-var babelPluginDEV = require('fbjs-scripts/babel/dev-expression');
-var babelPluginModules = require('fbjs-scripts/babel/rewrite-modules');
+var babelPluginModules = require('fbjs-scripts/babel-6/rewrite-modules');
var createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction');
// Use require.resolve to be resilient to file moves, npm updates, etc
-var pathToBabel = path.join(require.resolve('babel'), '..', 'package.json');
+var pathToBabel = path.join(require.resolve('babel-core'), '..', 'package.json');
var pathToModuleMap = require.resolve('fbjs/module-map');
-var pathToBabelPluginDev = require.resolve('fbjs-scripts/babel/dev-expression');
-var pathToBabelPluginModules = require.resolve('fbjs-scripts/babel/rewrite-modules');
+var pathToBabelPluginDev = require.resolve('fbjs-scripts/babel-6/dev-expression');
+var pathToBabelPluginModules = require.resolve('fbjs-scripts/babel-6/rewrite-modules');
+var pathToBabelrc = path.join(__dirname, '..', '..', '.babelrc');
// TODO: make sure this stays in sync with gulpfile
var babelOptions = {
- nonStandard: true,
- blacklist: [
- 'spec.functionName',
- 'validation.react',
+ plugins: [
+ [babelPluginModules, { map: moduleMap }],
],
- optional: [
- 'es7.trailingFunctionCommas',
- ],
- plugins: [babelPluginDEV, babelPluginModules],
retainLines: true,
- _moduleMap: moduleMap,
};
module.exports = {
@@ -62,6 +55,7 @@ module.exports = {
getCacheKey: createCacheKeyFunction([
__filename,
pathToBabel,
+ pathToBabelrc,
pathToModuleMap,
pathToBabelPluginDev,
pathToBabelPluginModules,

0 comments on commit 1365498

Please sign in to comment.
Something went wrong with that request. Please try again.