prettier-plugin-brace-style icon indicating copy to clipboard operation
prettier-plugin-brace-style copied to clipboard

support "allowSingleLine" option

Open mmorgan4x opened this issue 1 year ago • 3 comments

support for option "allowSingleLine"

This rule has an object option for an exception: "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

mmorgan4x avatar Feb 01 '24 20:02 mmorgan4x

This plugin is theoretically equivalent to applying ESLint formatting (brace-style only) after applying Prettier formatting.

Therefore, currently, it is not possible to tell from the intermediate text (Prettier formatted) whether the original text was written as a single line, so research is needed to implement the feature.

ony3000 avatar Feb 02 '24 02:02 ony3000

In my code, I sometimes have empty methods, like this:

const test = () => {};

The brace-style rule in ESLint and this plugin will place the brace on the second line, like this:

const test = () => 
{};

Is it possible to allow single line brackets when the function body is empty?

nogeenkopjethee avatar Dec 12 '24 17:12 nogeenkopjethee

@nogeenkopjethee This is possible if the allowSingleLine option is implemented.

ony3000 avatar Dec 17 '24 15:12 ony3000