diff --git a/.gitignore b/.gitignore
index 3c3629e647..9601cebf50 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
node_modules
+*.DS_Store
diff --git a/README.md b/README.md
index 75aff34270..7faf41e229 100644
--- a/README.md
+++ b/README.md
@@ -1,2228 +1,30 @@
-# Airbnb JavaScript Style Guide() {
+# lint-trap
-*A mostly reasonable approach to JavaScript*
+This package provides Virtru's .eslintrc as an extensible shared config.
-[](https://www.npmjs.com/package/eslint-config-airbnb)
-[](https://gitter.im/airbnb/javascript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
+## Usage
-[For the ES5-only guide click here](es5/).
+1. `npm install --save-dev virtru/lint-trap`
+2. add `"extends": "lint-trap"` to your .eslintrc
-## Table of Contents
+See the [ESlint config docs](http://eslint.org/docs/user-guide/configuring#extending-configuration-files)
+for more information.
- 1. [Types](#types)
- 1. [References](#references)
- 1. [Objects](#objects)
- 1. [Arrays](#arrays)
- 1. [Destructuring](#destructuring)
- 1. [Strings](#strings)
- 1. [Functions](#functions)
- 1. [Arrow Functions](#arrow-functions)
- 1. [Constructors](#constructors)
- 1. [Modules](#modules)
- 1. [Iterators and Generators](#iterators-and-generators)
- 1. [Properties](#properties)
- 1. [Variables](#variables)
- 1. [Hoisting](#hoisting)
- 1. [Comparison Operators & Equality](#comparison-operators--equality)
- 1. [Blocks](#blocks)
- 1. [Comments](#comments)
- 1. [Whitespace](#whitespace)
- 1. [Commas](#commas)
- 1. [Semicolons](#semicolons)
- 1. [Type Casting & Coercion](#type-casting--coercion)
- 1. [Naming Conventions](#naming-conventions)
- 1. [Accessors](#accessors)
- 1. [Events](#events)
- 1. [jQuery](#jquery)
- 1. [ECMAScript 5 Compatibility](#ecmascript-5-compatibility)
- 1. [ECMAScript 6 Styles](#ecmascript-6-styles)
- 1. [Testing](#testing)
- 1. [Performance](#performance)
- 1. [Resources](#resources)
- 1. [In the Wild](#in-the-wild)
- 1. [Translation](#translation)
- 1. [The JavaScript Style Guide Guide](#the-javascript-style-guide-guide)
- 1. [Chat With Us About Javascript](#chat-with-us-about-javascript)
- 1. [Contributors](#contributors)
- 1. [License](#license)
+A basic .eslintrc file will look like this:
+```json
+{
+ "extends": "lint-trap"
+}
+```
-## Types
+You may need to add repo specific environments and globals, but this is all you need for a brand new repo.
- - [1.1](#1.1) **Primitives**: When you access a primitive type you work directly on its value.
+### Environment Variables
- + `string`
- + `number`
- + `boolean`
- + `null`
- + `undefined`
+There are two environment variables that you can set to determine what rules are ran.
- ```javascript
- const foo = 1;
- let bar = foo;
+##### REPO_ENVIRONMENT
+Either `'dev'` or `'ci'`. The default is `'dev'`. CI rules are for things we don't want to be allowed into a repo, but allow for convenience during development.
- bar = 9;
-
- console.log(foo, bar); // => 1, 9
- ```
- - [1.2](#1.2) **Complex**: When you access a complex type you work on a reference to its value.
-
- + `object`
- + `array`
- + `function`
-
- ```javascript
- const foo = [1, 2];
- const bar = foo;
-
- bar[0] = 9;
-
- console.log(foo[0], bar[0]); // => 9, 9
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-## References
-
- - [2.1](#2.1) Use `const` for all of your references; avoid using `var`.
-
- > Why? This ensures that you can't reassign your references (mutation), which can lead to bugs and difficult to comprehend code.
-
- ```javascript
- // bad
- var a = 1;
- var b = 2;
-
- // good
- const a = 1;
- const b = 2;
- ```
-
- - [2.2](#2.2) If you must mutate references, use `let` instead of `var`.
-
- > Why? `let` is block-scoped rather than function-scoped like `var`.
-
- ```javascript
- // bad
- var count = 1;
- if (true) {
- count += 1;
- }
-
- // good, use the let.
- let count = 1;
- if (true) {
- count += 1;
- }
- ```
-
- - [2.3](#2.3) Note that both `let` and `const` are block-scoped.
-
- ```javascript
- // const and let only exist in the blocks they are defined in.
- {
- let a = 1;
- const b = 1;
- }
- console.log(a); // ReferenceError
- console.log(b); // ReferenceError
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-## Objects
-
- - [3.1](#3.1) Use the literal syntax for object creation.
-
- ```javascript
- // bad
- const item = new Object();
-
- // good
- const item = {};
- ```
-
- - [3.2](#3.2) If your code will be executed in browsers in script context, don't use [reserved words](http://es5.github.io/#x7.6.1) as keys. It won't work in IE8. [More info](https://github.com/airbnb/javascript/issues/61). It’s OK to use them in ES6 modules and server-side code.
-
- ```javascript
- // bad
- const superman = {
- default: { clark: 'kent' },
- private: true,
- };
-
- // good
- const superman = {
- defaults: { clark: 'kent' },
- hidden: true,
- };
- ```
-
- - [3.3](#3.3) Use readable synonyms in place of reserved words.
-
- ```javascript
- // bad
- const superman = {
- class: 'alien',
- };
-
- // bad
- const superman = {
- klass: 'alien',
- };
-
- // good
- const superman = {
- type: 'alien',
- };
- ```
-
-
- - [3.4](#3.4) Use computed property names when creating objects with dynamic property names.
-
- > Why? They allow you to define all the properties of an object in one place.
-
- ```javascript
-
- function getKey(k) {
- return `a key named ${k}`;
- }
-
- // bad
- const obj = {
- id: 5,
- name: 'San Francisco',
- };
- obj[getKey('enabled')] = true;
-
- // good
- const obj = {
- id: 5,
- name: 'San Francisco',
- [getKey('enabled')]: true,
- };
- ```
-
-
- - [3.5](#3.5) Use object method shorthand.
-
- ```javascript
- // bad
- const atom = {
- value: 1,
-
- addValue: function (value) {
- return atom.value + value;
- },
- };
-
- // good
- const atom = {
- value: 1,
-
- addValue(value) {
- return atom.value + value;
- },
- };
- ```
-
-
- - [3.6](#3.6) Use property value shorthand.
-
- > Why? It is shorter to write and descriptive.
-
- ```javascript
- const lukeSkywalker = 'Luke Skywalker';
-
- // bad
- const obj = {
- lukeSkywalker: lukeSkywalker,
- };
-
- // good
- const obj = {
- lukeSkywalker,
- };
- ```
-
- - [3.7](#3.7) Group your shorthand properties at the beginning of your object declaration.
-
- > Why? It's easier to tell which properties are using the shorthand.
-
- ```javascript
- const anakinSkywalker = 'Anakin Skywalker';
- const lukeSkywalker = 'Luke Skywalker';
-
- // bad
- const obj = {
- episodeOne: 1,
- twoJediWalkIntoACantina: 2,
- lukeSkywalker,
- episodeThree: 3,
- mayTheFourth: 4,
- anakinSkywalker,
- };
-
- // good
- const obj = {
- lukeSkywalker,
- anakinSkywalker,
- episodeOne: 1,
- twoJediWalkIntoACantina: 2,
- episodeThree: 3,
- mayTheFourth: 4,
- };
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-## Arrays
-
- - [4.1](#4.1) Use the literal syntax for array creation.
-
- ```javascript
- // bad
- const items = new Array();
-
- // good
- const items = [];
- ```
-
- - [4.2](#4.2) Use Array#push instead of direct assignment to add items to an array.
-
- ```javascript
- const someStack = [];
-
- // bad
- someStack[someStack.length] = 'abracadabra';
-
- // good
- someStack.push('abracadabra');
- ```
-
-
- - [4.3](#4.3) Use array spreads `...` to copy arrays.
-
- ```javascript
- // bad
- const len = items.length;
- const itemsCopy = [];
- let i;
-
- for (i = 0; i < len; i++) {
- itemsCopy[i] = items[i];
- }
-
- // good
- const itemsCopy = [...items];
- ```
- - [4.4](#4.4) To convert an array-like object to an array, use Array#from.
-
- ```javascript
- const foo = document.querySelectorAll('.foo');
- const nodes = Array.from(foo);
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-## Destructuring
-
- - [5.1](#5.1) Use object destructuring when accessing and using multiple properties of an object.
-
- > Why? Destructuring saves you from creating temporary references for those properties.
-
- ```javascript
- // bad
- function getFullName(user) {
- const firstName = user.firstName;
- const lastName = user.lastName;
-
- return `${firstName} ${lastName}`;
- }
-
- // good
- function getFullName(obj) {
- const { firstName, lastName } = obj;
- return `${firstName} ${lastName}`;
- }
-
- // best
- function getFullName({ firstName, lastName }) {
- return `${firstName} ${lastName}`;
- }
- ```
-
- - [5.2](#5.2) Use array destructuring.
-
- ```javascript
- const arr = [1, 2, 3, 4];
-
- // bad
- const first = arr[0];
- const second = arr[1];
-
- // good
- const [first, second] = arr;
- ```
-
- - [5.3](#5.3) Use object destructuring for multiple return values, not array destructuring.
-
- > Why? You can add new properties over time or change the order of things without breaking call sites.
-
- ```javascript
- // bad
- function processInput(input) {
- // then a miracle occurs
- return [left, right, top, bottom];
- }
-
- // the caller needs to think about the order of return data
- const [left, __, top] = processInput(input);
-
- // good
- function processInput(input) {
- // then a miracle occurs
- return { left, right, top, bottom };
- }
-
- // the caller selects only the data they need
- const { left, right } = processInput(input);
- ```
-
-
-**[⬆ back to top](#table-of-contents)**
-
-## Strings
-
- - [6.1](#6.1) Use single quotes `''` for strings.
-
- ```javascript
- // bad
- const name = "Capt. Janeway";
-
- // good
- const name = 'Capt. Janeway';
- ```
-
- - [6.2](#6.2) Strings longer than 100 characters should be written across multiple lines using string concatenation.
- - [6.3](#6.3) Note: If overused, long strings with concatenation could impact performance. [jsPerf](http://jsperf.com/ya-string-concat) & [Discussion](https://github.com/airbnb/javascript/issues/40).
-
- ```javascript
- // bad
- const errorMessage = 'This is a super long error that was thrown because of Batman. When you stop to think about how Batman had anything to do with this, you would get nowhere fast.';
-
- // bad
- const errorMessage = 'This is a super long error that was thrown because \
- of Batman. When you stop to think about how Batman had anything to do \
- with this, you would get nowhere \
- fast.';
-
- // good
- const errorMessage = 'This is a super long error that was thrown because ' +
- 'of Batman. When you stop to think about how Batman had anything to do ' +
- 'with this, you would get nowhere fast.';
- ```
-
-
- - [6.4](#6.4) When programmatically building up strings, use template strings instead of concatenation.
-
- > Why? Template strings give you a readable, concise syntax with proper newlines and string interpolation features.
-
- ```javascript
- // bad
- function sayHi(name) {
- return 'How are you, ' + name + '?';
- }
-
- // bad
- function sayHi(name) {
- return ['How are you, ', name, '?'].join();
- }
-
- // good
- function sayHi(name) {
- return `How are you, ${name}?`;
- }
- ```
- - [6.5](#6.5) Never use eval() on a string, it opens too many vulnerabilities.
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Functions
-
- - [7.1](#7.1) Use function declarations instead of function expressions.
-
- > Why? Function declarations are named, so they're easier to identify in call stacks. Also, the whole body of a function declaration is hoisted, whereas only the reference of a function expression is hoisted. This rule makes it possible to always use [Arrow Functions](#arrow-functions) in place of function expressions.
-
- ```javascript
- // bad
- const foo = function () {
- };
-
- // good
- function foo() {
- }
- ```
-
- - [7.2](#7.2) Function expressions:
-
- ```javascript
- // immediately-invoked function expression (IIFE)
- (() => {
- console.log('Welcome to the Internet. Please follow me.');
- })();
- ```
-
- - [7.3](#7.3) Never declare a function in a non-function block (if, while, etc). Assign the function to a variable instead. Browsers will allow you to do it, but they all interpret it differently, which is bad news bears.
- - [7.4](#7.4) **Note:** ECMA-262 defines a `block` as a list of statements. A function declaration is not a statement. [Read ECMA-262's note on this issue](http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf#page=97).
-
- ```javascript
- // bad
- if (currentUser) {
- function test() {
- console.log('Nope.');
- }
- }
-
- // good
- let test;
- if (currentUser) {
- test = () => {
- console.log('Yup.');
- };
- }
- ```
-
- - [7.5](#7.5) Never name a parameter `arguments`. This will take precedence over the `arguments` object that is given to every function scope.
-
- ```javascript
- // bad
- function nope(name, options, arguments) {
- // ...stuff...
- }
-
- // good
- function yup(name, options, args) {
- // ...stuff...
- }
- ```
-
-
- - [7.6](#7.6) Never use `arguments`, opt to use rest syntax `...` instead.
-
- > Why? `...` is explicit about which arguments you want pulled. Plus rest arguments are a real Array and not Array-like like `arguments`.
-
- ```javascript
- // bad
- function concatenateAll() {
- const args = Array.prototype.slice.call(arguments);
- return args.join('');
- }
-
- // good
- function concatenateAll(...args) {
- return args.join('');
- }
- ```
-
-
- - [7.7](#7.7) Use default parameter syntax rather than mutating function arguments.
-
- ```javascript
- // really bad
- function handleThings(opts) {
- // No! We shouldn't mutate function arguments.
- // Double bad: if opts is falsy it'll be set to an object which may
- // be what you want but it can introduce subtle bugs.
- opts = opts || {};
- // ...
- }
-
- // still bad
- function handleThings(opts) {
- if (opts === void 0) {
- opts = {};
- }
- // ...
- }
-
- // good
- function handleThings(opts = {}) {
- // ...
- }
- ```
-
- - [7.8](#7.8) Avoid side effects with default parameters
-
- > Why? They are confusing to reason about.
-
- ```javascript
- var b = 1;
- // bad
- function count(a = b++) {
- console.log(a);
- }
- count(); // 1
- count(); // 2
- count(3); // 3
- count(); // 3
- ```
-
-- [7.9](#7.9) Never use the Function constructor to create a new function.
-
- > Why? Creating a function in this way evaluates a string similarly to eval(), which opens vulnerabilities.
-
- ```javascript
- // bad
- var add = new Function('a', 'b', 'return a + b');
-
- // still bad
- var subtract = Function('a', 'b', 'return a - b');
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-## Arrow Functions
-
- - [8.1](#8.1) When you must use function expressions (as when passing an anonymous function), use arrow function notation.
-
- > Why? It creates a version of the function that executes in the context of `this`, which is usually what you want, and is a more concise syntax.
-
- > Why not? If you have a fairly complicated function, you might move that logic out into its own function declaration.
-
- ```javascript
- // bad
- [1, 2, 3].map(function (x) {
- const y = x + 1;
- return x * y;
- });
-
- // good
- [1, 2, 3].map((x) => {
- const y = x + 1;
- return x * y;
- });
- ```
-
- - [8.2](#8.2) If the function body consists of a single expression, feel free to omit the braces and use the implicit return. Otherwise use a `return` statement.
-
- > Why? Syntactic sugar. It reads well when multiple functions are chained together.
-
- > Why not? If you plan on returning an object.
-
- ```javascript
- // good
- [1, 2, 3].map(number => `A string containing the ${number}.`);
-
- // bad
- [1, 2, 3].map(number => {
- const nextNumber = number + 1;
- `A string containing the ${nextNumber}.`;
- });
-
- // good
- [1, 2, 3].map(number => {
- const nextNumber = number + 1;
- return `A string containing the ${nextNumber}.`;
- });
- ```
-
- - [8.3](#8.3) In case the expression spans over multiple lines, wrap it in parentheses for better readability.
-
- > Why? It shows clearly where the function starts and ends.
-
- ```js
- // bad
- [1, 2, 3].map(number => 'As time went by, the string containing the ' +
- `${number} became much longer. So we needed to break it over multiple ` +
- 'lines.'
- );
-
- // good
- [1, 2, 3].map(number => (
- `As time went by, the string containing the ${number} became much ` +
- 'longer. So we needed to break it over multiple lines.'
- ));
- ```
-
-
- - [8.4](#8.4) If your function only takes a single argument, feel free to omit the parentheses.
-
- > Why? Less visual clutter.
-
- ```js
- // good
- [1, 2, 3].map(x => x * x);
-
- // good
- [1, 2, 3].reduce((y, x) => x + y);
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Constructors
-
- - [9.1](#9.1) Always use `class`. Avoid manipulating `prototype` directly.
-
- > Why? `class` syntax is more concise and easier to reason about.
-
- ```javascript
- // bad
- function Queue(contents = []) {
- this._queue = [...contents];
- }
- Queue.prototype.pop = function() {
- const value = this._queue[0];
- this._queue.splice(0, 1);
- return value;
- }
-
-
- // good
- class Queue {
- constructor(contents = []) {
- this._queue = [...contents];
- }
- pop() {
- const value = this._queue[0];
- this._queue.splice(0, 1);
- return value;
- }
- }
- ```
-
- - [9.2](#9.2) Use `extends` for inheritance.
-
- > Why? It is a built-in way to inherit prototype functionality without breaking `instanceof`.
-
- ```javascript
- // bad
- const inherits = require('inherits');
- function PeekableQueue(contents) {
- Queue.apply(this, contents);
- }
- inherits(PeekableQueue, Queue);
- PeekableQueue.prototype.peek = function() {
- return this._queue[0];
- }
-
- // good
- class PeekableQueue extends Queue {
- peek() {
- return this._queue[0];
- }
- }
- ```
-
- - [9.3](#9.3) Methods can return `this` to help with method chaining.
-
- ```javascript
- // bad
- Jedi.prototype.jump = function() {
- this.jumping = true;
- return true;
- };
-
- Jedi.prototype.setHeight = function(height) {
- this.height = height;
- };
-
- const luke = new Jedi();
- luke.jump(); // => true
- luke.setHeight(20); // => undefined
-
- // good
- class Jedi {
- jump() {
- this.jumping = true;
- return this;
- }
-
- setHeight(height) {
- this.height = height;
- return this;
- }
- }
-
- const luke = new Jedi();
-
- luke.jump()
- .setHeight(20);
- ```
-
-
- - [9.4](#9.4) It's okay to write a custom toString() method, just make sure it works successfully and causes no side effects.
-
- ```javascript
- class Jedi {
- constructor(options = {}) {
- this.name = options.name || 'no name';
- }
-
- getName() {
- return this.name;
- }
-
- toString() {
- return `Jedi - ${this.getName()}`;
- }
- }
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Modules
-
- - [10.1](#10.1) Always use modules (`import`/`export`) over a non-standard module system. You can always transpile to your preferred module system.
-
- > Why? Modules are the future, let's start using the future now.
-
- ```javascript
- // bad
- const AirbnbStyleGuide = require('./AirbnbStyleGuide');
- module.exports = AirbnbStyleGuide.es6;
-
- // ok
- import AirbnbStyleGuide from './AirbnbStyleGuide';
- export default AirbnbStyleGuide.es6;
-
- // best
- import { es6 } from './AirbnbStyleGuide';
- export default es6;
- ```
-
- - [10.2](#10.2) Do not use wildcard imports.
-
- > Why? This makes sure you have a single default export.
-
- ```javascript
- // bad
- import * as AirbnbStyleGuide from './AirbnbStyleGuide';
-
- // good
- import AirbnbStyleGuide from './AirbnbStyleGuide';
- ```
-
- - [10.3](#10.3) And do not export directly from an import.
-
- > Why? Although the one-liner is concise, having one clear way to import and one clear way to export makes things consistent.
-
- ```javascript
- // bad
- // filename es6.js
- export { es6 as default } from './airbnbStyleGuide';
-
- // good
- // filename es6.js
- import { es6 } from './AirbnbStyleGuide';
- export default es6;
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-## Iterators and Generators
-
- - [11.1](#11.1) Don't use iterators. Prefer JavaScript's higher-order functions like `map()` and `reduce()` instead of loops like `for-of`.
-
- > Why? This enforces our immutable rule. Dealing with pure functions that return values is easier to reason about than side-effects.
-
- ```javascript
- const numbers = [1, 2, 3, 4, 5];
-
- // bad
- let sum = 0;
- for (let num of numbers) {
- sum += num;
- }
-
- sum === 15;
-
- // good
- let sum = 0;
- numbers.forEach((num) => sum += num);
- sum === 15;
-
- // best (use the functional force)
- const sum = numbers.reduce((total, num) => total + num, 0);
- sum === 15;
- ```
-
- - [11.2](#11.2) Don't use generators for now.
-
- > Why? They don't transpile well to ES5.
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Properties
-
- - [12.1](#12.1) Use dot notation when accessing properties.
-
- ```javascript
- const luke = {
- jedi: true,
- age: 28,
- };
-
- // bad
- const isJedi = luke['jedi'];
-
- // good
- const isJedi = luke.jedi;
- ```
-
- - [12.2](#12.2) Use subscript notation `[]` when accessing properties with a variable.
-
- ```javascript
- const luke = {
- jedi: true,
- age: 28,
- };
-
- function getProp(prop) {
- return luke[prop];
- }
-
- const isJedi = getProp('jedi');
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Variables
-
- - [13.1](#13.1) Always use `const` to declare variables. Not doing so will result in global variables. We want to avoid polluting the global namespace. Captain Planet warned us of that.
-
- ```javascript
- // bad
- superPower = new SuperPower();
-
- // good
- const superPower = new SuperPower();
- ```
-
- - [13.2](#13.2) Use one `const` declaration per variable.
-
- > Why? It's easier to add new variable declarations this way, and you never have to worry about swapping out a `;` for a `,` or introducing punctuation-only diffs.
-
- ```javascript
- // bad
- const items = getItems(),
- goSportsTeam = true,
- dragonball = 'z';
-
- // bad
- // (compare to above, and try to spot the mistake)
- const items = getItems(),
- goSportsTeam = true;
- dragonball = 'z';
-
- // good
- const items = getItems();
- const goSportsTeam = true;
- const dragonball = 'z';
- ```
-
- - [13.3](#13.3) Group all your `const`s and then group all your `let`s.
-
- > Why? This is helpful when later on you might need to assign a variable depending on one of the previous assigned variables.
-
- ```javascript
- // bad
- let i, len, dragonball,
- items = getItems(),
- goSportsTeam = true;
-
- // bad
- let i;
- const items = getItems();
- let dragonball;
- const goSportsTeam = true;
- let len;
-
- // good
- const goSportsTeam = true;
- const items = getItems();
- let dragonball;
- let i;
- let length;
- ```
-
- - [13.4](#13.4) Assign variables where you need them, but place them in a reasonable place.
-
- > Why? `let` and `const` are block scoped and not function scoped.
-
- ```javascript
- // good
- function() {
- test();
- console.log('doing stuff..');
-
- //..other stuff..
-
- const name = getName();
-
- if (name === 'test') {
- return false;
- }
-
- return name;
- }
-
- // bad - unnecessary function call
- function(hasName) {
- const name = getName();
-
- if (!hasName) {
- return false;
- }
-
- this.setFirstName(name);
-
- return true;
- }
-
- // good
- function(hasName) {
- if (!hasName) {
- return false;
- }
-
- const name = getName();
- this.setFirstName(name);
-
- return true;
- }
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Hoisting
-
- - [14.1](#14.1) `var` declarations get hoisted to the top of their scope, their assignment does not. `const` and `let` declarations are blessed with a new concept called [Temporal Dead Zones (TDZ)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let#Temporal_dead_zone_and_errors_with_let). It's important to know why [typeof is no longer safe](http://es-discourse.com/t/why-typeof-is-no-longer-safe/15).
-
- ```javascript
- // we know this wouldn't work (assuming there
- // is no notDefined global variable)
- function example() {
- console.log(notDefined); // => throws a ReferenceError
- }
-
- // creating a variable declaration after you
- // reference the variable will work due to
- // variable hoisting. Note: the assignment
- // value of `true` is not hoisted.
- function example() {
- console.log(declaredButNotAssigned); // => undefined
- var declaredButNotAssigned = true;
- }
-
- // The interpreter is hoisting the variable
- // declaration to the top of the scope,
- // which means our example could be rewritten as:
- function example() {
- let declaredButNotAssigned;
- console.log(declaredButNotAssigned); // => undefined
- declaredButNotAssigned = true;
- }
-
- // using const and let
- function example() {
- console.log(declaredButNotAssigned); // => throws a ReferenceError
- console.log(typeof declaredButNotAssigned); // => throws a ReferenceError
- const declaredButNotAssigned = true;
- }
- ```
-
- - [14.2](#14.2) Anonymous function expressions hoist their variable name, but not the function assignment.
-
- ```javascript
- function example() {
- console.log(anonymous); // => undefined
-
- anonymous(); // => TypeError anonymous is not a function
-
- var anonymous = function() {
- console.log('anonymous function expression');
- };
- }
- ```
-
- - [14.3](#14.3) Named function expressions hoist the variable name, not the function name or the function body.
-
- ```javascript
- function example() {
- console.log(named); // => undefined
-
- named(); // => TypeError named is not a function
-
- superPower(); // => ReferenceError superPower is not defined
-
- var named = function superPower() {
- console.log('Flying');
- };
- }
-
- // the same is true when the function name
- // is the same as the variable name.
- function example() {
- console.log(named); // => undefined
-
- named(); // => TypeError named is not a function
-
- var named = function named() {
- console.log('named');
- }
- }
- ```
-
- - [14.4](#14.4) Function declarations hoist their name and the function body.
-
- ```javascript
- function example() {
- superPower(); // => Flying
-
- function superPower() {
- console.log('Flying');
- }
- }
- ```
-
- - For more information refer to [JavaScript Scoping & Hoisting](http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting) by [Ben Cherry](http://www.adequatelygood.com/).
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Comparison Operators & Equality
-
- - [15.1](#15.1) Use `===` and `!==` over `==` and `!=`.
- - [15.2](#15.2) Conditional statements such as the `if` statement evaluate their expression using coercion with the `ToBoolean` abstract method and always follow these simple rules:
-
- + **Objects** evaluate to **true**
- + **Undefined** evaluates to **false**
- + **Null** evaluates to **false**
- + **Booleans** evaluate to **the value of the boolean**
- + **Numbers** evaluate to **false** if **+0, -0, or NaN**, otherwise **true**
- + **Strings** evaluate to **false** if an empty string `''`, otherwise **true**
-
- ```javascript
- if ([0]) {
- // true
- // An array is an object, objects evaluate to true
- }
- ```
-
- - [15.3](#15.3) Use shortcuts.
-
- ```javascript
- // bad
- if (name !== '') {
- // ...stuff...
- }
-
- // good
- if (name) {
- // ...stuff...
- }
-
- // bad
- if (collection.length > 0) {
- // ...stuff...
- }
-
- // good
- if (collection.length) {
- // ...stuff...
- }
- ```
-
- - [15.4](#15.4) For more information see [Truth Equality and JavaScript](http://javascriptweblog.wordpress.com/2011/02/07/truth-equality-and-javascript/#more-2108) by Angus Croll.
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Blocks
-
- - [16.1](#16.1) Use braces with all multi-line blocks.
-
- ```javascript
- // bad
- if (test)
- return false;
-
- // good
- if (test) return false;
-
- // good
- if (test) {
- return false;
- }
-
- // bad
- function() { return false; }
-
- // good
- function() {
- return false;
- }
- ```
-
- - [16.2](#16.2) If you're using multi-line blocks with `if` and `else`, put `else` on the same line as your
- `if` block's closing brace.
-
- ```javascript
- // bad
- if (test) {
- thing1();
- thing2();
- }
- else {
- thing3();
- }
-
- // good
- if (test) {
- thing1();
- thing2();
- } else {
- thing3();
- }
- ```
-
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Comments
-
- - [17.1](#17.1) Use `/** ... */` for multi-line comments. Include a description, specify types and values for all parameters and return values.
-
- ```javascript
- // bad
- // make() returns a new element
- // based on the passed in tag name
- //
- // @param {String} tag
- // @return {Element} element
- function make(tag) {
-
- // ...stuff...
-
- return element;
- }
-
- // good
- /**
- * make() returns a new element
- * based on the passed in tag name
- *
- * @param {String} tag
- * @return {Element} element
- */
- function make(tag) {
-
- // ...stuff...
-
- return element;
- }
- ```
-
- - [17.2](#17.2) Use `//` for single line comments. Place single line comments on a newline above the subject of the comment. Put an empty line before the comment.
-
- ```javascript
- // bad
- const active = true; // is current tab
-
- // good
- // is current tab
- const active = true;
-
- // bad
- function getType() {
- console.log('fetching type...');
- // set the default type to 'no type'
- const type = this._type || 'no type';
-
- return type;
- }
-
- // good
- function getType() {
- console.log('fetching type...');
-
- // set the default type to 'no type'
- const type = this._type || 'no type';
-
- return type;
- }
- ```
-
- - [17.3](#17.3) Prefixing your comments with `FIXME` or `TODO` helps other developers quickly understand if you're pointing out a problem that needs to be revisited, or if you're suggesting a solution to the problem that needs to be implemented. These are different than regular comments because they are actionable. The actions are `FIXME -- need to figure this out` or `TODO -- need to implement`.
-
- - [17.4](#17.4) Use `// FIXME:` to annotate problems.
-
- ```javascript
- class Calculator extends Abacus {
- constructor() {
- super();
-
- // FIXME: shouldn't use a global here
- total = 0;
- }
- }
- ```
-
- - [17.5](#17.5) Use `// TODO:` to annotate solutions to problems.
-
- ```javascript
- class Calculator extends Abacus {
- constructor() {
- super();
-
- // TODO: total should be configurable by an options param
- this.total = 0;
- }
- }
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Whitespace
-
- - [18.1](#18.1) Use soft tabs set to 2 spaces.
-
- ```javascript
- // bad
- function() {
- ∙∙∙∙const name;
- }
-
- // bad
- function() {
- ∙const name;
- }
-
- // good
- function() {
- ∙∙const name;
- }
- ```
-
- - [18.2](#18.2) Place 1 space before the leading brace.
-
- ```javascript
- // bad
- function test(){
- console.log('test');
- }
-
- // good
- function test() {
- console.log('test');
- }
-
- // bad
- dog.set('attr',{
- age: '1 year',
- breed: 'Bernese Mountain Dog',
- });
-
- // good
- dog.set('attr', {
- age: '1 year',
- breed: 'Bernese Mountain Dog',
- });
- ```
-
- - [18.3](#18.3) Place 1 space before the opening parenthesis in control statements (`if`, `while` etc.). Place no space before the argument list in function calls and declarations.
-
- ```javascript
- // bad
- if(isJedi) {
- fight ();
- }
-
- // good
- if (isJedi) {
- fight();
- }
-
- // bad
- function fight () {
- console.log ('Swooosh!');
- }
-
- // good
- function fight() {
- console.log('Swooosh!');
- }
- ```
-
- - [18.4](#18.4) Set off operators with spaces.
-
- ```javascript
- // bad
- const x=y+5;
-
- // good
- const x = y + 5;
- ```
-
- - [18.5](#18.5) End files with a single newline character.
-
- ```javascript
- // bad
- (function(global) {
- // ...stuff...
- })(this);
- ```
-
- ```javascript
- // bad
- (function(global) {
- // ...stuff...
- })(this);↵
- ↵
- ```
-
- ```javascript
- // good
- (function(global) {
- // ...stuff...
- })(this);↵
- ```
-
- - [18.5](#18.5) Use indentation when making long method chains. Use a leading dot, which
- emphasizes that the line is a method call, not a new statement.
-
- ```javascript
- // bad
- $('#items').find('.selected').highlight().end().find('.open').updateCount();
-
- // bad
- $('#items').
- find('.selected').
- highlight().
- end().
- find('.open').
- updateCount();
-
- // good
- $('#items')
- .find('.selected')
- .highlight()
- .end()
- .find('.open')
- .updateCount();
-
- // bad
- const leds = stage.selectAll('.led').data(data).enter().append('svg:svg').class('led', true)
- .attr('width', (radius + margin) * 2).append('svg:g')
- .attr('transform', 'translate(' + (radius + margin) + ',' + (radius + margin) + ')')
- .call(tron.led);
-
- // good
- const leds = stage.selectAll('.led')
- .data(data)
- .enter().append('svg:svg')
- .classed('led', true)
- .attr('width', (radius + margin) * 2)
- .append('svg:g')
- .attr('transform', 'translate(' + (radius + margin) + ',' + (radius + margin) + ')')
- .call(tron.led);
- ```
-
- - [18.6](#18.6) Leave a blank line after blocks and before the next statement.
-
- ```javascript
- // bad
- if (foo) {
- return bar;
- }
- return baz;
-
- // good
- if (foo) {
- return bar;
- }
-
- return baz;
-
- // bad
- const obj = {
- foo() {
- },
- bar() {
- },
- };
- return obj;
-
- // good
- const obj = {
- foo() {
- },
-
- bar() {
- },
- };
-
- return obj;
-
- // bad
- const arr = [
- function foo() {
- },
- function bar() {
- },
- ];
- return arr;
-
- // good
- const arr = [
- function foo() {
- },
-
- function bar() {
- },
- ];
-
- return arr;
- ```
-
-
-**[⬆ back to top](#table-of-contents)**
-
-## Commas
-
- - [19.1](#19.1) Leading commas: **Nope.**
-
- ```javascript
- // bad
- const story = [
- once
- , upon
- , aTime
- ];
-
- // good
- const story = [
- once,
- upon,
- aTime,
- ];
-
- // bad
- const hero = {
- firstName: 'Ada'
- , lastName: 'Lovelace'
- , birthYear: 1815
- , superPower: 'computers'
- };
-
- // good
- const hero = {
- firstName: 'Ada',
- lastName: 'Lovelace',
- birthYear: 1815,
- superPower: 'computers',
- };
- ```
-
- - [19.2](#19.2) Additional trailing comma: **Yup.**
-
- > Why? This leads to cleaner git diffs. Also, transpilers like Babel will remove the additional trailing comma in the transpiled code which means you don't have to worry about the [trailing comma problem](es5/README.md#commas) in legacy browsers.
-
- ```javascript
- // bad - git diff without trailing comma
- const hero = {
- firstName: 'Florence',
- - lastName: 'Nightingale'
- + lastName: 'Nightingale',
- + inventorOf: ['coxcomb graph', 'modern nursing']
- }
-
- // good - git diff with trailing comma
- const hero = {
- firstName: 'Florence',
- lastName: 'Nightingale',
- + inventorOf: ['coxcomb chart', 'modern nursing'],
- }
-
- // bad
- const hero = {
- firstName: 'Dana',
- lastName: 'Scully'
- };
-
- const heroes = [
- 'Batman',
- 'Superman'
- ];
-
- // good
- const hero = {
- firstName: 'Dana',
- lastName: 'Scully',
- };
-
- const heroes = [
- 'Batman',
- 'Superman',
- ];
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Semicolons
-
- - [20.1](#20.1) **Yup.**
-
- ```javascript
- // bad
- (function() {
- const name = 'Skywalker'
- return name
- })()
-
- // good
- (() => {
- const name = 'Skywalker';
- return name;
- })();
-
- // good (guards against the function becoming an argument when two files with IIFEs are concatenated)
- ;(() => {
- const name = 'Skywalker';
- return name;
- })();
- ```
-
- [Read more](http://stackoverflow.com/a/7365214/1712802).
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Type Casting & Coercion
-
- - [21.1](#21.1) Perform type coercion at the beginning of the statement.
- - [21.2](#21.2) Strings:
-
- ```javascript
- // => this.reviewScore = 9;
-
- // bad
- const totalScore = this.reviewScore + '';
-
- // good
- const totalScore = String(this.reviewScore);
- ```
-
- - [21.3](#21.3) Use `parseInt` for Numbers and always with a radix for type casting.
-
- ```javascript
- const inputValue = '4';
-
- // bad
- const val = new Number(inputValue);
-
- // bad
- const val = +inputValue;
-
- // bad
- const val = inputValue >> 0;
-
- // bad
- const val = parseInt(inputValue);
-
- // good
- const val = Number(inputValue);
-
- // good
- const val = parseInt(inputValue, 10);
- ```
-
- - [21.4](#21.4) If for whatever reason you are doing something wild and `parseInt` is your bottleneck and need to use Bitshift for [performance reasons](http://jsperf.com/coercion-vs-casting/3), leave a comment explaining why and what you're doing.
-
- ```javascript
- // good
- /**
- * parseInt was the reason my code was slow.
- * Bitshifting the String to coerce it to a
- * Number made it a lot faster.
- */
- const val = inputValue >> 0;
- ```
-
- - [21.5](#21.5) **Note:** Be careful when using bitshift operations. Numbers are represented as [64-bit values](http://es5.github.io/#x4.3.19), but Bitshift operations always return a 32-bit integer ([source](http://es5.github.io/#x11.7)). Bitshift can lead to unexpected behavior for integer values larger than 32 bits. [Discussion](https://github.com/airbnb/javascript/issues/109). Largest signed 32-bit Int is 2,147,483,647:
-
- ```javascript
- 2147483647 >> 0 //=> 2147483647
- 2147483648 >> 0 //=> -2147483648
- 2147483649 >> 0 //=> -2147483647
- ```
-
- - [21.6](#21.6) Booleans:
-
- ```javascript
- const age = 0;
-
- // bad
- const hasAge = new Boolean(age);
-
- // good
- const hasAge = Boolean(age);
-
- // good
- const hasAge = !!age;
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Naming Conventions
-
- - [22.1](#22.1) Avoid single letter names. Be descriptive with your naming.
-
- ```javascript
- // bad
- function q() {
- // ...stuff...
- }
-
- // good
- function query() {
- // ..stuff..
- }
- ```
-
- - [22.2](#22.2) Use camelCase when naming objects, functions, and instances.
-
- ```javascript
- // bad
- const OBJEcttsssss = {};
- const this_is_my_object = {};
- function c() {}
-
- // good
- const thisIsMyObject = {};
- function thisIsMyFunction() {}
- ```
-
- - [22.3](#22.3) Use PascalCase when naming constructors or classes.
-
- ```javascript
- // bad
- function user(options) {
- this.name = options.name;
- }
-
- const bad = new user({
- name: 'nope',
- });
-
- // good
- class User {
- constructor(options) {
- this.name = options.name;
- }
- }
-
- const good = new User({
- name: 'yup',
- });
- ```
-
- - [22.4](#22.4) Use a leading underscore `_` when naming private properties.
-
- ```javascript
- // bad
- this.__firstName__ = 'Panda';
- this.firstName_ = 'Panda';
-
- // good
- this._firstName = 'Panda';
- ```
-
- - [22.5](#22.5) Don't save references to `this`. Use arrow functions or Function#bind.
-
- ```javascript
- // bad
- function foo() {
- const self = this;
- return function() {
- console.log(self);
- };
- }
-
- // bad
- function foo() {
- const that = this;
- return function() {
- console.log(that);
- };
- }
-
- // good
- function foo() {
- return () => {
- console.log(this);
- };
- }
- ```
-
- - [22.6](#22.6) If your file exports a single class, your filename should be exactly the name of the class.
- ```javascript
- // file contents
- class CheckBox {
- // ...
- }
- export default CheckBox;
-
- // in some other file
- // bad
- import CheckBox from './checkBox';
-
- // bad
- import CheckBox from './check_box';
-
- // good
- import CheckBox from './CheckBox';
- ```
-
- - [22.7](#22.7) Use camelCase when you export-default a function. Your filename should be identical to your function's name.
-
- ```javascript
- function makeStyleGuide() {
- }
-
- export default makeStyleGuide;
- ```
-
- - [22.8](#22.8) Use PascalCase when you export a singleton / function library / bare object.
-
- ```javascript
- const AirbnbStyleGuide = {
- es6: {
- }
- };
-
- export default AirbnbStyleGuide;
- ```
-
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Accessors
-
- - [23.1](#23.1) Accessor functions for properties are not required.
- - [23.2](#23.2) If you do make accessor functions use getVal() and setVal('hello').
-
- ```javascript
- // bad
- dragon.age();
-
- // good
- dragon.getAge();
-
- // bad
- dragon.age(25);
-
- // good
- dragon.setAge(25);
- ```
-
- - [23.3](#23.3) If the property is a `boolean`, use `isVal()` or `hasVal()`.
-
- ```javascript
- // bad
- if (!dragon.age()) {
- return false;
- }
-
- // good
- if (!dragon.hasAge()) {
- return false;
- }
- ```
-
- - [23.4](#23.4) It's okay to create get() and set() functions, but be consistent.
-
- ```javascript
- class Jedi {
- constructor(options = {}) {
- const lightsaber = options.lightsaber || 'blue';
- this.set('lightsaber', lightsaber);
- }
-
- set(key, val) {
- this[key] = val;
- }
-
- get(key) {
- return this[key];
- }
- }
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Events
-
- - [24.1](#24.1) When attaching data payloads to events (whether DOM events or something more proprietary like Backbone events), pass a hash instead of a raw value. This allows a subsequent contributor to add more data to the event payload without finding and updating every handler for the event. For example, instead of:
-
- ```javascript
- // bad
- $(this).trigger('listingUpdated', listing.id);
-
- ...
-
- $(this).on('listingUpdated', function(e, listingId) {
- // do something with listingId
- });
- ```
-
- prefer:
-
- ```javascript
- // good
- $(this).trigger('listingUpdated', { listingId: listing.id });
-
- ...
-
- $(this).on('listingUpdated', function(e, data) {
- // do something with data.listingId
- });
- ```
-
- **[⬆ back to top](#table-of-contents)**
-
-
-## jQuery
-
- - [25.1](#25.1) Prefix jQuery object variables with a `$`.
-
- ```javascript
- // bad
- const sidebar = $('.sidebar');
-
- // good
- const $sidebar = $('.sidebar');
-
- // good
- const $sidebarBtn = $('.sidebar-btn');
- ```
-
- - [25.2](#25.2) Cache jQuery lookups.
-
- ```javascript
- // bad
- function setSidebar() {
- $('.sidebar').hide();
-
- // ...stuff...
-
- $('.sidebar').css({
- 'background-color': 'pink'
- });
- }
-
- // good
- function setSidebar() {
- const $sidebar = $('.sidebar');
- $sidebar.hide();
-
- // ...stuff...
-
- $sidebar.css({
- 'background-color': 'pink'
- });
- }
- ```
-
- - [25.3](#25.3) For DOM queries use Cascading `$('.sidebar ul')` or parent > child `$('.sidebar > ul')`. [jsPerf](http://jsperf.com/jquery-find-vs-context-sel/16)
- - [25.4](#25.4) Use `find` with scoped jQuery object queries.
-
- ```javascript
- // bad
- $('ul', '.sidebar').hide();
-
- // bad
- $('.sidebar').find('ul').hide();
-
- // good
- $('.sidebar ul').hide();
-
- // good
- $('.sidebar > ul').hide();
-
- // good
- $sidebar.find('ul').hide();
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## ECMAScript 5 Compatibility
-
- - [26.1](#26.1) Refer to [Kangax](https://twitter.com/kangax/)'s ES5 [compatibility table](http://kangax.github.com/es5-compat-table/).
-
-**[⬆ back to top](#table-of-contents)**
-
-## ECMAScript 6 Styles
-
- - [27.1](#27.1) This is a collection of links to the various es6 features.
-
-1. [Arrow Functions](#arrow-functions)
-1. [Classes](#constructors)
-1. [Object Shorthand](#es6-object-shorthand)
-1. [Object Concise](#es6-object-concise)
-1. [Object Computed Properties](#es6-computed-properties)
-1. [Template Strings](#es6-template-literals)
-1. [Destructuring](#destructuring)
-1. [Default Parameters](#es6-default-parameters)
-1. [Rest](#es6-rest)
-1. [Array Spreads](#es6-array-spreads)
-1. [Let and Const](#references)
-1. [Iterators and Generators](#iterators-and-generators)
-1. [Modules](#modules)
-
-**[⬆ back to top](#table-of-contents)**
-
-## Testing
-
- - [28.1](#28.1) **Yup.**
-
- ```javascript
- function() {
- return true;
- }
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Performance
-
- - [On Layout & Web Performance](http://kellegous.com/j/2013/01/26/layout-performance/)
- - [String vs Array Concat](http://jsperf.com/string-vs-array-concat/2)
- - [Try/Catch Cost In a Loop](http://jsperf.com/try-catch-in-loop-cost)
- - [Bang Function](http://jsperf.com/bang-function)
- - [jQuery Find vs Context, Selector](http://jsperf.com/jquery-find-vs-context-sel/13)
- - [innerHTML vs textContent for script text](http://jsperf.com/innerhtml-vs-textcontent-for-script-text)
- - [Long String Concatenation](http://jsperf.com/ya-string-concat)
- - Loading...
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Resources
-
-**Learning ES6**
-
- - [Draft ECMA 2015 (ES6) Spec](https://people.mozilla.org/~jorendorff/es6-draft.html)
- - [ExploringJS](http://exploringjs.com/)
- - [ES6 Compatibility Table](https://kangax.github.io/compat-table/es6/)
- - [Comprehensive Overview of ES6 Features](http://es6-features.org/)
-
-**Read This**
-
- - [Standard ECMA-262](http://www.ecma-international.org/ecma-262/6.0/index.html)
-
-**Tools**
-
- - Code Style Linters
- + [ESlint](http://eslint.org/) - [Airbnb Style .eslintrc](https://github.com/airbnb/javascript/blob/master/linters/.eslintrc)
- + [JSHint](http://www.jshint.com/) - [Airbnb Style .jshintrc](https://github.com/airbnb/javascript/blob/master/linters/jshintrc)
- + [JSCS](https://github.com/jscs-dev/node-jscs) - [Airbnb Style Preset](https://github.com/jscs-dev/node-jscs/blob/master/presets/airbnb.json)
-
-**Other Style Guides**
-
- - [Google JavaScript Style Guide](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml)
- - [jQuery Core Style Guidelines](http://docs.jquery.com/JQuery_Core_Style_Guidelines)
- - [Principles of Writing Consistent, Idiomatic JavaScript](https://github.com/rwldrn/idiomatic.js/)
-
-**Other Styles**
-
- - [Naming this in nested functions](https://gist.github.com/4135065) - Christian Johansen
- - [Conditional Callbacks](https://github.com/airbnb/javascript/issues/52) - Ross Allen
- - [Popular JavaScript Coding Conventions on Github](http://sideeffect.kr/popularconvention/#javascript) - JeongHoon Byun
- - [Multiple var statements in JavaScript, not superfluous](http://benalman.com/news/2012/05/multiple-var-statements-javascript/) - Ben Alman
-
-**Further Reading**
-
- - [Understanding JavaScript Closures](http://javascriptweblog.wordpress.com/2010/10/25/understanding-javascript-closures/) - Angus Croll
- - [Basic JavaScript for the impatient programmer](http://www.2ality.com/2013/06/basic-javascript.html) - Dr. Axel Rauschmayer
- - [You Might Not Need jQuery](http://youmightnotneedjquery.com/) - Zack Bloom & Adam Schwartz
- - [ES6 Features](https://github.com/lukehoban/es6features) - Luke Hoban
- - [Frontend Guidelines](https://github.com/bendc/frontend-guidelines) - Benjamin De Cock
-
-**Books**
-
- - [JavaScript: The Good Parts](http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742) - Douglas Crockford
- - [JavaScript Patterns](http://www.amazon.com/JavaScript-Patterns-Stoyan-Stefanov/dp/0596806752) - Stoyan Stefanov
- - [Pro JavaScript Design Patterns](http://www.amazon.com/JavaScript-Design-Patterns-Recipes-Problem-Solution/dp/159059908X) - Ross Harmes and Dustin Diaz
- - [High Performance Web Sites: Essential Knowledge for Front-End Engineers](http://www.amazon.com/High-Performance-Web-Sites-Essential/dp/0596529309) - Steve Souders
- - [Maintainable JavaScript](http://www.amazon.com/Maintainable-JavaScript-Nicholas-C-Zakas/dp/1449327680) - Nicholas C. Zakas
- - [JavaScript Web Applications](http://www.amazon.com/JavaScript-Web-Applications-Alex-MacCaw/dp/144930351X) - Alex MacCaw
- - [Pro JavaScript Techniques](http://www.amazon.com/Pro-JavaScript-Techniques-John-Resig/dp/1590597273) - John Resig
- - [Smashing Node.js: JavaScript Everywhere](http://www.amazon.com/Smashing-Node-js-JavaScript-Everywhere-Magazine/dp/1119962595) - Guillermo Rauch
- - [Secrets of the JavaScript Ninja](http://www.amazon.com/Secrets-JavaScript-Ninja-John-Resig/dp/193398869X) - John Resig and Bear Bibeault
- - [Human JavaScript](http://humanjavascript.com/) - Henrik Joreteg
- - [Superhero.js](http://superherojs.com/) - Kim Joar Bekkelund, Mads Mobæk, & Olav Bjorkoy
- - [JSBooks](http://jsbooks.revolunet.com/) - Julien Bouquillon
- - [Third Party JavaScript](http://manning.com/vinegar/) - Ben Vinegar and Anton Kovalyov
- - [Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript](http://amzn.com/0321812182) - David Herman
- - [Eloquent JavaScript](http://eloquentjavascript.net/) - Marijn Haverbeke
- - [You Don't Know JS: ES6 & Beyond](http://shop.oreilly.com/product/0636920033769.do) - Kyle Simpson
-
-**Blogs**
-
- - [DailyJS](http://dailyjs.com/)
- - [JavaScript Weekly](http://javascriptweekly.com/)
- - [JavaScript, JavaScript...](http://javascriptweblog.wordpress.com/)
- - [Bocoup Weblog](http://weblog.bocoup.com/)
- - [Adequately Good](http://www.adequatelygood.com/)
- - [NCZOnline](http://www.nczonline.net/)
- - [Perfection Kills](http://perfectionkills.com/)
- - [Ben Alman](http://benalman.com/)
- - [Dmitry Baranovskiy](http://dmitry.baranovskiy.com/)
- - [Dustin Diaz](http://dustindiaz.com/)
- - [nettuts](http://net.tutsplus.com/?s=javascript)
-
-**Podcasts**
-
- - [JavaScript Jabber](http://devchat.tv/js-jabber/)
-
-
-**[⬆ back to top](#table-of-contents)**
-
-## In the Wild
-
- This is a list of organizations that are using this style guide. Send us a pull request or open an issue and we'll add you to the list.
-
- - **Aan Zee**: [AanZee/javascript](https://github.com/AanZee/javascript)
- - **Adult Swim**: [adult-swim/javascript](https://github.com/adult-swim/javascript)
- - **Airbnb**: [airbnb/javascript](https://github.com/airbnb/javascript)
- - **Apartmint**: [apartmint/javascript](https://github.com/apartmint/javascript)
- - **Avalara**: [avalara/javascript](https://github.com/avalara/javascript)
- - **Billabong**: [billabong/javascript](https://github.com/billabong/javascript)
- - **Blendle**: [blendle/javascript](https://github.com/blendle/javascript)
- - **ComparaOnline**: [comparaonline/javascript](https://github.com/comparaonline/javascript)
- - **Compass Learning**: [compasslearning/javascript-style-guide](https://github.com/compasslearning/javascript-style-guide)
- - **DailyMotion**: [dailymotion/javascript](https://github.com/dailymotion/javascript)
- - **Digitpaint** [digitpaint/javascript](https://github.com/digitpaint/javascript)
- - **Evernote**: [evernote/javascript-style-guide](https://github.com/evernote/javascript-style-guide)
- - **ExactTarget**: [ExactTarget/javascript](https://github.com/ExactTarget/javascript)
- - **Expensify** [Expensify/Style-Guide](https://github.com/Expensify/Style-Guide/blob/master/javascript.md)
- - **Flexberry**: [Flexberry/javascript-style-guide](https://github.com/Flexberry/javascript-style-guide)
- - **Gawker Media**: [gawkermedia/javascript](https://github.com/gawkermedia/javascript)
- - **General Electric**: [GeneralElectric/javascript](https://github.com/GeneralElectric/javascript)
- - **GoodData**: [gooddata/gdc-js-style](https://github.com/gooddata/gdc-js-style)
- - **Grooveshark**: [grooveshark/javascript](https://github.com/grooveshark/javascript)
- - **How About We**: [howaboutwe/javascript](https://github.com/howaboutwe/javascript)
- - **Huballin**: [huballin/javascript](https://github.com/huballin/javascript)
- - **InfoJobs**: [InfoJobs/JavaScript-Style-Guide](https://github.com/InfoJobs/JavaScript-Style-Guide)
- - **Intent Media**: [intentmedia/javascript](https://github.com/intentmedia/javascript)
- - **Jam3**: [Jam3/Javascript-Code-Conventions](https://github.com/Jam3/Javascript-Code-Conventions)
- - **JSSolutions**: [JSSolutions/javascript](https://github.com/JSSolutions/javascript)
- - **Kinetica Solutions**: [kinetica/javascript](https://github.com/kinetica/javascript)
- - **Mighty Spring**: [mightyspring/javascript](https://github.com/mightyspring/javascript)
- - **MinnPost**: [MinnPost/javascript](https://github.com/MinnPost/javascript)
- - **MitocGroup**: [MitocGroup/javascript](https://github.com/MitocGroup/javascript)
- - **ModCloth**: [modcloth/javascript](https://github.com/modcloth/javascript)
- - **Money Advice Service**: [moneyadviceservice/javascript](https://github.com/moneyadviceservice/javascript)
- - **Muber**: [muber/javascript](https://github.com/muber/javascript)
- - **National Geographic**: [natgeo/javascript](https://github.com/natgeo/javascript)
- - **National Park Service**: [nationalparkservice/javascript](https://github.com/nationalparkservice/javascript)
- - **Nimbl3**: [nimbl3/javascript](https://github.com/nimbl3/javascript)
- - **Orion Health**: [orionhealth/javascript](https://github.com/orionhealth/javascript)
- - **Peerby**: [Peerby/javascript](https://github.com/Peerby/javascript)
- - **Razorfish**: [razorfish/javascript-style-guide](https://github.com/razorfish/javascript-style-guide)
- - **reddit**: [reddit/styleguide/javascript](https://github.com/reddit/styleguide/tree/master/javascript)
- - **REI**: [reidev/js-style-guide](https://github.com/reidev/js-style-guide)
- - **Ripple**: [ripple/javascript-style-guide](https://github.com/ripple/javascript-style-guide)
- - **SeekingAlpha**: [seekingalpha/javascript-style-guide](https://github.com/seekingalpha/javascript-style-guide)
- - **Shutterfly**: [shutterfly/javascript](https://github.com/shutterfly/javascript)
- - **Springload**: [springload/javascript](https://github.com/springload/javascript)
- - **StudentSphere**: [studentsphere/javascript](https://github.com/studentsphere/javascript)
- - **Target**: [target/javascript](https://github.com/target/javascript)
- - **TheLadders**: [TheLadders/javascript](https://github.com/TheLadders/javascript)
- - **T4R Technology**: [T4R-Technology/javascript](https://github.com/T4R-Technology/javascript)
- - **VoxFeed**: [VoxFeed/javascript-style-guide](https://github.com/VoxFeed/javascript-style-guide)
- - **Weggo**: [Weggo/javascript](https://github.com/Weggo/javascript)
- - **Zillow**: [zillow/javascript](https://github.com/zillow/javascript)
- - **ZocDoc**: [ZocDoc/javascript](https://github.com/ZocDoc/javascript)
-
-**[⬆ back to top](#table-of-contents)**
-
-## Translation
-
- This style guide is also available in other languages:
-
- -  **Brazilian Portuguese**: [armoucar/javascript-style-guide](https://github.com/armoucar/javascript-style-guide)
- -  **Bulgarian**: [borislavvv/javascript](https://github.com/borislavvv/javascript)
- -  **Catalan**: [fpmweb/javascript-style-guide](https://github.com/fpmweb/javascript-style-guide)
- -  **Chinese(Traditional)**: [jigsawye/javascript](https://github.com/jigsawye/javascript)
- -  **Chinese(Simplified)**: [sivan/javascript-style-guide](https://github.com/sivan/javascript-style-guide)
- -  **French**: [nmussy/javascript-style-guide](https://github.com/nmussy/javascript-style-guide)
- -  **German**: [timofurrer/javascript-style-guide](https://github.com/timofurrer/javascript-style-guide)
- -  **Italian**: [sinkswim/javascript-style-guide](https://github.com/sinkswim/javascript-style-guide)
- -  **Japanese**: [mitsuruog/javacript-style-guide](https://github.com/mitsuruog/javacript-style-guide)
- -  **Korean**: [tipjs/javascript-style-guide](https://github.com/tipjs/javascript-style-guide)
- -  **Polish**: [mjurczyk/javascript](https://github.com/mjurczyk/javascript)
- -  **Russian**: [uprock/javascript](https://github.com/uprock/javascript)
- -  **Spanish**: [paolocarrasco/javascript-style-guide](https://github.com/paolocarrasco/javascript-style-guide)
- -  **Thai**: [lvarayut/javascript-style-guide](https://github.com/lvarayut/javascript-style-guide)
-
-## The JavaScript Style Guide Guide
-
- - [Reference](https://github.com/airbnb/javascript/wiki/The-JavaScript-Style-Guide-Guide)
-
-## Chat With Us About JavaScript
-
- - Find us on [gitter](https://gitter.im/airbnb/javascript).
-
-## Contributors
-
- - [View Contributors](https://github.com/airbnb/javascript/graphs/contributors)
-
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2014 Airbnb
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**[⬆ back to top](#table-of-contents)**
-
-## Amendments
-
-We encourage you to fork this guide and change the rules to fit your team's style guide. Below, you may list some amendments to the style guide. This allows you to periodically update your style guide without having to deal with merge conflicts.
-
-# };
+##### REPO_TYPE
+Either `'frontend'` or `'backend'`. The default is `'frontend'`. Currently only is used when `REPO_ENVIRONMENT` is set to `'ci'`
\ No newline at end of file
diff --git a/change-log.md b/change-log.md
new file mode 100644
index 0000000000..93ec4cac10
--- /dev/null
+++ b/change-log.md
@@ -0,0 +1,23 @@
+Developer change log should contain an entry for each release/tag. Each entry should include the new tag version
+according to [SemVer](http://semver.org/), the date the tag was created, each JIRA issue which work was done against,
+and a summary of the work completed.
+
+The format for an entry is as follows:
+
+```markdown
+* 1.0.0 (2014-10-30)
+ * ABC-123
+ * _Major_: description of the major change. Note the upper case letter 'M' in Major
+ * _minor_: description of the minor change. Note the lower case letter 'm' in minor
+ * _patch_: description of the patch change.
+```
+
+Consult the git commit log for complete details of a release/tag.
+
+# Change log (most recent first)
+* 3.0.1 (2019-02-19)
+ * _minor_: reinstalled major version of eslint to update resolved version of eslint-scope to 3.7.3 per saas-55
+* 2.2.0 (2017-03-14)
+ * _minor_: Update 'valid-jsdoc' rule from error to warn
+* 2.1.0 (2016-12-06)
+ * _minor_: Enable eslint for VS code's eslint plugin
diff --git a/es5/README.md b/es5/README.md
deleted file mode 100644
index f961d8e0d6..0000000000
--- a/es5/README.md
+++ /dev/null
@@ -1,1741 +0,0 @@
-[](https://gitter.im/airbnb/javascript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
-
-# Airbnb JavaScript Style Guide() {
-
-*A mostly reasonable approach to JavaScript*
-
-
-## Table of Contents
-
- 1. [Types](#types)
- 1. [Objects](#objects)
- 1. [Arrays](#arrays)
- 1. [Strings](#strings)
- 1. [Functions](#functions)
- 1. [Properties](#properties)
- 1. [Variables](#variables)
- 1. [Hoisting](#hoisting)
- 1. [Comparison Operators & Equality](#comparison-operators--equality)
- 1. [Blocks](#blocks)
- 1. [Comments](#comments)
- 1. [Whitespace](#whitespace)
- 1. [Commas](#commas)
- 1. [Semicolons](#semicolons)
- 1. [Type Casting & Coercion](#type-casting--coercion)
- 1. [Naming Conventions](#naming-conventions)
- 1. [Accessors](#accessors)
- 1. [Constructors](#constructors)
- 1. [Events](#events)
- 1. [Modules](#modules)
- 1. [jQuery](#jquery)
- 1. [ECMAScript 5 Compatibility](#ecmascript-5-compatibility)
- 1. [Testing](#testing)
- 1. [Performance](#performance)
- 1. [Resources](#resources)
- 1. [In the Wild](#in-the-wild)
- 1. [Translation](#translation)
- 1. [The JavaScript Style Guide Guide](#the-javascript-style-guide-guide)
- 1. [Chat With Us About Javascript](#chat-with-us-about-javascript)
- 1. [Contributors](#contributors)
- 1. [License](#license)
-
-## Types
-
- - **Primitives**: When you access a primitive type you work directly on its value.
-
- + `string`
- + `number`
- + `boolean`
- + `null`
- + `undefined`
-
- ```javascript
- var foo = 1;
- var bar = foo;
-
- bar = 9;
-
- console.log(foo, bar); // => 1, 9
- ```
- - **Complex**: When you access a complex type you work on a reference to its value.
-
- + `object`
- + `array`
- + `function`
-
- ```javascript
- var foo = [1, 2];
- var bar = foo;
-
- bar[0] = 9;
-
- console.log(foo[0], bar[0]); // => 9, 9
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-## Objects
-
- - Use the literal syntax for object creation.
-
- ```javascript
- // bad
- var item = new Object();
-
- // good
- var item = {};
- ```
-
- - Don't use [reserved words](http://es5.github.io/#x7.6.1) as keys. It won't work in IE8. [More info](https://github.com/airbnb/javascript/issues/61).
-
- ```javascript
- // bad
- var superman = {
- default: { clark: 'kent' },
- private: true
- };
-
- // good
- var superman = {
- defaults: { clark: 'kent' },
- hidden: true
- };
- ```
-
- - Use readable synonyms in place of reserved words.
-
- ```javascript
- // bad
- var superman = {
- class: 'alien'
- };
-
- // bad
- var superman = {
- klass: 'alien'
- };
-
- // good
- var superman = {
- type: 'alien'
- };
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-## Arrays
-
- - Use the literal syntax for array creation.
-
- ```javascript
- // bad
- var items = new Array();
-
- // good
- var items = [];
- ```
-
- - Use Array#push instead of direct assignment to add items to an array.
-
- ```javascript
- var someStack = [];
-
-
- // bad
- someStack[someStack.length] = 'abracadabra';
-
- // good
- someStack.push('abracadabra');
- ```
-
- - When you need to copy an array use Array#slice. [jsPerf](http://jsperf.com/converting-arguments-to-an-array/7)
-
- ```javascript
- var len = items.length;
- var itemsCopy = [];
- var i;
-
- // bad
- for (i = 0; i < len; i++) {
- itemsCopy[i] = items[i];
- }
-
- // good
- itemsCopy = items.slice();
- ```
-
- - To convert an array-like object to an array, use Array#slice.
-
- ```javascript
- function trigger() {
- var args = Array.prototype.slice.call(arguments);
- ...
- }
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Strings
-
- - Use single quotes `''` for strings.
-
- ```javascript
- // bad
- var name = "Bob Parr";
-
- // good
- var name = 'Bob Parr';
-
- // bad
- var fullName = "Bob " + this.lastName;
-
- // good
- var fullName = 'Bob ' + this.lastName;
- ```
-
- - Strings longer than 100 characters should be written across multiple lines using string concatenation.
- - Note: If overused, long strings with concatenation could impact performance. [jsPerf](http://jsperf.com/ya-string-concat) & [Discussion](https://github.com/airbnb/javascript/issues/40).
-
- ```javascript
- // bad
- var errorMessage = 'This is a super long error that was thrown because of Batman. When you stop to think about how Batman had anything to do with this, you would get nowhere fast.';
-
- // bad
- var errorMessage = 'This is a super long error that was thrown because \
- of Batman. When you stop to think about how Batman had anything to do \
- with this, you would get nowhere \
- fast.';
-
- // good
- var errorMessage = 'This is a super long error that was thrown because ' +
- 'of Batman. When you stop to think about how Batman had anything to do ' +
- 'with this, you would get nowhere fast.';
- ```
-
- - When programmatically building up a string, use Array#join instead of string concatenation. Mostly for IE: [jsPerf](http://jsperf.com/string-vs-array-concat/2).
-
- ```javascript
- var items;
- var messages;
- var length;
- var i;
-
- messages = [{
- state: 'success',
- message: 'This one worked.'
- }, {
- state: 'success',
- message: 'This one worked as well.'
- }, {
- state: 'error',
- message: 'This one did not work.'
- }];
-
- length = messages.length;
-
- // bad
- function inbox(messages) {
- items = '
';
-
- for (i = 0; i < length; i++) {
- items += '- ' + messages[i].message + '
';
- }
-
- return items + '
';
- }
-
- // good
- function inbox(messages) {
- items = [];
-
- for (i = 0; i < length; i++) {
- // use direct assignment in this case because we're micro-optimizing.
- items[i] = '' + messages[i].message + '';
- }
-
- return '';
- }
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Functions
-
- - Function expressions:
-
- ```javascript
- // anonymous function expression
- var anonymous = function() {
- return true;
- };
-
- // named function expression
- var named = function named() {
- return true;
- };
-
- // immediately-invoked function expression (IIFE)
- (function() {
- console.log('Welcome to the Internet. Please follow me.');
- })();
- ```
-
- - Never declare a function in a non-function block (if, while, etc). Assign the function to a variable instead. Browsers will allow you to do it, but they all interpret it differently, which is bad news bears.
- - **Note:** ECMA-262 defines a `block` as a list of statements. A function declaration is not a statement. [Read ECMA-262's note on this issue](http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf#page=97).
-
- ```javascript
- // bad
- if (currentUser) {
- function test() {
- console.log('Nope.');
- }
- }
-
- // good
- var test;
- if (currentUser) {
- test = function test() {
- console.log('Yup.');
- };
- }
- ```
-
- - Never name a parameter `arguments`. This will take precedence over the `arguments` object that is given to every function scope.
-
- ```javascript
- // bad
- function nope(name, options, arguments) {
- // ...stuff...
- }
-
- // good
- function yup(name, options, args) {
- // ...stuff...
- }
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-
-## Properties
-
- - Use dot notation when accessing properties.
-
- ```javascript
- var luke = {
- jedi: true,
- age: 28
- };
-
- // bad
- var isJedi = luke['jedi'];
-
- // good
- var isJedi = luke.jedi;
- ```
-
- - Use subscript notation `[]` when accessing properties with a variable.
-
- ```javascript
- var luke = {
- jedi: true,
- age: 28
- };
-
- function getProp(prop) {
- return luke[prop];
- }
-
- var isJedi = getProp('jedi');
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Variables
-
- - Always use `var` to declare variables. Not doing so will result in global variables. We want to avoid polluting the global namespace. Captain Planet warned us of that.
-
- ```javascript
- // bad
- superPower = new SuperPower();
-
- // good
- var superPower = new SuperPower();
- ```
-
- - Use one `var` declaration per variable.
- It's easier to add new variable declarations this way, and you never have
- to worry about swapping out a `;` for a `,` or introducing punctuation-only
- diffs.
-
- ```javascript
- // bad
- var items = getItems(),
- goSportsTeam = true,
- dragonball = 'z';
-
- // bad
- // (compare to above, and try to spot the mistake)
- var items = getItems(),
- goSportsTeam = true;
- dragonball = 'z';
-
- // good
- var items = getItems();
- var goSportsTeam = true;
- var dragonball = 'z';
- ```
-
- - Declare unassigned variables last. This is helpful when later on you might need to assign a variable depending on one of the previous assigned variables.
-
- ```javascript
- // bad
- var i, len, dragonball,
- items = getItems(),
- goSportsTeam = true;
-
- // bad
- var i;
- var items = getItems();
- var dragonball;
- var goSportsTeam = true;
- var len;
-
- // good
- var items = getItems();
- var goSportsTeam = true;
- var dragonball;
- var length;
- var i;
- ```
-
- - Assign variables at the top of their scope. This helps avoid issues with variable declaration and assignment hoisting related issues.
-
- ```javascript
- // bad
- function() {
- test();
- console.log('doing stuff..');
-
- //..other stuff..
-
- var name = getName();
-
- if (name === 'test') {
- return false;
- }
-
- return name;
- }
-
- // good
- function() {
- var name = getName();
-
- test();
- console.log('doing stuff..');
-
- //..other stuff..
-
- if (name === 'test') {
- return false;
- }
-
- return name;
- }
-
- // bad - unnecessary function call
- function() {
- var name = getName();
-
- if (!arguments.length) {
- return false;
- }
-
- this.setFirstName(name);
-
- return true;
- }
-
- // good
- function() {
- var name;
-
- if (!arguments.length) {
- return false;
- }
-
- name = getName();
- this.setFirstName(name);
-
- return true;
- }
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Hoisting
-
- - Variable declarations get hoisted to the top of their scope, but their assignment does not.
-
- ```javascript
- // we know this wouldn't work (assuming there
- // is no notDefined global variable)
- function example() {
- console.log(notDefined); // => throws a ReferenceError
- }
-
- // creating a variable declaration after you
- // reference the variable will work due to
- // variable hoisting. Note: the assignment
- // value of `true` is not hoisted.
- function example() {
- console.log(declaredButNotAssigned); // => undefined
- var declaredButNotAssigned = true;
- }
-
- // The interpreter is hoisting the variable
- // declaration to the top of the scope,
- // which means our example could be rewritten as:
- function example() {
- var declaredButNotAssigned;
- console.log(declaredButNotAssigned); // => undefined
- declaredButNotAssigned = true;
- }
- ```
-
- - Anonymous function expressions hoist their variable name, but not the function assignment.
-
- ```javascript
- function example() {
- console.log(anonymous); // => undefined
-
- anonymous(); // => TypeError anonymous is not a function
-
- var anonymous = function() {
- console.log('anonymous function expression');
- };
- }
- ```
-
- - Named function expressions hoist the variable name, not the function name or the function body.
-
- ```javascript
- function example() {
- console.log(named); // => undefined
-
- named(); // => TypeError named is not a function
-
- superPower(); // => ReferenceError superPower is not defined
-
- var named = function superPower() {
- console.log('Flying');
- };
- }
-
- // the same is true when the function name
- // is the same as the variable name.
- function example() {
- console.log(named); // => undefined
-
- named(); // => TypeError named is not a function
-
- var named = function named() {
- console.log('named');
- }
- }
- ```
-
- - Function declarations hoist their name and the function body.
-
- ```javascript
- function example() {
- superPower(); // => Flying
-
- function superPower() {
- console.log('Flying');
- }
- }
- ```
-
- - For more information refer to [JavaScript Scoping & Hoisting](http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting) by [Ben Cherry](http://www.adequatelygood.com/).
-
-**[⬆ back to top](#table-of-contents)**
-
-
-
-## Comparison Operators & Equality
-
- - Use `===` and `!==` over `==` and `!=`.
- - Conditional statements such as the `if` statement evaluate their expression using coercion with the `ToBoolean` abstract method and always follow these simple rules:
-
- + **Objects** evaluate to **true**
- + **Undefined** evaluates to **false**
- + **Null** evaluates to **false**
- + **Booleans** evaluate to **the value of the boolean**
- + **Numbers** evaluate to **false** if **+0, -0, or NaN**, otherwise **true**
- + **Strings** evaluate to **false** if an empty string `''`, otherwise **true**
-
- ```javascript
- if ([0]) {
- // true
- // An array is an object, objects evaluate to true
- }
- ```
-
- - Use shortcuts.
-
- ```javascript
- // bad
- if (name !== '') {
- // ...stuff...
- }
-
- // good
- if (name) {
- // ...stuff...
- }
-
- // bad
- if (collection.length > 0) {
- // ...stuff...
- }
-
- // good
- if (collection.length) {
- // ...stuff...
- }
- ```
-
- - For more information see [Truth Equality and JavaScript](http://javascriptweblog.wordpress.com/2011/02/07/truth-equality-and-javascript/#more-2108) by Angus Croll.
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Blocks
-
- - Use braces with all multi-line blocks.
-
- ```javascript
- // bad
- if (test)
- return false;
-
- // good
- if (test) return false;
-
- // good
- if (test) {
- return false;
- }
-
- // bad
- function() { return false; }
-
- // good
- function() {
- return false;
- }
- ```
-
- - If you're using multi-line blocks with `if` and `else`, put `else` on the same line as your
- `if` block's closing brace.
-
- ```javascript
- // bad
- if (test) {
- thing1();
- thing2();
- }
- else {
- thing3();
- }
-
- // good
- if (test) {
- thing1();
- thing2();
- } else {
- thing3();
- }
- ```
-
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Comments
-
- - Use `/** ... */` for multi-line comments. Include a description, specify types and values for all parameters and return values.
-
- ```javascript
- // bad
- // make() returns a new element
- // based on the passed in tag name
- //
- // @param {String} tag
- // @return {Element} element
- function make(tag) {
-
- // ...stuff...
-
- return element;
- }
-
- // good
- /**
- * make() returns a new element
- * based on the passed in tag name
- *
- * @param {String} tag
- * @return {Element} element
- */
- function make(tag) {
-
- // ...stuff...
-
- return element;
- }
- ```
-
- - Use `//` for single line comments. Place single line comments on a newline above the subject of the comment. Put an empty line before the comment.
-
- ```javascript
- // bad
- var active = true; // is current tab
-
- // good
- // is current tab
- var active = true;
-
- // bad
- function getType() {
- console.log('fetching type...');
- // set the default type to 'no type'
- var type = this._type || 'no type';
-
- return type;
- }
-
- // good
- function getType() {
- console.log('fetching type...');
-
- // set the default type to 'no type'
- var type = this._type || 'no type';
-
- return type;
- }
- ```
-
- - Prefixing your comments with `FIXME` or `TODO` helps other developers quickly understand if you're pointing out a problem that needs to be revisited, or if you're suggesting a solution to the problem that needs to be implemented. These are different than regular comments because they are actionable. The actions are `FIXME -- need to figure this out` or `TODO -- need to implement`.
-
- - Use `// FIXME:` to annotate problems.
-
- ```javascript
- function Calculator() {
-
- // FIXME: shouldn't use a global here
- total = 0;
-
- return this;
- }
- ```
-
- - Use `// TODO:` to annotate solutions to problems.
-
- ```javascript
- function Calculator() {
-
- // TODO: total should be configurable by an options param
- this.total = 0;
-
- return this;
- }
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Whitespace
-
- - Use soft tabs set to 2 spaces.
-
- ```javascript
- // bad
- function() {
- ∙∙∙∙var name;
- }
-
- // bad
- function() {
- ∙var name;
- }
-
- // good
- function() {
- ∙∙var name;
- }
- ```
-
- - Place 1 space before the leading brace.
-
- ```javascript
- // bad
- function test(){
- console.log('test');
- }
-
- // good
- function test() {
- console.log('test');
- }
-
- // bad
- dog.set('attr',{
- age: '1 year',
- breed: 'Bernese Mountain Dog'
- });
-
- // good
- dog.set('attr', {
- age: '1 year',
- breed: 'Bernese Mountain Dog'
- });
- ```
-
- - Place 1 space before the opening parenthesis in control statements (`if`, `while` etc.). Place no space before the argument list in function calls and declarations.
-
- ```javascript
- // bad
- if(isJedi) {
- fight ();
- }
-
- // good
- if (isJedi) {
- fight();
- }
-
- // bad
- function fight () {
- console.log ('Swooosh!');
- }
-
- // good
- function fight() {
- console.log('Swooosh!');
- }
- ```
-
- - Set off operators with spaces.
-
- ```javascript
- // bad
- var x=y+5;
-
- // good
- var x = y + 5;
- ```
-
- - End files with a single newline character.
-
- ```javascript
- // bad
- (function(global) {
- // ...stuff...
- })(this);
- ```
-
- ```javascript
- // bad
- (function(global) {
- // ...stuff...
- })(this);↵
- ↵
- ```
-
- ```javascript
- // good
- (function(global) {
- // ...stuff...
- })(this);↵
- ```
-
- - Use indentation when making long method chains. Use a leading dot, which
- emphasizes that the line is a method call, not a new statement.
-
- ```javascript
- // bad
- $('#items').find('.selected').highlight().end().find('.open').updateCount();
-
- // bad
- $('#items').
- find('.selected').
- highlight().
- end().
- find('.open').
- updateCount();
-
- // good
- $('#items')
- .find('.selected')
- .highlight()
- .end()
- .find('.open')
- .updateCount();
-
- // bad
- var leds = stage.selectAll('.led').data(data).enter().append('svg:svg').classed('led', true)
- .attr('width', (radius + margin) * 2).append('svg:g')
- .attr('transform', 'translate(' + (radius + margin) + ',' + (radius + margin) + ')')
- .call(tron.led);
-
- // good
- var leds = stage.selectAll('.led')
- .data(data)
- .enter().append('svg:svg')
- .classed('led', true)
- .attr('width', (radius + margin) * 2)
- .append('svg:g')
- .attr('transform', 'translate(' + (radius + margin) + ',' + (radius + margin) + ')')
- .call(tron.led);
- ```
-
- - Leave a blank line after blocks and before the next statement
-
- ```javascript
- // bad
- if (foo) {
- return bar;
- }
- return baz;
-
- // good
- if (foo) {
- return bar;
- }
-
- return baz;
-
- // bad
- var obj = {
- foo: function() {
- },
- bar: function() {
- }
- };
- return obj;
-
- // good
- var obj = {
- foo: function() {
- },
-
- bar: function() {
- }
- };
-
- return obj;
- ```
-
-
-**[⬆ back to top](#table-of-contents)**
-
-## Commas
-
- - Leading commas: **Nope.**
-
- ```javascript
- // bad
- var story = [
- once
- , upon
- , aTime
- ];
-
- // good
- var story = [
- once,
- upon,
- aTime
- ];
-
- // bad
- var hero = {
- firstName: 'Bob'
- , lastName: 'Parr'
- , heroName: 'Mr. Incredible'
- , superPower: 'strength'
- };
-
- // good
- var hero = {
- firstName: 'Bob',
- lastName: 'Parr',
- heroName: 'Mr. Incredible',
- superPower: 'strength'
- };
- ```
-
- - Additional trailing comma: **Nope.** This can cause problems with IE6/7 and IE9 if it's in quirksmode. Also, in some implementations of ES3 would add length to an array if it had an additional trailing comma. This was clarified in ES5 ([source](http://es5.github.io/#D)):
-
- > Edition 5 clarifies the fact that a trailing comma at the end of an ArrayInitialiser does not add to the length of the array. This is not a semantic change from Edition 3 but some implementations may have previously misinterpreted this.
-
- ```javascript
- // bad
- var hero = {
- firstName: 'Kevin',
- lastName: 'Flynn',
- };
-
- var heroes = [
- 'Batman',
- 'Superman',
- ];
-
- // good
- var hero = {
- firstName: 'Kevin',
- lastName: 'Flynn'
- };
-
- var heroes = [
- 'Batman',
- 'Superman'
- ];
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Semicolons
-
- - **Yup.**
-
- ```javascript
- // bad
- (function() {
- var name = 'Skywalker'
- return name
- })()
-
- // good
- (function() {
- var name = 'Skywalker';
- return name;
- })();
-
- // good (guards against the function becoming an argument when two files with IIFEs are concatenated)
- ;(function() {
- var name = 'Skywalker';
- return name;
- })();
- ```
-
- [Read more](http://stackoverflow.com/a/7365214/1712802).
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Type Casting & Coercion
-
- - Perform type coercion at the beginning of the statement.
- - Strings:
-
- ```javascript
- // => this.reviewScore = 9;
-
- // bad
- var totalScore = this.reviewScore + '';
-
- // good
- var totalScore = '' + this.reviewScore;
-
- // bad
- var totalScore = '' + this.reviewScore + ' total score';
-
- // good
- var totalScore = this.reviewScore + ' total score';
- ```
-
- - Use `parseInt` for Numbers and always with a radix for type casting.
-
- ```javascript
- var inputValue = '4';
-
- // bad
- var val = new Number(inputValue);
-
- // bad
- var val = +inputValue;
-
- // bad
- var val = inputValue >> 0;
-
- // bad
- var val = parseInt(inputValue);
-
- // good
- var val = Number(inputValue);
-
- // good
- var val = parseInt(inputValue, 10);
- ```
-
- - If for whatever reason you are doing something wild and `parseInt` is your bottleneck and need to use Bitshift for [performance reasons](http://jsperf.com/coercion-vs-casting/3), leave a comment explaining why and what you're doing.
-
- ```javascript
- // good
- /**
- * parseInt was the reason my code was slow.
- * Bitshifting the String to coerce it to a
- * Number made it a lot faster.
- */
- var val = inputValue >> 0;
- ```
-
- - **Note:** Be careful when using bitshift operations. Numbers are represented as [64-bit values](http://es5.github.io/#x4.3.19), but Bitshift operations always return a 32-bit integer ([source](http://es5.github.io/#x11.7)). Bitshift can lead to unexpected behavior for integer values larger than 32 bits. [Discussion](https://github.com/airbnb/javascript/issues/109). Largest signed 32-bit Int is 2,147,483,647:
-
- ```javascript
- 2147483647 >> 0 //=> 2147483647
- 2147483648 >> 0 //=> -2147483648
- 2147483649 >> 0 //=> -2147483647
- ```
-
- - Booleans:
-
- ```javascript
- var age = 0;
-
- // bad
- var hasAge = new Boolean(age);
-
- // good
- var hasAge = Boolean(age);
-
- // good
- var hasAge = !!age;
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Naming Conventions
-
- - Avoid single letter names. Be descriptive with your naming.
-
- ```javascript
- // bad
- function q() {
- // ...stuff...
- }
-
- // good
- function query() {
- // ..stuff..
- }
- ```
-
- - Use camelCase when naming objects, functions, and instances.
-
- ```javascript
- // bad
- var OBJEcttsssss = {};
- var this_is_my_object = {};
- var o = {};
- function c() {}
-
- // good
- var thisIsMyObject = {};
- function thisIsMyFunction() {}
- ```
-
- - Use PascalCase when naming constructors or classes.
-
- ```javascript
- // bad
- function user(options) {
- this.name = options.name;
- }
-
- var bad = new user({
- name: 'nope'
- });
-
- // good
- function User(options) {
- this.name = options.name;
- }
-
- var good = new User({
- name: 'yup'
- });
- ```
-
- - Use a leading underscore `_` when naming private properties.
-
- ```javascript
- // bad
- this.__firstName__ = 'Panda';
- this.firstName_ = 'Panda';
-
- // good
- this._firstName = 'Panda';
- ```
-
- - When saving a reference to `this` use `_this`.
-
- ```javascript
- // bad
- function() {
- var self = this;
- return function() {
- console.log(self);
- };
- }
-
- // bad
- function() {
- var that = this;
- return function() {
- console.log(that);
- };
- }
-
- // good
- function() {
- var _this = this;
- return function() {
- console.log(_this);
- };
- }
- ```
-
- - Name your functions. This is helpful for stack traces.
-
- ```javascript
- // bad
- var log = function(msg) {
- console.log(msg);
- };
-
- // good
- var log = function log(msg) {
- console.log(msg);
- };
- ```
-
- - **Note:** IE8 and below exhibit some quirks with named function expressions. See [http://kangax.github.io/nfe/](http://kangax.github.io/nfe/) for more info.
-
- - If your file exports a single class, your filename should be exactly the name of the class.
- ```javascript
- // file contents
- class CheckBox {
- // ...
- }
- module.exports = CheckBox;
-
- // in some other file
- // bad
- var CheckBox = require('./checkBox');
-
- // bad
- var CheckBox = require('./check_box');
-
- // good
- var CheckBox = require('./CheckBox');
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Accessors
-
- - Accessor functions for properties are not required.
- - If you do make accessor functions use getVal() and setVal('hello').
-
- ```javascript
- // bad
- dragon.age();
-
- // good
- dragon.getAge();
-
- // bad
- dragon.age(25);
-
- // good
- dragon.setAge(25);
- ```
-
- - If the property is a boolean, use isVal() or hasVal().
-
- ```javascript
- // bad
- if (!dragon.age()) {
- return false;
- }
-
- // good
- if (!dragon.hasAge()) {
- return false;
- }
- ```
-
- - It's okay to create get() and set() functions, but be consistent.
-
- ```javascript
- function Jedi(options) {
- options || (options = {});
- var lightsaber = options.lightsaber || 'blue';
- this.set('lightsaber', lightsaber);
- }
-
- Jedi.prototype.set = function(key, val) {
- this[key] = val;
- };
-
- Jedi.prototype.get = function(key) {
- return this[key];
- };
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Constructors
-
- - Assign methods to the prototype object, instead of overwriting the prototype with a new object. Overwriting the prototype makes inheritance impossible: by resetting the prototype you'll overwrite the base!
-
- ```javascript
- function Jedi() {
- console.log('new jedi');
- }
-
- // bad
- Jedi.prototype = {
- fight: function fight() {
- console.log('fighting');
- },
-
- block: function block() {
- console.log('blocking');
- }
- };
-
- // good
- Jedi.prototype.fight = function fight() {
- console.log('fighting');
- };
-
- Jedi.prototype.block = function block() {
- console.log('blocking');
- };
- ```
-
- - Methods can return `this` to help with method chaining.
-
- ```javascript
- // bad
- Jedi.prototype.jump = function() {
- this.jumping = true;
- return true;
- };
-
- Jedi.prototype.setHeight = function(height) {
- this.height = height;
- };
-
- var luke = new Jedi();
- luke.jump(); // => true
- luke.setHeight(20); // => undefined
-
- // good
- Jedi.prototype.jump = function() {
- this.jumping = true;
- return this;
- };
-
- Jedi.prototype.setHeight = function(height) {
- this.height = height;
- return this;
- };
-
- var luke = new Jedi();
-
- luke.jump()
- .setHeight(20);
- ```
-
-
- - It's okay to write a custom toString() method, just make sure it works successfully and causes no side effects.
-
- ```javascript
- function Jedi(options) {
- options || (options = {});
- this.name = options.name || 'no name';
- }
-
- Jedi.prototype.getName = function getName() {
- return this.name;
- };
-
- Jedi.prototype.toString = function toString() {
- return 'Jedi - ' + this.getName();
- };
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Events
-
- - When attaching data payloads to events (whether DOM events or something more proprietary like Backbone events), pass a hash instead of a raw value. This allows a subsequent contributor to add more data to the event payload without finding and updating every handler for the event. For example, instead of:
-
- ```js
- // bad
- $(this).trigger('listingUpdated', listing.id);
-
- ...
-
- $(this).on('listingUpdated', function(e, listingId) {
- // do something with listingId
- });
- ```
-
- prefer:
-
- ```js
- // good
- $(this).trigger('listingUpdated', { listingId : listing.id });
-
- ...
-
- $(this).on('listingUpdated', function(e, data) {
- // do something with data.listingId
- });
- ```
-
- **[⬆ back to top](#table-of-contents)**
-
-
-## Modules
-
- - The module should start with a `!`. This ensures that if a malformed module forgets to include a final semicolon there aren't errors in production when the scripts get concatenated. [Explanation](https://github.com/airbnb/javascript/issues/44#issuecomment-13063933)
- - The file should be named with camelCase, live in a folder with the same name, and match the name of the single export.
- - Add a method called `noConflict()` that sets the exported module to the previous version and returns this one.
- - Always declare `'use strict';` at the top of the module.
-
- ```javascript
- // fancyInput/fancyInput.js
-
- !function(global) {
- 'use strict';
-
- var previousFancyInput = global.FancyInput;
-
- function FancyInput(options) {
- this.options = options || {};
- }
-
- FancyInput.noConflict = function noConflict() {
- global.FancyInput = previousFancyInput;
- return FancyInput;
- };
-
- global.FancyInput = FancyInput;
- }(this);
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## jQuery
-
- - Prefix jQuery object variables with a `$`.
-
- ```javascript
- // bad
- var sidebar = $('.sidebar');
-
- // good
- var $sidebar = $('.sidebar');
- ```
-
- - Cache jQuery lookups.
-
- ```javascript
- // bad
- function setSidebar() {
- $('.sidebar').hide();
-
- // ...stuff...
-
- $('.sidebar').css({
- 'background-color': 'pink'
- });
- }
-
- // good
- function setSidebar() {
- var $sidebar = $('.sidebar');
- $sidebar.hide();
-
- // ...stuff...
-
- $sidebar.css({
- 'background-color': 'pink'
- });
- }
- ```
-
- - For DOM queries use Cascading `$('.sidebar ul')` or parent > child `$('.sidebar > ul')`. [jsPerf](http://jsperf.com/jquery-find-vs-context-sel/16)
- - Use `find` with scoped jQuery object queries.
-
- ```javascript
- // bad
- $('ul', '.sidebar').hide();
-
- // bad
- $('.sidebar').find('ul').hide();
-
- // good
- $('.sidebar ul').hide();
-
- // good
- $('.sidebar > ul').hide();
-
- // good
- $sidebar.find('ul').hide();
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## ECMAScript 5 Compatibility
-
- - Refer to [Kangax](https://twitter.com/kangax/)'s ES5 [compatibility table](http://kangax.github.com/es5-compat-table/).
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Testing
-
- - **Yup.**
-
- ```javascript
- function() {
- return true;
- }
- ```
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Performance
-
- - [On Layout & Web Performance](http://kellegous.com/j/2013/01/26/layout-performance/)
- - [String vs Array Concat](http://jsperf.com/string-vs-array-concat/2)
- - [Try/Catch Cost In a Loop](http://jsperf.com/try-catch-in-loop-cost)
- - [Bang Function](http://jsperf.com/bang-function)
- - [jQuery Find vs Context, Selector](http://jsperf.com/jquery-find-vs-context-sel/13)
- - [innerHTML vs textContent for script text](http://jsperf.com/innerhtml-vs-textcontent-for-script-text)
- - [Long String Concatenation](http://jsperf.com/ya-string-concat)
- - Loading...
-
-**[⬆ back to top](#table-of-contents)**
-
-
-## Resources
-
-
-**Read This**
-
- - [Annotated ECMAScript 5.1](http://es5.github.com/)
-
-**Tools**
-
- - Code Style Linters
- + [JSHint](http://www.jshint.com/) - [Airbnb Style .jshintrc](https://github.com/airbnb/javascript/blob/master/linters/jshintrc)
- + [JSCS](https://github.com/jscs-dev/node-jscs) - [Airbnb Style Preset](https://github.com/jscs-dev/node-jscs/blob/master/presets/airbnb.json)
-
-**Other Style Guides**
-
- - [Google JavaScript Style Guide](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml)
- - [jQuery Core Style Guidelines](http://docs.jquery.com/JQuery_Core_Style_Guidelines)
- - [Principles of Writing Consistent, Idiomatic JavaScript](https://github.com/rwldrn/idiomatic.js/)
- - [JavaScript Standard Style](https://github.com/feross/standard)
-
-**Other Styles**
-
- - [Naming this in nested functions](https://gist.github.com/4135065) - Christian Johansen
- - [Conditional Callbacks](https://github.com/airbnb/javascript/issues/52) - Ross Allen
- - [Popular JavaScript Coding Conventions on Github](http://sideeffect.kr/popularconvention/#javascript) - JeongHoon Byun
- - [Multiple var statements in JavaScript, not superfluous](http://benalman.com/news/2012/05/multiple-var-statements-javascript/) - Ben Alman
-
-**Further Reading**
-
- - [Understanding JavaScript Closures](http://javascriptweblog.wordpress.com/2010/10/25/understanding-javascript-closures/) - Angus Croll
- - [Basic JavaScript for the impatient programmer](http://www.2ality.com/2013/06/basic-javascript.html) - Dr. Axel Rauschmayer
- - [You Might Not Need jQuery](http://youmightnotneedjquery.com/) - Zack Bloom & Adam Schwartz
- - [ES6 Features](https://github.com/lukehoban/es6features) - Luke Hoban
- - [Frontend Guidelines](https://github.com/bendc/frontend-guidelines) - Benjamin De Cock
-
-**Books**
-
- - [JavaScript: The Good Parts](http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742) - Douglas Crockford
- - [JavaScript Patterns](http://www.amazon.com/JavaScript-Patterns-Stoyan-Stefanov/dp/0596806752) - Stoyan Stefanov
- - [Pro JavaScript Design Patterns](http://www.amazon.com/JavaScript-Design-Patterns-Recipes-Problem-Solution/dp/159059908X) - Ross Harmes and Dustin Diaz
- - [High Performance Web Sites: Essential Knowledge for Front-End Engineers](http://www.amazon.com/High-Performance-Web-Sites-Essential/dp/0596529309) - Steve Souders
- - [Maintainable JavaScript](http://www.amazon.com/Maintainable-JavaScript-Nicholas-C-Zakas/dp/1449327680) - Nicholas C. Zakas
- - [JavaScript Web Applications](http://www.amazon.com/JavaScript-Web-Applications-Alex-MacCaw/dp/144930351X) - Alex MacCaw
- - [Pro JavaScript Techniques](http://www.amazon.com/Pro-JavaScript-Techniques-John-Resig/dp/1590597273) - John Resig
- - [Smashing Node.js: JavaScript Everywhere](http://www.amazon.com/Smashing-Node-js-JavaScript-Everywhere-Magazine/dp/1119962595) - Guillermo Rauch
- - [Secrets of the JavaScript Ninja](http://www.amazon.com/Secrets-JavaScript-Ninja-John-Resig/dp/193398869X) - John Resig and Bear Bibeault
- - [Human JavaScript](http://humanjavascript.com/) - Henrik Joreteg
- - [Superhero.js](http://superherojs.com/) - Kim Joar Bekkelund, Mads Mobæk, & Olav Bjorkoy
- - [JSBooks](http://jsbooks.revolunet.com/) - Julien Bouquillon
- - [Third Party JavaScript](http://manning.com/vinegar/) - Ben Vinegar and Anton Kovalyov
- - [Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript](http://amzn.com/0321812182) - David Herman
- - [Eloquent JavaScript](http://eloquentjavascript.net) - Marijn Haverbeke
- - [You Don't Know JS](https://github.com/getify/You-Dont-Know-JS) - Kyle Simpson
-
-**Blogs**
-
- - [DailyJS](http://dailyjs.com/)
- - [JavaScript Weekly](http://javascriptweekly.com/)
- - [JavaScript, JavaScript...](http://javascriptweblog.wordpress.com/)
- - [Bocoup Weblog](http://weblog.bocoup.com/)
- - [Adequately Good](http://www.adequatelygood.com/)
- - [NCZOnline](http://www.nczonline.net/)
- - [Perfection Kills](http://perfectionkills.com/)
- - [Ben Alman](http://benalman.com/)
- - [Dmitry Baranovskiy](http://dmitry.baranovskiy.com/)
- - [Dustin Diaz](http://dustindiaz.com/)
- - [nettuts](http://net.tutsplus.com/?s=javascript)
-
-**Podcasts**
-
- - [JavaScript Jabber](http://devchat.tv/js-jabber/)
-
-
-**[⬆ back to top](#table-of-contents)**
-
-## In the Wild
-
- This is a list of organizations that are using this style guide. Send us a pull request or open an issue and we'll add you to the list.
-
- - **Aan Zee**: [AanZee/javascript](https://github.com/AanZee/javascript)
- - **Adult Swim**: [adult-swim/javascript](https://github.com/adult-swim/javascript)
- - **Airbnb**: [airbnb/javascript](https://github.com/airbnb/javascript)
- - **Apartmint**: [apartmint/javascript](https://github.com/apartmint/javascript)
- - **Avalara**: [avalara/javascript](https://github.com/avalara/javascript)
- - **Billabong**: [billabong/javascript](https://github.com/billabong/javascript)
- - **Compass Learning**: [compasslearning/javascript-style-guide](https://github.com/compasslearning/javascript-style-guide)
- - **DailyMotion**: [dailymotion/javascript](https://github.com/dailymotion/javascript)
- - **Digitpaint** [digitpaint/javascript](https://github.com/digitpaint/javascript)
- - **Evernote**: [evernote/javascript-style-guide](https://github.com/evernote/javascript-style-guide)
- - **ExactTarget**: [ExactTarget/javascript](https://github.com/ExactTarget/javascript)
- - **Flexberry**: [Flexberry/javascript-style-guide](https://github.com/Flexberry/javascript-style-guide)
- - **Gawker Media**: [gawkermedia/javascript](https://github.com/gawkermedia/javascript)
- - **General Electric**: [GeneralElectric/javascript](https://github.com/GeneralElectric/javascript)
- - **GoodData**: [gooddata/gdc-js-style](https://github.com/gooddata/gdc-js-style)
- - **Grooveshark**: [grooveshark/javascript](https://github.com/grooveshark/javascript)
- - **How About We**: [howaboutwe/javascript](https://github.com/howaboutwe/javascript)
- - **InfoJobs**: [InfoJobs/JavaScript-Style-Guide](https://github.com/InfoJobs/JavaScript-Style-Guide)
- - **Intent Media**: [intentmedia/javascript](https://github.com/intentmedia/javascript)
- - **Jam3**: [Jam3/Javascript-Code-Conventions](https://github.com/Jam3/Javascript-Code-Conventions)
- - **JSSolutions**: [JSSolutions/javascript](https://github.com/JSSolutions/javascript)
- - **Kinetica Solutions**: [kinetica/javascript](https://github.com/kinetica/javascript)
- - **Mighty Spring**: [mightyspring/javascript](https://github.com/mightyspring/javascript)
- - **MinnPost**: [MinnPost/javascript](https://github.com/MinnPost/javascript)
- - **ModCloth**: [modcloth/javascript](https://github.com/modcloth/javascript)
- - **Money Advice Service**: [moneyadviceservice/javascript](https://github.com/moneyadviceservice/javascript)
- - **Muber**: [muber/javascript](https://github.com/muber/javascript)
- - **National Geographic**: [natgeo/javascript](https://github.com/natgeo/javascript)
- - **National Park Service**: [nationalparkservice/javascript](https://github.com/nationalparkservice/javascript)
- - **Nimbl3**: [nimbl3/javascript](https://github.com/nimbl3/javascript)
- - **Nordic Venture Family**: [CodeDistillery/javascript](https://github.com/CodeDistillery/javascript)
- - **Orion Health**: [orionhealth/javascript](https://github.com/orionhealth/javascript)
- - **Peerby**: [Peerby/javascript](https://github.com/Peerby/javascript)
- - **Razorfish**: [razorfish/javascript-style-guide](https://github.com/razorfish/javascript-style-guide)
- - **reddit**: [reddit/styleguide/javascript](https://github.com/reddit/styleguide/tree/master/javascript)
- - **REI**: [reidev/js-style-guide](https://github.com/reidev/js-style-guide)
- - **Ripple**: [ripple/javascript-style-guide](https://github.com/ripple/javascript-style-guide)
- - **SeekingAlpha**: [seekingalpha/javascript-style-guide](https://github.com/seekingalpha/javascript-style-guide)
- - **Shutterfly**: [shutterfly/javascript](https://github.com/shutterfly/javascript)
- - **StudentSphere**: [studentsphere/javascript](https://github.com/studentsphere/javascript)
- - **Target**: [target/javascript](https://github.com/target/javascript)
- - **TheLadders**: [TheLadders/javascript](https://github.com/TheLadders/javascript)
- - **T4R Technology**: [T4R-Technology/javascript](https://github.com/T4R-Technology/javascript)
- - **VoxFeed**: [VoxFeed/javascript-style-guide](https://github.com/VoxFeed/javascript-style-guide)
- - **Weggo**: [Weggo/javascript](https://github.com/Weggo/javascript)
- - **Zillow**: [zillow/javascript](https://github.com/zillow/javascript)
- - **ZocDoc**: [ZocDoc/javascript](https://github.com/ZocDoc/javascript)
-
-## Translation
-
- This style guide is also available in other languages:
-
- -  **Brazilian Portuguese**: [armoucar/javascript-style-guide](https://github.com/armoucar/javascript-style-guide)
- -  **Bulgarian**: [borislavvv/javascript](https://github.com/borislavvv/javascript)
- -  **Catalan**: [fpmweb/javascript-style-guide](https://github.com/fpmweb/javascript-style-guide)
- -  **Chinese(Traditional)**: [jigsawye/javascript](https://github.com/jigsawye/javascript)
- -  **Chinese(Simplified)**: [sivan/javascript-style-guide](https://github.com/sivan/javascript-style-guide)
- -  **French**: [nmussy/javascript-style-guide](https://github.com/nmussy/javascript-style-guide)
- -  **German**: [timofurrer/javascript-style-guide](https://github.com/timofurrer/javascript-style-guide)
- -  **Italian**: [sinkswim/javascript-style-guide](https://github.com/sinkswim/javascript-style-guide)
- -  **Japanese**: [mitsuruog/javacript-style-guide](https://github.com/mitsuruog/javacript-style-guide)
- -  **Korean**: [tipjs/javascript-style-guide](https://github.com/tipjs/javascript-style-guide)
- -  **Polish**: [mjurczyk/javascript](https://github.com/mjurczyk/javascript)
- -  **Russian**: [uprock/javascript](https://github.com/uprock/javascript)
- -  **Spanish**: [paolocarrasco/javascript-style-guide](https://github.com/paolocarrasco/javascript-style-guide)
- -  **Thai**: [lvarayut/javascript-style-guide](https://github.com/lvarayut/javascript-style-guide)
-
-## The JavaScript Style Guide Guide
-
- - [Reference](https://github.com/airbnb/javascript/wiki/The-JavaScript-Style-Guide-Guide)
-
-## Chat With Us About JavaScript
-
- - Find us on [gitter](https://gitter.im/airbnb/javascript).
-
-## Contributors
-
- - [View Contributors](https://github.com/airbnb/javascript/graphs/contributors)
-
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2014 Airbnb
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**[⬆ back to top](#table-of-contents)**
-
-# };
diff --git a/es6.js b/es6.js
new file mode 100644
index 0000000000..9f6522cf41
--- /dev/null
+++ b/es6.js
@@ -0,0 +1,4 @@
+'use strict';
+
+var virtruLintConfig = require('./lib/util').getEnv();
+module.exports = require('./lib/es6/' + (virtruLintConfig.repoEnvironment || process.env.REPO_ENVIRONMENT || 'ci'));
diff --git a/index.js b/index.js
new file mode 100644
index 0000000000..8efa968681
--- /dev/null
+++ b/index.js
@@ -0,0 +1,4 @@
+'use strict';
+
+var virtruLintConfig = require('./lib/util').getEnv();
+module.exports = require('./lib/' + (virtruLintConfig.repoEnvironment || process.env.REPO_ENVIRONMENT || 'ci'));
diff --git a/lib/ci.js b/lib/ci.js
new file mode 100644
index 0000000000..3fde23c6cf
--- /dev/null
+++ b/lib/ci.js
@@ -0,0 +1,4 @@
+'use strict';
+
+var virtruLintConfig = require('./util').getEnv();
+module.exports = require('./ci/' + (virtruLintConfig.repoType || process.env.REPO_TYPE || 'frontend'));
diff --git a/lib/ci/backend.js b/lib/ci/backend.js
new file mode 100644
index 0000000000..dd730e0494
--- /dev/null
+++ b/lib/ci/backend.js
@@ -0,0 +1,10 @@
+module.exports = {
+ rules: {
+ 'no-console': 0,
+ 'comma-dangle': 0
+ },
+ env: {
+ 'es6': true
+ },
+ extends: 'lint-trap/lib/ci/common'
+};
diff --git a/lib/ci/common.js b/lib/ci/common.js
new file mode 100644
index 0000000000..6219579a35
--- /dev/null
+++ b/lib/ci/common.js
@@ -0,0 +1,6 @@
+module.exports = {
+ rules: {
+ 'no-debugger': 2
+ },
+ extends: 'lint-trap/lib/defaults'
+};
diff --git a/lib/ci/frontend.js b/lib/ci/frontend.js
new file mode 100644
index 0000000000..dd859d1423
--- /dev/null
+++ b/lib/ci/frontend.js
@@ -0,0 +1,7 @@
+module.exports = {
+ rules: {
+ 'no-console': 2,
+ 'comma-dangle': 2
+ },
+ extends: 'lint-trap/lib/ci/common'
+};
diff --git a/lib/defaults.js b/lib/defaults.js
new file mode 100644
index 0000000000..f84cf16180
--- /dev/null
+++ b/lib/defaults.js
@@ -0,0 +1,261 @@
+'use strict';
+
+module.exports = {
+ extends: 'airbnb-base/legacy',
+ 'env': { // http://eslint.org/docs/user-guide/configuring.html#specifying-environments
+ 'browser': true, // browser global variables
+ 'node': true, // Node.js global variables and Node.js-specific rules
+ 'es6': true
+ },
+ 'plugins': [
+ 'virtru-lint'
+ ],
+
+/*@TODO: Decide upon these later
+ 'ecmaFeatures': {
+ 'arrowFunctions': true,
+ 'blockBindings': true,
+ 'classes': true,
+ 'defaultParams': true,
+ 'destructuring': true,
+ 'forOf': true,
+ 'generators': false,
+ 'modules': true,
+ 'objectLiteralComputedProperties': true,
+ 'objectLiteralDuplicateProperties': false,
+ 'objectLiteralShorthandMethods': true,
+ 'objectLiteralShorthandProperties': true,
+ 'spread': true,
+ 'superInFunctions': true,
+ 'templateStrings': true,
+ 'jsx': true
+ },
+*/
+ 'rules': {
+ /**
+ * Node
+ */
+ 'global-require': 0,
+
+ /**
+ * Strict mode
+ */
+ //@TODO: We aren't using babel at the moment.
+ //babel inserts 'use strict'; for us
+ //'strict': [2, 'never'], // http://eslint.org/docs/rules/strict
+
+
+
+ /**
+ * Virtru Specific Rules
+ */
+ 'virtru-lint/virtru-func-names': 2,
+
+ /**
+ * ES6
+ */
+/*
+ 'no-var': 2, // http://eslint.org/docs/rules/no-var
+ 'prefer-const': 2, // http://eslint.org/docs/rules/prefer-const
+*/
+ /**
+ * Variables
+ */
+ 'no-shadow': [2, { // http://eslint.org/docs/rules/no-shadow
+ allow: ['res', 'req', 'err', 'next', 'resolve', 'reject', 'done', 'cb']
+ }],
+ 'no-unused-vars': [2, { // http://eslint.org/docs/rules/no-unused-vars
+ 'vars': 'all',
+ 'args': 'none'
+ }],
+ 'no-use-before-define': [2, 'nofunc'], // http://eslint.org/docs/rules/no-use-before-define
+
+ /**
+ * Possible errors
+ */
+ 'comma-dangle': [2, 'only-multiline'], // http://eslint.org/docs/rules/comma-dangle @TODO: Turn into separate for front/back in dev env
+ 'no-cond-assign': [2, 'except-parens'], // http://eslint.org/docs/rules/no-cond-assign
+ //'no-console': 1, // http://eslint.org/docs/rules/no-console
+ 'no-debugger': 1, // http://eslint.org/docs/rules/no-debugger
+ 'no-alert': 2, // http://eslint.org/docs/rules/no-alert
+ //'no-constant-condition': 1, // http://eslint.org/docs/rules/no-constant-condition
+ //'no-dupe-keys': 2, // http://eslint.org/docs/rules/no-dupe-keys
+ //'no-duplicate-case': 2, // http://eslint.org/docs/rules/no-duplicate-case
+ //'no-empty': 2, // http://eslint.org/docs/rules/no-empty
+ //'no-ex-assign': 2, // http://eslint.org/docs/rules/no-ex-assign
+ 'no-extra-boolean-cast': 2, // http://eslint.org/docs/rules/no-extra-boolean-cast
+ 'no-extra-parens': [2, 'functions'], // http://eslint.org/docs/rules/no-extra-parens
+ //'no-extra-semi': 2, // http://eslint.org/docs/rules/no-extra-semi
+ //'no-func-assign': 2, // http://eslint.org/docs/rules/no-func-assign
+ //'no-inner-declarations': 2, // http://eslint.org/docs/rules/no-inner-declarations
+ //'no-invalid-regexp': 2, // http://eslint.org/docs/rules/no-invalid-regexp
+ //'no-irregular-whitespace': 2, // http://eslint.org/docs/rules/no-irregular-whitespace
+ //'no-obj-calls': 2, // http://eslint.org/docs/rules/no-obj-calls
+ //'no-sparse-arrays': 2, // http://eslint.org/docs/rules/no-sparse-arrays
+ //'no-unreachable': 2, // http://eslint.org/docs/rules/no-unreachable
+ //'use-isnan': 2, // http://eslint.org/docs/rules/use-isnan
+ 'valid-jsdoc': ['warn', {requireReturn: false}],
+
+ /**
+ * Best practices
+ */
+ 'consistent-return': [1, { treatUndefinedAsUnspecified: true}], // http://eslint.org/docs/rules/consistent-return
+ //'curly': [2, 'multi-line'], // http://eslint.org/docs/rules/curly
+ //'default-case': 2, // http://eslint.org/docs/rules/default-case
+ /*'dot-notation': [2, { // http://eslint.org/docs/rules/dot-notation
+ 'allowKeywords': true
+ }],*/
+ 'eqeqeq': 2, // http://eslint.org/docs/rules/eqeqeq
+ //'guard-for-in': 2, // http://eslint.org/docs/rules/guard-for-in
+ //'no-caller': 2, // http://eslint.org/docs/rules/no-caller
+ //'no-else-return': 2, // http://eslint.org/docs/rules/no-else-return
+ 'no-eq-null': 2, // http://eslint.org/docs/rules/no-eq-null
+ //'no-eval': 2, // http://eslint.org/docs/rules/no-eval
+ //'no-extend-native': 2, // http://eslint.org/docs/rules/no-extend-native
+ //'no-extra-bind': 2, // http://eslint.org/docs/rules/no-extra-bind
+ //'no-fallthrough': 2, // http://eslint.org/docs/rules/no-fallthrough
+ //'no-floating-decimal': 2, // http://eslint.org/docs/rules/no-floating-decimal
+ //'no-implied-eval': 2, // http://eslint.org/docs/rules/no-implied-eval
+ //'no-lone-blocks': 2, // http://eslint.org/docs/rules/no-lone-blocks
+ //'no-loop-func': 2, // http://eslint.org/docs/rules/no-loop-func
+ //'no-multi-str': 2, // http://eslint.org/docs/rules/no-multi-str
+ //'no-native-reassign': 2, // http://eslint.org/docs/rules/no-native-reassign
+ //'no-new': 2, // http://eslint.org/docs/rules/no-new
+ //'no-new-func': 2, // http://eslint.org/docs/rules/no-new-func
+ //'no-new-wrappers': 2, // http://eslint.org/docs/rules/no-new-wrappers
+ //'no-octal': 2, // http://eslint.org/docs/rules/no-octal
+ //'no-octal-escape': 2, // http://eslint.org/docs/rules/no-octal-escape
+ 'no-param-reassign': 0, // http://eslint.org/docs/rules/no-param-reassign
+ //'no-proto': 2, // http://eslint.org/docs/rules/no-proto
+ //'no-redeclare': 2, // http://eslint.org/docs/rules/no-redeclare
+ //'no-return-assign': 2, // http://eslint.org/docs/rules/no-return-assign
+ //'no-script-url': 2, // http://eslint.org/docs/rules/no-script-url
+ //'no-self-compare': 2, // http://eslint.or//g/docs/rules/no-self-compare
+ //'no-sequences': 2, // http://eslint.org/docs/rules/no-sequences
+ //'no-throw-literal': 2, // http://eslint.org/docs/rules/no-throw-literal
+ //'no-with': 2, // http://eslint.org/docs/rules/no-with
+ //'radix': 2, // http://eslint.org/docs/rules/radix
+ 'vars-on-top': 0, // http://eslint.org/docs/rules/vars-on-top
+ 'wrap-iife': [2, 'any'], // http://eslint.org/docs/rules/wrap-iife
+ //'yoda': 2, // http://eslint.org/docs/rules/yoda
+
+ /**
+ * Style
+ */
+ /*'brace-style': [ // http://eslint.org/docs/rules/brace-style
+ 2,
+ '1tbs',
+ { 'allowSingleLine': true }
+ ],*/
+ 'camelcase': [2, { // http://eslint.org/docs/rules/camelcase
+ 'properties': 'always'
+ }],
+ /*'comma-spacing': [2, { // http://eslint.org/docs/rules/comma-spacing
+ 'before': false,
+ 'after': true
+ }],*/
+ //'comma-style': [2, 'last'], // http://eslint.org/docs/rules/comma-style
+ 'eol-last': 0, // http://eslint.org/docs/rules/eol-last
+ 'func-names': 0, // http://eslint.org/docs/rules/func-names
+ /*'indent': [ //http://eslint.org/docs/rules/indent
+ 2,
+ 2,
+ { 'SwitchCase': 1 }
+ ],*/
+ /*'key-spacing': [2, { // http://eslint.org/docs/rules/key-spacing
+ 'beforeColon': false,
+ 'afterColon': true
+ }],*/
+ 'max-len': [2, 200, 2, {
+ ignoreUrls: true,
+ ignoreComments: false
+ }],
+ 'max-statements': [1, 30],
+ /*'new-cap': [2, { // http://eslint.org/docs/rules/new-cap
+ 'newIsCap': true
+ }],*/
+ 'no-multiple-empty-lines': [2, { // http://eslint.org/docs/rules/no-multiple-empty-lines
+ 'max': 2
+ }],
+ //'no-nested-ternary': 2, // http://eslint.org/docs/rules/no-nested-ternary
+ //'no-new-object': 2, // http://eslint.org/docs/rules/no-new-object
+ 'no-underscore-dangle': 0, // http://eslint.org/docs/rules/no-underscore-dangle
+ 'object-curly-spacing': [1, 'always'], //http://eslint.org/docs/rules/object-curly-spacing
+ //'one-var': [2, 'never'], // http://eslint.org/docs/rules/one-var
+ 'padded-blocks': [0, 'never'], // http://eslint.org/docs/rules/padded-blocks
+ /*'quotes': [
+ 2, 'single', {avoidEscape: true} // http://eslint.org/docs/rules/quotes
+ ],*/
+ //'semi': [2, 'always'], // http://eslint.org/docs/rules/semi
+ /*'semi-spacing': [2, { // http://eslint.org/docs/rules/semi-spacing
+ 'before': false,
+ 'after': true
+ }],*/
+ 'space-before-function-paren': [2, 'never'], // http://eslint.org/docs/rules/space-before-function-paren
+ 'space-in-parens': [1, 'never'],
+ 'space-infix-ops': 2, // http://eslint.org/docs/rules/space-infix-ops
+ 'spaced-comment': [1, 'always', {// http://eslint.org/docs/rules/spaced-comment
+ 'exceptions': ['*'],
+ 'markers': ['@TODO:', '@NOTE:', '@FIXME:', '@HACK:']
+ }],
+
+/**
+ * JSX style
+ */
+ /*
+ 'react/display-name': 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
+ 'react/jsx-boolean-value': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
+ 'react/jsx-quotes': [2, 'double'], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-quotes.md
+ 'react/jsx-no-undef': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
+ 'react/jsx-sort-props': 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
+ 'react/jsx-sort-prop-types': 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-prop-types.md
+ 'react/jsx-uses-react': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
+ 'react/jsx-uses-vars': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
+ 'react/no-did-mount-set-state': [2, 'allow-in-func'], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
+ 'react/no-did-update-set-state': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
+ 'react/no-multi-comp': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
+ 'react/no-unknown-property': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
+ 'react/prop-types': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
+ 'react/react-in-jsx-scope': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
+ 'react/self-closing-comp': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
+ 'react/wrap-multilines': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md
+ 'react/sort-comp': [2, { // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
+ 'order': [
+ 'displayName',
+ 'propTypes',
+ 'contextTypes',
+ 'childContextTypes',
+ 'mixins',
+ 'statics',
+ 'defaultProps',
+ 'constructor',
+ 'getDefaultProps',
+ 'getInitialState',
+ 'getChildContext',
+ 'componentWillMount',
+ 'componentDidMount',
+ 'componentWillReceiveProps',
+ 'shouldComponentUpdate',
+ 'componentWillUpdate',
+ 'componentDidUpdate',
+ 'componentWillUnmount',
+ '/^on.+$/',
+ '/^get.+$/',
+ '/^render.+$/',
+ 'render'
+ ]
+ }]
+*/
+ }
+};
+
+let version = require('eslint/package.json').version;
+let semver = require('semver');
+
+if (semver.satisfies(version, '>=2.0.0')) {
+ module.exports.rules['keyword-spacing'] = 2; // http://eslint.org/docs/rules/keyword-spacing
+} else {
+ module.exports.rules['no-spaced-func'] = 2; // http://eslint.org/docs/rules/no-spaced-func
+ module.exports.rules['no-trailing-spaces'] = 2; // http://eslint.org/docs/rules/no-trailing-spaces
+ module.exports.rules['space-return-throw-case'] = 2; // http://eslint.org/docs/rules/space-return-throw-case
+}
diff --git a/lib/dev.js b/lib/dev.js
new file mode 100644
index 0000000000..e7290c42a5
--- /dev/null
+++ b/lib/dev.js
@@ -0,0 +1,3 @@
+module.exports = {
+ extends: 'lint-trap/lib/defaults'
+};
diff --git a/lib/es6/ci.js b/lib/es6/ci.js
new file mode 100644
index 0000000000..e97516c613
--- /dev/null
+++ b/lib/es6/ci.js
@@ -0,0 +1,4 @@
+'use strict';
+
+var virtruLintConfig = require('../util').getEnv();
+module.exports = require('./ci/' + (virtruLintConfig.repoType || process.env.REPO_TYPE || 'frontend'));
diff --git a/lib/es6/ci/backend.js b/lib/es6/ci/backend.js
new file mode 100644
index 0000000000..675c1d2eb0
--- /dev/null
+++ b/lib/es6/ci/backend.js
@@ -0,0 +1,8 @@
+'use strict';
+
+module.exports = {
+ extends: 'lint-trap/lib/es6/ci/common',
+ rules: {
+ 'global-require': 'warn',
+ }
+};
diff --git a/lib/es6/ci/common.js b/lib/es6/ci/common.js
new file mode 100644
index 0000000000..46227b67cf
--- /dev/null
+++ b/lib/es6/ci/common.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = { extends: 'lint-trap/lib/es6/defaults' };
diff --git a/lib/es6/ci/frontend.js b/lib/es6/ci/frontend.js
new file mode 100644
index 0000000000..efde8f6dc1
--- /dev/null
+++ b/lib/es6/ci/frontend.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = { extends: 'lint-trap/lib/es6/ci/common' };
diff --git a/lib/es6/defaults.js b/lib/es6/defaults.js
new file mode 100644
index 0000000000..071c4c92da
--- /dev/null
+++ b/lib/es6/defaults.js
@@ -0,0 +1,14 @@
+'use strict';
+
+module.exports = {
+ extends: ['airbnb-base']
+ .concat([
+ '../overrides/best-practices',
+ '../overrides/errors',
+ '../overrides/node',
+ '../overrides/style',
+ '../overrides/variables',
+ '../overrides/es6',
+ '../overrides/imports',
+ ].map(require.resolve))
+};
diff --git a/lib/es6/dev.js b/lib/es6/dev.js
new file mode 100644
index 0000000000..e97516c613
--- /dev/null
+++ b/lib/es6/dev.js
@@ -0,0 +1,4 @@
+'use strict';
+
+var virtruLintConfig = require('../util').getEnv();
+module.exports = require('./ci/' + (virtruLintConfig.repoType || process.env.REPO_TYPE || 'frontend'));
diff --git a/lib/overrides/best-practices.js b/lib/overrides/best-practices.js
new file mode 100644
index 0000000000..14aceabd1c
--- /dev/null
+++ b/lib/overrides/best-practices.js
@@ -0,0 +1,64 @@
+// https://github.com/airbnb/javascript/blob/8cf2c70a4164ba2dad9a79e7ac9021d32a406487/packages/eslint-config-airbnb-base/rules/best-practices.js
+
+module.exports = {
+ rules: {
+ // require the use of === and !==
+ // https://eslint.org/docs/rules/eqeqeq
+ //eqeqeq: ['error', 'always', { null: 'ignore' }],
+ eqeqeq: ['error', 'smart'],
+
+ // disallow the use of alert, confirm, and prompt
+ //'no-alert': 'warn',
+ 'no-alert': 'error',
+
+ // disallow this keywords outside of classes or class-like objects
+ //'no-invalid-this': 'off',
+ 'no-invalid-this': 'error',
+
+ // disallow reassignment of function parameters
+ // disallow parameter object manipulation except for specific exclusions
+ // rule: https://eslint.org/docs/rules/no-param-reassign.html
+ /*
+ 'no-param-reassign': ['error', {
+ props: true,
+ ignorePropertyModificationsFor: [
+ 'acc', // for reduce accumulators
+ 'e', // for e.returnvalue
+ 'ctx', // for Koa routing
+ 'req', // for Express requests
+ 'request', // for Express requests
+ 'res', // for Express responses
+ 'response', // for Express responses
+ '$scope', // for Angular 1 scopes
+ ]
+ }],*/
+ 'no-param-reassign': 'off',
+
+ // disallow use of assignment in return statement
+ //'no-return-assign': ['error', 'always'],
+ 'no-return-assign': ['error', 'except-parens'],
+
+ // disallow unmodified conditions of loops
+ // https://eslint.org/docs/rules/no-unmodified-loop-condition
+ //'no-unmodified-loop-condition': 'off',
+ 'no-unmodified-loop-condition': 'warn',
+
+ // disallow unnecessary .call() and .apply()
+ //'no-useless-call': 'off',
+ 'no-useless-call': 'warn',
+
+ // require using Error objects as Promise rejection reasons
+ // https://eslint.org/docs/rules/prefer-promise-reject-errors
+ //'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
+ 'prefer-promise-reject-errors': ['warn', { allowEmptyReject: true }],
+
+ // require `await` in `async function` (note: this is a horrible rule that should never be used)
+ // https://eslint.org/docs/rules/require-await
+ //'require-await': 'off',
+ 'require-await': 'warn',
+
+ // requires to declare all vars on top of their containing scope
+ //'vars-on-top': 'error',
+ 'vars-on-top': 'warn',
+ }
+};
diff --git a/lib/overrides/errors.js b/lib/overrides/errors.js
new file mode 100644
index 0000000000..bc5845e600
--- /dev/null
+++ b/lib/overrides/errors.js
@@ -0,0 +1,29 @@
+// https://github.com/airbnb/javascript/blob/8cf2c70a4164ba2dad9a79e7ac9021d32a406487/packages/eslint-config-airbnb-base/rules/errors.js
+
+module.exports = {
+ rules: {
+ // disallow assignment in conditional expressions
+ //'no-cond-assign': ['error', 'always'],
+ 'no-cond-assign': ['error', 'except-parens'],
+
+ // disallow double-negation boolean casts in a boolean context
+ // https://eslint.org/docs/rules/no-extra-boolean-cast
+ 'no-extra-boolean-cast': 'error',
+
+ // disallow unnecessary parentheses
+ // https://eslint.org/docs/rules/no-extra-parens
+ /*'no-extra-parens': ['off', 'all', {
+ conditionalAssign: true,
+ nestedBinaryExpressions: false,
+ returnAssign: false,
+ ignoreJSX: 'all', // delegate to eslint-plugin-react
+ enforceForArrowConditionals: false,
+ }],*/
+ 'no-extra-parens': ['error', 'functions'],
+
+ // ensure JSDoc comments are valid
+ // https://eslint.org/docs/rules/valid-jsdoc
+ //'valid-jsdoc': 'off',
+ 'valid-jsdoc': ['warn', {requireReturn: false}],
+ }
+};
diff --git a/lib/overrides/es6.js b/lib/overrides/es6.js
new file mode 100644
index 0000000000..278249fc1c
--- /dev/null
+++ b/lib/overrides/es6.js
@@ -0,0 +1,64 @@
+// https://github.com/airbnb/javascript/blob/8cf2c70a4164ba2dad9a79e7ac9021d32a406487/packages/eslint-config-airbnb-base/rules/es6.js
+
+module.exports = {
+ parserOptions: {
+ sourceType: 'script', // Until we have full import/module usage across the board
+ },
+ rules: {
+ // enforces no braces where they can be omitted
+ // https://eslint.org/docs/rules/arrow-body-style
+ // TODO: enable requireReturnForObjectLiteral?
+ /*'arrow-body-style': ['error', 'as-needed', {
+ requireReturnForObjectLiteral: false,
+ }],*/
+ 'arrow-body-style': ['warn', 'as-needed', {
+ requireReturnForObjectLiteral: false,
+ }],
+
+ // require parens in arrow function arguments
+ // https://eslint.org/docs/rules/arrow-parens
+ /*'arrow-parens': ['error', 'as-needed', {
+ requireForBlockBody: true,
+ }],*/
+ 'arrow-parens': ['warn', 'as-needed', {
+ requireForBlockBody: true,
+ }],
+
+ // suggest using arrow functions as callbacks
+ /*'prefer-arrow-callback': ['error', {
+ allowNamedFunctions: false,
+ allowUnboundThis: true,
+ }],*/
+ 'prefer-arrow-callback': ['warn', {
+ allowNamedFunctions: true,
+ allowUnboundThis: true,
+ }],
+
+ // Prefer destructuring from arrays and objects
+ // https://eslint.org/docs/rules/prefer-destructuring
+ /*'prefer-destructuring': ['error', {
+ VariableDeclarator: {
+ array: false,
+ object: true,
+ },
+ AssignmentExpression: {
+ array: true,
+ object: true,
+ },
+ }, {
+ enforceForRenamedProperties: false,
+ }],*/
+ 'prefer-destructuring': ['warn', {
+ VariableDeclarator: {
+ array: false,
+ object: true,
+ },
+ AssignmentExpression: {
+ array: true,
+ object: true,
+ },
+ }, {
+ enforceForRenamedProperties: false,
+ }],
+ }
+};
diff --git a/lib/overrides/imports.js b/lib/overrides/imports.js
new file mode 100644
index 0000000000..deb67a022d
--- /dev/null
+++ b/lib/overrides/imports.js
@@ -0,0 +1,35 @@
+// https://github.com/airbnb/javascript/blob/8cf2c70a4164ba2dad9a79e7ac9021d32a406487/packages/eslint-config-airbnb-base/rules/imports.js
+
+module.exports = {
+ rules: {
+ // Static analysis:
+
+ // Helpful warnings:
+
+ // Module systems:
+
+ // Style guide:
+
+ // disallow non-import statements appearing before import statements
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md
+ //'import/first': ['error', 'absolute-first'],
+ 'import/first': ['warn', 'absolute-first'],
+
+ // Enforce a convention in module import order
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
+ // TODO: enable?
+ /*'import/order': ['off', {
+ groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
+ 'newlines-between': 'never',
+ }],*/
+ 'import/order': ['warn', {
+ groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
+ 'newlines-between': 'ignore',
+ }],
+
+ // Forbid require() calls with expressions
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
+ //'import/no-dynamic-require': 'error',
+ 'import/no-dynamic-require': 'warn',
+ },
+};
diff --git a/lib/overrides/node.js b/lib/overrides/node.js
new file mode 100644
index 0000000000..5353b4b478
--- /dev/null
+++ b/lib/overrides/node.js
@@ -0,0 +1,6 @@
+// https://github.com/airbnb/javascript/blob/8cf2c70a4164ba2dad9a79e7ac9021d32a406487/packages/eslint-config-airbnb-base/rules/node.js
+
+module.exports = {
+ rules: {
+ }
+};
diff --git a/lib/overrides/style.js b/lib/overrides/style.js
new file mode 100644
index 0000000000..d7287fbe11
--- /dev/null
+++ b/lib/overrides/style.js
@@ -0,0 +1,189 @@
+// https://github.com/airbnb/javascript/blob/8cf2c70a4164ba2dad9a79e7ac9021d32a406487/packages/eslint-config-airbnb-base/rules/style.js
+
+module.exports = {
+ rules: {
+ // enforce line breaks after opening and before closing array brackets
+ // https://eslint.org/docs/rules/array-bracket-newline
+ // TODO: enable? semver-major
+ //'array-bracket-newline': ['off', 'consistent'], // object option alternative: { multiline: true, minItems: 3 }
+ 'array-bracket-newline': ['error', 'consistent'],
+
+ // enforce line breaks between array elements
+ // https://eslint.org/docs/rules/array-element-newline
+ // TODO: enable? semver-major
+ //'array-element-newline': ['off', { multiline: true, minItems: 3 }],
+ 'array-element-newline': 'off', // Doesn't work as expected, need https://github.com/eslint/eslint/issues/9457 to be implemented
+
+ // require camel case names
+ //camelcase: ['error', { properties: 'never' }],
+ camelcase: ['error', { properties: 'always' }],
+
+ // require trailing commas in multiline object literals
+ /*'comma-dangle': ['error', {
+ arrays: 'always-multiline',
+ objects: 'always-multiline',
+ imports: 'always-multiline',
+ exports: 'always-multiline',
+ functions: 'always-multiline',
+ }],*/
+ 'comma-dangle': ['error', 'only-multiline'],
+
+ // enforce newline at the end of file, with no multiple empty lines
+ //'eol-last': ['error', 'always'],
+ 'eol-last': 'off',
+
+ // require function expressions to have a name
+ // https://eslint.org/docs/rules/func-names
+ //'func-names': 'warn',
+ 'func-names': ['warn', 'as-needed'],
+
+ // enforces use of function declarations or expressions
+ // https://eslint.org/docs/rules/func-style
+ // TODO: enable
+ //'func-style': ['off', 'expression'],
+ 'func-style': ['warn', 'declaration', { allowArrowFunctions: true }],
+
+ // enforce consistent line breaks inside function parentheses
+ // https://eslint.org/docs/rules/function-paren-newline
+ //'function-paren-newline': ['error', 'multiline'],
+ 'function-paren-newline': ['warn', 'consistent'], // This is very strict the rule, so switch to warn
+
+ // enforce position of line comments
+ // https://eslint.org/docs/rules/line-comment-position
+ // TODO: enable?
+ /*'line-comment-position': ['off', {
+ position: 'above',
+ ignorePattern: '',
+ applyDefaultPatterns: true,
+ }],*/
+ 'line-comment-position': 'off',
+
+ // require or disallow an empty line between class members
+ // https://eslint.org/docs/rules/lines-between-class-members
+ //'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: false }],
+ 'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
+
+ // require or disallow newlines around directives
+ // https://eslint.org/docs/rules/lines-around-directive
+ /*'lines-around-directive': ['error', {
+ before: 'always',
+ after: 'always',
+ }],*/
+ 'lines-around-directive': 'off',
+
+ // specify the maximum depth that blocks can be nested
+ //'max-depth': ['off', 4],
+ 'max-depth': ['warn', 4],
+
+ // specify the maximum length of a line in your program
+ // https://eslint.org/docs/rules/max-len
+ /*'max-len': ['error', 100, 2, {
+ ignoreUrls: true,
+ ignoreComments: false,
+ ignoreRegExpLiterals: true,
+ ignoreStrings: true,
+ ignoreTemplateLiterals: true,
+ }],*/
+ 'max-len': ['error', 200, 2, {
+ ignoreUrls: true,
+ ignoreComments: false,
+ ignoreRegExpLiterals: true,
+ ignoreStrings: true,
+ ignoreTemplateLiterals: true,
+ }],
+
+ // specify the maximum depth callbacks can be nested
+ //'max-nested-callbacks': 'off',
+ 'max-nested-callbacks': ['warn', { max: 2 }],
+
+ // limits the number of parameters that can be used in the function declaration.
+ //'max-params': ['off', 3],
+ 'max-params': ['warn', { max: 5 }],
+
+ // require multiline ternary
+ // https://eslint.org/docs/rules/multiline-ternary
+ // TODO: enable?
+ //'multiline-ternary': ['off', 'never'],
+ 'multiline-ternary': ['error', 'always-multiline'],
+
+ // enforces new line after each method call in the chain to make it
+ // more readable and easy to maintain
+ // https://eslint.org/docs/rules/newline-per-chained-call
+ //'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }],
+ 'newline-per-chained-call': ['warn', { ignoreChainWithDepth: 4 }],
+
+ // disallow negated conditions
+ // https://eslint.org/docs/rules/no-negated-condition
+ //'no-negated-condition': 'off',
+ 'no-negated-condition': 'warn',
+
+ // disallow use of unary operators, ++ and --
+ // https://eslint.org/docs/rules/no-plusplus
+ //'no-plusplus': 'error',
+ 'no-plusplus': 'off',
+
+ // disallow dangling underscores in identifiers
+ /*'no-underscore-dangle': ['error', {
+ allow: [],
+ allowAfterThis: false,
+ allowAfterSuper: false,
+ enforceInMethodNames: false,
+ }],*/
+ 'no-underscore-dangle': 'off',
+
+ // require padding inside curly braces
+ //'object-curly-spacing': ['error', 'always'],
+ 'object-curly-spacing': ['warn', 'always'],
+
+ // enforce line breaks between braces
+ // https://eslint.org/docs/rules/object-curly-newline
+ /*'object-curly-newline': ['error', {
+ ObjectExpression: { minProperties: 4, multiline: true, consistent: true },
+ ObjectPattern: { minProperties: 4, multiline: true, consistent: true }
+ }],*/
+ 'object-curly-newline': ['error', {
+ ObjectExpression: { consistent: true },
+ ObjectPattern: { consistent: true }
+ }],
+
+ // require assignment operator shorthand where possible or prohibit it entirely
+ // https://eslint.org/docs/rules/operator-assignment
+ //'operator-assignment': ['error', 'always'],
+ 'operator-assignment': ['warn', 'always'],
+
+ // require or disallow space before function opening parenthesis
+ // https://eslint.org/docs/rules/space-before-function-paren
+ /*'space-before-function-paren': ['error', {
+ anonymous: 'always',
+ named: 'never',
+ asyncArrow: 'always'
+ }],*/
+ 'space-before-function-paren': ['error', {
+ anonymous: 'never',
+ named: 'never',
+ asyncArrow: 'always'
+ }],
+
+ // require or disallow spaces inside parentheses
+ //'space-in-parens': ['error', 'never'],
+ 'space-in-parens': ['warn', 'never'],
+
+ // require or disallow a space immediately following the // or /* in a comment
+ // https://eslint.org/docs/rules/spaced-comment
+ /*'spaced-comment': ['error', 'always', {
+ line: {
+ exceptions: ['-', '+'],
+ markers: ['=', '!'], // space here to support sprockets directives
+ },
+ block: {
+ exceptions: ['-', '+'],
+ markers: ['=', '!'], // space here to support sprockets directives
+ balanced: true,
+ }
+ }],*/
+ 'spaced-comment': ['warn', 'always', {// http://eslint.org/docs/rules/spaced-comment
+ 'exceptions': ['*'],
+ 'markers': ['@TODO:', '@NOTE:', '@FIXME:', '@HACK:']
+ }],
+ }
+};
diff --git a/lib/overrides/variables.js b/lib/overrides/variables.js
new file mode 100644
index 0000000000..f4a3d35f39
--- /dev/null
+++ b/lib/overrides/variables.js
@@ -0,0 +1,13 @@
+// https://github.com/airbnb/javascript/blob/8cf2c70a4164ba2dad9a79e7ac9021d32a406487/packages/eslint-config-airbnb-base/rules/variables.js
+
+module.exports = {
+ rules: {
+ // disallow declaration of variables that are not used in the code
+ //'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }],
+ 'no-unused-vars': ['error', { vars: 'all', args: 'none', ignoreRestSiblings: true }],
+
+ // disallow use of variables before they are defined
+ //'no-use-before-define': ['error', { functions: true, classes: true, variables: true }],
+ 'no-use-before-define': ['error', { functions: false, classes: true, variables: true }],
+ }
+};
diff --git a/lib/util.js b/lib/util.js
new file mode 100644
index 0000000000..e35af7de71
--- /dev/null
+++ b/lib/util.js
@@ -0,0 +1,38 @@
+'use strict';
+
+const fs = require('fs');
+const path = require('path');
+
+let virtruLint = undefined;
+
+/**
+ * This function pulls the locally applied elsint config from the
+ * package.json file. It looks for an element named 'virtruLint'
+ * that takes the form:
+ *
+ * ```
+ * "virtruLint": {
+ * "repoEnvironment": "ci|dev",
+ * "repoType": "frontend|backend"
+ * }
+ * ```
+ * This maps to the environment variables used to control the configurations.
+ * These configurations will take lower precendence than the environment
+ * variables.
+ *
+ * @returns {*} - The configuration, if it exists, or an empty object
+ */
+module.exports.getEnv = function() {
+ if (!virtruLint) {
+ virtruLint = {};
+
+ var packageJsonPath = path.resolve(process.cwd(), 'package.json');
+ if (fs.existsSync(packageJsonPath)) {
+ let packageJson = require(packageJsonPath);
+ virtruLint = packageJson.virtruLint || packageJson.virtru && packageJson.virtru.lint;
+ virtruLint = virtruLint || {};
+ }
+ }
+
+ return virtruLint;
+};
diff --git a/linters/.eslintrc b/linters/.eslintrc
deleted file mode 100644
index 9e203a5473..0000000000
--- a/linters/.eslintrc
+++ /dev/null
@@ -1,5 +0,0 @@
-// Use this file as a starting point for your project's .eslintrc.
-// Copy this file, and add rule overrides as needed.
-{
- "extends": "airbnb"
-}
diff --git a/linters/README.md b/linters/README.md
deleted file mode 100644
index b027a5dcd2..0000000000
--- a/linters/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-## `.eslintrc`
-
-Our `.eslintrc` requires the following NPM packages:
-
-- `eslint-config-airbnb`
-- `eslint`
-- `babel-eslint`
-- `eslint-plugin-react`
diff --git a/linters/SublimeLinter/SublimeLinter.sublime-settings b/linters/SublimeLinter/SublimeLinter.sublime-settings
deleted file mode 100644
index 12360f3f1c..0000000000
--- a/linters/SublimeLinter/SublimeLinter.sublime-settings
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Airbnb JSHint settings for use with SublimeLinter and Sublime Text 2.
- *
- * 1. Install SublimeLinter at https://github.com/SublimeLinter/SublimeLinter
- * 2. Open user preferences for the SublimeLinter package in Sublime Text 2
- * * For Mac OS X go to _Sublime Text 2_ > _Preferences_ > _Package Settings_ > _SublimeLinter_ > _Settings - User_
- * 3. Paste the contents of this file into your settings file
- * 4. Save the settings file
- *
- * @version 0.3.0
- * @see https://github.com/SublimeLinter/SublimeLinter
- * @see http://www.jshint.com/docs/
- */
-{
- "jshint_options":
- {
- /*
- * ENVIRONMENTS
- * =================
- */
-
- // Define globals exposed by modern browsers.
- "browser": true,
-
- // Define globals exposed by jQuery.
- "jquery": true,
-
- // Define globals exposed by Node.js.
- "node": true,
-
- /*
- * ENFORCING OPTIONS
- * =================
- */
-
- // Force all variable names to use either camelCase style or UPPER_CASE
- // with underscores.
- "camelcase": true,
-
- // Prohibit use of == and != in favor of === and !==.
- "eqeqeq": true,
-
- // Suppress warnings about == null comparisons.
- "eqnull": true,
-
- // Enforce tab width of 2 spaces.
- "indent": 2,
-
- // Prohibit use of a variable before it is defined.
- "latedef": true,
-
- // Require capitalized names for constructor functions.
- "newcap": true,
-
- // Enforce use of single quotation marks for strings.
- "quotmark": "single",
-
- // Prohibit trailing whitespace.
- "trailing": true,
-
- // Prohibit use of explicitly undeclared variables.
- "undef": true,
-
- // Warn when variables are defined but never used.
- "unused": true,
-
- // Enforce line length to 80 characters
- "maxlen": 80,
-
- // Enforce placing 'use strict' at the top function scope
- "strict": true
- }
-}
diff --git a/linters/jshintrc b/linters/jshintrc
deleted file mode 100644
index 141067fd23..0000000000
--- a/linters/jshintrc
+++ /dev/null
@@ -1,62 +0,0 @@
-{
- /*
- * ENVIRONMENTS
- * =================
- */
-
- // Define globals exposed by modern browsers.
- "browser": true,
-
- // Define globals exposed by jQuery.
- "jquery": true,
-
- // Define globals exposed by Node.js.
- "node": true,
-
- // Allow ES6.
- "esnext": true,
-
- /*
- * ENFORCING OPTIONS
- * =================
- */
-
- // Force all variable names to use either camelCase style or UPPER_CASE
- // with underscores.
- "camelcase": true,
-
- // Prohibit use of == and != in favor of === and !==.
- "eqeqeq": true,
-
- // Enforce tab width of 2 spaces.
- "indent": 2,
-
- // Prohibit use of a variable before it is defined.
- "latedef": true,
-
- // Enforce line length to 80 characters
- "maxlen": 80,
-
- // Require capitalized names for constructor functions.
- "newcap": true,
-
- // Enforce use of single quotation marks for strings.
- "quotmark": "single",
-
- // Enforce placing 'use strict' at the top function scope
- "strict": true,
-
- // Prohibit use of explicitly undeclared variables.
- "undef": true,
-
- // Warn when variables are defined but never used.
- "unused": true,
-
- /*
- * RELAXING OPTIONS
- * =================
- */
-
- // Suppress warnings about == null comparisons.
- "eqnull": true
-}
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000000..e7fba3eebb
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,936 @@
+{
+ "name": "eslint-config-lint-trap",
+ "version": "3.0.0",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "acorn": {
+ "version": "5.7.3",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz",
+ "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw=="
+ },
+ "acorn-jsx": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz",
+ "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=",
+ "requires": {
+ "acorn": "^3.0.4"
+ },
+ "dependencies": {
+ "acorn": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
+ "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo="
+ }
+ }
+ },
+ "ajv": {
+ "version": "5.5.2",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
+ "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
+ "requires": {
+ "co": "^4.6.0",
+ "fast-deep-equal": "^1.0.0",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.3.0"
+ }
+ },
+ "ajv-keywords": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz",
+ "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I="
+ },
+ "ansi-escapes": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
+ "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ=="
+ },
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
+ },
+ "ansi-styles": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
+ "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
+ },
+ "argparse": {
+ "version": "1.0.10",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "requires": {
+ "sprintf-js": "~1.0.2"
+ }
+ },
+ "babel-code-frame": {
+ "version": "6.26.0",
+ "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
+ "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
+ "requires": {
+ "chalk": "^1.1.3",
+ "esutils": "^2.0.2",
+ "js-tokens": "^3.0.2"
+ },
+ "dependencies": {
+ "chalk": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
+ "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
+ "requires": {
+ "ansi-styles": "^2.2.1",
+ "escape-string-regexp": "^1.0.2",
+ "has-ansi": "^2.0.0",
+ "strip-ansi": "^3.0.0",
+ "supports-color": "^2.0.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ }
+ }
+ },
+ "balanced-match": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
+ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
+ },
+ "brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "requires": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "buffer-from": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
+ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A=="
+ },
+ "caller-path": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz",
+ "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=",
+ "requires": {
+ "callsites": "^0.2.0"
+ }
+ },
+ "callsites": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz",
+ "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo="
+ },
+ "chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "chardet": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz",
+ "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I="
+ },
+ "circular-json": {
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz",
+ "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A=="
+ },
+ "cli-cursor": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
+ "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",
+ "requires": {
+ "restore-cursor": "^2.0.0"
+ }
+ },
+ "cli-width": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz",
+ "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk="
+ },
+ "co": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
+ "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
+ },
+ "color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "requires": {
+ "color-name": "1.1.3"
+ }
+ },
+ "color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
+ },
+ "concat-stream": {
+ "version": "1.6.2",
+ "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
+ "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
+ "requires": {
+ "buffer-from": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^2.2.2",
+ "typedarray": "^0.0.6"
+ }
+ },
+ "core-util-is": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
+ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
+ },
+ "cross-spawn": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
+ "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
+ "requires": {
+ "lru-cache": "^4.0.1",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ }
+ },
+ "debug": {
+ "version": "3.2.6",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
+ "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "deep-is": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
+ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ="
+ },
+ "doctrine": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
+ "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
+ "requires": {
+ "esutils": "^2.0.2"
+ }
+ },
+ "escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
+ },
+ "eslint": {
+ "version": "4.19.1",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.19.1.tgz",
+ "integrity": "sha512-bT3/1x1EbZB7phzYu7vCr1v3ONuzDtX8WjuM9c0iYxe+cq+pwcKEoQjl7zd3RpC6YOLgnSy3cTN58M2jcoPDIQ==",
+ "requires": {
+ "ajv": "^5.3.0",
+ "babel-code-frame": "^6.22.0",
+ "chalk": "^2.1.0",
+ "concat-stream": "^1.6.0",
+ "cross-spawn": "^5.1.0",
+ "debug": "^3.1.0",
+ "doctrine": "^2.1.0",
+ "eslint-scope": "^3.7.1",
+ "eslint-visitor-keys": "^1.0.0",
+ "espree": "^3.5.4",
+ "esquery": "^1.0.0",
+ "esutils": "^2.0.2",
+ "file-entry-cache": "^2.0.0",
+ "functional-red-black-tree": "^1.0.1",
+ "glob": "^7.1.2",
+ "globals": "^11.0.1",
+ "ignore": "^3.3.3",
+ "imurmurhash": "^0.1.4",
+ "inquirer": "^3.0.6",
+ "is-resolvable": "^1.0.0",
+ "js-yaml": "^3.9.1",
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "levn": "^0.3.0",
+ "lodash": "^4.17.4",
+ "minimatch": "^3.0.2",
+ "mkdirp": "^0.5.1",
+ "natural-compare": "^1.4.0",
+ "optionator": "^0.8.2",
+ "path-is-inside": "^1.0.2",
+ "pluralize": "^7.0.0",
+ "progress": "^2.0.0",
+ "regexpp": "^1.0.1",
+ "require-uncached": "^1.0.3",
+ "semver": "^5.3.0",
+ "strip-ansi": "^4.0.0",
+ "strip-json-comments": "~2.0.1",
+ "table": "4.0.2",
+ "text-table": "~0.2.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.6.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz",
+ "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg=="
+ }
+ }
+ },
+ "eslint-scope": {
+ "version": "3.7.3",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.3.tgz",
+ "integrity": "sha512-W+B0SvF4gamyCTmUc+uITPY0989iXVfKvhwtmJocTaYoc/3khEHmEmvfY/Gn9HA9VV75jrQECsHizkNw1b68FA==",
+ "requires": {
+ "esrecurse": "^4.1.0",
+ "estraverse": "^4.1.1"
+ }
+ },
+ "eslint-visitor-keys": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",
+ "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ=="
+ },
+ "espree": {
+ "version": "3.5.4",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz",
+ "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==",
+ "requires": {
+ "acorn": "^5.5.0",
+ "acorn-jsx": "^3.0.0"
+ }
+ },
+ "esprima": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
+ "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
+ },
+ "esquery": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz",
+ "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==",
+ "requires": {
+ "estraverse": "^4.0.0"
+ }
+ },
+ "esrecurse": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz",
+ "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==",
+ "requires": {
+ "estraverse": "^4.1.0"
+ }
+ },
+ "estraverse": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz",
+ "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM="
+ },
+ "esutils": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
+ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs="
+ },
+ "external-editor": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz",
+ "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==",
+ "requires": {
+ "chardet": "^0.4.0",
+ "iconv-lite": "^0.4.17",
+ "tmp": "^0.0.33"
+ }
+ },
+ "fast-deep-equal": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
+ "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
+ },
+ "fast-json-stable-stringify": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
+ "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
+ },
+ "fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc="
+ },
+ "figures": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
+ "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=",
+ "requires": {
+ "escape-string-regexp": "^1.0.5"
+ }
+ },
+ "file-entry-cache": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz",
+ "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=",
+ "requires": {
+ "flat-cache": "^1.2.1",
+ "object-assign": "^4.0.1"
+ }
+ },
+ "flat-cache": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.4.tgz",
+ "integrity": "sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg==",
+ "requires": {
+ "circular-json": "^0.3.1",
+ "graceful-fs": "^4.1.2",
+ "rimraf": "~2.6.2",
+ "write": "^0.2.1"
+ }
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
+ },
+ "functional-red-black-tree": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
+ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc="
+ },
+ "glob": {
+ "version": "7.1.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
+ "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ },
+ "globals": {
+ "version": "11.11.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-11.11.0.tgz",
+ "integrity": "sha512-WHq43gS+6ufNOEqlrDBxVEbb8ntfXrfAUU2ZOpCxrBdGKW3gyv8mCxAfIBD0DroPKGrJ2eSsXsLtY9MPntsyTw=="
+ },
+ "graceful-fs": {
+ "version": "4.1.15",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
+ "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA=="
+ },
+ "has-ansi": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
+ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ },
+ "has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
+ },
+ "iconv-lite": {
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ }
+ },
+ "ignore": {
+ "version": "3.3.10",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz",
+ "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug=="
+ },
+ "imurmurhash": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o="
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "requires": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
+ },
+ "inquirer": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz",
+ "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==",
+ "requires": {
+ "ansi-escapes": "^3.0.0",
+ "chalk": "^2.0.0",
+ "cli-cursor": "^2.1.0",
+ "cli-width": "^2.0.0",
+ "external-editor": "^2.0.4",
+ "figures": "^2.0.0",
+ "lodash": "^4.3.0",
+ "mute-stream": "0.0.7",
+ "run-async": "^2.2.0",
+ "rx-lite": "^4.0.8",
+ "rx-lite-aggregates": "^4.0.8",
+ "string-width": "^2.1.0",
+ "strip-ansi": "^4.0.0",
+ "through": "^2.3.6"
+ }
+ },
+ "is-fullwidth-code-point": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
+ "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
+ },
+ "is-promise": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz",
+ "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o="
+ },
+ "is-resolvable": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz",
+ "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg=="
+ },
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
+ },
+ "isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
+ },
+ "js-tokens": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
+ "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls="
+ },
+ "js-yaml": {
+ "version": "3.12.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz",
+ "integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==",
+ "requires": {
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ }
+ },
+ "json-schema-traverse": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
+ "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A="
+ },
+ "json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE="
+ },
+ "levn": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
+ "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=",
+ "requires": {
+ "prelude-ls": "~1.1.2",
+ "type-check": "~0.3.2"
+ }
+ },
+ "lodash": {
+ "version": "4.17.11",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
+ "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
+ },
+ "lru-cache": {
+ "version": "4.1.5",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
+ "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
+ "requires": {
+ "pseudomap": "^1.0.2",
+ "yallist": "^2.1.2"
+ }
+ },
+ "mimic-fn": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
+ "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ=="
+ },
+ "minimatch": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "minimist": {
+ "version": "0.0.8",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
+ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
+ },
+ "mkdirp": {
+ "version": "0.5.1",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
+ "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
+ "requires": {
+ "minimist": "0.0.8"
+ }
+ },
+ "ms": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
+ "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
+ },
+ "mute-stream": {
+ "version": "0.0.7",
+ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
+ "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s="
+ },
+ "natural-compare": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc="
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "onetime": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
+ "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",
+ "requires": {
+ "mimic-fn": "^1.0.0"
+ }
+ },
+ "optionator": {
+ "version": "0.8.2",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",
+ "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=",
+ "requires": {
+ "deep-is": "~0.1.3",
+ "fast-levenshtein": "~2.0.4",
+ "levn": "~0.3.0",
+ "prelude-ls": "~1.1.2",
+ "type-check": "~0.3.2",
+ "wordwrap": "~1.0.0"
+ }
+ },
+ "os-tmpdir": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
+ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
+ },
+ "path-is-inside": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz",
+ "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM="
+ },
+ "pluralize": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz",
+ "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow=="
+ },
+ "prelude-ls": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
+ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ="
+ },
+ "process-nextick-args": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
+ "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw=="
+ },
+ "progress": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
+ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA=="
+ },
+ "pseudomap": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
+ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM="
+ },
+ "readable-stream": {
+ "version": "2.3.6",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
+ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ },
+ "regexpp": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-1.1.0.tgz",
+ "integrity": "sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw=="
+ },
+ "require-uncached": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz",
+ "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=",
+ "requires": {
+ "caller-path": "^0.1.0",
+ "resolve-from": "^1.0.0"
+ }
+ },
+ "resolve-from": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz",
+ "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY="
+ },
+ "restore-cursor": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
+ "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",
+ "requires": {
+ "onetime": "^2.0.0",
+ "signal-exit": "^3.0.2"
+ }
+ },
+ "rimraf": {
+ "version": "2.6.3",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
+ "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "run-async": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz",
+ "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=",
+ "requires": {
+ "is-promise": "^2.1.0"
+ }
+ },
+ "rx-lite": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz",
+ "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ="
+ },
+ "rx-lite-aggregates": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz",
+ "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=",
+ "requires": {
+ "rx-lite": "*"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
+ },
+ "shebang-command": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
+ "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
+ "requires": {
+ "shebang-regex": "^1.0.0"
+ }
+ },
+ "shebang-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
+ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM="
+ },
+ "signal-exit": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
+ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
+ },
+ "slice-ansi": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz",
+ "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==",
+ "requires": {
+ "is-fullwidth-code-point": "^2.0.0"
+ }
+ },
+ "sprintf-js": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
+ },
+ "string-width": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
+ "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
+ "requires": {
+ "is-fullwidth-code-point": "^2.0.0",
+ "strip-ansi": "^4.0.0"
+ }
+ },
+ "string_decoder": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
+ "requires": {
+ "safe-buffer": "~5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
+ "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
+ "requires": {
+ "ansi-regex": "^3.0.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
+ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg="
+ }
+ }
+ },
+ "strip-json-comments": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
+ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo="
+ },
+ "supports-color": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
+ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc="
+ },
+ "table": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz",
+ "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==",
+ "requires": {
+ "ajv": "^5.2.3",
+ "ajv-keywords": "^2.1.0",
+ "chalk": "^2.1.0",
+ "lodash": "^4.17.4",
+ "slice-ansi": "1.0.0",
+ "string-width": "^2.1.1"
+ }
+ },
+ "text-table": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
+ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ="
+ },
+ "through": {
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
+ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
+ },
+ "tmp": {
+ "version": "0.0.33",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
+ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
+ "requires": {
+ "os-tmpdir": "~1.0.2"
+ }
+ },
+ "type-check": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
+ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=",
+ "requires": {
+ "prelude-ls": "~1.1.2"
+ }
+ },
+ "typedarray": {
+ "version": "0.0.6",
+ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
+ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
+ },
+ "util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
+ },
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ },
+ "wordwrap": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
+ "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus="
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
+ },
+ "write": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz",
+ "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=",
+ "requires": {
+ "mkdirp": "^0.5.1"
+ }
+ },
+ "yallist": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
+ "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI="
+ }
+ }
+}
diff --git a/package.json b/package.json
index dc0225dc08..9ca155e564 100644
--- a/package.json
+++ b/package.json
@@ -1,28 +1,29 @@
{
- "name": "airbnb-style",
- "version": "2.0.0",
- "description": "A mostly reasonable approach to JavaScript.",
+ "name": "eslint-config-lint-trap",
+ "version": "3.0.0",
+ "description": "A fork of AirBnB's eslint config for use at Virtru",
+ "main": "index.js",
"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1",
- "publish-all": "npm publish && cd ./packages/eslint-config-airbnb && npm publish"
+ "test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
- "url": "https://github.com/airbnb/javascript.git"
+ "url": "git+ssh://git@github.com/virtru/lint-trap.git"
},
"keywords": [
- "style guide",
- "lint",
- "airbnb",
- "es6",
- "es2015",
- "react",
- "jsx"
+ "eslint",
+ "eslintconfig"
],
- "author": "Harrison Shoff (https://twitter.com/hshoff)",
+ "author": "Gregory Waxman",
"license": "MIT",
"bugs": {
- "url": "https://github.com/airbnb/javascript/issues"
+ "url": "https://github.com/virtru/lint-trap/issues"
},
- "homepage": "https://github.com/airbnb/javascript"
+ "homepage": "https://github.com/virtru/lint-trap#readme",
+ "dependencies": {
+ "eslint": "^4.19.1",
+ "eslint-config-airbnb-base": "^12.1.0",
+ "eslint-plugin-import": "^2.8.0",
+ "semver": "^5.4.1"
+ }
}
diff --git a/packages/eslint-config-airbnb/README.md b/packages/eslint-config-airbnb/README.md
deleted file mode 100644
index 6edb34f355..0000000000
--- a/packages/eslint-config-airbnb/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# eslint-config-airbnb
-
-This package provides Airbnb's .eslintrc as an extensible shared config.
-
-## Usage
-
-1. `npm install --save-dev eslint-config-airbnb babel-eslint eslint-plugin-react`
-2. add `"extends": "eslint-config-airbnb"` to your .eslintrc
-
-See [Airbnb's Javascript styleguide](https://github.com/airbnb/javascript) and
-the [ESlint config docs](http://eslint.org/docs/user-guide/configuring#extending-configuration-files)
-for more information.
diff --git a/packages/eslint-config-airbnb/index.js b/packages/eslint-config-airbnb/index.js
deleted file mode 100644
index 35bc6b07d2..0000000000
--- a/packages/eslint-config-airbnb/index.js
+++ /dev/null
@@ -1,220 +0,0 @@
-module.exports = {
- 'parser': 'babel-eslint', // https://github.com/babel/babel-eslint
- 'plugins': [
- 'react' // https://github.com/yannickcr/eslint-plugin-react
- ],
- 'env': { // http://eslint.org/docs/user-guide/configuring.html#specifying-environments
- 'browser': true, // browser global variables
- 'node': true // Node.js global variables and Node.js-specific rules
- },
- 'ecmaFeatures': {
- 'arrowFunctions': true,
- 'blockBindings': true,
- 'classes': true,
- 'defaultParams': true,
- 'destructuring': true,
- 'forOf': true,
- 'generators': false,
- 'modules': true,
- 'objectLiteralComputedProperties': true,
- 'objectLiteralDuplicateProperties': false,
- 'objectLiteralShorthandMethods': true,
- 'objectLiteralShorthandProperties': true,
- 'spread': true,
- 'superInFunctions': true,
- 'templateStrings': true,
- 'jsx': true
- },
- 'rules': {
-/**
- * Strict mode
- */
- // babel inserts 'use strict'; for us
- 'strict': [2, 'never'], // http://eslint.org/docs/rules/strict
-
-/**
- * ES6
- */
- 'no-var': 2, // http://eslint.org/docs/rules/no-var
- 'prefer-const': 2, // http://eslint.org/docs/rules/prefer-const
-
-/**
- * Variables
- */
- 'no-shadow': 2, // http://eslint.org/docs/rules/no-shadow
- 'no-shadow-restricted-names': 2, // http://eslint.org/docs/rules/no-shadow-restricted-names
- 'no-unused-vars': [2, { // http://eslint.org/docs/rules/no-unused-vars
- 'vars': 'local',
- 'args': 'after-used'
- }],
- 'no-use-before-define': 2, // http://eslint.org/docs/rules/no-use-before-define
-
-/**
- * Possible errors
- */
- 'comma-dangle': [2, 'always-multiline'], // http://eslint.org/docs/rules/comma-dangle
- 'no-cond-assign': [2, 'always'], // http://eslint.org/docs/rules/no-cond-assign
- 'no-console': 1, // http://eslint.org/docs/rules/no-console
- 'no-debugger': 1, // http://eslint.org/docs/rules/no-debugger
- 'no-alert': 1, // http://eslint.org/docs/rules/no-alert
- 'no-constant-condition': 1, // http://eslint.org/docs/rules/no-constant-condition
- 'no-dupe-keys': 2, // http://eslint.org/docs/rules/no-dupe-keys
- 'no-duplicate-case': 2, // http://eslint.org/docs/rules/no-duplicate-case
- 'no-empty': 2, // http://eslint.org/docs/rules/no-empty
- 'no-ex-assign': 2, // http://eslint.org/docs/rules/no-ex-assign
- 'no-extra-boolean-cast': 0, // http://eslint.org/docs/rules/no-extra-boolean-cast
- 'no-extra-semi': 2, // http://eslint.org/docs/rules/no-extra-semi
- 'no-func-assign': 2, // http://eslint.org/docs/rules/no-func-assign
- 'no-inner-declarations': 2, // http://eslint.org/docs/rules/no-inner-declarations
- 'no-invalid-regexp': 2, // http://eslint.org/docs/rules/no-invalid-regexp
- 'no-irregular-whitespace': 2, // http://eslint.org/docs/rules/no-irregular-whitespace
- 'no-obj-calls': 2, // http://eslint.org/docs/rules/no-obj-calls
- 'no-sparse-arrays': 2, // http://eslint.org/docs/rules/no-sparse-arrays
- 'no-unreachable': 2, // http://eslint.org/docs/rules/no-unreachable
- 'use-isnan': 2, // http://eslint.org/docs/rules/use-isnan
- 'block-scoped-var': 2, // http://eslint.org/docs/rules/block-scoped-var
-
-/**
- * Best practices
- */
- 'consistent-return': 2, // http://eslint.org/docs/rules/consistent-return
- 'curly': [2, 'multi-line'], // http://eslint.org/docs/rules/curly
- 'default-case': 2, // http://eslint.org/docs/rules/default-case
- 'dot-notation': [2, { // http://eslint.org/docs/rules/dot-notation
- 'allowKeywords': true
- }],
- 'eqeqeq': 2, // http://eslint.org/docs/rules/eqeqeq
- 'guard-for-in': 2, // http://eslint.org/docs/rules/guard-for-in
- 'no-caller': 2, // http://eslint.org/docs/rules/no-caller
- 'no-else-return': 2, // http://eslint.org/docs/rules/no-else-return
- 'no-eq-null': 2, // http://eslint.org/docs/rules/no-eq-null
- 'no-eval': 2, // http://eslint.org/docs/rules/no-eval
- 'no-extend-native': 2, // http://eslint.org/docs/rules/no-extend-native
- 'no-extra-bind': 2, // http://eslint.org/docs/rules/no-extra-bind
- 'no-fallthrough': 2, // http://eslint.org/docs/rules/no-fallthrough
- 'no-floating-decimal': 2, // http://eslint.org/docs/rules/no-floating-decimal
- 'no-implied-eval': 2, // http://eslint.org/docs/rules/no-implied-eval
- 'no-lone-blocks': 2, // http://eslint.org/docs/rules/no-lone-blocks
- 'no-loop-func': 2, // http://eslint.org/docs/rules/no-loop-func
- 'no-multi-str': 2, // http://eslint.org/docs/rules/no-multi-str
- 'no-native-reassign': 2, // http://eslint.org/docs/rules/no-native-reassign
- 'no-new': 2, // http://eslint.org/docs/rules/no-new
- 'no-new-func': 2, // http://eslint.org/docs/rules/no-new-func
- 'no-new-wrappers': 2, // http://eslint.org/docs/rules/no-new-wrappers
- 'no-octal': 2, // http://eslint.org/docs/rules/no-octal
- 'no-octal-escape': 2, // http://eslint.org/docs/rules/no-octal-escape
- 'no-param-reassign': 2, // http://eslint.org/docs/rules/no-param-reassign
- 'no-proto': 2, // http://eslint.org/docs/rules/no-proto
- 'no-redeclare': 2, // http://eslint.org/docs/rules/no-redeclare
- 'no-return-assign': 2, // http://eslint.org/docs/rules/no-return-assign
- 'no-script-url': 2, // http://eslint.org/docs/rules/no-script-url
- 'no-self-compare': 2, // http://eslint.org/docs/rules/no-self-compare
- 'no-sequences': 2, // http://eslint.org/docs/rules/no-sequences
- 'no-throw-literal': 2, // http://eslint.org/docs/rules/no-throw-literal
- 'no-with': 2, // http://eslint.org/docs/rules/no-with
- 'radix': 2, // http://eslint.org/docs/rules/radix
- 'vars-on-top': 2, // http://eslint.org/docs/rules/vars-on-top
- 'wrap-iife': [2, 'any'], // http://eslint.org/docs/rules/wrap-iife
- 'yoda': 2, // http://eslint.org/docs/rules/yoda
-
-/**
- * Style
- */
- 'indent': [2, 2], // http://eslint.org/docs/rules/indent
- 'brace-style': [2, // http://eslint.org/docs/rules/brace-style
- '1tbs', {
- 'allowSingleLine': true
- }],
- 'quotes': [
- 2, 'single', 'avoid-escape' // http://eslint.org/docs/rules/quotes
- ],
- 'camelcase': [2, { // http://eslint.org/docs/rules/camelcase
- 'properties': 'never'
- }],
- 'comma-spacing': [2, { // http://eslint.org/docs/rules/comma-spacing
- 'before': false,
- 'after': true
- }],
- 'comma-style': [2, 'last'], // http://eslint.org/docs/rules/comma-style
- 'eol-last': 2, // http://eslint.org/docs/rules/eol-last
- 'func-names': 1, // http://eslint.org/docs/rules/func-names
- 'key-spacing': [2, { // http://eslint.org/docs/rules/key-spacing
- 'beforeColon': false,
- 'afterColon': true
- }],
- 'new-cap': [2, { // http://eslint.org/docs/rules/new-cap
- 'newIsCap': true
- }],
- 'no-multiple-empty-lines': [2, { // http://eslint.org/docs/rules/no-multiple-empty-lines
- 'max': 2
- }],
- 'no-nested-ternary': 2, // http://eslint.org/docs/rules/no-nested-ternary
- 'no-new-object': 2, // http://eslint.org/docs/rules/no-new-object
- 'no-spaced-func': 2, // http://eslint.org/docs/rules/no-spaced-func
- 'no-trailing-spaces': 2, // http://eslint.org/docs/rules/no-trailing-spaces
- 'no-extra-parens': [2, 'functions'], // http://eslint.org/docs/rules/no-extra-parens
- 'no-underscore-dangle': 0, // http://eslint.org/docs/rules/no-underscore-dangle
- 'one-var': [2, 'never'], // http://eslint.org/docs/rules/one-var
- 'padded-blocks': [2, 'never'], // http://eslint.org/docs/rules/padded-blocks
- 'semi': [2, 'always'], // http://eslint.org/docs/rules/semi
- 'semi-spacing': [2, { // http://eslint.org/docs/rules/semi-spacing
- 'before': false,
- 'after': true
- }],
- 'space-after-keywords': 2, // http://eslint.org/docs/rules/space-after-keywords
- 'space-before-blocks': 2, // http://eslint.org/docs/rules/space-before-blocks
- 'space-before-function-paren': [2, 'never'], // http://eslint.org/docs/rules/space-before-function-paren
- 'space-infix-ops': 2, // http://eslint.org/docs/rules/space-infix-ops
- 'space-return-throw-case': 2, // http://eslint.org/docs/rules/space-return-throw-case
- 'spaced-comment': [2, 'always', {// http://eslint.org/docs/rules/spaced-comment
- 'exceptions': ['-', '+'],
- 'markers': ['=', '!'] // space here to support sprockets directives
- }],
-
-/**
- * JSX style
- */
- 'react/display-name': 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
- 'react/jsx-boolean-value': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
- 'react/jsx-quotes': [2, 'double'], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-quotes.md
- 'react/jsx-no-undef': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
- 'react/jsx-sort-props': 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
- 'react/jsx-sort-prop-types': 0, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-prop-types.md
- 'react/jsx-uses-react': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
- 'react/jsx-uses-vars': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
- 'react/no-did-mount-set-state': [2, 'allow-in-func'], // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
- 'react/no-did-update-set-state': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
- 'react/no-multi-comp': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
- 'react/no-unknown-property': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
- 'react/prop-types': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
- 'react/react-in-jsx-scope': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
- 'react/self-closing-comp': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
- 'react/wrap-multilines': 2, // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md
- 'react/sort-comp': [2, { // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
- 'order': [
- 'displayName',
- 'propTypes',
- 'contextTypes',
- 'childContextTypes',
- 'mixins',
- 'statics',
- 'defaultProps',
- 'constructor',
- 'getDefaultProps',
- 'getInitialState',
- 'getChildContext',
- 'componentWillMount',
- 'componentDidMount',
- 'componentWillReceiveProps',
- 'shouldComponentUpdate',
- 'componentWillUpdate',
- 'componentDidUpdate',
- 'componentWillUnmount',
- '/^on.+$/',
- '/^get.+$/',
- '/^render.+$/',
- 'render'
- ]
- }]
- }
-};
diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-airbnb/package.json
deleted file mode 100644
index a082518584..0000000000
--- a/packages/eslint-config-airbnb/package.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "name": "eslint-config-airbnb",
- "version": "0.0.7",
- "description": "Airbnb's ESLint config, following our styleguide",
- "main": "index.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/airbnb/javascript"
- },
- "keywords": [
- "eslint",
- "eslintconfig",
- "config",
- "airbnb",
- "javascript",
- "styleguide"
- ],
- "author": "Jake Teton-Landis (https://twitter.com/@jitl)",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/airbnb/javascript/issues"
- },
- "homepage": "https://github.com/airbnb/javascript"
-}
diff --git a/react/README.md b/react/README.md
deleted file mode 100644
index 3c01981f8c..0000000000
--- a/react/README.md
+++ /dev/null
@@ -1,315 +0,0 @@
-# Airbnb React/JSX Style Guide
-
-*A mostly reasonable approach to React and JSX*
-
-## Table of Contents
-
- 1. [Basic Rules](#basic-rules)
- 1. [Naming](#naming)
- 1. [Declaration](#declaration)
- 1. [Alignment](#alignment)
- 1. [Quotes](#quotes)
- 1. [Spacing](#spacing)
- 1. [Props](#props)
- 1. [Parentheses](#parentheses)
- 1. [Tags](#tags)
- 1. [Methods](#methods)
- 1. [Ordering](#ordering)
-
-## Basic Rules
-
- - Only include one React component per file.
- - Always use JSX syntax.
- - Do not use `React.createElement` unless you're initializing the app from a file that is not JSX.
-
-## Class vs React.createClass
-
- - Use class extends React.Component unless you have a very good reason to use mixins.
-
- ```javascript
- // bad
- const Listing = React.createClass({
- render() {
- return ;
- }
- });
-
- // good
- class Listing extends React.Component {
- render() {
- return ;
- }
- }
- ```
-
-## Naming
-
- - **Extensions**: Use `.jsx` extension for React components.
- - **Filename**: Use PascalCase for filenames. E.g., `ReservationCard.jsx`.
- - **Reference Naming**: Use PascalCase for React components and camelCase for their instances:
- ```javascript
- // bad
- const reservationCard = require('./ReservationCard');
-
- // good
- const ReservationCard = require('./ReservationCard');
-
- // bad
- const ReservationItem = ;
-
- // good
- const reservationItem = ;
- ```
-
- **Component Naming**: Use the filename as the component name. For example, `ReservationCard.jsx` should have a reference name of `ReservationCard`. However, for root components of a directory, use `index.jsx` as the filename and use the directory name as the component name:
- ```javascript
- // bad
- const Footer = require('./Footer/Footer.jsx')
-
- // bad
- const Footer = require('./Footer/index.jsx')
-
- // good
- const Footer = require('./Footer')
- ```
-
-
-## Declaration
- - Do not use displayName for naming components. Instead, name the component by reference.
-
- ```javascript
- // bad
- export default React.createClass({
- displayName: 'ReservationCard',
- // stuff goes here
- });
-
- // good
- class ReservationCard extends React.Component {
- }
-
- export default ReservationCard;
- ```
-
-## Alignment
- - Follow these alignment styles for JS syntax
-
- ```javascript
- // bad
-
-
- // good
-
-
- // if props fit in one line then keep it on the same line
-
-
- // children get indented normally
-
-
-
- ```
-
-## Quotes
- - Always use double quotes (`"`) for JSX attributes, but single quotes for all other JS.
- ```javascript
- // bad
-
-
- // good
-
-
- // bad
-
-
- // good
-
- ```
-
-## Spacing
- - Always include a single space in your self-closing tag.
- ```javascript
- // bad
-
-
- // very bad
-
-
- // bad
-
-
- // good
-
- ```
-
-## Props
- - Always use camelCase for prop names.
- ```javascript
- // bad
-
-
- // good
-
- ```
-
-## Parentheses
- - Wrap JSX tags in parentheses when they span more than one line:
- ```javascript
- /// bad
- render() {
- return
-
- ;
- }
-
- // good
- render() {
- return (
-
-
-
- );
- }
-
- // good, when single line
- render() {
- const body = hello
;
- return {body};
- }
- ```
-
-## Tags
- - Always self-close tags that have no children.
- ```javascript
- // bad
-
-
- // good
-
- ```
-
- - If your component has multi-line properties, close its tag on a new line.
- ```javascript
- // bad
-
-
- // good
-
- ```
-
-## Methods
- - Do not use underscore prefix for internal methods of a React component.
- ```javascript
- // bad
- React.createClass({
- _onClickSubmit() {
- // do stuff
- }
-
- // other stuff
- });
-
- // good
- class extends React.Component {
- onClickSubmit() {
- // do stuff
- }
-
- // other stuff
- });
- ```
-
-## Ordering
-
- - Ordering for class extends React.Component:
-
- 1. constructor
- 1. optional static methods
- 1. getChildContext
- 1. componentWillMount
- 1. componentDidMount
- 1. componentWillReceiveProps
- 1. shouldComponentUpdate
- 1. componentWillUpdate
- 1. componentDidUpdate
- 1. componentWillUnmount
- 1. *clickHandlers or eventHandlers* like onClickSubmit() or onChangeDescription()
- 1. *getter methods for render* like getSelectReason() or getFooterContent()
- 1. *Optional render methods* like renderNavigation() or renderProfilePicture()
- 1. render
-
- - How to define propTypes, defaultProps, contextTypes, etc...
-
- ```javascript
- import React, { Component, PropTypes } from 'react';
-
- const propTypes = {
- id: PropTypes.number.isRequired,
- url: PropTypes.string.isRequired,
- text: PropTypes.string,
- };
-
- const defaultProps = {
- text: 'Hello World',
- };
-
- class Link extends Component {
- static methodsAreOk() {
- return true;
- }
-
- render() {
- return {this.props.text}
- }
- }
-
- Link.propTypes = propTypes;
- Link.defaultProps = defaultProps;
-
- export default Link;
- ```
-
- - Ordering for React.createClass:
-
- 1. displayName
- 1. propTypes
- 1. contextTypes
- 1. childContextTypes
- 1. mixins
- 1. statics
- 1. defaultProps
- 1. getDefaultProps
- 1. getInitialState
- 1. getChildContext
- 1. componentWillMount
- 1. componentDidMount
- 1. componentWillReceiveProps
- 1. shouldComponentUpdate
- 1. componentWillUpdate
- 1. componentDidUpdate
- 1. componentWillUnmount
- 1. *clickHandlers or eventHandlers* like onClickSubmit() or onChangeDescription()
- 1. *getter methods for render* like getSelectReason() or getFooterContent()
- 1. *Optional render methods* like renderNavigation() or renderProfilePicture()
- 1. render
-
-**[⬆ back to top](#table-of-contents)**