Skip to content

Use Babel 6 #1347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
{
"stage": 0,
"loose": "all"
plugins: [
["transform-es2015-template-literals", { "loose": true }],
"transform-es2015-literals",
"transform-es2015-function-name",
"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", { "loose": true }],
["transform-es2015-for-of", { "loose": true }],
"transform-es2015-sticky-regex",
"transform-es2015-unicode-regex",
"check-es2015-constants",
["transform-es2015-spread", { "loose": true }],
"transform-es2015-parameters",
["transform-es2015-destructuring", { "loose": true }],
"transform-es2015-block-scoping",
["transform-es2015-modules-commonjs", { "loose": true }],
"transform-object-rest-spread"
]
}
15 changes: 2 additions & 13 deletions examples/async/.babelrc
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
{
"stage": 2,
"presets": ["es2015", "react"],
"env": {
"development": {
"plugins": [
"react-transform"
],
"extra": {
"react-transform": {
"transforms": [{
"transform": "react-transform-hmr",
"imports": ["react"],
"locals": ["module"]
}]
}
}
"presets": ["react-hmre"]
}
}
}
2 changes: 1 addition & 1 deletion examples/async/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'babel-core/polyfill'
import 'babel-polyfill'
import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
Expand Down
10 changes: 6 additions & 4 deletions examples/async/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@
"redux-thunk": "^1.0.3"
},
"devDependencies": {
"babel-core": "^5.6.18",
"babel-loader": "^5.1.4",
"babel-plugin-react-transform": "^1.1.0",
"babel-core": "^6.3.15",
"babel-loader": "^6.2.0",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-react-hmre": "^1.0.1",
"expect": "^1.6.0",
"express": "^4.13.3",
"node-libs-browser": "^0.5.2",
"react-transform-hmr": "^1.0.0",
"webpack": "^1.9.11",
"webpack-dev-middleware": "^1.2.0",
"webpack-hot-middleware": "^2.2.0"
Expand Down
14 changes: 8 additions & 6 deletions examples/async/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ module.exports = {
new webpack.NoErrorsPlugin()
],
module: {
loaders: [{
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/,
include: __dirname
}]
loaders: [
{
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/,
include: __dirname
}
]
}
}

Expand Down
15 changes: 2 additions & 13 deletions examples/counter/.babelrc
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
{
"stage": 2,
"presets": ["es2015", "react"],
"env": {
"development": {
"plugins": [
"react-transform"
],
"extra": {
"react-transform": {
"transforms": [{
"transform": "react-transform-hmr",
"imports": ["react"],
"locals": ["module"]
}]
}
}
"presets": ["react-hmre"]
}
}
}
9 changes: 5 additions & 4 deletions examples/counter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@
"redux": "^3.1.2"
},
"devDependencies": {
"babel-core": "^5.6.18",
"babel-loader": "^5.1.4",
"babel-plugin-react-transform": "^1.1.0",
"babel-core": "^6.3.15",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-react-hmre": "^1.0.1",
"cross-env": "^1.0.7",
"expect": "^1.6.0",
"express": "^4.13.3",
"jsdom": "^5.6.1",
"mocha": "^2.2.5",
"node-libs-browser": "^0.5.2",
"react-addons-test-utils": "^0.14.7",
"react-transform-hmr": "^1.0.0",
"webpack": "^1.9.11",
"webpack-dev-middleware": "^1.2.0",
"webpack-hot-middleware": "^2.2.0"
Expand Down
15 changes: 2 additions & 13 deletions examples/real-world/.babelrc
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
{
"stage": 2,
"presets": ["es2015", "react"],
"env": {
"development": {
"plugins": [
"react-transform"
],
"extra": {
"react-transform": {
"transforms": [{
"transform": "react-transform-hmr",
"imports": ["react"],
"locals": ["module"]
}]
}
}
"presets": ["react-hmre"]
}
}
}
2 changes: 1 addition & 1 deletion examples/real-world/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'babel-core/polyfill'
import 'babel-polyfill'
import React from 'react'
import { render } from 'react-dom'
import Root from './containers/Root'
Expand Down
10 changes: 6 additions & 4 deletions examples/real-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@
"redux-thunk": "^1.0.3"
},
"devDependencies": {
"babel-core": "^5.6.18",
"babel-loader": "^5.1.4",
"babel-plugin-react-transform": "^1.1.0",
"babel-core": "^6.3.15",
"babel-loader": "^6.2.0",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-react-hmre": "^1.0.1",
"concurrently": "^0.1.1",
"express": "^4.13.3",
"react-transform-hmr": "^1.0.0",
"redux-devtools": "^3.0.2",
"redux-devtools-dock-monitor": "^1.0.1",
"redux-devtools-log-monitor": "^1.0.2",
Expand Down
14 changes: 8 additions & 6 deletions examples/real-world/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ module.exports = {
new webpack.NoErrorsPlugin()
],
module: {
loaders: [{
test: /\.js$/,
loaders: [ 'babel' ],
exclude: /node_modules/,
include: __dirname
}]
loaders: [
{
test: /\.js$/,
loaders: [ 'babel' ],
exclude: /node_modules/,
include: __dirname
}
]
}
}

