question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plugin names without the eslint-plugin prefix

See original GitHub issue

What 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:closed
  • Created 8 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
TheSaviorcommented, Oct 3, 2016

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.

0reactions
TheSaviorcommented, Oct 3, 2016

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. 😕

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get internal eslint plugins without the ... - Stack Overflow
I have finished making an internal eslint plugin, but unfortunately our company requires us to prefix all of our internal npm packages with ......
Read more >
Plugins & Parsers - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
How to create a custom ESLint plugin for function prefix
Meaning, all function name should start with the prefix defined in the eslint rule. Instead of giving some random names to the function,...
Read more >
eslint-plugin-prefix-types - npm package - Snyk
An eslint plugin to enforce the prefixing of types and interfaces. Visit Snyk Advisor to see a full health score report for eslint-plugin-prefix...
Read more >
eslint-plugin-consistent-file-and-folder-names - NPM Package ...
Add eslint-plugin-consistent-file-and-folder-names to the plugins section of your ESLint config file without the eslint-plugin- prefix.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found