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.

add variable ignore list for `block-scoped-var`

See original GitHub issue

The version of ESLint you are using. v6.8.0

The problem you want to solve. block-scoped-var does not offer a progressive path to enable this rule. Therefore, users have to fix all existing violations in order to enable this rule. For a large pre-ECMAScript 2015 codebase, it is quite difficult to fix all existing violations and enable this rule all at once.

Your take on the correct solution to problem. Similar to no-unused-vars, have an option to add variables to ignore. By doing this way,

  • we don’t make any breaking changes. (not providing variable ignore list will still work as intended)
  • we allow users to enable this rule immediately

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
yeonjuancommented, Apr 30, 2020

Hi @bcko 😃

For a large pre-ECMAScript 2015 codebase, it is quite difficult to fix all existing violations and enable this rule all at once.

I’m not strongly opposed to this proposal. But maybe some alternatives can help you. What about the setting error level with wran or using eslint-disable comment? ( + running cli --max-warning)

0reactions
eslint-deprecated[bot]commented, Jun 2, 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

block-scoped-var - ESLint - Pluggable JavaScript Linter
The block-scoped-var rule generates warnings when variables are used outside of the block in which they were defined. This emulates C-style block scope....
Read more >
JavaScript let: Declaring Block-Scoped Variables
This tutorial introduces you to a new way to declare block-scoped variables using JavaScript let and explains the temporal death zone (TDZ) concept...
Read more >
Re-declaration of block scoped loop variable inside the loop
I recently came across a piece of code that has me confused about the block scoped variables declared with let keyword inside a...
Read more >
The old "var" - The Modern JavaScript Tutorial
“var” has no block scope. Variables, declared with var , are either function-scoped or global-scoped. They are visible through blocks.
Read more >
Documentation - Variable Declaration - TypeScript
When a variable is declared using let , it uses what some call lexical-scoping or block-scoping. Unlike variables declared with var whose scopes...
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