Skip to content
the poor coder

Bracket Spacing .prettierrc

Poor Man
Published
Reading time
1 min read

Bracket Spacing .prettierrc#

If you're a developer who is particular about code formatting, you may have heard of Prettier. It's a code formatter that helps standardize code formatting styles. One of the options in Prettier is "Bracket Spacing". This option allows you to control the spacing around brackets in your code.

To configure "Bracket Spacing" in Prettier, you need to create a .prettierrc file in the root of your project. This file is used to configure Prettier according to your preferences.

Here's an example of how to configure "Bracket Spacing" in your .prettierrc file:

Text

{
  "bracketSpacing": true
}

The above configuration will add a space before and after brackets. If you prefer no spaces around brackets, you can set the value to false:

Text

{
  "bracketSpacing": false
}

In addition to the boolean values, you can also set numeric values for "Bracket Spacing". This allows you to control the number of spaces around brackets:

Text

{
  "bracketSpacing": {
    "object": 1,
    "array": 0
  }
}

The above configuration will add one space before and no spaces after object brackets, and no spaces around array brackets.

Overall, Prettier offers a lot of flexibility in controlling code formatting styles. By configuring options like "Bracket Spacing" in your .prettierrc file, you can customize Prettier to work the way you want it to.

Keep going

2023

how to sort an array

How to Sort an Array If you have an array and you want to order its elements in a specific way, you need to use a sorting algorithm. There are several sorting algorithms available, but two of the most commonly used are…

javascript2 min read
2023

jquery mobile or desktop

jQuery Mobile or Desktop? As a web developer, I have had some experience with both jQuery Mobile and jQuery Desktop. Both frameworks have their pros and cons, and which one to use really depends on the specific project…

javascript1 min read
2023

node.js folder structure

Node.js Folder Structure If you are new to Node.js, it can be daunting to create a folder structure that will work for your project. The structure you choose will depend on the size and complexity of your project. Here…

javascript1 min read
ESC