Skip to content

Commit 3251baa

Browse files
author
Nick Hwang
committed
Update with airbnb/[email protected]
Minor change regarding quoted keywords. Rule is disabled on our style guide so no differences from `HubSpot/[email protected]`.
1 parent 33c20f2 commit 3251baa

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,28 @@ Other Style Guides (from Airbnb)
292292
};
293293
```
294294
295+
- [3.8](#3.8) <a name="3.8"></a> Only quote properties that are invalid identifiers.
296+
297+
> Why? In general we consider it subjectively easier to read. It improves syntax highlighting, and is also more easily optimized by many JS engines.
298+
299+
eslint rules: [`quote-props`](http://eslint.org/docs/rules/quote-props.html).
300+
301+
```javascript
302+
// bad
303+
const bad = {
304+
'foo': 3,
305+
'bar': 4,
306+
'data-blah': 5,
307+
};
308+
309+
// good
310+
const good = {
311+
foo: 3,
312+
bar: 4,
313+
'data-blah': 5,
314+
};
315+
```
316+
295317
**[⬆ back to top](#table-of-contents)**
296318
297319
## Arrays
@@ -361,8 +383,8 @@ Other Style Guides (from Airbnb)
361383
}
362384
363385
// good
364-
function getFullName(obj) {
365-
const { firstName, lastName } = obj;
386+
function getFullName(user) {
387+
const { firstName, lastName } = user;
366388
return `${firstName} ${lastName}`;
367389
}
368390
@@ -1891,6 +1913,8 @@ Other Style Guides (from Airbnb)
18911913
18921914
- [21.3](#21.3) <a name='21.3'></a> Numbers: Use `Number` for type casting and `parseInt` always with a radix for parsing strings.
18931915
1916+
eslint rules: [`radix`](http://eslint.org/docs/rules/radix).
1917+
18941918
```javascript
18951919
const inputValue = '4';
18961920

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.0.0",
3+
"version": "3.0.1",
44
"description": "HubSpot's version of a mostly reasonable approach to JavaScript",
55
"scripts": {
66
"difftool": "./bin/difftool",

packages/eslint-config-hubspot/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
3.0.1 / 2016-01-06
2+
==================
3+
- [fix] because we use babel, keywords should not be quoted
4+
15
3.0.0 / 2016-01-04
26
==================
37
- [breaking] enable `quote-props` rule (#632)

packages/eslint-config-hubspot/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-hubspot",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "HubSpot's ESLint config, following our styleguide",
55
"main": "index.js",
66
"scripts": {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ module.exports = {
8686
'padded-blocks': [2, 'never'],
8787
// require quotes around object literal property names
8888
// http://eslint.org/docs/rules/quote-props.html
89-
'quote-props': [0, 'as-needed', { 'keywords': true, 'unnecessary': true, 'numbers': false }],
89+
'quote-props': [0, 'as-needed', { 'keywords': false, 'unnecessary': true, 'numbers': false }],
9090
// specify whether double or single quotes should be used
9191
'quotes': [2, 'single', 'avoid-escape'],
9292
// require identifiers to match the provided regular expression

0 commit comments

Comments
 (0)