Skip to content

Commit bf9fd5e

Browse files
author
Nick Hwang
committed
Update with airbnb/[email protected]
In addition to the changes in `4.0.0`, the following HubSpot variant rules were also updated: - Add no parentheses around object literals in style guide - Closes HubSpot#14 - Ignore `react/jsx-closing-bracket-location#nonEmpty` - Closes HubSpot#15
1 parent 6ca3b16 commit bf9fd5e

File tree

12 files changed

+232
-76
lines changed

12 files changed

+232
-76
lines changed

README.md

Lines changed: 122 additions & 33 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hubspot-style",
3-
"version": "3.1.0",
3+
"version": "4.0.0",
44
"description": "HubSpot's version of a mostly reasonable approach to JavaScript",
55
"scripts": {
66
"difftool": "./bin/difftool",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"presets": ["es2015"],
3+
"plugins": [
4+
"transform-strict-mode",
5+
"transform-export-extensions"
6+
]
7+
}

packages/eslint-config-hubspot/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
4.0.0 / 2016-01-22
2+
==================
3+
- [breaking] require outer IIFE wrapping; flesh out guide section
4+
- [minor] Add missing `arrow-body-style`, `prefer-template` rules (#678)
5+
- [minor] Add `prefer-arrow-callback` to ES6 rules (to match the guide) (#677)
6+
- [Tests] run `npm run lint` as part of tests; fix errors
7+
- [Tests] use `parallelshell` to parallelize npm run-scripts
8+
- [hubspot] Add rule about no parentheses around object literals
9+
- [hubspot] Ignore `react/jsx-closing-bracket-location#nonEmpty` rule (#15)
10+
111
3.1.0 / 2016-01-07
212
==================
313
- [minor] Allow multiple stateless components in a single file

packages/eslint-config-hubspot/package.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "eslint-config-hubspot",
3-
"version": "3.1.0",
3+
"version": "4.0.0",
44
"description": "HubSpot's ESLint config, following our styleguide",
55
"main": "index.js",
66
"scripts": {
77
"lint": "eslint .",
8-
"test": "babel-tape-runner ./test/test-*.js | faucet"
8+
"tape": "babel-tape-runner ./test/test-*.js | faucet",
9+
"test": "parallelshell 'npm run lint' 'npm run tape'"
910
},
1011
"repository": {
1112
"type": "git",
@@ -31,11 +32,15 @@
3132
},
3233
"homepage": "https://github.com/HubSpot/javascript",
3334
"devDependencies": {
34-
"babel-tape-runner": "1.2.0",
35+
"babel-plugin-transform-export-extensions": "^6.4.0",
36+
"babel-plugin-transform-strict-mode": "^6.3.13",
37+
"babel-preset-es2015": "^6.3.13",
38+
"babel-tape-runner": "2.0.0",
3539
"eslint": "^1.10.3",
36-
"eslint-plugin-react": "^3.14.0",
40+
"eslint-plugin-react": "^3.16.0",
3741
"faucet": "0.0.1",
38-
"react": "^0.13.3",
42+
"parallelshell": "^2.0.0",
43+
"react": "^0.14.6",
3944
"tape": "^4.2.2"
4045
},
4146
"peerDependencies": {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rules": {
3+
"quote-props": 0
4+
}
5+
}

packages/eslint-config-hubspot/rules/best-practices.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
'rules': {
3-
// Enforces getter/setter pairs in objects
3+
// enforces getter/setter pairs in objects
44
'accessor-pairs': 0,
55
// treat var statements as if they were block scoped
66
'block-scoped-var': 2,
@@ -13,7 +13,7 @@ module.exports = {
1313
// require default case in switch statements
1414
'default-case': 2,
1515
// encourages use of dot notation whenever possible
16-
'dot-notation': [2, { 'allowKeywords': true}],
16+
'dot-notation': [2, { 'allowKeywords': true }],
1717
// enforces consistent newlines before or after dots
1818
'dot-location': 0,
1919
// require the use of === and !==
@@ -108,6 +108,7 @@ module.exports = {
108108
// requires to declare all vars on top of their containing scope
109109
'vars-on-top': 2,
110110
// require immediate function invocation to be wrapped in parentheses
111+
// http://eslint.org/docs/rules/wrap-iife.html
111112
'wrap-iife': [2, 'any'],
112113
// require or disallow Yoda conditions
113114
'yoda': 2

packages/eslint-config-hubspot/rules/es6.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ module.exports = {
2323
'experimentalObjectRestSpread': true
2424
},
2525
'rules': {
26+
// enforces no braces where they can be omitted
27+
// http://eslint.org/docs/rules/arrow-body-style
28+
'arrow-body-style': [2, 'as-needed'],
2629
// require parens in arrow function arguments
2730
'arrow-parens': 0,
2831
// require space before/after arrow function's arrow
@@ -43,12 +46,17 @@ module.exports = {
4346
// require method and property shorthand syntax for object literals
4447
// https://github.com/eslint/eslint/blob/master/docs/rules/object-shorthand.md
4548
'object-shorthand': [2, 'always'],
49+
// suggest using arrow functions as callbacks
50+
'prefer-arrow-callback': 2,
4651
// suggest using of const declaration for variables that are never modified after declared
4752
'prefer-const': 2,
4853
// suggest using the spread operator instead of .apply()
4954
'prefer-spread': 0,
5055
// suggest using Reflect methods where applicable
5156
'prefer-reflect': 0,
57+
// suggest using template literals instead of string concatenation
58+
// http://eslint.org/docs/rules/prefer-template
59+
'prefer-template': 2,
5260
// disallow generator functions that do not have yield
5361
'require-yield': 0
5462
}

packages/eslint-config-hubspot/rules/react.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ module.exports = {
1010
'rules': {
1111
// Prevent missing displayName in a React component definition
1212
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
13-
'react/display-name': [0, {'acceptTranspilerName': false}],
13+
'react/display-name': [0, { 'acceptTranspilerName': false }],
1414
// Forbid certain propTypes (any, array, object)
1515
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md
16-
'react/forbid-prop-types': [0, {'forbid': ['any', 'array', 'object']}],
16+
'react/forbid-prop-types': [0, { 'forbid': ['any', 'array', 'object'] }],
1717
// Enforce boolean attributes notation in JSX
1818
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
1919
'react/jsx-boolean-value': [2, 'always'],
2020
// Validate closing bracket location in JSX
2121
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
22-
'react/jsx-closing-bracket-location': [2, {'selfClosing': 'tag-aligned', 'nonEmpty': 'after-props'}],
22+
'react/jsx-closing-bracket-location': [2, { 'selfClosing': 'tag-aligned', 'nonEmpty': false }],
2323
// Enforce or disallow spaces inside of curly braces in JSX attributes
2424
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
25-
'react/jsx-curly-spacing': [0, 'never', {'allowMultiline': true}],
25+
'react/jsx-curly-spacing': [0, 'never', { 'allowMultiline': true }],
2626
// Enforce event handler naming conventions in JSX
2727
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
2828
'react/jsx-handler-names': [0, {
@@ -37,13 +37,13 @@ module.exports = {
3737
'react/jsx-key': 0,
3838
// Limit maximum of props on a single line in JSX
3939
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
40-
'react/jsx-max-props-per-line': [0, {'maximum': 1}],
40+
'react/jsx-max-props-per-line': [0, { 'maximum': 1 }],
4141
// Prevent usage of .bind() and arrow functions in JSX props
4242
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
4343
'react/jsx-no-bind': 2,
4444
// Prevent duplicate props in JSX
4545
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
46-
'react/jsx-no-duplicate-props': [0, {'ignoreCase': false}],
46+
'react/jsx-no-duplicate-props': [0, { 'ignoreCase': false }],
4747
// Prevent usage of unwrapped JSX strings
4848
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
4949
'react/jsx-no-literals': 0,
@@ -76,7 +76,7 @@ module.exports = {
7676
'react/no-danger': 0,
7777
// Prevent usage of deprecated methods
7878
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
79-
'react/no-deprecated': [0, {'react': '0.14.0'}],
79+
'react/no-deprecated': [0, { 'react': '0.14.0' }],
8080
// Prevent usage of setState in componentDidMount
8181
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
8282
'react/no-did-mount-set-state': [2, 'allow-in-func'],
@@ -91,7 +91,7 @@ module.exports = {
9191
'react/no-is-mounted': 0,
9292
// Prevent multiple component definition per file
9393
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
94-
'react/no-multi-comp': [2, {'ignoreStateless': true}],
94+
'react/no-multi-comp': [2, { 'ignoreStateless': true }],
9595
// Prevent usage of setState
9696
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
9797
'react/no-set-state': 0,
@@ -106,13 +106,13 @@ module.exports = {
106106
'react/prefer-es6-class': [0, 'always'],
107107
// Prevent missing props validation in a React component definition
108108
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
109-
'react/prop-types': [2, {'ignore': [], customValidators: []}],
109+
'react/prop-types': [2, { 'ignore': [], customValidators: [] }],
110110
// Prevent missing React when using JSX
111111
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
112112
'react/react-in-jsx-scope': 2,
113113
// Restrict file extensions that may be required
114114
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-extension.md
115-
'react/require-extension': [0, {'extensions': ['.jsx']}],
115+
'react/require-extension': [0, { 'extensions': ['.jsx'] }],
116116
// Prevent extra closing tags for components without children
117117
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
118118
'react/self-closing-comp': 2,

packages/eslint-config-hubspot/rules/style.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ module.exports = {
33
// enforce spacing inside array brackets
44
'array-bracket-spacing': [2, 'never'],
55
// enforce one true brace style
6-
'brace-style': [2, '1tbs', {'allowSingleLine': true }],
6+
'brace-style': [2, '1tbs', { 'allowSingleLine': true }],
77
// require camel case names
8-
'camelcase': [2, {'properties': 'never'}],
8+
'camelcase': [2, { 'properties': 'never' }],
99
// enforce spacing before and after comma
10-
'comma-spacing': [2, {'before': false, 'after': true}],
10+
'comma-spacing': [2, { 'before': false, 'after': true }],
1111
// enforce one true comma style
1212
'comma-style': [2, 'last'],
1313
// disallow padding inside computed properties
@@ -20,7 +20,8 @@ module.exports = {
2020
'func-names': 1,
2121
// enforces use of function declarations or expressions
2222
'func-style': 0,
23-
// this option enforces minimum and maximum identifier lengths (variable names, property names etc.)
23+
// this option enforces minimum and maximum identifier lengths
24+
// (variable names, property names etc.)
2425
'id-length': 0,
2526
// this option sets a specific tab width for your code
2627
// https://github.com/eslint/eslint/blob/master/docs/rules/indent.md
@@ -29,7 +30,7 @@ module.exports = {
2930
// http://eslint.org/docs/rules/jsx-quotes
3031
'jsx-quotes': [2, 'prefer-double'],
3132
// enforces spacing between keys and values in object literal properties
32-
'key-spacing': [2, {'beforeColon': false, 'afterColon': true}],
33+
'key-spacing': [2, { 'beforeColon': false, 'afterColon': true }],
3334
// enforces empty lines around comments
3435
'lines-around-comment': 0,
3536
// disallow mixed 'LF' and 'CRLF' as linebreaks
@@ -43,7 +44,7 @@ module.exports = {
4344
// specify the maximum depth callbacks can be nested
4445
'max-nested-callbacks': 0,
4546
// require a capital letter for constructors
46-
'new-cap': [2, {'newIsCap': true, 'capIsNew': false}],
47+
'new-cap': [2, { 'newIsCap': true, 'capIsNew': false }],
4748
// disallow the omission of parentheses when invoking a constructor with no arguments
4849
'new-parens': 0,
4950
// allow/disallow an empty newline after var statement
@@ -59,7 +60,7 @@ module.exports = {
5960
// disallow mixed spaces and tabs for indentation
6061
'no-mixed-spaces-and-tabs': 2,
6162
// disallow multiple empty lines and only one newline at the end
62-
'no-multiple-empty-lines': [2, {'max': 2, 'maxEOF': 1}],
63+
'no-multiple-empty-lines': [2, { 'max': 2, 'maxEOF': 1 }],
6364
// disallow nested ternary expressions
6465
'no-nested-ternary': 2,
6566
// disallow use of the Object constructor
@@ -92,7 +93,7 @@ module.exports = {
9293
// require identifiers to match the provided regular expression
9394
'id-match': 0,
9495
// enforce spacing before and after semicolons
95-
'semi-spacing': [2, {'before': false, 'after': true}],
96+
'semi-spacing': [2, { 'before': false, 'after': true }],
9697
// require or disallow use of semicolons instead of ASI
9798
'semi': [2, 'always'],
9899
// sort variables within the same declaration block

0 commit comments

Comments
 (0)