Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-preset-airbnb

Package Overview
Dependencies
Maintainers
5
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-preset-airbnb - npm Package Compare versions

Comparing version 2.6.0 to 3.0.0

4

CHANGELOG.md

@@ -6,2 +6,6 @@ # Change Log

## [3.0.0] - 2018-10-08
* [Breaking] update to babel 7 (#37)
* [New] add support to supply the react preset's "development" option
## [2.6.0] - 2018-08-29

@@ -8,0 +12,0 @@ * [New] Add `removePropTypes` option (#36)

84

index.js
'use strict';
var assign = require('object.assign');
const { declare } = require('@babel/helper-plugin-utils');
var modules = [require('babel-plugin-transform-es2015-modules-commonjs'), {
strictMode: true, // add "use strict"
strict: false // this allows __esModule to be exported
}];
var defaultTargets = {
const defaultTargets = {
android: 30,

@@ -17,49 +12,64 @@ chrome: 35,

safari: 8,
ucandroid: 1
ucandroid: 1,
};
function buildTargets(options) {
return assign({}, defaultTargets, options.additionalTargets);
function buildTargets({ additionalTargets }) {
return Object.assign({}, defaultTargets, additionalTargets);
}
module.exports = function buildAirbnbPreset(context, options) {
var transpileTargets = (options && options.targets) || buildTargets(options || {});
module.exports = declare((api, options) => {
// see docs about api at https://babeljs.io/docs/en/config-files#apicache
api.assertVersion(7);
var debug = (options && typeof options.debug === 'boolean') ? !!options.debug : false;
const {
modules,
targets = buildTargets(options),
removePropTypes,
} = options;
const debug = typeof options.debug === 'boolean' ? options.debug : false;
const development = typeof options.development === 'boolean'
? options.development
: api.cache.using(() => process.env.NODE_ENV === 'development');
return {
presets: [
require('babel-preset-env').default(null, {
debug: debug,
[require('@babel/preset-env'), {
debug,
exclude: [
'transform-async-to-generator',
'transform-es2015-template-literals',
'transform-regenerator'
'transform-template-literals',
'transform-regenerator',
],
modules: false,
targets: transpileTargets
}),
require('babel-preset-react')
modules: modules === false ? false : {
allowTopLevelThis: false,
loose: false, // true means, use [[Set]] instead of [[Define]]
strict: false, // true means, do not emit __esModule
strictMode: true, // === false means, do not force "use strict" pragma to appear
noInterop: false, // true means, do not use interopRequireDefault
lazy: false, // true means, lazily evaluate imported modules (violates the spec)
},
targets,
}],
[require('@babel/preset-react'), { development }],
],
plugins: [
options && !!options.removePropTypes ? ['babel-plugin-transform-react-remove-prop-types', assign({
removePropTypes ? [require('babel-plugin-transform-react-remove-prop-types'), Object.assign({
mode: 'wrap',
additionalLibraries: ['airbnb-prop-types'],
ignoreFilenames: ['node_modules']
}, options.removePropTypes)] : null,
ignoreFilenames: ['node_modules'],
}, removePropTypes)] : null,
options && options.modules === false ? null : modules,
options && options.modules === false ? null : ['babel-plugin-transform-strict-mode', { strictMode: true }],
[require('babel-plugin-transform-es2015-template-literals'), {
spec: true
[require('@babel/plugin-transform-template-literals'), {
spec: true,
}],
require('babel-plugin-transform-es5-property-mutators'),
require('babel-plugin-transform-es3-member-expression-literals'),
require('babel-plugin-transform-es3-property-literals'),
require('babel-plugin-transform-jscript'),
[require('babel-plugin-transform-object-rest-spread'), {
useBuiltIns: true
}]
].filter(Boolean)
require('@babel/plugin-transform-property-mutators'),
require('@babel/plugin-transform-member-expression-literals'),
require('@babel/plugin-transform-property-literals'),
require('@babel/plugin-transform-jscript'),
[require('@babel/plugin-proposal-object-rest-spread'), {
useBuiltIns: true,
}],
].filter(Boolean),
};
};
});
{
"name": "babel-preset-airbnb",
"version": "2.6.0",
"version": "3.0.0",
"description": "A babel preset for transforming your JavaScript for Airbnb",

@@ -19,28 +19,31 @@ "main": "index.js",

"dependencies": {
"babel-plugin-syntax-trailing-function-commas": "^6.22.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-plugin-transform-es3-member-expression-literals": "^6.22.0",
"babel-plugin-transform-es3-property-literals": "^6.22.0",
"babel-plugin-transform-es5-property-mutators": "^6.24.1",
"babel-plugin-transform-exponentiation-operator": "^6.24.1",
"babel-plugin-transform-jscript": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.15",
"babel-plugin-transform-strict-mode": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"object.assign": "^4.1.0"
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/plugin-transform-exponentiation-operator": "^7.0.0",
"@babel/plugin-transform-jscript": "^7.0.0",
"@babel/plugin-transform-member-expression-literals": "^7.0.0",
"@babel/plugin-transform-property-literals": "^7.0.0",
"@babel/plugin-transform-property-mutators": "^7.0.0",
"@babel/plugin-transform-template-literals": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.18"
},
"peerDependencies": {
"@babel/core": "^7.0.0"
},
"devDependencies": {
"eslint": "^4.19.1",
"eslint-config-airbnb-base": "^13.0.0",
"eslint-plugin-import": "^2.13.0"
"@babel/core": "^7.0.0",
"eslint": "^5.6.1",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.14.0",
"safe-publish-latest": "^1.1.2"
},
"scripts": {
"prepublish": "safe-publish-latest",
"pretest": "npm run lint",
"test": "npm run tests-only",
"tests-only": "echo 'no tests';",
"tests-only": "node . && echo 'parsed successfully'",
"lint": "eslint ."
}
}

@@ -38,4 +38,4 @@ # babel-preset-airbnb

```javascript
require("babel-core").transform("code", {
presets: ["airbnb"]
require('@babel/core').transform('code', {
presets: ['airbnb']
});

@@ -46,5 +46,5 @@ ```

This module uses babel-preset-env to target specific environments.
This module uses @babel/preset-env to target specific environments.
Please refer to [babel-preset-env#targets](https://github.com/babel/babel-preset-env#targets) for a list of available options.
Please refer to [@babel/preset-env#targets](https://babeljs.io/docs/en/babel-preset-env#targets) for a list of available options.

@@ -102,2 +102,16 @@ For a list of browsers please see [browserlist](https://github.com/ai/browserslist).

## React Development Mode
When `process.env.NODE_ENV` is `'development'`, [the `development` mode will be set for `@babel/preset-react`](https://babeljs.io/docs/en/babel-preset-react#development).
You may override our default development option by providing your own boolean `development` key.
```json
{
"presets": [["airbnb", {
"development": false
}]]
}
```
## React PropTypes removal

@@ -104,0 +118,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc