eslint-plugin-riot

eslint plugin to lint javascript in riot tag.

Usage no npm install needed!

<script type="module">
  import eslintPluginRiot from 'https://cdn.skypack.dev/eslint-plugin-riot';
</script>

README

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.