@rensovargas/eslint-plugin-riot
v0.1.6
Published
eslint plugin to lint javascript in riot tag.
Downloads
7
Maintainers
Readme
eslint-plugin-riot
[![Build Status][travis-image]][travis-url] [![NPM version][npm-version-image]][npm-url] [![Code Climate][codeclimate-image]][codeclimate-url]
An ESLint plugin to extract and lint scripts from riot tag.
Supported extensions are .html
and .tag
.
lints es6
and text/javascript
script in tag.
Usage
Install the plugin:
npm install --save-dev @rensovargas/eslint-plugin-riot
Add it to your .eslintrc
:
{
"plugins": ["riot"]
}
Write your riot tag file with extension .html
or .tag
, and wrap your script with <script type="es6"> </script>
, for example:
<postcell>
<div>
<span>Id: {opts.data.postId}</span>
<span>Title: <a href="#detail/{opts.data.postId}">{opts.data.title}</a></span>
<span>{opts.data.likes} Likes</span>
<button onclick={likePost}>Like</button>
</div>
<script type="es6">
this.likePost = () => {
riot.control.trigger(riot.VE.LIKE_POST, opts.data.postId)
}
</script>
</postcell>