eslint-plugin-riot

0.1.8 • Public • Published

eslint-plugin-riot

Build Status NPM version Code Climate

An ESLint plugin to extract and lint scripts from riot tag.

Supported extensions are .html and .tag.

It only lints es6, babel or javascript script in tag. It does not support riot mini es6 syntax.

Usage

Install the plugin:

npm install --save-dev 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>

Example

Here is an example of project that use riot + es6 + webpack + eslint + eslint-plugin-riot. It will show you how to use this plugin to configure your project.

Package Sidebar

Install

npm i eslint-plugin-riot

Weekly Downloads

170

Version

0.1.8

License

MIT

Unpacked Size

15.7 kB

Total Files

10

Last publish

Collaborators

  • txchen