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.

Support having plugins as dependencies in shareable config

See original GitHub issue

My shareable config uses rules from an external plugin and I would like to make it a dependency so the user doesn’t have to manually install the plugin manually. I couldn’t find any docs on this, but it doesn’t seem to work, so I’ll assume it’s not currently supported.

module.js:338
    throw err;
          ^
Error: Cannot find module 'eslint-plugin-no-use-extend-native'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at /usr/local/lib/node_modules/eslint/lib/cli-engine.js:106:26
    at Array.forEach (native)
    at loadPlugins (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:97:21)
    at processText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:182:5)
    at processFile (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:224:12)
    at /usr/local/lib/node_modules/eslint/lib/cli-engine.js:391:26

I assume it’s because you only try to load the plugin when the config is finished merging.

Other shareable configs that depend on a plugin instructs the users to manually install the plugin too and they have it in peerDependencies. I find this sub-optimal though and I don’t want the users to have to care what plugins my config uses internally.

The whole point of shareable configs is to minimize boilerplate and overhead, so this would be a welcome improvement.

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:608
  • Comments:208 (96 by maintainers)

github_iconTop GitHub Comments

275reactions
sindresorhuscommented, Aug 20, 2015

Ugh, that’s such a leaky abstraction. I guess I won’t use plugins then…

The user shouldn’t have to care what plugins I use for the rules. This is like requiring to manual install of Lodash when you want ESLint. A shareable config is a node module and should act like it.

151reactions
lo1tumacommented, Oct 31, 2019

We already discussed this in #2518 with the conclusion that a peerDependency is the way to go.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How ESLint Resolves Plugins And Shareable Configs
First of all, ESLint has plugins and it has shareable configs. ... issue dating back to 2015: Support having plugins as dependencies in...
Read more >
How ESLint Resolves Plugins And ... - Tomas Zaicevas
First of all, ESLint has plugins and it has shareable configs. ... back to 2015: Support having plugins as dependencies in shareable config....
Read more >
Shareable Configs - 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 >
ESLint configuration and peer dependencies - Stack Overflow
I tried publishing my own configs before where everything is in deps, and had no issue with that. Babel configs are shared without...
Read more >
Support having plugins as dependencies in shareable config
My shareable config uses rules from an external plugin and I would like to make it a dependency so the user doesn't have...
Read more >

github_iconTop Related Medium Post

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 Hashnode Post

No results found