-
-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mongo env is for mongo shell, not mongo server-side scripts #75
Comments
If your primary use case is ESLint, then I'd suggest creating a plugin with these environments. http://eslint.org/docs/developer-guide/working-with-plugins#environments-in-plugins |
I currently just have the globals in my config file, which works well enough. I filed this issue, because I think the "mongo" environment that is bundled with eslint is poorly named. And if eslint is going to ship with one Mongo environment, I would think it would be Mongo server-side and not Mongo shell, being as server-side scripts are more likely to be used in production deployments and therefore more in need of being error-free. |
This is why I suggest creating a plugin. I think it's time to for ESLint to stop making arbitrary decisions about what environments it ships with and instead democratize the process. It sounds like you have deep knowledge of Mongo, so it would be better for ESLint users to have someone like you write and maintain a plugin with this info rather than going through the circuitous route of trying to have it included by default. |
Ok, I got ya. I created a plugin: https://www.npmjs.com/package/eslint-plugin-mongo Let me know if you see any issues with it. If not, can you link to it from the ESLint docs to help other people find it? Thanks! |
@nzakas Should we maybe add a note in the readme with something like this?
|
Closing in favor of #82. |
The "mongo" env is currently for mongo shell (https://docs.mongodb.org/manual/reference/method/), but Mongo also has another context for JavaScript execution - Mongo server-side scripts (https://docs.mongodb.org/manual/core/server-side-javascript/), which has an almost completely different set of predefined globals (https://docs.mongodb.org/manual/reference/operator/query/where/#behavior). There really should be two separate environments for Mongo. I think the names "mongo-shell" and "mongo-server-side" would be most intuitive. I'd suggest making the current "mongo" env a deprecated alias for "mongo-shell".
If the powers that be agree this is a good idea, I can create a PR. Please let me know.
The text was updated successfully, but these errors were encountered: