Plugin names without the eslint-plugin prefix
See original GitHub issueWhat version of ESLint are you using? 1.9.0
The problem you want to solve Our company has a javascript package that we have used for a long time to programmatically define linter configurations. We want to turn this into an eslint plugin but don’t want to have to rename this entire project.
Your take on the correct solution to problem. In lots of packages that have plugins, they prefer loading packages with their given prefix but fall back to the specified package name without the prefix if it doesn’t exist with the prefix.
What I’d like to be able to do is change this section: https://github.com/eslint/eslint/blob/master/lib/config/plugins.js#L116 to first check if the module exists with PLUGIN_NAME_PREFIX
, if it does not, check without PLUGIN_NAME_PREFIX
, and if it still doesn’t exist then, throw.
A reasonable concern would be that if the prefix isn’t required, then people will stop providing the prefix and then plugins will become harder to find. IMO, this isn’t a likely situation since it is pretty well drilled into the community that plugin names begin with eslint-plugin
. Also, since the documentation still recommends adding the keywords, I don’t think that will be a problem. I see this as being a use case for a very small sub percentage of users who can’t easily do it the recommended way.
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (8 by maintainers)
It looks like Facebook found a work around by using package.json to create an npm module from a local folder: https://github.com/facebook/react/pull/4034/files
I can make that work.
I’ve run into a problem with rulesdir in my 30 minutes of playing with it before writing that last comment that makes it a no go.
Since rulesdir is only a cli flag and can’t be set in the eslintrc, for which there are many issues requesting that feature which @nzakas has closed, editor integrations for our team will be broken without manual configuration. They won’t be able to work just by following the config files. I’d have to help every member of my team specially configure their editor plugin to also pass that flag.
That pretty much makes rulesdir a no go and I’m back to the beginning. 😕