Lint Rules

noRestrictedGlobals (since v0.10.0)

This rule allows you to specify global variable names that you don’t want to use in your application.

Disallowing usage of specific global variables can be useful if you want to allow a set of global variables by enabling an environment, but still want to disallow some of those.

Examples

Invalid

console.log(event)
correctness/noRestrictedGlobals.js:1:13 lint/correctness/noRestrictedGlobals ━━━━━━━━━━━━━━━━━━━━━━━

   Do not use the global variable event.
  
  > 1 │ console.log(event)
               ^^^^^
    2 │ 
  
   Use a local variable instead.
  

Valid

function f(event) {
    console.log(event)
}