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

Transforms should match the original formatting #33

Open
nolanlawson opened this issue May 3, 2024 · 0 comments
Open

Transforms should match the original formatting #33

nolanlawson opened this issue May 3, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@nolanlawson
Copy link
Collaborator

nolanlawson commented May 3, 2024

Currently, we reformat HTML/JS after running it through the tool. This can lead to a few issues:

JS

The formatting may end up different from the source file, e.g. in the case of indentation.

Before:

export default class Foo extends LightningElement {
    // Public
    @api title;
}

After:

export default class Foo extends LightningElement {
static renderMode = "light";
// Public
@api title;
}

(Note the changed indentation.)

HTML

Before:

<some-component foo></some-component>

After:

<some-component foo=""></some-component>

This is equivalent code per HTML semantics, but in the case of some-component it might actually treat the two differently. So this could change the behavior. Actually getAttribute/hasAttribute returns the same thing in both cases, so it's strictly equivalent.

We also transform things like SVG <path /> into <path></path>. (Equivalent, but potentially unwanted.)

CSS

I'm not aware of any cases where we change formatting/indentation, but maybe we do.

@nolanlawson nolanlawson added the enhancement New feature or request label May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant