question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why do you use object-curly-spacing

See original GitHub issue

Hi airbnb team, Can give us your thinking behind applying the object-curly-spacing rule? I can think of only one: it distinguishes the arrays from the objects. Or do you have another reason?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:11

github_iconTop GitHub Comments

18reactions
ljharbcommented, May 8, 2017

Are you asking why there’s a rule to enforce it, or why we chose the config we did?

It’s enforced because everything that can be enforced should be; because consistency is paramount; and because nobody should have to argue on a PR about curly brace spacing.

4reactions
ljharbcommented, May 2, 2018

It’s using array and object syntax, but it’s not arrays and objects - specifically, iterable destructuring (not array destructuring, there’s no such thing) uses the iterable protocol, which is different.

I don’t agree that it’s ugly or that it’s inconsistent.

named imports/exports are also not objects, nor destructuring - it simply overloads object literal syntax. It’s far more like an object than like a block (it’s not a block in any way), but it’s not an object either.

Read more comments on GitHub >

github_iconTop Results From Across the Web

object-curly-spacing - ESLint - Pluggable JavaScript Linter
Rule Details​​ This rule enforces consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.
Read more >
object-curly-spacing | typescript-eslint
This rule extends the base eslint/object-curly-spacing rule. It adds support for TypeScript's object types. How to Use​ .eslintrc.cjs. module.
Read more >
Object Curly Spacing
Inserts a space before/after brackets for object literals, destructuring assignments, and import/export specifiers. Configuration option for beautifiers ...
Read more >
How do I disable There should be no space after ...
Modify your rules to look like this: rules: { 'object-curly-spacing': ['error', 'always'], 'quotes': ['error'], },. After this change you ...
Read more >
JS.TS.OBJECT.CURLY.SPACING
This rule extends the base JS.BASE.OBJECT.CURLY.SPACING rule. It adds support for TypeScript's object types. How to use. { // note you must disable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found