Add more rules

This commit is contained in:
Timothy Warren 2016-10-12 13:04:40 -04:00
parent b52074c992
commit f713261cae

View File

@ -1,3 +1,7 @@
const OFF = 0;
const WARN = 1;
const ERROR = 2;
module.exports = {
env: {
browser: true,
@ -10,19 +14,62 @@ module.exports = {
}
},
rules: {
'no-cond-assign': ['error', 'except-parens'], // Don't assign in conditionals
'no-constant-condition': ['error', {
'accessor-pairs': [ERROR], // Require get/set pairs for ES5 accessor/mutators
'block-scoped-var': [ERROR],
'class-methods-use-this': [WARN], // Class methods should use 'this', or be marked as static
curly: [ERROR],
'default-case': [ERROR], // Require a default condition in switch statements
'dot-notation': [ERROR], // Use dot notation over [] notation for object properties
'eqeqeq' : [ERROR], // Require === over ==, and !== over !=
'guard-for-in': [ERROR],
'no-alert': [ERROR], // Disable use of alert, prompt, and confirm
'no-caller': [ERROR],
'no-case-declarations': [ERROR],
'no-cond-assign': [ERROR, 'except-parens'], // Don't assign in conditionals
'no-constant-condition': [ERROR, {
checkLoops: false,
}],
'no-control-regex': ['error'], // Don't match control characters (ASCII 0-31) in regex
'no-debugger': ['error'], // Disallow use of debugger statements
'no-dupe-args': ['error'], // No duplicate function arguments
'no-dupe-keys': ['error'], // No duplicate keys in object literals
'no-duplicate-case': ['error'], // No duplicate case labels in switch statements
'no-empty-character-class': ['error'], // No empty character classes in regex
'no-extra-boolean-cast': ['error'], // Disable unneeded boolean casts
quotes: ['warn', 'single', {
'no-control-regex': [ERROR], // Don't match control characters (ASCII 0-31) in regex
'no-debugger': [ERROR], // Disallow use of debugger statements
'no-div-regex': [ERROR],
'no-dupe-args': [ERROR], // No duplicate function arguments
'no-dupe-keys': [ERROR], // No duplicate keys in object literals
'no-duplicate-case': [ERROR], // No duplicate case labels in switch statements
'no-else-return': [ERROR],
'no-empty-character-class': [ERROR], // No empty character classes in regex
'no-empty-function': [ERROR],
'no-empty-pattern': [ERROR],
'no-eval': [ERROR],
'no-extra-bind': [ERROR],
'no-extra-boolean-cast': [ERROR], // Disable unneeded boolean casts
'no-extra-label': [ERROR],
'no-extra-semi': [ERROR], // Don't use extra semicolons
'no-func-assign': [ERROR], // Don't re-declare a function
'no-implied-eval': [ERROR],
'no-invalid-regexp': [ERROR],
'no-invalid-this': [ERROR],
'no-irregular-whitespace': [ERROR],
'no-iterator': [ERROR], // Disallow use of __iterator__
'no-lone-blocks': [WARN],
'no-loop-func': [ERROR], // No function declarations in loops
'no-magic-numbers': [ERROR],
'no-multi-spaces': [ERROR],
'no-new': [ERROR], // Disable new keyword for only side effects
'no-new-func': [ERROR], // Disable use of Function() to create new functions
'no-new-wrappers': [ERROR],
'no-obj-calls': [ERROR], // Don't call built in objects as functions
'no-octal': [ERROR],
'no-regex-spaces': [ERROR], // Don't have repeated literal spaces in regexes
'no-sparse-arrays': [ERROR],
'no-template-curly-in-string': [ERROR], // Only have template curlys in template strings
'no-unexpected-multiline': [ERROR],
'no-unreachable': [ERROR], // Throw an error on unreachable code statements
'no-unsafe-finally': [ERROR],
'no-unsafe-negation': [ERROR],
quotes: [WARN, 'single', {
allowTemplateLiterals: true,
}],
'use-isnan': [ERROR], // Use isNan() to check for NaN
'valid-jsdoc': [ERROR],
},
};