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.

not work "builtinGlobals" in rule "no-redeclare"

See original GitHub issue

Tell us about your environment

  • ESLint Version: v4.0.0
  • Node Version: v8.0.0
  • npm Version: v5.0.0

Hi, maybe I finded bug. Not wokr rule property “builtinGlobals” in rule “no-redeclare”.

/*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
/*eslint-env browser*/

var top = 0;
var Object = 0;

console message without error “no-redeclare”

4:1   error  Unexpected var, use let or const instead        no-var
  4:5   error  'top' is assigned a value but never used        no-unused-vars
  4:11  error  Number constants declarations must use 'const'  no-magic-numbers
  5:1   error  Unexpected var, use let or const instead        no-var
  5:5   error  'Object' is assigned a value but never used     no-unused-vars
  5:14  error  Number constants declarations must use 'const'  no-magic-numbers

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mysticateacommented, Jun 27, 2017

Because you have env: {node: true} in your configuration. The node environment has special function scope which encloses whole code. So variable declarations shadow globals but don’t redeclare globals.

0reactions
platinumazurecommented, Jun 27, 2017

Good point @boggddan, we should add a note about module scope for Node and similar environments and recommend no-shadow’s equivalent option. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-redeclare - ESLint - Pluggable JavaScript Linter
This rule takes one optional argument, an object with a boolean property "builtinGlobals" . It defaults to true . If set to true...
Read more >
no-redeclare | typescript-eslint
This rule extends the base eslint/no-redeclare rule. It adds support for TypeScript function overloads, and declaration merging.
Read more >
Add an ESLint rule/configuration to disallow definition of Cc ...
I've dug around a bit. I'd like to change our config to use no-redeclare's builtinGlobals option: "no-redeclare": ["error", {"builtinGlobals": ...
Read more >
Migrating to v6.0.0 - ESLint中文文档
The no-redeclare rule is now more strict by default. Note: This update is planned, but has not been implemented in the latest alpha...
Read more >
eslint/eslint - Gitter
Are there any supported mechanisms for causing no-redeclare to not consider globals as declarations? ... ESLint can only run rules after a successful...
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