{"id":20216,"library":"mocha-eslint","title":"mocha-eslint","description":"Run ESLint as Mocha tests without a task runner like Grunt or Gulp. Version 7.0.0 supports ESLint ^7.0.0 and requires Node ^10.12.0 or >=12.0.0. It creates separate Mocha tests for each linted path or glob pattern, with options for formatter, timeout, slow, strict mode, and context name. Unlike alternatives that require plugin registration, this package directly exposes a function to run linting in any Mocha test file.","status":"active","version":"7.0.0","language":"javascript","source_language":"en","source_url":"git://github.com/BadgeLabs/mocha-eslint","tags":["javascript","mocha","eslint","mochaplugin"],"install":[{"cmd":"npm install mocha-eslint","lang":"bash","label":"npm"},{"cmd":"yarn add mocha-eslint","lang":"bash","label":"yarn"},{"cmd":"pnpm add mocha-eslint","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for linting functionality","package":"eslint","optional":false},{"reason":"Test runner, expected to be installed in consuming project","package":"mocha","optional":false}],"imports":[{"note":"Package uses CommonJS; ESM import may fail in older Node or without transpiler.","wrong":"import lint from 'mocha-eslint';","symbol":"default","correct":"const lint = require('mocha-eslint');"},{"note":"The exported value is a function; no named exports.","wrong":"","symbol":"Value","correct":"const lint = require('mocha-eslint');"},{"note":"There is no named export; must import default.","wrong":"import { lint } from 'mocha-eslint';","symbol":"Type","correct":"const lint = require('mocha-eslint');"}],"quickstart":{"code":"const lint = require('mocha-eslint');\nconst paths = ['src', 'test/**/*.js', '!test/exclude.js'];\nconst options = {\n  formatter: 'stylish',\n  alwaysWarn: true,\n  timeout: 5000,\n  slow: 1000,\n  strict: false,\n  contextName: 'eslint'\n};\nlint(paths, options);","lang":"javascript","description":"Configure mocha-eslint with paths, formatter style, timeout, and strict mode, then run linting as Mocha tests."},"warnings":[{"fix":"Review ESLint 7 migration guide for rule and config changes.","message":"Version 7.0.0 updates ESLint to ^7.0.0. ESLint 7 includes breaking changes such as removal of some rules and configuration changes.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Use Node >=8.0.0. Update ESLint config for version 6 changes.","message":"Version 6.0.0 drops support for Node 6 and updates to ESLint 6 and Mocha 6.","severity":"breaking","affected_versions":">=6.0.0 <7.0.0"},{"fix":"Ensure Node >=6.0.0. Review ESLint 5 migration.","message":"Version 5.0.0 drops Node <6 support and updates ESLint to ^5.10.0.","severity":"breaking","affected_versions":">=5.0.0 <6.0.0"},{"fix":"Install mocha as a devDependency: npm install --save-dev mocha.","message":"Mocha must be installed separately; mocha-eslint does not include it.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Place negation patterns after all positive patterns in the array.","message":"Negation patterns (e.g., !tests/NotATest.js) must be at the end of the paths array or they will not work.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install eslint --save-dev","cause":"ESLint is not installed or not installed as a peer dependency.","error":"Error: Cannot find module 'eslint'"},{"fix":"Use const lint = require('mocha-eslint');","cause":"Using named import instead of default import.","error":"TypeError: lint is not a function"},{"fix":"Set the timeout option in mocha-eslint or globally in Mocha.","cause":"Linting takes longer than the default Mocha timeout.","error":"Mocha error: timeout of 2000ms exceeded"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}