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.

Set aside CLI option to allow forwarding config options to dynamic .eslintrc(.js/.cjs) files

See original GitHub issue

The version of ESLint you are using.

6.8.0

The problem you want to solve.

I have to create separate configs to tweak portions of the config according to my run-time interest.

For example, if I wanted to just check for security-related rules, I’d have to make a separate config (“security” would be a nice fix-type incidentally). While the configs are modular, it requires manually creating extra configs for each permutation–one with the feature, one without, one with both this and that feature but not that feature, etc.

Or to auto-generate some complicated options (I’m thinking of the likes of blocking all global variables except those whitelisted, such as in this example which whitelists only a and b as an argument to the no-restricted-syntax rule: VariableDeclaration > .declarations[type="VariableDeclarator"][id.name="a"],VariableDeclaration > .declarations[type="VariableDeclarator"][id.name="b"]). I currently have to build this rule by hand or create my own rule which wraps the logic.

Your take on the correct solution to problem.

The simplest solution would be just to reserve one option such as --config-options and fail to err upon encountering it. Then config files could just check process.argv and handle it this way. It might look like --config-options="option1=val1,option2=val2" similar to how Mocha does --reporter-option(s) (https://mochajs.org/#command-line-usage and https://mochajs.org/#-reporter-option-option-o-option-reporter-options-option ).

Alternatively, one could allow JavaScript-based config files to optionally export a function which will be passed an object based on an extra CLI argument.

Are you willing to submit a pull request to implement this change?

Possibly, yes.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
brettz9commented, Mar 24, 2020

My plate is quite full at the moment, but I can hopefully get to that. Have put it on my to-do list!

0reactions
eslint-deprecated[bot]commented, Apr 25, 2020

Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach accepted status after 21 days tend to never be accepted, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration Files - 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 fails with ESM and JS eslintrc · Issue #14137 - GitHub
The eslint CLI tries to load the .eslintrc.js with require , which fails if you've set "type": "module" in your package.json.
Read more >
@vue/cli-plugin-eslint | Yarn - Package Manager
Usage: vue-cli-service lint [options] [...files] Options: --format [formatter] ... fix: allow disabling progress plugin via devServer.client.progress.
Read more >
Basic Features: ESLint - Next.js
Only select this option if you plan on setting up your own custom ESLint configuration. If either of the two configuration options are...
Read more >
ESLint not working in VS Code? - Stack Overflow
If yes, then set it manually by configuring the eslint.nodePath in the VSCode settings ( settings.json ). Give it the full path (for...
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