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

XML formatter #460

Closed
3 tasks done
zanfee opened this issue Apr 23, 2024 · 4 comments · Fixed by #472
Closed
3 tasks done

XML formatter #460

zanfee opened this issue Apr 23, 2024 · 4 comments · Fixed by #472
Labels
enhancement New feature or request

Comments

@zanfee
Copy link
Contributor

zanfee commented Apr 23, 2024

Clear and concise description of the problem

As a SAPUI5 (a JavaScript framework) developer I define views (based on the MVC pattern) for my web apps using XML (as described in the SAPUI5 docs). Currently I use a fork of @antfu/eslint-config which includes the @html-eslint plugin and parser that work for both HTML and XML. I created this fork before you included formatters in @antfu/eslint-config and I think that I could migrate back to @antfu/eslint-config once XML is supported. Since XML is a common format for many use-cases, I believe that it would benefit other developers too.

I'd be happy to submit a PR for this.

Suggested solution

I think we could use eslint-plugin-format based on Prettier and dprint to support XML as you already do for HTML. I haven't checked if there's anything else you need to do to make it work, but I'd be happy to give it a try.

Alternative

No response

Additional context

No response

Validations

@zanfee zanfee added the enhancement New feature or request label Apr 23, 2024
@zanfee
Copy link
Contributor Author

zanfee commented Apr 23, 2024

Prettier does not support XML by default but with a community plugin (plugin-xml).

@antfu
Copy link
Owner

antfu commented Apr 25, 2024

Maybe we could use dprint? I am ok to have it as opt-in if it's not too complicated to maintain

@zanfee
Copy link
Contributor Author

zanfee commented Apr 26, 2024

There's no XML plugin listed on dprint's plugin site and I couldn't find one either. Are you suggesting creating a plugin for XML from scratch? Dprint also has a Prettier wrapper, but since eslint-plugin-format supports both Prettier and dprint, there's probably no point in using that but rather just Prettier with the community plugin. But I'm not familiar with dprint, so maybe you know more than I do and could elaborate.

Having XML support as opt-in is fine for me.

@antfu
Copy link
Owner

antfu commented Apr 30, 2024

Oh, I thought Dprint had it built in. I am fine with Prettier, but the problem I see is because XML support is provided as an external plugin which would make the configuration tricky - If you managed to get it work, we could then discuss it with in the PR.

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

Successfully merging a pull request may close this issue.

2 participants