All files / src/rules core-variables.js

100% Statements 2/2
100% Branches 0/0
100% Functions 0/0
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51    1x         1x                                                                                      
'use strict'
 
const confusingBrowserGlobals = require('confusing-browser-globals')
 
/**
 * ESLint core 'Variables' rules relate to variable declarations
 */
module.exports = {
  // enforce or disallow variable initializations at definition
  'init-declarations': 'off',
 
  // disallow the catch clause parameter name being the same as a variable in the outer scope
  'no-catch-shadow': 'off',
 
  // disallow deletion of variables
  'no-delete-var': 'error',
 
  // disallow labels that share a name with a variable
  // https://eslint.org/docs/rules/no-label-var
  'no-label-var': 'error',
 
  // disallow specific globals
  'no-restricted-globals': ['error', 'isFinite', 'isNaN'].concat(confusingBrowserGlobals),
 
  // disallow declaration of variables already declared in the outer scope
  'no-shadow': 'error',
 
  // disallow shadowing of names such as arguments
  'no-shadow-restricted-names': 'error',
 
  // disallow use of undeclared variables unless mentioned in a /*global */ block
  'no-undef': 'error',
 
  // disallow use of undefined when initializing variables
  'no-undef-init': 'error',
 
  // disallow use of undefined variable
  // https://eslint.org/docs/rules/no-undefined
  // TODO: enable?
  'no-undefined': 'off',
 
  // disallow declaration of variables that are not used in the code
  'no-unused-vars': [
    'error',
    { vars: 'all', args: 'after-used', ignoreRestSiblings: true },
  ],
 
  // disallow use of variables before they are defined
  'no-use-before-define': ['error', { functions: true, classes: true, variables: true }],
}