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

Add a more descriptive message for the error generated by an empty shorthand attribute #6217

Merged
merged 7 commits into from
Jun 22, 2021

Conversation

rster2002
Copy link
Contributor

@rster2002 rster2002 commented Apr 20, 2021

Changes

Added an error message when the parser finds an empty shorthand attribute (#6086) Right now it's an error, but as the issue suggests, it could also changed to generate a warning instead of an error. Let me know what you think!

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with npm test and lint the project with npm run lint

@dummdidumm
Copy link
Member

Not sure if this must be part of this PR and instead a separate PR but this code where a attribute value is read could be enhanced, too, to explicitely handle the {} case.

I would add both as errors for now, and in another step I think it would make sense to introduce a "loose" AST parsing mode for language tools which would try to only warn in these cases and continue parsing.

@rster2002
Copy link
Contributor Author

In the original issue there was already a discusion about whether or not this should be an error or just a warning. I did not know how strict parser should handle these situations so I assumed it should be strict, but as you said: later this could be changed to be more lenient.

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

Successfully merging this pull request may close these issues.

4 participants