Skip to content

feat: add svelte/html-closing-bracket-spacing #186

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

Merged
merged 21 commits into from
Jul 26, 2022
Merged

feat: add svelte/html-closing-bracket-spacing #186

merged 21 commits into from
Jul 26, 2022

Conversation

marekvospel
Copy link
Contributor

@marekvospel marekvospel commented Jul 12, 2022

Added html-closing-bracket-spacing rule, which can be seen in eslint-plugin-vue

Related PRs

feat: add svelte/html-self-closing #190
feat: add svelte/no-spaces-around-equal-signs-in-attribute #191

svelte/html-closing-bracket-spacing

A simple rule for enforcing a space before closing a tag

<div/>
<!-- gets fixed to -->
<div />

Coverage

100% test coverage.

Notes & questions

  • This is my first time contributing to this project and creating eslint plugins in general, so I'm sorry if some parts of my code aren't as good.
  • How should I document the rules? Is there a script to automatically generate the documentation, or should I create a new markdown file inside docs/rules? (This information should probably be added to contributing section in README)

@ota-meshi
Copy link
Member

Thank you for this PR!
You need to add documents that describes the rules you added. After adding the files, run yarn update to update the header and footer.

@marekvospel
Copy link
Contributor Author

@ota-meshi I've added the docs, fixed the merge conflicts and both the docs build and lint should be passing now!

@ota-meshi
Copy link
Member

Thank you for adding the documentation! I'm busy this week so I'll probably check it next week.

@marekvospel
Copy link
Contributor Author

I had extra time today, so I have added svelte/html-closing-bracket-spacing rule!

<div/>
# gets fixed to
<div />

It's similar to to svelte/no-spaces-around-equal-signs-in-attribute , but only has to check the end of the tag, so it's a bit simpler rule.

The test also has 100% coverage

I've also fixed some minor problems in my docs (such as since version being 0.2.2, which is already released, or mistyped <div />

@marekvospel marekvospel changed the title feat: add svelte/html-self-closing and svelte/no-spaces-around-equal-signs-in-attribute rules feat: add svelte/html-closing-bracket-spacing, svelte/html-self-closing and svelte/no-spaces-around-equal-signs-in-attribute rules Jul 15, 2022
Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR!

I have change requests.
I've looked at the source code for one rule, but I'll check the rest after tomorrow.

@ota-meshi
Copy link
Member

If possible, can you separate the PR for each rule?
That way I can split the time to check the PR.

@ota-meshi
Copy link
Member

If you want to create new rules besides these, you may find it useful to use yarn new new-rule-name.

@marekvospel marekvospel changed the title feat: add svelte/html-closing-bracket-spacing, svelte/html-self-closing and svelte/no-spaces-around-equal-signs-in-attribute rules feat: add svelte/html-closing-bracket-spacing Jul 21, 2022
@JounQin
Copy link
Collaborator

JounQin commented Jul 21, 2022

Hi @marekvospel Can you update this PR’s description align to its actual content?

@marekvospel
Copy link
Contributor Author

Hi @marekvospel Can you update this PR’s description align to its actual content?

sure

Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for changing this PR. Also, thank you for splitting the PR.
I commented only one. Other than that, it looks good to me.

@JounQin
Copy link
Collaborator

JounQin commented Jul 21, 2022

Personally thinking, styling rules should be extracted to another plugin like eslint-plugin-svelte-styling just like ESLint core has frozen their styling rules. We have prettier for .svelte or .vue files, although someone may not be using prettier, but another eslint-plugin-svelte-styling can help, so that styling rules can be excluded from this one.

@ota-meshi
Copy link
Member

Hmm. I'm not sure if the stylistic rules should be an another plugin.
For now, I don't think it's necessary. Because the stylistic rules of the ESLint core are not yet another plugin.
But later my thinking may change.

@JounQin
Copy link
Collaborator

JounQin commented Jul 21, 2022

Because the stylistic rules of the ESLint core are not yet another plugin.

ESLint core has frozen their stylistic rules, no new related rule will be added, and no new feature for these rules will be added neither.

@ota-meshi
Copy link
Member

ota-meshi commented Jul 21, 2022

I know that, but plugin for Svelte doesn't freeze the stylistic rules.
The ESLint core stylistic rules were used by many users and enhanced by many contributors until they froze. However, this plugin is not yet known to users and there are not enough stylistic rules.


If we continue to discuss what to do with stylistic rules, it may be better to open a new issue and discuss it there.

Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ota-meshi ota-meshi requested a review from JounQin July 22, 2022 03:38
ota-meshi pushed a commit that referenced this pull request Jul 26, 2022
* feat: add `svelte/no-spaces-around-equal-signs-in-attribute`

Moved to separate PR from #186

* chore: requested changes
@ota-meshi ota-meshi merged commit 671dfca into sveltejs:main Jul 26, 2022
@ota-meshi
Copy link
Member

@marekvospel Thank you for your great contribution!
I merged and released the two rules 🎉
https://github.com/ota-meshi/eslint-plugin-svelte/releases/tag/v2.3.0

I will release the next version when the rest of the rules are complete.

ota-meshi pushed a commit that referenced this pull request Aug 4, 2022
* feat: add `svelte/html-self-closing`

Moved to separate PR from #186

* chore: requested changes

* fix: test not passing, lint, edit rule docs

* chore(html-self-closing): move options from html object, move utils to ast-utils
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.

3 participants