Why do you use object-curly-spacing
See original GitHub issueHi 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:
- Created 6 years ago
- Reactions:1
- Comments:11
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.