3.0.8 • Published 6 years ago
eslint-config-tester v3.0.8
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 --devInstall the ESlint Config Tester locally.
$ yarn add eslint-config-tester --devUsage
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.