Skip to content

Commit

Permalink
feat(rules): add variables rule set
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwiens committed Jan 27, 2017
1 parent 2201d52 commit daabb4f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
extends: [
'./rules/variables',
'./rules/node',
'./rules/stylistic-issues',
'./rules/es2015'
Expand Down
51 changes: 51 additions & 0 deletions rules/variables.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
module.exports = {
rules: {
// require or disallow initialization in variable declarations
// http://eslint.org/docs/rules/init-declarations
'init-declarations': 'off',

// disallow catch clause parameters from shadowing variables in the outer scope
// http://eslint.org/docs/rules/no-catch-shadow
'no-catch-shadow': 'off',

// disallow deleting variables
// http://eslint.org/docs/rules/no-delete-var
'no-delete-var': 'error',

// disallow labels that share a name with a variable
// http://eslint.org/docs/rules/no-label-var
'no-label-var': 'error',

// disallow specified global variables
// http://eslint.org/docs/rules/no-restricted-globals
'no-restricted-globals': 'off',

// disallow identifiers from shadowing restricted names
// http://eslint.org/docs/rules/no-shadow-restricted-names
'no-shadow-restricted-names': 'error',

// disallow variable declarations from shadowing variables declared in the outer scope
// http://eslint.org/docs/rules/no-shadow
'no-shadow': 'error',

// disallow initializing variables to undefined
// http://eslint.org/docs/rules/no-undef-init
'no-undef-init': 'error',

// disallow the use of undeclared variables unless mentioned in /*global */ comments
// http://eslint.org/docs/rules/no-undef
'no-undef': 'error',

// disallow the use of undefined as an identifier
// http://eslint.org/docs/rules/no-undefined
'no-undefined': 'on',

// disallow unused variables
// http://eslint.org/docs/rules/no-unused-vars
'no-unused-vars': ['error', { vars: 'local', args: 'after-used' }],

// disallow the use of variables before they are defined
// http://eslint.org/docs/rules/no-use-before-define
'no-use-before-define': 'error'
}
};

0 comments on commit daabb4f

Please sign in to comment.