{"id":19839,"library":"eslint-plugin-mongo","title":"eslint-plugin-mongo","description":"ESLint plugin providing environments for MongoDB server-side scripts (mapReduce, eval, $where) and MongoDB shell scripts. Version 1.0.5 is the latest and only release. It defines global variables specific to MongoDB contexts to prevent false positives in ESLint. Limited to environment definitions; does not include custom rules. Requires ESLint as a peer dependency. Last updated in 2018; no active development.","status":"maintenance","version":"1.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/ispringer/eslint-plugin-mongo","tags":["javascript","eslint","eslintplugin","eslint-plugin","mongo","mongodb"],"install":[{"cmd":"npm install eslint-plugin-mongo","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-mongo","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-mongo","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: plugin only works within ESLint","package":"eslint","optional":false}],"imports":[{"note":"Plugin name prefix 'eslint-plugin-' should be omitted in ESLint config.","wrong":"{ \"plugins\": [\"eslint-plugin-mongo\"] }","symbol":"eslint-plugin-mongo","correct":"// In .eslintrc: { \"plugins\": [\"mongo\"] }"},{"note":"Environment name uses slash, not hyphen.","wrong":"{ \"env\": { \"mongo-server-side\": true } }","symbol":"mongo/server-side","correct":"// In .eslintrc: { \"env\": { \"mongo/server-side\": true } }"},{"note":"Environment name uses slash, not hyphen.","wrong":"{ \"env\": { \"mongo-shell\": true } }","symbol":"mongo/shell","correct":"// In .eslintrc: { \"env\": { \"mongo/shell\": true } }"}],"quickstart":{"code":"// Install: npm install eslint eslint-plugin-mongo --save-dev\n// .eslintrc.json\n{\n  \"plugins\": [\"mongo\"],\n  \"env\": {\n    \"mongo/shell\": true\n  }\n}","lang":"javascript","description":"Quick setup to enable MongoDB shell environment in ESLint: install packages and configure plugin and environment."},"warnings":[{"fix":"Consider using eslint-plugin-mongodb or writing custom globals.","message":"Package is unmaintained since 2018.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Combine with other plugins or define custom rules.","message":"Plugin only defines environments, no rules. May not meet all linting needs.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Manually add globals in ESLint config.","message":"Environments may not include all MongoDB globals (e.g., ObjectId, ISODate).","severity":"gotcha","affected_versions":">=1.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-plugin-mongo --save-dev' and ensure node_modules is accessible.","cause":"Plugin not installed or ESLint cannot resolve it.","error":"Error: Failed to load plugin 'mongo' declared in '.eslintrc.json': Cannot find module 'eslint-plugin-mongo'"},{"fix":"Enable the 'mongo/shell' environment in your ESLint config.","cause":"MongoDB shell globals like 'db' are not recognized by ESLint.","error":"Parsing error: The keyword 'db' is not defined."},{"fix":"Check plugin documentation; only environments are provided.","cause":"Plugin does not provide custom rules.","error":"Definition for rule 'mongo/rule-name' was not found."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}