Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support "allowSingleLine" option #23

Open
mmorgan4x opened this issue Feb 1, 2024 · 3 comments
Open

support "allowSingleLine" option #23

mmorgan4x opened this issue Feb 1, 2024 · 3 comments
Assignees

Comments

@mmorgan4x
Copy link

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 mmorgan4x added the enhancement New feature or request label Feb 1, 2024
@ony3000 ony3000 self-assigned this Feb 2, 2024
@ony3000
Copy link
Owner

ony3000 commented Feb 2, 2024

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.

@nogeenkopjethee
Copy link

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?

@ony3000
Copy link
Owner

ony3000 commented Dec 17, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants