eslint-config-tester

3.0.8 • Public • Published

ESLint Config Tester

eslint-config-tester is a utility library to write tests for ESLint configurations. It relies on eslint.CLIEngine to run configurations.

Installation

Install ESLint locally.

$ yarn add eslint --dev

Install the ESlint Config Tester locally.

$ yarn add eslint-config-tester --dev

Usage

eslint-config-tester exposes a single runOnText method. This method lets you run any given configuration against a JavaScript snippet. It throws an error if the configuration has any problems or the JavaScript snippet violates the rules set by the configuration.

'use strict';
 
const eslintConfigTester = require('eslint-config-tester');
const path = require('path');
 
const pathToEslintConfig = path.resolve(__dirname, 'index.js');
const jsSnippetToTest = "const hello = 'world';\nexport default hello;\n";
 
eslintConfigTester.prettierCheck(
    pathToYourEslintConfig,
);
 
eslintConfigTester.runOnText(
    pathToYourEslintConfig,
    jsSnippetToTest
);

Contributing

See Contributing.

Readme

Keywords

none

Package Sidebar

Install

npm i eslint-config-tester

Weekly Downloads

0

Version

3.0.8

License

MIT

Unpacked Size

7.94 kB

Total Files

6

Last publish

Collaborators

  • jjinux
  • kngroo
  • inancs
  • eedeebee
  • joecan
  • vladimirkopychev-udemy
  • carmen.wick
  • cansin