pax_global_header00006660000000000000000000000064131250071610014506gustar00rootroot0000000000000052 comment=5a7049dd7e7cad31bed6111d0ac8a32ba9629e85 babel-preset-airbnb-2.4.0/000077500000000000000000000000001312500716100153115ustar00rootroot00000000000000babel-preset-airbnb-2.4.0/.babel5rc000066400000000000000000000007471312500716100170010ustar00rootroot00000000000000{ "whitelist": [ "es3.memberExpressionLiterals", "es3.propertyLiterals", "es6.arrowFunctions", "es6.blockScoping", "es6.classes", "es6.constants", "es6.destructuring", "es6.modules", "es6.parameters", "es6.properties.computed", "es6.properties.shorthand", "es6.spread", "es6.templateLiterals", "es6.regex.unicode", "es7.exponentiationOperator", "es7.trailingFunctionCommas", "es7.objectRestSpread", "react" ] } babel-preset-airbnb-2.4.0/.eslintrc000066400000000000000000000003421312500716100171340ustar00rootroot00000000000000{ "root": true, "extends": "airbnb-base/legacy", "rules": { "global-require": 0, "no-var": 0, "strict": ["error", "global"] }, "parserOptions": { "ecmaVersion": 5, "sourceType": "script" }, } babel-preset-airbnb-2.4.0/.gitignore000066400000000000000000000001551312500716100173020ustar00rootroot00000000000000# gitignore node_modules # Only apps should have lockfiles package-lock.json yarn.lock npm-shrinkwrap.json babel-preset-airbnb-2.4.0/.npmrc000066400000000000000000000000231312500716100164240ustar00rootroot00000000000000package-lock=false babel-preset-airbnb-2.4.0/.travis.yml000066400000000000000000000022501312500716100174210ustar00rootroot00000000000000language: node_js os: - linux node_js: - "8" - "6" - "4" - "0.12" before_install: - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then npm install -g npm@1.3 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi' - 'if [ "${TRAVIS_NODE_VERSION%${TRAVIS_NODE_VERSION#[0-9]}}" = "0" ]; then npm install -g npm@4.5 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then npm install -g npm; fi' install: - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then nvm install 0.8 && npm install -g npm@1.3 && npm install -g npm@1.4.28 && npm install -g npm@2 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' script: - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' sudo: false env: - TEST=true matrix: fast_finish: true include: - node_js: "node" env: PRETEST=true allow_failures: - os: osx - env: TEST=true ALLOW_FAILURE=true babel-preset-airbnb-2.4.0/CHANGELOG.md000066400000000000000000000004321312500716100171210ustar00rootroot00000000000000# Change Log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). ## [2.3.3] - 2017-06-20 * Switches from `babel-preset-es2015` to `babel-preset-env`. Allows targeting of specific environments. babel-preset-airbnb-2.4.0/README.md000066400000000000000000000043431312500716100165740ustar00rootroot00000000000000# babel-preset-airbnb > A babel preset for transforming your JavaScript for Airbnb. Currently contains transforms for all standard syntax that is [stage 4](https://tc39.github.io/ecma262/) (ES2017) or [stage 3](https://github.com/tc39/proposals#active-proposals), except for the following: - generators: `regenerator-runtime` is too heavyweight for our use. - `async/await`: `regenerator-runtime` is too heavyweight for our use, and [async-to-promises](https://www.npmjs.com/package/babel-plugin-async-to-promises) is not yet complete enough to be safely used. - `SIMD`: this is a performance feature, so is pretty pointless to polyfill/transpile. - lifted template literal restrictions: we do not use tagged template literals, nor implement custom DSLs, otherwise we would enable this. We have also enabled object rest/spread, although it is only at stage 2. It will hopefully achieve stage 3 soon. ## Install ```sh $ npm install --save-dev babel-preset-airbnb ``` ## Usage ### Via `.babelrc` (Recommended) **.babelrc** ```json { "presets": ["airbnb"] } ``` ### Via CLI ```sh $ babel script.js --presets airbnb ``` ### Via Node API ```javascript require("babel-core").transform("code", { presets: ["airbnb"] }); ``` ### Targeting 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. For a list of browsers please see [browserlist](https://github.com/ai/browserslist). You may override our default list of targets by providing your own `targets` key. ```json { "presets": [["airbnb", { "targets": { "chrome": 50, "explorer": 11, "firefox": 45 } }]] } ``` The following transpiles only for Node v6. ```json { "presets": [["airbnb", { "targets": { "node": 6 } }]] } ``` If you wish, you can also inherit our default list of browsers and extend them using `additionalTargets`. ```json { "presets": [["airbnb", { "additionalTargets": { "chrome": 42, "explorer": 8 } }]] } ``` You may override our default debug option by providing your own `debug` key. ```json { "presets": [["airbnb", { "debug": true }]] } ``` babel-preset-airbnb-2.4.0/index.js000066400000000000000000000027001312500716100167550ustar00rootroot00000000000000'use strict'; var assign = require('object.assign'); var modules = [require('babel-plugin-transform-es2015-modules-commonjs'), { strict: false }]; var defaultTargets = { android: 30, chrome: 35, edge: 14, explorer: 9, firefox: 52, safari: 8, ucandroid: 1 }; function buildTargets(options) { return assign({}, defaultTargets, options.additionalTargets); } module.exports = function buildAirbnbPreset(context, options) { var transpileTargets = (options && options.targets) || buildTargets(options || {}); var debug = (options && typeof options.debug === 'boolean') ? !!options.debug : false; return { presets: [ require('babel-preset-env').default(null, { debug: debug, exclude: [ 'transform-async-to-generator', 'transform-es2015-template-literals', 'transform-regenerator' ], modules: false, targets: transpileTargets }), require('babel-preset-react') ], plugins: [ options && options.modules === false ? null : modules, [require('babel-plugin-transform-es2015-template-literals'), { spec: true }], 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) }; }; babel-preset-airbnb-2.4.0/package.json000066400000000000000000000024521312500716100176020ustar00rootroot00000000000000{ "name": "babel-preset-airbnb", "version": "2.4.0", "description": "A babel preset for transforming your JavaScript for Airbnb", "main": "index.js", "author": "Josh Perez ", "repository": { "type": "git", "url": "git@github.com:airbnb/babel-preset-airbnb.git" }, "keywords": [ "babel", "es6", "es2015", "javascript" ], "license": "Apache-2.0", "dependencies": { "babel-plugin-syntax-trailing-function-commas": "^6.22.0", "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", "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-exponentiation-operator": "^6.24.1", "babel-plugin-transform-jscript": "^6.22.0", "babel-plugin-transform-object-rest-spread": "^6.23.0", "babel-preset-env": "^1.5.2", "babel-preset-react": "^6.24.1", "object.assign": "^4.0.4" }, "devDependencies": { "eslint": "^3.19.0", "eslint-config-airbnb-base": "^11.2.0", "eslint-plugin-import": "^2.3.0" }, "scripts": { "pretest": "npm run lint", "test": "npm run tests-only", "tests-only": "echo 'no tests';", "lint": "eslint ." } }