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.

Run single rule *without* using `--no-eslintrc`

See original GitHub issue

The version of ESLint you are using.

6.5.1

The problem you want to solve.

I would like to be able to run a single ESLint rule, but without having to repeat all the other setup config that is in my root .eslintrc.js file.

My specific use case is running a single file on a TypeScript file, something like this:

console.log('foo');
debugger;
export enum Numbers {
  one,
  two,
  three,
  four
}

Running eslint --no-eslintrc --rule no-debugger:error fails on this file with a parsing error (the enum).

Running eslint --rule no-debugger:error runs all the other rules defined in the extends part of my root .eslintrc.js file.

This problem is not isolated to the CLI, but also the JS API, which I am currently using.

Your take on the correct solution to problem.

I believe I could use the JS API to do resolveFileGlobPatterns() and use getConfigForFile() for each file and then modify the result to just set the one rule I want, but that seems like it would be really slow. Is that the correct approach? Is there something I am missing?

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

Yes, happy to give it a crack!

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
eslint-deprecated[bot]commented, Jan 18, 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.

1reaction
kaicataldocommented, Dec 16, 2019

Also, since this is a change to core, I think this proposal should go through the RFC process outlined here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you run eslint for only a specific rule or set of rules
eslint helpme.js --no-eslintrc --env "es6" --env "node" ... Simple way to see single rule output while still using .eslintrc is to use grep:...
Read more >
Run single rule · Issue #6333 · eslint/eslint - GitHub
While moving a bigger project from jscs to eslint, I found myself wanting to have the possibility to run a specific or subset...
Read more >
Command Line Interface - 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 | IntelliJ IDEA Documentation - JetBrains
Open the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Languages & Frameworks | JavaScript | Code Quality Tools | ESLint, and select Automatic...
Read more >
VS Code ESLint extension - Visual Studio Marketplace
eslintrc configuration file. You can do this by either using the VS Code command Create ESLint configuration or by running the eslint command...
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