Skip to content
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

Closed
ispringer opened this issue Feb 18, 2016 · 6 comments
Closed

mongo env is for mongo shell, not mongo server-side scripts #75

ispringer opened this issue Feb 18, 2016 · 6 comments

Comments

@ispringer
Copy link

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.

@nzakas
Copy link
Collaborator

nzakas commented Feb 18, 2016

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

@ispringer
Copy link
Author

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.

@nzakas
Copy link
Collaborator

nzakas commented Feb 19, 2016

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.

@ispringer
Copy link
Author

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!

@sindresorhus
Copy link
Owner

@nzakas Should we maybe add a note in the readme with something like this?

We're not accepting new environments. The most popular ones are already included. If you need a new environment for ESLint, just create a plugin.

@sindresorhus
Copy link
Owner

Closing in favor of #82.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants