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.

Remove fixer from no-debugger rule

See original GitHub issue

What rule do you want to change? no-debugger

Does this change cause the rule to produce more or fewer warnings?

Fixer for this rule forces me to put eslint-disable-next-line comment before debugger statement rending this rule useless.

With fixer for no-debugger my IDE’s (VS Code and vim) fix-on-save feature removes debugger statement the moment I save the file. I have to use

// eslint-disable-next-line
debugger

construction and I already have debugger statement slipped into production code at least twice.

How will the change be implemented? (New option, new default behavior, etc.)?

Please remove the fixer completely or make it optional. I’ve read the comment https://github.com/eslint/eslint/pull/8660#issuecomment-315806299 and I still think that for no-debugger rule fixer is kind of useless. You’ll never have more that one or two accidentally forgotten statements to force IDE creators to implement such mechanism.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:46 (31 by maintainers)

github_iconTop GitHub Comments

5reactions
not-an-aardvarkcommented, Jun 5, 2018

This idea was also discussed in https://github.com/eslint/eslint/issues/7873 (and has come up in a few other places, e.g. https://github.com/eslint/eslint/issues/7714). We’ve generally been following the policy that autofixers should never change the behavior of user code. I’m not convinced we could ever be sure enough of the user’s intentions that it would be a good idea to change the behavior of their code without user input.

4reactions
michaelficarracommented, Jun 5, 2018

There seems to be two conflicting goals people have when using eslint’s auto-fixing.

  1. Those running it on save want only stylistic rules fixed. In my opinion, this is the domain of prettier.
  2. Those using it so that they don’t have to manually fix the things that they’ve told eslint are undesirable.

For the first group, changing anything that we could fix automatically but which changes the structure/behaviour of the program is unwanted. For the second group, not changing something that we could fix automatically adds burden on them.

It looks to me like the way to resolve this is to have auto-fixing run in one of two modes: fix only stylistic things, and fix anything that we possibly can.

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-debugger - 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 autofix ignore rule - visual studio code - Stack Overflow
Ignore 1 particular rule for fixing: prefer-const; See all the warnings and errors ... I'm looking to do the same with the no-debugger...
Read more >
Linting Code - LearnHowToProgram.com
2 or "error" means that ESLint will throw an error and stop our code in its tracks. That means we can't build until...
Read more >
Write eslint Rules That Meet Needs - Alibaba Cloud Community
This article discusses the general framework of eslint rule writing. ... Fixer supports four APIs for adding, two for deleting, ...
Read more >
ValidateJavaScript - Online Tool to Find & Fix JavaScript Errors
Rules : eslint. accessor-pairs array-bracket-newline array-bracket-spacing ... no-debugger no-delete-var no-div-regex no-dupe-args no-dupe-class-members
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