{"id":19853,"library":"eslint-plugin-no-only-tests","title":"eslint-plugin-no-only-tests","description":"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.","status":"active","version":"3.3.0","language":"javascript","source_language":"en","source_url":"git@github.com:levibuzolic/eslint-plugin-no-only-tests","tags":["javascript","eslint","eslintplugin","eslint-plugin","mocha","rule","only","describe","it"],"install":[{"cmd":"npm install eslint-plugin-no-only-tests","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-no-only-tests","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-no-only-tests","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency – requires ESLint as the linting framework","package":"eslint","optional":false}],"imports":[{"note":"Default import for use in eslint.config.js (flat config). For CommonJS require, use the correct path: const plugin = require('eslint-plugin-no-only-tests');","wrong":"const plugin = require('eslint-plugin-no-only-tests')","symbol":"plugin","correct":"import eslintPluginNoOnlyTests from 'eslint-plugin-no-only-tests'"},{"note":"Accessing the rules object directly is useful for custom configs or programmatic use.","wrong":"const rules = require('eslint-plugin-no-only-tests').rules","symbol":"rules","correct":"import { rules } from 'eslint-plugin-no-only-tests'"},{"note":"The rule is namespaced under 'no-only-tests', so you must use 'no-only-tests/no-only-tests' as the key.","wrong":"\"no-only-tests\": \"error\"","symbol":"rule","correct":"// In .eslintrc: \"no-only-tests/no-only-tests\": \"error\""}],"quickstart":{"code":"// .eslintrc.json\n{\n  \"plugins\": [\"no-only-tests\"],\n  \"rules\": {\n    \"no-only-tests/no-only-tests\": \"error\"\n  }\n}\n\n// Example test file that will cause an error:\ndescribe.only('my suite', () => {\n  it('test', () => {\n    // ...\n  });\n});","lang":"javascript","description":"Shows how to configure the plugin and rule to flag any `.only` calls in test files, preventing accidental commits."},"warnings":[{"fix":"Set the option `{\"fix\": true}` in the rule config.","message":"The rule does not automatically fix `.only` by default; the `fix` option must be explicitly set to `true` to enable autofixing.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Review your block patterns and ensure they only match intended test function names.","message":"The `block` option supports prefix matching with a trailing asterisk (e.g., `test*`), but this may cause unexpected matches if not used carefully.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Update your ESLint config: use `\"no-only-tests/no-only-tests\"` instead of `\"no-only-tests\"`.","message":"In v3.0.0, the rule was moved to a new `no-only-tests/no-only-tests` namespace; previously it was just `no-only-tests`.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use `{\"fix\": true}` instead of just `\"fix\": true`.","message":"The `fix` option as a boolean is deprecated in favor of an object with `fix: true`.","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use 'no-only-tests/no-only-tests' as the rule key.","cause":"The rule name is 'no-only-tests/no-only-tests' because it is namespaced under the plugin.","error":"ESLint: 'no-only-tests' is not a valid rule."},{"fix":"Run `npm install --save-dev eslint-plugin-no-only-tests`.","cause":"The package is not installed or ESLint cannot resolve it.","error":"Error: Cannot find module 'eslint-plugin-no-only-tests'"},{"fix":"Add '\"plugins\": [\"no-only-tests\"]' to your ESLint configuration.","cause":"The plugin is not listed in the 'plugins' array in your ESLint config.","error":"Definition for rule 'no-only-tests/no-only-tests' was not found."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}