Skip to content

Unwanted line break in javascript class private fields on save #141

Open

Description

@Wombosvideo

Description

When creating private fields in javascript classes this formatter adds a newline between the # and the variable name. This results in invalid javascript code.

Example

The code

class MyClass {
    #myPrivateField = 'some value';
}

is turned into

class MyClass {
    #
    myPrivateField = 'some value';
}

on save. This is invalid javascript.

Further Information

To find out more about private fields in javascript classes, see section Private field declarations on mdn/JS/Classes.

Suggested Workaround

Since this extension is hardly maintained I suggest moving on from it and switching to an alternative like Prettier - Code formatter. Keep in mind that with every formatter the code looks a little different and you might have to change some settings in order for the code to look just the way you prefer.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions