{"id":635,"hash":"ff7a89034995cd93c852d64115a37a38fc4bc86892e8dabc52abd8dd6f1534dd","pattern":"Eslint adds unnecessary space between braces, Prettier shows error","full_message":"I'm using prettier and eslint with typescript.\n\nWhen I write some code and have to leave an empty function for reasons, Eslint and Prettier struggle adding and removing spaces between the empty function's braces.\n\nPrettier is removing the space while Eslint is adding it.\n\nWhat is expected:\n\n  constructor(\n    @inject('UsersRepository')\n    private usersRepository: IUsersRepository,\n  ) {}\n\nconst example = ({ variable }) => {\n    console.log(variable)\n};\n\nWhat I get after saving (Eslint fixing on save):\n\n  constructor(\n    @inject('UsersRepository')\n    private usersRepository: IUsersRepository,\n  ) { }\n\nconst example = ({ variable }) => {\n    console.log(variable)\n};\n\nSe the space between the constructor braces? That gives me a Delete `·` eslint(prettier/prettier) error.\n\nWhen I save the file, or Prettier removes the space... then Eslint adds it again.\n\nHow can I solve this?\n\nEDIT: I want to keep the destructuring assignment space (eg ({ variable })) but not on empty braces (eg {})\n\nBelow, my .eslintrc.json and prettier.config.js\n\n{\n  \"env\": {\n    \"es6\": true,\n    \"node\": true,\n    \"jest\": true\n  },\n  \"extends\": [\n    \"airbnb-base\",\n    \"plugin:@typescript-eslint/recommended\",\n    \"prettier/@typescript-eslint\",\n    \"plugin:prettier/recommended\"\n  ],\n  \"globals\": {\n    \"Atomics\": \"readonly\",\n    \"SharedArrayBuffer\": \"readonly\"\n  },\n  \"parser\": \"@typescript-eslint/parser\",\n  \"parserOptions\": {\n    \"ecmaVersion\": 2018,\n    \"sourceType\": \"module\"\n  },\n  \"plugins\": [\n    \"@typescript-eslint\",\n    \"prettier\"\n  ],\n  \"rules\": {\n    \"prettier/prettier\": \"error\",\n    \"class-methods-use-this\": \"off\",\n    \"@typescript-eslint/camelcase\": \"off\",\n    \"no-useless-constructor\": \"off\",\n    \"object-curly-spacing\": [\n      \"error\",\n      \"always\"\n    ],\n    \"@typescript-eslint/no-unused-vars\": [\n      \"error\",\n      {\n        \"argsIgnorePattern\": \"_\"\n      }\n    ],\n    \"@typescript-eslint/interface-name-prefix\": [\n      \"error\",\n      {\n        \"prefixWithI\": \"always\"\n      }\n    ],\n    \"import/extensions\": [\n      \"error\",\n      \"ignorePackages\",\n      {\n        \"ts\": \"never\"\n      }\n    ]\n  },\n  \"settings\": {\n    \"import/resolver\": {\n      \"typescript\": {}\n    }\n  }\n}\n\nmodule.exports = {\n  singleQuote: true,\n  trailingComma: 'all',\n  arrowParens: 'avoid',\n};","ecosystem":"npm","package_name":"eslint","package_version":null,"solution":"I've had very similar error, but in my case default VSCode TypeScript formatter was messing with braces.\nIn .vscode/settings.json add:\n\n\"javascript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces\": false,\n\"typescript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces\": false,\n\nYou might also find useful option:\n\n\"[typescript]\": {\n    \"editor.defaultFormatter\": \"dbaeumer.vscode-eslint\"\n}","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/61670561/eslint-adds-unnecessary-space-between-braces-prettier-shows-error","votes":55,"created_at":"2026-04-19T04:51:25.709101+00:00","updated_at":"2026-04-19T04:51:25.709101+00:00"}