diff --git a/README.md b/README.md
index a8cae50e14..9cc4ef6529 100644
--- a/README.md
+++ b/README.md
@@ -96,6 +96,8 @@ Other Style Guides (from Airbnb)
> Why? This ensures that you can't reassign your references, which can lead to bugs and difficult to comprehend code.
+ eslint rules: [`prefer-const`](http://eslint.org/docs/rules/prefer-const.html), [`no-const-assign`](http://eslint.org/docs/rules/no-const-assign.html).
+
```javascript
// bad
var a = 1;
@@ -110,6 +112,8 @@ Other Style Guides (from Airbnb)
> Why? `let` is block-scoped rather than function-scoped like `var`.
+ eslint rules: [`no-var`](http://eslint.org/docs/rules/no-var.html).
+
```javascript
// bad
var count = 1;
@@ -142,6 +146,8 @@ Other Style Guides (from Airbnb)
- [3.1](#3.1) Use the literal syntax for object creation.
+ eslint rules: [`no-new-object`](http://eslint.org/docs/rules/no-new-object.html).
+
```javascript
// bad
const item = new Object();
@@ -214,6 +220,8 @@ Other Style Guides (from Airbnb)
- [3.5](#3.5) Use object method shorthand.
+ eslint rules: [`object-shorthand`](http://eslint.org/docs/rules/object-shorthand.html).
+
```javascript
// bad
const atom = {
@@ -239,6 +247,8 @@ Other Style Guides (from Airbnb)
> Why? It is shorter to write and descriptive.
+ eslint rules: [`object-shorthand`](http://eslint.org/docs/rules/object-shorthand.html).
+
```javascript
const lukeSkywalker = 'Luke Skywalker';
@@ -288,6 +298,8 @@ Other Style Guides (from Airbnb)
- [4.1](#4.1) Use the literal syntax for array creation.
+ eslint rules: [`no-array-constructor`](http://eslint.org/docs/rules/no-array-constructor.html).
+
```javascript
// bad
const items = new Array();
@@ -404,6 +416,8 @@ Other Style Guides (from Airbnb)
- [6.1](#6.1) Use single quotes `''` for strings.
+ eslint rules: [`quotes`](http://eslint.org/docs/rules/quotes.html).
+
```javascript
// bad
const name = "Capt. Janeway";
@@ -436,6 +450,8 @@ Other Style Guides (from Airbnb)
> Why? Template strings give you a readable, concise syntax with proper newlines and string interpolation features.
+ eslint rules: [`prefer-template`](http://eslint.org/docs/rules/prefer-template.html).
+
```javascript
// bad
function sayHi(name) {
@@ -613,6 +629,8 @@ Other Style Guides (from Airbnb)
> Why not? If you have a fairly complicated function, you might move that logic out into its own function declaration.
+ eslint rules: [`prefer-arrow-callback`](http://eslint.org/docs/rules/prefer-arrow-callback.html), [`arrow-spacing`](http://eslint.org/docs/rules/arrow-spacing.html).
+
```javascript
// bad
[1, 2, 3].map(function (x) {
@@ -633,6 +651,8 @@ Other Style Guides (from Airbnb)
> Why not? If you plan on returning an object.
+ eslint rules: [`arrow-parens`](http://eslint.org/docs/rules/arrow-parens.html), [`arrow-body-style`](http://eslint.org/docs/rules/arrow-body-style.html).
+
```javascript
// good
[1, 2, 3].map(number => `A string containing the ${number}.`);
@@ -673,6 +693,8 @@ Other Style Guides (from Airbnb)
> Why? Less visual clutter.
+ eslint rules: [`arrow-parens`](http://eslint.org/docs/rules/arrow-parens.html).
+
```js
// good
[1, 2, 3].map(x => x * x);
@@ -851,6 +873,8 @@ Other Style Guides (from Airbnb)
> Why? This enforces our immutable rule. Dealing with pure functions that return values is easier to reason about than side-effects.
+ eslint rules: [`no-iterator`](http://eslint.org/docs/rules/no-iterator.html).
+
```javascript
const numbers = [1, 2, 3, 4, 5];
@@ -883,6 +907,8 @@ Other Style Guides (from Airbnb)
- [12.1](#12.1) Use dot notation when accessing properties.
+ eslint rules: [`dot-notation`](http://eslint.org/docs/rules/dot-notation.html).
+
```javascript
const luke = {
jedi: true,
@@ -930,6 +956,8 @@ Other Style Guides (from Airbnb)
> 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.
+ eslint rules: [`one-var`](http://eslint.org/docs/rules/one-var.html).
+
```javascript
// bad
const items = getItems(),
@@ -1124,12 +1152,14 @@ Other Style Guides (from Airbnb)
- [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**
+ eslint rules: [`eqeqeq`](http://eslint.org/docs/rules/eqeqeq.html).
+
+ + **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]) {
@@ -1196,6 +1226,8 @@ Other Style Guides (from Airbnb)
- [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.
+ eslint rules: [`brace-style`](http://eslint.org/docs/rules/brace-style.html).
+
```javascript
// bad
if (test) {
@@ -1326,6 +1358,8 @@ Other Style Guides (from Airbnb)
- [18.1](#18.1) Use soft tabs set to 2 spaces.
+ eslint rules: [`indent`](http://eslint.org/docs/rules/indent.html).
+
```javascript
// bad
function() {
@@ -1345,6 +1379,8 @@ Other Style Guides (from Airbnb)
- [18.2](#18.2) Place 1 space before the leading brace.
+ eslint rules: [`space-before-blocks`](http://eslint.org/docs/rules/space-before-blocks.html).
+
```javascript
// bad
function test(){
@@ -1371,6 +1407,8 @@ Other Style Guides (from Airbnb)
- [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.
+ eslint rules: [`space-after-keywords`](http://eslint.org/docs/rules/space-after-keywords.html), [`space-before-keywords`](http://eslint.org/docs/rules/space-before-keywords.html).
+
```javascript
// bad
if(isJedi) {
@@ -1395,6 +1433,8 @@ Other Style Guides (from Airbnb)
- [18.4](#18.4) Set off operators with spaces.
+ eslint rules: [`space-infix-ops`](http://eslint.org/docs/rules/space-infix-ops.html).
+
```javascript
// bad
const x=y+5;
@@ -1526,6 +1566,8 @@ Other Style Guides (from Airbnb)
- [18.8](#18.8) Do not pad your blocks with blank lines.
+ eslint rules: [`padded-blocks`](http://eslint.org/docs/rules/padded-blocks.html).
+
```javascript
// bad
function bar() {
@@ -1556,6 +1598,57 @@ Other Style Guides (from Airbnb)
}
```
+ - [18.9](#18.9) Do not add spaces inside parentheses.
+
+ eslint rules: [`space-in-parens`](http://eslint.org/docs/rules/space-in-parens.html).
+
+ ```javascript
+ // bad
+ function bar( foo ) {
+ return foo;
+ }
+
+ // good
+ function bar(foo) {
+ return foo;
+ }
+
+ // bad
+ if ( foo ) {
+ console.log(foo);
+ }
+
+ // good
+ if (foo) {
+ console.log(foo);
+ }
+ ```
+
+ - [18.10](#18.10) Do not add spaces inside brackets.
+
+ eslint rules: [`array-bracket-spacing`](http://eslint.org/docs/rules/array-bracket-spacing.html).
+
+ ```javascript
+ // bad
+ const foo = [ 1, 2, 3 ];
+ console.log(foo[ 0 ]);
+
+ // good
+ const foo = [1, 2, 3];
+ console.log(foo[0]);
+ ```
+
+ - [18.11](#18.11) Add spaces inside curly braces.
+
+ eslint rules: [`object-curly-spacing`](http://eslint.org/docs/rules/object-curly-spacing.html).
+
+ ```javascript
+ // bad
+ const foo = {clark: 'kent'};
+
+ // good
+ const foo = { clark: 'kent' };
+ ```
**[⬆ back to top](#table-of-contents)**
@@ -1563,6 +1656,8 @@ Other Style Guides (from Airbnb)
- [19.1](#19.1) Leading commas: **Nope.**
+ eslint rules: [`comma-style`](http://eslint.org/docs/rules/comma-style.html).
+
```javascript
// bad
const story = [
@@ -1597,6 +1692,8 @@ Other Style Guides (from Airbnb)
- [19.2](#19.2) Additional trailing comma: **Yup.**
+ eslint rules: [`no-comma-dangle`](http://eslint.org/docs/rules/no-comma-dangle.html).
+
> 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
@@ -1645,6 +1742,8 @@ Other Style Guides (from Airbnb)
- [20.1](#20.1) **Yup.**
+ eslint rules: [`semi`](http://eslint.org/docs/rules/semi.html).
+
```javascript
// bad
(function() {
@@ -1765,6 +1864,8 @@ Other Style Guides (from Airbnb)
- [22.2](#22.2) Use camelCase when naming objects, functions, and instances.
+ eslint rules: [`camelcase`](http://eslint.org/docs/rules/camelcase.html).
+
```javascript
// bad
const OBJEcttsssss = {};
@@ -1802,6 +1903,8 @@ Other Style Guides (from Airbnb)
- [22.4](#22.4) Use a leading underscore `_` when naming private properties.
+ eslint rules: [`no-underscore-dangle`](http://eslint.org/docs/rules/no-underscore-dangle.html).
+
```javascript
// bad
this.__firstName__ = 'Panda';
@@ -1839,6 +1942,7 @@ Other Style Guides (from Airbnb)
```
- [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 {
@@ -2250,6 +2354,7 @@ Other Style Guides (from Airbnb)
- **Apartmint**: [apartmint/javascript](https://github.com/apartmint/javascript)
- **Avalara**: [avalara/javascript](https://github.com/avalara/javascript)
- **Billabong**: [billabong/javascript](https://github.com/billabong/javascript)
+ - **Bisk**: [bisk/javascript](https://github.com/Bisk/javascript/)
- **Blendle**: [blendle/javascript](https://github.com/blendle/javascript)
- **ComparaOnline**: [comparaonline/javascript](https://github.com/comparaonline/javascript-style-guide)
- **Compass Learning**: [compasslearning/javascript-style-guide](https://github.com/compasslearning/javascript-style-guide)
@@ -2271,6 +2376,7 @@ Other Style Guides (from Airbnb)
- **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)
+ - **JeopardyBot**: [kesne/jeopardy-bot](https://github.com/kesne/jeopardy-bot/blob/master/STYLEGUIDE.md)
- **JSSolutions**: [JSSolutions/javascript](https://github.com/JSSolutions/javascript)
- **Kinetica Solutions**: [kinetica/javascript](https://github.com/kinetica/Javascript-style-guide)
- **Mighty Spring**: [mightyspring/javascript](https://github.com/mightyspring/javascript)
@@ -2283,9 +2389,11 @@ Other Style Guides (from Airbnb)
- **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)
+ - **OutBoxSoft**: [OutBoxSoft/javascript](https://github.com/OutBoxSoft/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)
+ - **React**: [/facebook/react/blob/master/CONTRIBUTING.md#style-guide](https://github.com/facebook/react/blob/master/CONTRIBUTING.md#style-guide)
- **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)
diff --git a/package.json b/package.json
index 675daaeffc..c0dc84ed8b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "hubspot-style",
- "version": "1.0.7",
+ "version": "2.0.0",
"description": "HubSpot's version of a mostly reasonable approach to JavaScript",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
diff --git a/packages/eslint-config-hubspot/CHANGELOG.md b/packages/eslint-config-hubspot/CHANGELOG.md
new file mode 100644
index 0000000000..bc269e9222
--- /dev/null
+++ b/packages/eslint-config-hubspot/CHANGELOG.md
@@ -0,0 +1,63 @@
+2.1.1 / 2015-12-15
+==================
+ - [fix] Remove deprecated react/jsx-quotes (#622)
+
+2.1.0 / 2015-12-15
+==================
+ - [fix] use `require.resolve` to allow nested `extend`s (#582)
+ - [new] enable `object-shorthand` rule (#621)
+ - [new] enable `arrow-spacing` rule (#517)
+ - [docs] flesh out react rule defaults (#618)
+
+2.0.0 / 2015-12-03
+==================
+ - [breaking] `space-before-function-paren`: require function spacing: `function (` (#605)
+ - [breaking] `indent`: Fix switch statement indentation rule (#606)
+ - [breaking] `array-bracket-spacing`, `computed-property-spacing`: disallow spacing inside brackets (#594)
+ - [breaking] `object-curly-spacing`: require padding inside curly braces (#594)
+ - [breaking] `space-in-parens`: disallow spaces in parens (#594)
+
+1.0.2 / 2015-11-25
+==================
+ - [breaking] `no-multiple-empty-lines`: only allow 1 blank line at EOF (#578)
+ - [new] `restParams`: enable rest params (#592)
+
+1.0.1 / 2015-11-25
+==================
+ - *erroneous publish*
+
+1.0.0 / 2015-11-08
+==================
+ - require `eslint` `v1.0.0` or higher
+ - remove `babel-eslint` dependency
+
+0.1.1 / 2015-11-05
+==================
+ - remove id-length rule (#569)
+ - enable `no-mixed-spaces-and-tabs` (#539)
+ - enable `no-const-assign` (#560)
+ - enable `space-before-keywords` (#554)
+
+0.1.0 / 2015-11-05
+==================
+ - switch to modular rules files courtesy the [eslint-config-default][ecd] project and [@taion][taion]. [PR][pr-modular]
+ - export `eslint-config-airbnb/legacy` for ES5-only users. `eslint-config-airbnb/legacy` does not require the `babel-eslint` parser. [PR][pr-legacy]
+
+0.0.9 / 2015-09-24
+==================
+- add rule `no-undef`
+- add rule `id-length`
+
+0.0.8 / 2015-08-21
+==================
+ - now has a changelog
+ - now is modular (see instructions above for with react and without react versions)
+
+0.0.7 / 2015-07-30
+==================
+ - TODO: fill in
+
+[ecd]: https://github.com/walmartlabs/eslint-config-defaults
+[taion]: https://github.com/taion
+[pr-modular]: https://github.com/airbnb/javascript/pull/526
+[pr-legacy]: https://github.com/airbnb/javascript/pull/527
diff --git a/packages/eslint-config-hubspot/README.md b/packages/eslint-config-hubspot/README.md
index 4c2316f3f7..181b8ce34f 100644
--- a/packages/eslint-config-hubspot/README.md
+++ b/packages/eslint-config-hubspot/README.md
@@ -46,45 +46,3 @@ programming to structure our README as test cases for our .eslintrc?
You can run tests with `npm test`.
You can make sure this module lints with itself using `npm run lint`.
-
-## Changelog
-
-### 1.0.2
-- enable rest params in linter, derp. (#592)
-- enforce rule 18.5, ensuring files end with a single newline character. (#578)
-
-### 1.0.1
-
-oops
-
-### 1.0.0
-- require `eslint` `v1.0.0` or higher
-- removes `babel-eslint` dependency
-
-### 0.1.1
-- remove id-length rule (#569)
-- enable `no-mixed-spaces-and-tabs` (#539)
-- enable `no-const-assign` (#560)
-- enable `space-before-keywords` (#554)
-
-### 0.1.0
-
-- switch to modular rules files courtesy the [eslint-config-default][ecd]
- project and [@taion][taion]. [PR][pr-modular]
-- export `eslint-config-airbnb/legacy` for ES5-only users.
- `eslint-config-airbnb/legacy` does not require the `babel-eslint` parser.
- [PR][pr-legacy]
-
-[ecd]: https://github.com/walmartlabs/eslint-config-defaults
-[taion]: https://github.com/taion
-[pr-modular]: https://github.com/airbnb/javascript/pull/526
-[pr-legacy]: https://github.com/airbnb/javascript/pull/527
-
-### 0.0.9
-
-- add rule no-undef
-- add rule id-length
-
-### 0.0.8
- - now has a changelog
- - now is modular (see instructions above for with react and without react versions)
diff --git a/packages/eslint-config-hubspot/base.js b/packages/eslint-config-hubspot/base.js
index 9af22602e8..0dc72dfe10 100644
--- a/packages/eslint-config-hubspot/base.js
+++ b/packages/eslint-config-hubspot/base.js
@@ -2,6 +2,6 @@ module.exports = {
extends: [
'eslint-config-hubspot/legacy',
'eslint-config-hubspot/rules/es6',
- ],
+ ].map(require.resolve),
rules: {}
};
diff --git a/packages/eslint-config-hubspot/index.js b/packages/eslint-config-hubspot/index.js
index a89c69aab8..fc0dcf2d07 100644
--- a/packages/eslint-config-hubspot/index.js
+++ b/packages/eslint-config-hubspot/index.js
@@ -2,6 +2,6 @@ module.exports = {
extends: [
'eslint-config-hubspot/base',
'eslint-config-hubspot/rules/react',
- ],
+ ].map(require.resolve),
rules: {}
};
diff --git a/packages/eslint-config-hubspot/legacy.js b/packages/eslint-config-hubspot/legacy.js
index 8992fcd2df..08c5661fa5 100644
--- a/packages/eslint-config-hubspot/legacy.js
+++ b/packages/eslint-config-hubspot/legacy.js
@@ -7,7 +7,7 @@ module.exports = {
'eslint-config-hubspot/rules/strict',
'eslint-config-hubspot/rules/style',
'eslint-config-hubspot/rules/variables'
- ],
+ ].map(require.resolve),
env: {
browser: true,
node: true,
diff --git a/packages/eslint-config-hubspot/package.json b/packages/eslint-config-hubspot/package.json
index d00807ab9a..182c47db1f 100644
--- a/packages/eslint-config-hubspot/package.json
+++ b/packages/eslint-config-hubspot/package.json
@@ -1,6 +1,6 @@
{
"name": "eslint-config-hubspot",
- "version": "1.0.7",
+ "version": "2.0.0",
"description": "HubSpot's ESLint config, following our styleguide",
"main": "index.js",
"scripts": {
@@ -32,8 +32,8 @@
"homepage": "https://github.com/HubSpot/javascript",
"devDependencies": {
"babel-tape-runner": "1.2.0",
- "eslint": "^1.10.2",
- "eslint-plugin-react": "^3.11.1",
+ "eslint": "^1.10.3",
+ "eslint-plugin-react": "^3.11.3",
"faucet": "0.0.1",
"react": "^0.13.3",
"tape": "^4.2.2"
diff --git a/packages/eslint-config-hubspot/rules/es6.js b/packages/eslint-config-hubspot/rules/es6.js
index 1509ad9424..35d190d36b 100644
--- a/packages/eslint-config-hubspot/rules/es6.js
+++ b/packages/eslint-config-hubspot/rules/es6.js
@@ -26,7 +26,8 @@ module.exports = {
// require parens in arrow function arguments
'arrow-parens': 0,
// require space before/after arrow function's arrow
- 'arrow-spacing': 0,
+ // https://github.com/eslint/eslint/blob/master/docs/rules/arrow-spacing.md
+ 'arrow-spacing': [2, { 'before': true, 'after': true }],
// verify super() callings in constructors
'constructor-super': 0,
// enforce the spacing around the * in generator functions
@@ -40,7 +41,8 @@ module.exports = {
// require let or const instead of var
'no-var': 2,
// require method and property shorthand syntax for object literals
- 'object-shorthand': 0,
+ // https://github.com/eslint/eslint/blob/master/docs/rules/object-shorthand.md
+ 'object-shorthand': [2, 'always'],
// suggest using of const declaration for variables that are never modified after declared
'prefer-const': 2,
// suggest using the spread operator instead of .apply()
diff --git a/packages/eslint-config-hubspot/rules/react.js b/packages/eslint-config-hubspot/rules/react.js
index 5ac5380513..4d41cdb006 100644
--- a/packages/eslint-config-hubspot/rules/react.js
+++ b/packages/eslint-config-hubspot/rules/react.js
@@ -7,44 +7,67 @@ module.exports = {
},
'rules': {
// Prevent missing displayName in a React component definition
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
'react/display-name': 0,
// Enforce boolean attributes notation in JSX
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
'react/jsx-boolean-value': [2, 'always'],
+ // Validate closing bracket location in JSX
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
+ 'react/jsx-closing-bracket-location': [2, {'selfClosing': 'tag-aligned', 'nonEmpty': 'after-props'}],
// Enforce or disallow spaces inside of curly braces in JSX attributes
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
'react/jsx-curly-spacing': 0,
+ // Validate props indentation in JSX
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
+ 'react/jsx-indent-props': [2, 2],
// Prevent duplicate props in JSX
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
'react/jsx-no-duplicate-props': 0,
// Disallow undeclared variables in JSX
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
'react/jsx-no-undef': 2,
- // Enforce quote style for JSX attributes
- 'react/jsx-quotes': 0,
// Enforce propTypes declarations alphabetical sorting
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-prop-types.md
'react/jsx-sort-prop-types': 0,
// Enforce props alphabetical sorting
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
'react/jsx-sort-props': 0,
// Prevent React to be incorrectly marked as unused
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
'react/jsx-uses-react': 2,
// Prevent variables used in JSX to be incorrectly marked as unused
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
'react/jsx-uses-vars': 2,
// Prevent usage of dangerous JSX properties
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md
'react/no-danger': 0,
// Prevent usage of setState in componentDidMount
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
'react/no-did-mount-set-state': [2, 'allow-in-func'],
// Prevent usage of setState in componentDidUpdate
- '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-did-update-set-state': [2, 'allow-in-func'],
// Prevent multiple component definition per file
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
'react/no-multi-comp': 2,
// Prevent usage of unknown DOM property
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
'react/no-unknown-property': 2,
// Prevent missing props validation in a React component definition
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
'react/prop-types': 2,
// Prevent missing React when using JSX
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
'react/react-in-jsx-scope': 2,
// Restrict file extensions that may be required
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-extension.md
'react/require-extension': 0,
// Prevent extra closing tags for components without children
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
'react/self-closing-comp': 2,
// Enforce component methods order
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
'react/sort-comp': [2, {
'order': [
'lifecycle',
@@ -75,6 +98,11 @@ module.exports = {
}
}],
// Prevent missing parentheses around multilines JSX
- 'react/wrap-multilines': 2
+ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md
+ 'react/wrap-multilines': [2, {
+ declaration: true,
+ assignment: true,
+ return: true
+ }]
}
};
diff --git a/packages/eslint-config-hubspot/rules/style.js b/packages/eslint-config-hubspot/rules/style.js
index 8518d496ac..4ad35174d6 100644
--- a/packages/eslint-config-hubspot/rules/style.js
+++ b/packages/eslint-config-hubspot/rules/style.js
@@ -1,7 +1,7 @@
module.exports = {
'rules': {
// enforce spacing inside array brackets
- 'array-bracket-spacing': 0,
+ 'array-bracket-spacing': [2, 'never'],
// enforce one true brace style
'brace-style': [2, '1tbs', {'allowSingleLine': true }],
// require camel case names
@@ -11,7 +11,7 @@ module.exports = {
// enforce one true comma style
'comma-style': [2, 'last'],
// require or disallow padding inside computed properties
- 'computed-property-spacing': 0,
+ 'computed-property-spacing': [2, 'never'],
// enforces consistent naming when capturing the current execution context
'consistent-this': 0,
// enforce newline at the end of file, with no multiple empty lines
@@ -23,8 +23,10 @@ module.exports = {
// this option enforces minimum and maximum identifier lengths (variable names, property names etc.)
'id-length': 0,
// this option sets a specific tab width for your code
- 'indent': [2, 2],
+ // https://github.com/eslint/eslint/blob/master/docs/rules/indent.md
+ 'indent': [2, 2, { 'SwitchCase': 1, 'VariableDeclarator': 1 }],
// specify whether double or single quotes should be used in JSX attributes
+ // http://eslint.org/docs/rules/jsx-quotes
'jsx-quotes': [2, 'prefer-double'],
// enforces spacing between keys and values in object literal properties
'key-spacing': [2, {'beforeColon': false, 'afterColon': true}],
@@ -95,9 +97,10 @@ module.exports = {
// require or disallow space before blocks
'space-before-blocks': 2,
// require or disallow space before function opening parenthesis
+ // https://github.com/eslint/eslint/blob/master/docs/rules/space-before-function-paren.md
'space-before-function-paren': [2, 'never'],
// require or disallow spaces inside parentheses
- 'space-in-parens': 0,
+ 'space-in-parens': [2, 'never'],
// require spaces around operators
'space-infix-ops': 2,
// require a space after return, throw, and case
diff --git a/react/README.md b/react/README.md
index a05fd8dda4..b177af82ce 100644
--- a/react/README.md
+++ b/react/README.md
@@ -33,6 +33,8 @@
- Use class extends React.Component unless you have a very good reason to use mixins.
+ eslint rules: [`react/prefer-es6-class`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md).
+
```javascript
// bad
const Listing = React.createClass({
@@ -54,7 +56,10 @@
- **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:
+ - **Reference Naming**: Use PascalCase for React components and camelCase for their instances.
+
+ eslint rules: [`react/jsx-pascal-case`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md).
+
```javascript
// bad
const reservationCard = require('./ReservationCard');
@@ -101,6 +106,8 @@
## Alignment
- Follow these alignment styles for JSX syntax
+ eslint rules: [`react/jsx-closing-bracket-location`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md).
+
```javascript
// bad
Why? JSX attributes [can't contain escaped quotes](http://eslint.org/docs/rules/jsx-quotes), so double quotes make conjunctions like `"don't"` easier to type.
> Regular HTML attributes also typically use double quotes instead of single, so JSX attributes mirror this convention.
+ eslint rules: [`jsx-quotes`](http://eslint.org/docs/rules/jsx-quotes).
+
```javascript
// bad
@@ -297,6 +306,9 @@
## Tags
- Always self-close tags that have no children.
+
+ eslint rules: [`react/self-closing-comp`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md).
+
```javascript
// bad
@@ -306,6 +318,9 @@
```
- If your component has multi-line properties, close its tag on a new line.
+
+ eslint rules: [`react/jsx-closing-bracket-location`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md).
+
```javascript
// bad