From f713261cae2a27c0c91d614c0f0bfc23fe8fbff1 Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Wed, 12 Oct 2016 13:04:40 -0400 Subject: [PATCH] Add more rules --- index.js | 67 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 85a8b76..fc1bfcb 100644 --- a/index.js +++ b/index.js @@ -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], }, }; \ No newline at end of file