Expand Down
8 changes: 8 additions & 0 deletions examples/shopping-cart/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": ["es2015", "react"],
"env": {
"development": {
"presets": ["react-hmre"]
}
}
}
1 change: 1 addition & 0 deletions examples/shopping-cart/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'babel-polyfill'
import React from 'react'
import { render } from 'react-dom'
import { createStore, applyMiddleware } from 'redux'
Expand Down
8 changes: 5 additions & 3 deletions examples/shopping-cart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
"redux-thunk": "^1.0.3"
},
"devDependencies": {
"babel-core": "^5.6.18",
"babel-loader": "^5.1.4",
"babel-plugin-react-transform": "^1.0.3",
"babel-core": "^6.3.15",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-react-hmre": "^1.0.1",
"express": "^4.13.3",
"json-loader": "^0.5.3",
"redux-logger": "^2.0.1",
Expand Down
5 changes: 2 additions & 3 deletions examples/shopping-cart/reducers/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ function quantityById(state = initialState.quantityById, action) {
switch (action.type) {
case ADD_TO_CART:
const { productId } = action
return {
...state,
return Object.assign({}, state, {
[productId]: (state[productId] || 0) + 1
}
})
default:
return state
}
Expand Down
11 changes: 7 additions & 4 deletions examples/shopping-cart/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ export function getTotal(state) {
}

export function getCartProducts(state) {
return getAddedIds(state.cart).map(id => ({
...getProduct(state.products, id),
quantity: getQuantity(state.cart, id)
}))
return getAddedIds(state.cart).map(id => Object.assign(
{},
getProduct(state.products, id),
{
quantity: getQuantity(state.cart, id)
}
))
}

export default combineReducers({
Expand Down
18 changes: 8 additions & 10 deletions examples/shopping-cart/reducers/products.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import { RECEIVE_PRODUCTS, ADD_TO_CART } from '../constants/ActionTypes'
function products(state, action) {
switch (action.type) {
case ADD_TO_CART:
return {
...state,
return Object.assign({}, state, {
inventory: state.inventory - 1
}
})
default:
return state
}
Expand All @@ -16,20 +15,19 @@ function products(state, action) {
function byId(state = {}, action) {
switch (action.type) {
case RECEIVE_PRODUCTS:
return {
...state,
...action.products.reduce((obj, product) => {
return Object.assign({},
state,
action.products.reduce((obj, product) => {
obj[product.id] = product
return obj
}, {})
}
)
default:
const { productId } = action
if (productId) {
return {
...state,
return Object.assign({}, state, {
[productId]: products(state[productId], action)
}
})
}
return state
}
Expand Down
26 changes: 14 additions & 12 deletions examples/shopping-cart/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@ module.exports = {
new webpack.NoErrorsPlugin()
],
module: {
loaders: [{
test: /\.js$/,
loaders: [ 'babel' ],
exclude: /node_modules/,
include: __dirname
},
{
test: /\.json$/,
loaders: [ 'json' ],
exclude: /node_modules/,
include: __dirname
}]
loaders: [
{
test: /\.js$/,
loaders: [ 'babel' ],
exclude: /node_modules/,
include: __dirname
},
{
test: /\.json$/,
loaders: [ 'json' ],
exclude: /node_modules/,
include: __dirname
}
]
}
}

Expand Down
15 changes: 2 additions & 13 deletions examples/todomvc/.babelrc
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
{
"stage": 2,
"presets": ["es2015", "react"],
"env": {
"development": {
"plugins": [
"react-transform"
],
"extra": {
"react-transform": {
"transforms": [{
"transform": "react-transform-hmr",
"imports": ["react"],
"locals": ["module"]
}]
}
}
"presets": ["react-hmre"]
}
}
}
2 changes: 1 addition & 1 deletion examples/todomvc/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'babel-core/polyfill'
import 'babel-polyfill'
import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
Expand Down
10 changes: 6 additions & 4 deletions examples/todomvc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
"redux": "^3.1.2"
},
"devDependencies": {
"babel-core": "^5.6.18",
"babel-loader": "^5.1.4",
"babel-plugin-react-transform": "^1.1.0",
"babel-polyfill": "^6.3.14",
"babel-core": "^6.3.15",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-react-hmre": "^1.0.1",
"cross-env": "^1.0.7",
"expect": "^1.8.0",
"express": "^4.13.3",
Expand All @@ -35,7 +38,6 @@
"node-libs-browser": "^0.5.2",
"raw-loader": "^0.5.1",
"react-addons-test-utils": "^0.14.7",
"react-transform-hmr": "^1.0.0",
"style-loader": "^0.12.3",
"todomvc-app-css": "^2.0.1",
"webpack": "^1.9.11",
Expand Down
Loading