<commit_before>---
layout: post
title:  "6.23.0 Released"
author: <NAME>
date:   2017-02-13 20:00:00
categories: announcements
share_text: "6.23.0"
---

In this release: multiple improvements to the `react-constant-elements` plugin by [@STRML](https://github.com/STRML), some codegen optimizations, and lots of bug fixes! Thanks to [@loganfsmyth](https://github.com/loganfsmyth) for the release + reviews!

> Shoutouts to [@xtina-starr](https://github.com/xtina-starr), [@finkef](https://github.com/finkef), [@chitchu](https://github.com/chitchu), [@yongxu](https://github.com/yongxu), [@jwbay](https://github.com/jwbay), [@hex13](https://github.com/hex13) for their first PRs! 🎉

Check out [GitHub](https://github.com/babel/babel/releases/tag/v6.23.0) for the whole changelog.

---

I'll be writing up the 7.0 post (our current progress) soon so look out for that! We want to do whatever we can to make it easy for both end-users and plugin/tool authors to upgrade seamlessly: whether it be a beta period for the release, a [7.0 upgrade guide](https://github.com/babel/babel.github.io/pull/1146), codemods if necessary, a bot to automatically upgrade your OSS project from 6 to 7, or any other suggestions you can give us!

Since not everyone realises, I wanted to re-iterate again that our [team](https://github.com/babel/babel#team) is still a small group of volunteers. There's no company sponsor or even anyone working on it full time.

We'd love for you to contribute (especially not code!), so please reach out to us! More designers, technical writers/editors, and teachers for our website would be amazing.

And in other news, Babel has been accepted as a [Rails Girls Summer of Code](https://teams.railsgirlssummerofcode.org/projects/177-babel) project as well as waiting to hear back as a mentor organization for [Google Summer of Code](https://summerofcode.withgoogle.com/)!

---

## 🚀 New Feature

### [#5236](https://github.com/babel/babel/pull/5236) `transform-es2015-block-scoping`: add option `throwIfClosureRequired` to throw on slow code. ([@spicyj](https://github.com/spicyj))

```json
{
  "plugins": [
    ["transform-es2015-block-scoping", {
      "throwIfClosureRequired": true
    }]
  ]
}
```

In cases such as the following, it is impossible to rewrite let/const without adding an additional function and closure while transforming:

```js
for (let i = 0; i < 5; i++) {
  setTimeout(() => console.log(i), 1);
}
```

In extremely performance-sensitive code, this can be undesirable. If `"throwIfClosureRequired": true` is set, Babel throws when transforming these patterns instead of automatically adding an additional function.

### [#4812](https://github.com/babel/babel/pull/4812) `transform-react-constant-elements`: support pure expressions ([@STRML](https://github.com/STRML))

Adds a `path.isPure()` check to the plugin.

> The expression will remain in the hoisted code, even though it could be statically evaluated. UglifyJS/Babili will take care of that in many cases.

In

```
const OFFSET = 3;

var Foo = React.createClass({
  render: function () {
    return (
      <div tabIndex={OFFSET + 1} />
    );
  }
});
```

Out

```
const OFFSET = 3;

var _ref = <div tabIndex={OFFSET + 1} />;

var Foo = React.createClass({
  render: function () {
    return _ref;
  }
});
```

> Deopt

As noted in [facebook/react#3226](https://github.com/facebook/react/issues/3226), it's not safe to reuse elements with mutable props.

```
<div style={
  { width: 100 }
} />
```

### [#5288](https://github.com/babel/babel/pull/5288) `babel-preset-flow`: add new preset ([@thejameskyle](https://github.com/thejameskyle))

`babel-preset-flow` just includes `transform-flow-strip-types`.

Before (still valid)

```json
{
  "plugins": ["transform-flow-strip-types"]
}
```

After

```json
{
  "presets": ["flow"]
}
```

> FYI: the React preset still includes the flow plugin by default (we might change it when TS support is added)

Thanks to [@simnalamburt](https://github.com/simnalamburt) for giving us the package name!

### [#5230](https://github.com/babel/babel/pull/5230) `babel-traverse`: Add extra sibling methods ([@chitchu](https://github.com/chitchu))

For plugin authors: there's already a `path.getSibling(number)`, so we're adding a few helper methods.

```js
path.getPrevSibling(); // path.getSibling(path.parentPath.key - 1)
path.getNextSibling(); // path.getSibling(path.parentPath.key + 1)
path.getAllPrevSiblings(); // returns Array<NodePath> of previous siblings
path.getAllNextSiblings();// returns Array<NodePath> of next siblings
```

## 🐛 Bug Fixes

> Because alsmot every bug fix can be an opportunity to learn more about JavaScript and how the tool that you use works, I would check out some of the PRs!

### [#5298](https://github.com/babel/babel/pull/5298) Fix loose `transform-es2015-for-of` with label. ([@jridgewell](https://github.com/jridgewell))

```js
b: for (let c of d()) { // previously, the label was completely dropped
  for (let e of f()) {
    continue b;
  }
}
```<commit_msg>Fix bug in bug fix section (#1164)<commit_after>---
layout: post
title:  "6.23.0 Released"
author: <NAME>
date:   2017-02-13 20:00:00
categories: announcements
share_text: "6.23.0"
---

In this release: multiple improvements to the `react-constant-elements` plugin by [@STRML](https://github.com/STRML), some codegen optimizations, and lots of bug fixes! Thanks to [@loganfsmyth](https://github.com/loganfsmyth) for the release + reviews!

> Shoutouts to [@xtina-starr](https://github.com/xtina-starr), [@finkef](https://github.com/finkef), [@chitchu](https://github.com/chitchu), [@yongxu](https://github.com/yongxu), [@jwbay](https://github.com/jwbay), [@hex13](https://github.com/hex13) for their first PRs! 🎉

Check out [GitHub](https://github.com/babel/babel/releases/tag/v6.23.0) for the whole changelog.

---

I'll be writing up the 7.0 post (our current progress) soon so look out for that! We want to do whatever we can to make it easy for both end-users and plugin/tool authors to upgrade seamlessly: whether it be a beta period for the release, a [7.0 upgrade guide](https://github.com/babel/babel.github.io/pull/1146), codemods if necessary, a bot to automatically upgrade your OSS project from 6 to 7, or any other suggestions you can give us!

Since not everyone realises, I wanted to re-iterate again that our [team](https://github.com/babel/babel#team) is still a small group of volunteers. There's no company sponsor or even anyone working on it full time.

We'd love for you to contribute (especially not code!), so please reach out to us! More designers, technical writers/editors, and teachers for our website would be amazing.

And in other news, Babel has been accepted as a [Rails Girls Summer of Code](https://teams.railsgirlssummerofcode.org/projects/177-babel) project as well as waiting to hear back as a mentor organization for [Google Summer of Code](https://summerofcode.withgoogle.com/)!

---

## 🚀 New Feature

### [#5236](https://github.com/babel/babel/pull/5236) `transform-es2015-block-scoping`: add option `throwIfClosureRequired` to throw on slow code. ([@spicyj](https://github.com/spicyj))

```json
{
  "plugins": [
    ["transform-es2015-block-scoping", {
      "throwIfClosureRequired": true
    }]
  ]
}
```

In cases such as the following, it is impossible to rewrite let/const without adding an additional function and closure while transforming:

```js
for (let i = 0; i < 5; i++) {
  setTimeout(() => console.log(i), 1);
}
```

In extremely performance-sensitive code, this can be undesirable. If `"throwIfClosureRequired": true` is set, Babel throws when transforming these patterns instead of automatically adding an additional function.

### [#4812](https://github.com/babel/babel/pull/4812) `transform-react-constant-elements`: support pure expressions ([@STRML](https://github.com/STRML))

Adds a `path.isPure()` check to the plugin.

> The expression will remain in the hoisted code, even though it could be statically evaluated. UglifyJS/Babili will take care of that in many cases.

In

```
const OFFSET = 3;

var Foo = React.createClass({
  render: function () {
    return (
      <div tabIndex={OFFSET + 1} />
    );
  }
});
```

Out

```
const OFFSET = 3;

var _ref = <div tabIndex={OFFSET + 1} />;

var Foo = React.createClass({
  render: function () {
    return _ref;
  }
});
```

> Deopt

As noted in [facebook/react#3226](https://github.com/facebook/react/issues/3226), it's not safe to reuse elements with mutable props.

```
<div style={
  { width: 100 }
} />
```

### [#5288](https://github.com/babel/babel/pull/5288) `babel-preset-flow`: add new preset ([@thejameskyle](https://github.com/thejameskyle))

`babel-preset-flow` just includes `transform-flow-strip-types`.

Before (still valid)

```json
{
  "plugins": ["transform-flow-strip-types"]
}
```

After

```json
{
  "presets": ["flow"]
}
```

> FYI: the React preset still includes the flow plugin by default (we might change it when TS support is added)

Thanks to [@simnalamburt](https://github.com/simnalamburt) for giving us the package name!

### [#5230](https://github.com/babel/babel/pull/5230) `babel-traverse`: Add extra sibling methods ([@chitchu](https://github.com/chitchu))

For plugin authors: there's already a `path.getSibling(number)`, so we're adding a few helper methods.

```js
path.getPrevSibling(); // path.getSibling(path.parentPath.key - 1)
path.getNextSibling(); // path.getSibling(path.parentPath.key + 1)
path.getAllPrevSiblings(); // returns Array<NodePath> of previous siblings
path.getAllNextSiblings();// returns Array<NodePath> of next siblings
```

## 🐛 Bug Fixes

> Because almost every bug fix can be an opportunity to learn more about JavaScript and how the tool that you use works, I would check out some of the PRs!

### [#5298](https://github.com/babel/babel/pull/5298) Fix loose `transform-es2015-for-of` with label. ([@jridgewell](https://github.com/jridgewell))

```js
b: for (let c of d()) { // previously, the label was completely dropped
  for (let e of f()) {
    continue b;
  }
}
```
{'fraction_non_alphanumeric': 0.14246059284227222, 'fraction_numerical': 0.023198175869931593, 'mean_word_length': 4.312269615587151, 'pattern_counts': {'":': 10, '<': 17, '<?xml version=': 0, '>': 27, 'https://': 50, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5495392', 'n_tokens_mistral': 3487, 'n_tokens_neox': 3160, 'n_words': 1072}