eslint-config-jhh
Version:
JHH ESLint config
113 lines (81 loc) • 3.58 kB
JavaScript
/**
* These rules relate to possible syntax or logic errors in JavaScript code
*
* @see http://eslint.org/docs/rules/#possible-errors
*/
module.exports = {
rules: {
// disallow await inside of loops
'no-await-in-loop': 'error',
// disallow assignment operators in conditional statements
'no-cond-assign': ['error', 'always'],
// disallow the use of console
'no-console': 'warn',
// disallow constant expressions in conditions
'no-constant-condition': 'warn',
// disallow control characters in regular expressions
'no-control-regex': 'error',
// disallow the use of debugger
'no-debugger': 'error',
// disallow duplicate arguments in function definitions
'no-dupe-args': 'error',
// disallow duplicate keys in object literals
'no-dupe-keys': 'error',
// disallow a duplicate case label
'no-duplicate-case': 'error',
// disallow empty character classes in regular expressions
'no-empty-character-class': 'error',
// disallow empty block statements
'no-empty': 'warn',
// disallow reassigning exceptions in catch clauses
'no-ex-assign': 'error',
// disallow unnecessary boolean casts
'no-extra-boolean-cast': 'error',
// disallow unnecessary parentheses
// Meh.
'no-extra-parens': 'off',
// disallow unnecessary semicolons
'no-extra-semi': 'error',
// disallow reassigning function declarations
'no-func-assign': 'error',
// disallow variable or function declarations in nested blocks
// You don't nee these in ES6
'no-inner-declarations': 'error',
// disallow invalid regular expression strings in RegExp constructors
'no-invalid-regexp': 'error',
// disallow irregular whitespace
'no-irregular-whitespace': 'warn',
// disallow calling global object properties as functions
'no-obj-calls': 'error',
// disallow use of Object.prototypes builtins directly
// Leaving as a warning since this is not technically "incorrect" in my
// opinion, just prone to the occasional issue. No one here is used to
// using `Object.create` for maps so as a warning you can still go about
// your business.
'no-prototype-builtins': 'warn',
// disallow multiple spaces in regular expression literals
'no-regex-spaces': 'error',
// disallow sparse arrays
'no-sparse-arrays': 'error',
// disallow template literal placeholder syntax in regular strings
// It's a string, let sjust warn in case it's something innocent.
'no-template-curly-in-string': 'warn',
// disallow confusing multiline expressions
'no-unexpected-multiline': 'error',
// disallow unreachable code after return, throw, continue, and break
// statements
'no-unreachable': 'error',
// disallow control flow statements in finally blocks
'no-unsafe-finally': 'error',
// disallow negating the left operand of relational operators
'no-unsafe-negation': 'error',
// require calls to isNaN() when checking for NaN
'use-isnan': 'error',
// enforce valid JSDoc comments
'valid-jsdoc': 'warn',
// enforce comparing typeof expressions against valid strings
'valid-typeof': ['error', {
requireStringLiterals: true
}]
}
}