Skip to content

Latest commit

 

History

History
63 lines (43 loc) · 1.71 KB

CONTRIBUTING.md

File metadata and controls

63 lines (43 loc) · 1.71 KB

Contributing

For new additions or changes to the guide, create a branch and submit a Pull Request. Only add/change 1 style guide rule per Pull Request. The Pull Request serves as a place to discuss and refine the additions/changes.

Format

Use Github Flavoured Markdown.

Use short and descriptive rule names as 2nd level heading:

## Keep expressions simple

Optionally add an short summary for the rule.

RiotJS allows any type of JavaScript expression as inline expression (`{ expression }`).

Describe why the rule exists. What purpose does it serve?

### Why?

Keep inline expressions simple because:

* complex inline expressions are hard to read
* inline expressions cant be reused

Describe how (and how not) to apply the rule.

### How?

If an expression becomes complex, move it to a tag property or method.

When using code snippets:

  • use ```html for improved syntax highlighting of Riot tag elements.
  • use ```javascript for improved syntax highlighting when script only.
  • use <!-- recommended --> and /* recommended */ or <!-- avoid --> and /* avoid */ at the start of the snippet to indicate if it's a good or bad practice.

For example:

<!-- recommended -->
<datetime>{ this.timestamp() }</datetime>

<!-- avoid -->
<datetime>
    { ((new Date()).getUTCMonth()+1) + ' ' + (new Date()).getUTCFullYear() }
</datetime>

Add a ↑ back to Table of Contents link at the end of each rule, so the reader can easily navigate back:

[↑ back to Table of Contents](#table-of-contents)