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

star spacing #572

Open
andreashuber69 opened this issue Oct 22, 2023 · 0 comments
Open

star spacing #572

andreashuber69 opened this issue Oct 22, 2023 · 0 comments

Comments

@andreashuber69
Copy link

andreashuber69 commented Oct 22, 2023

This somewhat duplicates what has been discussed before, but AFAICT has not been succinctly condensed into a feature request before. Most people seem to have a very strong opinion about this, which is probably why eslint can be configured to put the star just about anywhere, with the rules generator-star-spacing and yield-star-spacing. It would be nice to have similar configurability in dprint.

Here's an incomplete list of locations where star spacing would apply:

class A {
    public *before();
    public* after(); // yes, this is legal
    public static *before();
    public static* after(); // yes, this is legal
}
const anonymous = function *() {
    yield 1;
    yield 2;
};

const before = function *before() {
    yield *anonymous();
};

const after = function* after() {
    yield* anonymous();
};

In my experience most are not consistent about star spacing, some insist the star has to go with the function name function *func() (space before) but then happily write yield* func(); (space after), which happens to be the default setting with eslint.

IMO, dprint currently formats inconsistently as well, e.g. yield* and function* but private *whatever().

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

No branches or pull requests

1 participant