Prettier-vscode: Space between arrays on single line

Created on 9 Nov 2017  路  8Comments  路  Source: prettier/prettier-vscode

How to add spaces inside brackets of arrays on single line?

{
  "items": [ "item1", "item2" ]
}
locked

All 8 comments

This is a prettier feature, It was decided to remove spacing in brackets / parens.
Duplicate of #35
You can read more about it in prettier/prettier#296

Thank you.

Forgot to mention, if you really want it, you can use 'eslintIntegration' with https://eslint.org/docs/rules/space-in-brackets

@CiGit thanks for the hints!
But with this settings in VSCode it does not work on formatting the document:

  "eslint.enable": true,
  "eslint.options": {
    "rules": {
      "array-bracket-spacing": ["error", "always", { "objectsInArrays": false }]
    }
  },
  "prettier.eslintIntegration": true

Good point. We do not read from this settings.

You have to put them in a file .eslintrc

The same behavior when I place a .eslintrc file with this content in a directory of json files:

{
  "rules": {
    "array-bracket-spacing": ["always"]
  }
}

My bad, I've read your initial post really badly. Thought it was JS not JSON.
Sadly, I've no workaround for you.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Connorelsea picture Connorelsea  路  4Comments

SkeLLLa picture SkeLLLa  路  4Comments

sebastijandumancic picture sebastijandumancic  路  4Comments

bluemoehre picture bluemoehre  路  3Comments

bardware picture bardware  路  4Comments