Skip to content

Commit ee3759a

Browse files
committed
Add Section 18.10 - No spaces inside brackets
See airbnb#593
1 parent 2557a5b commit ee3759a

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,6 +1575,18 @@ Other Style Guides
15751575
}
15761576
```
15771577
1578+
- [18.10](#18.10) <a name='18.10'></a> Do not add spaces inside brackets.
1579+
1580+
```javascript
1581+
// bad
1582+
const foo = [ 1, 2, 3 ];
1583+
console.log(foo[ 0 ]);
1584+
1585+
// good
1586+
const foo = [1, 2, 3];
1587+
console.log(foo[0]);
1588+
```
1589+
15781590
**[⬆ back to top](#table-of-contents)**
15791591
15801592
## Commas

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
'rules': {
33
// enforce spacing inside array brackets
4-
'array-bracket-spacing': 0,
4+
'array-bracket-spacing': [2, 'never'],
55
// enforce one true brace style
66
'brace-style': [2, '1tbs', {'allowSingleLine': true }],
77
// require camel case names
@@ -10,8 +10,8 @@ module.exports = {
1010
'comma-spacing': [2, {'before': false, 'after': true}],
1111
// enforce one true comma style
1212
'comma-style': [2, 'last'],
13-
// require or disallow padding inside computed properties
14-
'computed-property-spacing': 0,
13+
// disallow padding inside computed properties
14+
'computed-property-spacing': [2, 'never'],
1515
// enforces consistent naming when capturing the current execution context
1616
'consistent-this': 0,
1717
// enforce newline at the end of file, with no multiple empty lines

0 commit comments

Comments
 (0)