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

feat: add test for tabs in no-extra-spacing-attrs #202

Merged
merged 9 commits into from
Aug 3, 2024

Conversation

RobertAKARobin
Copy link
Contributor

@RobertAKARobin RobertAKARobin commented Jul 29, 2024

This adds two things to no-extra-spacing-attrs:

  • It adds a disallowTabs option to enforce using only spaces inside a tag
  • It checks for extra spaces between the tag start and the tag end, whereas the current version only checks for extra spaces before the tag end if the tag has attributes or is self-closing

Because this rule can now have an effect when a tag has no attributes, in the future may want to rename the rule to just no-extra-spacing... Just a thought!

Thanks! :)

}
});
}

/**
Copy link
Contributor Author

@RobertAKARobin RobertAKARobin Jul 29, 2024

Choose a reason for hiding this comment

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

I moved this logic into the return { [Tag](node){} } function because otherwise I found that we were recalculating several variables that had already been calculated, and it also let me present the logic in a more linear way that I found easier to understand. This did result in one existing test being changed slightly... See https://github.com/yeonjuan/html-eslint/pull/202/files#diff-dc2d2c159cee6aaa292bf260ddb4613296b2d20c77543ba6c0705e29ed1a993eR312. I hope that's OK!

@@ -309,7 +309,7 @@ ruleTester.run("no-extra-spacing-attrs", rule, {
output: "<img src='foo.png' />",
errors: [
{
messageId: "unexpectedAfter",
messageId: "unexpectedBeforeSelfClose",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yeonjuan
Copy link
Owner

@RobertAKARobin

in the future may want to rename the rule to just no-extra-spacing... Just a thought!

I agree! This rule is doing more than its name implies. I think it would be a good idea to rename the rule in the future.

Copy link
Owner

@yeonjuan yeonjuan left a comment

Choose a reason for hiding this comment

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

LGTM!! 🎉 Thank you for your contribution.

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.

2 participants