babel-preset-airbnb
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -6,2 +6,9 @@ # Change Log | ||
## [3.2.0] - 2018-12-14 | ||
* [New] add `looseClasses` option to compile classes in loose mode (#46) | ||
* [New] infer default value of `jscript` option from explorer target version (#47) | ||
## [3.1.0] - 2018-12-13 | ||
* [New] add `jscript` option to disable JScript transformation (#45) | ||
## [3.0.1] - 2018-10-08 | ||
@@ -8,0 +15,0 @@ * [Fix] the env preset only accepts `false` or a string, not explicit options |
12
index.js
@@ -27,5 +27,11 @@ 'use strict'; | ||
removePropTypes, | ||
jscript = true, | ||
looseClasses = false, | ||
} = options; | ||
// jscript option is deprecated in favor of using the explorer target version | ||
// TODO: remove this option entirely in the next major release. | ||
const jscript = Object.prototype.hasOwnProperty.call(options, 'jscript') | ||
? options.jscript | ||
: (targets.explorer >= 6 && targets.explorer <= 8); | ||
if (typeof modules !== 'undefined' && typeof modules !== 'boolean' && modules !== 'auto') { | ||
@@ -55,2 +61,6 @@ throw new TypeError('babel-preset-airbnb only accepts `true`, `false`, or `"auto"` as the value of the "modules" option'); | ||
plugins: [ | ||
looseClasses ? [require('@babel/plugin-transform-classes'), { | ||
loose: true, | ||
}] : null, | ||
removePropTypes ? [require('babel-plugin-transform-react-remove-prop-types'), Object.assign({ | ||
@@ -57,0 +67,0 @@ mode: 'wrap', |
{ | ||
"name": "babel-preset-airbnb", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "A babel preset for transforming your JavaScript for Airbnb", | ||
@@ -21,2 +21,3 @@ "main": "index.js", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.0.0", | ||
"@babel/plugin-transform-classes": "^7.2.0", | ||
"@babel/plugin-transform-exponentiation-operator": "^7.0.0", | ||
@@ -23,0 +24,0 @@ "@babel/plugin-transform-jscript": "^7.0.0", |
@@ -153,5 +153,5 @@ # babel-preset-airbnb | ||
## JScript | ||
## Classes loose mode | ||
This preset uses a transform to protect against JScript bugs in older versions of Internet Explorer. If you'd like to disable this, set the `jscript` option to `false`: | ||
By default, this preset will compile classes in normal mode. This is safer, but comes with a bundle size and runtime overhead. To [compile classes in loose mode](https://babeljs.io/docs/en/babel-plugin-transform-classes#loose), set the `looseClasses` option to `true`: | ||
@@ -161,5 +161,7 @@ ```json | ||
"presets": [["airbnb", { | ||
"jscript": false, | ||
"looseClasses": true, | ||
}]] | ||
} | ||
``` | ||
The [risks of enabling loose classes are outlined in the Babel docs](https://babeljs.io/docs/en/babel-plugin-transform-classes#loose). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10589
71
166
13
+ Addedcaniuse-lite@1.0.30001684(transitive)
+ Addedelectron-to-chromium@1.5.65(transitive)
- Removedcaniuse-lite@1.0.30001683(transitive)
- Removedelectron-to-chromium@1.5.64(transitive)