eslint-tester is a utility package designed to facilitate testing within the ESLint project itself, and was initially intended for broader use by authors of custom ESLint rules. However, as of ESLint v1.0.0, this package has been deprecated and is no longer actively developed. Its functionality has been superseded by the `RuleTester` class, which is directly exposed within the main `eslint` package and is the recommended way to test ESLint rules. The package's last significant update (`v0.8.2`) was in June 2015, and its GitHub repository explicitly marks it as 'DEPRECATED'. Users should avoid this package and instead use `RuleTester` from `eslint` for current projects. The release cadence was irregular, with its primary focus being internal ESLint development.
npm install eslint-testerVerified import paths — ran on the pinned version, not inferred.
Demonstrates the conceptual usage of `eslint-tester` for defining and testing a simple custom ESLint rule. Note its deprecation.
Review all test case options for adherence to ESLint's configuration schema. Ensure properties like `code`, `errors`, `parserOptions` are correctly structured.
Migrate all rule testing logic to use `RuleTester` imported from the `eslint` package. Refer to the ESLint v1.0.0 migration guide for details.
For testing custom ESLint rules, use `RuleTester` from `eslint` (or `@typescript-eslint/rule-tester` for TypeScript rules) which provides a stable and well-documented API for this purpose.
Ensure you are using CommonJS `require` syntax: `const ESLintTester = require('eslint-tester');`Ensure your test runner (e.g., Mocha, Jest, Vitest) is correctly configured to provide global test hooks, or explicitly set `RuleTester.afterAll` (and similar hooks) before running tests: `RuleTester.afterAll = require('mocha').after;` (or equivalent for your test framework).