ESLint rule that prevents committing focused tests (`.only`) commonly used in Mocha, Jest, Jasmine, and other JS test frameworks. Version 3.3.0 is the current stable release, maintained actively with regular updates. Unlike general lint rules, it supports multiple test block names and custom focus methods, with opt-in autofixing. It catches `describe.only`, `it.only`, `test.only`, and many other patterns by default, and can be configured for any test framework that uses `.only` or similar focus patterns.
npm install eslint-plugin-no-only-testsVerified import paths — ran on the pinned version, not inferred.
Shows how to configure the plugin and rule to flag any `.only` calls in test files, preventing accidental commits.
Set the option `{"fix": true}` in the rule config.Review your block patterns and ensure they only match intended test function names.
Update your ESLint config: use `"no-only-tests/no-only-tests"` instead of `"no-only-tests"`.
Use `{"fix": true}` instead of just `"fix": true`.Use 'no-only-tests/no-only-tests' as the rule key.
Run `npm install --save-dev eslint-plugin-no-only-tests`.
Add '"plugins": ["no-only-tests"]' to your ESLint configuration.