question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Rule Idea] Enforce Splattributes

See original GitHub issue

This rule should check that exactly one element in the template has ...attributes attached to it.

Alternatively we could make it configurable to only error for multiple ...attributes, but allow zero and one instances of it.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Turbo87commented, May 15, 2019

hmm okay, guess then the rule should only warn if there are no splattributes at all

0reactions
lifeartcommented, Oct 23, 2019

I think this rule should work if component has internal “wrapper” node, or component and “wrapped node inside” (only in this case), other cases looks so complex and our linting may confuse developers.

rule apply exmples:

<div ...attributes>
  some content
</div>
<LooksLikeComponentNode>
   <div ...attributes></div>
</LooksLikeComponentNode>
<LooksLikeComponentNode ...attributes />

unsupported cases:

<div></div>
<div></div>
<LooksLikeComponentNode>
<div></div>
<div></div>
</LooksLikeComponentNode>
<LooksLikeComponentNode>
some text
</LooksLikeComponentNode>

  • if only one root node in template and node is not capitalized -> apply rule into this node

  • if only one root node and node self-closed -> apply rule into this node

  • if only one root node and node writeen block and capitalized and inside node level only one child node and this node is not capitalized -> apply rule into this child node

  • if template already has ...attributes -> ignore rule apply

  • other cases -> ignore rule apply

Read more comments on GitHub >

github_iconTop Results From Across the Web

Forwarding Element Modifiers with "Splattributes" - Ember RFCs
When teaching advanced component composition patterns, we can introduce the concept of "components that invokes other components". This would be ...
Read more >
ember-template-lint | Yarn - Package Manager
ember-template-lint is a library that will lint your handlebars template and return error results. For example, if the rule no-bare-strings is enabled, this ......
Read more >
Transformer - IBM
Use the Transformer to implement the business logic for your use case. ... As opposed to normal records, which contain any number of...
Read more >
Rules - ESLint - Pluggable JavaScript Linter
Rules in ESLint are grouped by type to help you understand their purpose. Each rule has emojis ... Enforce return statements in callbacks...
Read more >
ember-template-lint: Versions | Openbase
#2731 Allow nested menuitem s in no-nested-interactive rule (@geneukum). Documentation ... #2483 Implement support for embedded templates (@ventuno).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found