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.

Clarification of bracketSpacing option

See original GitHub issue

I’m not 100% sure what the bracketSpacing config does.

These explanations:

  • // Controls the printing of spaces inside object literals from the README.md
  • // Controls the printing of spaces inside arrays and objects from the atom package settings page

When using, the following code:

// source:
let list = [{
    name: "foo",
    value: "bar"
  },{
    name: "bar",
    value: "baz"
  }];

The output is always the same, wether bracketSpacing is used or not (cli or atom plugin):

// output:
let list = [
  {
    name: "foo",
    value: "bar"
  },
  {
    name: "bar",
    value: "baz"
  }
];

I’m assuming I’m just expecting something its not designed to do. With bracketSpacing disabled, I would have expected it to stay more dense. Any clarification would be great. Thanks!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

16reactions
jlongstercommented, Feb 20, 2017

People are pretty opinionated about trailing commas, and I think it’s worth having it as an option. However, I am open to removing the bracketSpacing option. I haven’t seen many people talk about it or use it. I think it’s mainly there because recast had that option.

4reactions
vjeuxcommented, Feb 15, 2017

Making trailing commas the default seems like a good idea! @jlongster we could use that option for the es7 trailing commas. I don’t think that trailing commas are very controversial

Read more comments on GitHub >

github_iconTop Results From Across the Web

Options - Prettier
Bracket Spacing. Print spaces between brackets in object literals. Valid options: true - Example: { foo: bar } .
Read more >
Typescript eslint-prettier puts space before and after in angled ...
... reason because I almost tried every single prettier option, disabled bracketSpacing etc. no chance. Anyone knows why is this happening?
Read more >
prettier - npm
Run prettier through the CLI with this script. Run it without any arguments to see the options. To format a file in-place, use...
Read more >
Blog - BracketSpace
This tutorial covers only Email carriers (in case you are interested in a different carrier you can see our tutorials here). The next...
Read more >
Configure Eslint, Prettier and Husky for WordPress Development
A brief explanation of ESLint options ... singleQuote: true trailingComma: es5 bracketSpacing: true parenSpacing: true jsxBracketSameLine: ...
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