1. eslint-ava-rule-tester
ESLint RuleTester for AVA
eslint-ava-rule-tester
Package: eslint-ava-rule-tester
Created by: jfmengels
Last modified: Sun, 07 Jan 2024 12:56:11 GMT
Version: 5.0.1
License: MIT
Downloads: 3,021
Repository: https://github.com/jfmengels/eslint-ava-rule-tester

Install

npm install eslint-ava-rule-tester
yarn add eslint-ava-rule-tester

eslint-ava-rule-tester

ESLint's RuleTester for AVA

Allows you to run ESLint's RuleTester with AVA while still getting the nice report it provides by default.

Install

 npm install --save-dev eslint-ava-rule-tester

Usage

Apart from how it is instantiated, the API is the same as ESLint's RuleTester. For information on how to test your rule, please follow the official documentation.

 import test from 'ava';
import AvaRuleTester from 'eslint-ava-rule-tester';
import rule from '../rules/my-awesome-rule.js';

const ruleTester = new AvaRuleTester(test, {
  languageOptions: {
    ecmaVersion: 2024,
  },
});

ruleTester.run('my-awesome-rule', rule, {
  valid: [
    '...',
  ],
  invalid: [
    {
      code: 'console.lgo',
      errors: [{ message: 'console.log was mistyped', column: 1, line: 1 }],
      output: 'console.log', // Optional, use this when your rule fixes the errors
    },
  ],
});

Run ava --verbose to get a better overview of which tests failed.

License

MIT © Jeroen Engels

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin