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 Request] Element Attribute Order

See original GitHub issue

Not exactly sure how to call this rule. Pretty much what I want is a rule that would throw on incorrect order inside of Element/Component invocation.

For example: Take this component:

<MyComp @name="test" data-test="123" @doSomething={{action "gogogo"}} class="flex" />

There is no order to the attributes/modifiers etc

I think there should be an order such that class is first, then data-test then props then actions Any thoughts?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:22 (14 by maintainers)

github_iconTop GitHub Comments

3reactions
rwjbluecommented, Apr 8, 2019

I think I’d prefer:

  • arguments
  • attributes
  • element modifiers
  • ...attributes
  • block params

To move forward here I think we need something like the following steps:

  • create a new rule (component-invocation-order, element-space-order, some other name?)
  • in the rule, implement the ElementNode visitor that ensures the ordering is correct
  • group node.attributes into “arguments” and “attributes” based on a leading @
  • compare the loc information of each entry in the three categories (arguments, attributes, and modifiers) to see if they match our expected ordering
    • confirming that no attributes (non-@ starting entries in node.attributes) are before the arguments (the @ leading names in node.attributes)
    • confirming that no modifiers are before either attributes or arguments
    • etc…

How does that sound?

1reaction
bmishcommented, Nov 8, 2022

Available in v4.18.0, thanks @rob-long!

Read more comments on GitHub >

github_iconTop Results From Across the Web

vue/attributes-order
Rule Details #. This rule aims to enforce ordering of component attributes. The default order is specified in the Vue.js Style Guide and...
Read more >
Capture request attributes based on web request data
Request attribute rules ​​ Rules are executed in order. If a request meets the criteria for both rules, its value will be taken...
Read more >
valid order for attributes of input type tag - html - Stack Overflow
There is no predefined order for the attributes in terms of passing w3c validation... it's completely up to you. However, you should introduce ......
Read more >
Create and manage attribute rules—ArcGIS Pro | Documentation
Evaluation order (Calculation rules); Exclude from application evaluation. To make changes to an existing attribute rule, complete the following steps: In the ...
Read more >
XML Schema Tutorial - Defining Elements and Attributes
Compositors provide rules that determine how and in what order there children can appear within XML document. There are three types of compositors...
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