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] New rule no-surrounding-whitespace #226

Merged
merged 1 commit into from Sep 3, 2020

Conversation

KamiKillertO
Copy link
Collaborator

This PR adds the new rule no-surrounding-whitespace proposed in issue #148.
This rule forbids the presence of whitespaces before or after a text node.
Here's a list of valid/invalid snippets.

VALID snippets:

<h1>Lorem ipsum</h1>
<p><strong>Lorem</strong> ipsum</p>
<p><!-- comment --><strong>Lorem</strong> ipsum</p>
<div>
    <p>Lorem ipsum dolor sit amet...</p>
</div>
<div>
    <p>
        Lorem ipsum dolor sit amet...
    </p>
</div>
<div>
    <p>
        <!-- comment -->
        Lorem ipsum dolor sit amet...
        <!-- comment -->
    </p>
</div>
<div></div>

INVALID snippets:

<h1> Lorem ipsum</h1>
<h1>Lorem ipsum   </h1>
<h1> Lorem ipsum </h1>
<p> <strong>Lorem</strong> ipsum</p>
<p> <!-- comment --><strong>Lorem</strong> ipsum</p>
<div> </div>

@KamiKillertO KamiKillertO added rules Anything related to the rules core Anything related to the core of linthtml labels Sep 2, 2020
@KamiKillertO KamiKillertO force-pushed the feat/rule_no_surrounding_whitespace branch from a69abe3 to 88172c0 Compare September 2, 2020 08:05
@acalvo
Copy link

acalvo commented Sep 2, 2020

Great! 🥳

Can you add this one to the test suite?

<div>
  <p>Lorem ipsum</p>
</div>

It's throwing an error in my tests and it shouldn't.

@KamiKillertO KamiKillertO force-pushed the feat/rule_no_surrounding_whitespace branch from 54314c7 to 5ca9be3 Compare September 2, 2020 15:24
@KamiKillertO
Copy link
Collaborator Author

@acalvo it's fixed

@acalvo
Copy link

acalvo commented Sep 3, 2020

Works like a charm now!

It's OK for me, can be merged. Thanks a lot!

@KamiKillertO KamiKillertO merged commit 83689a9 into 0.5.0 Sep 3, 2020
@delete-merged-branch delete-merged-branch bot deleted the feat/rule_no_surrounding_whitespace branch September 3, 2020 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Anything related to the core of linthtml rules Anything related to the rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants