Add more rules
This commit is contained in:
parent
b52074c992
commit
f713261cae
67
index.js
67
index.js
@ -1,3 +1,7 @@
|
|||||||
|
const OFF = 0;
|
||||||
|
const WARN = 1;
|
||||||
|
const ERROR = 2;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
@ -10,19 +14,62 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'no-cond-assign': ['error', 'except-parens'], // Don't assign in conditionals
|
'accessor-pairs': [ERROR], // Require get/set pairs for ES5 accessor/mutators
|
||||||
'no-constant-condition': ['error', {
|
'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,
|
checkLoops: false,
|
||||||
}],
|
}],
|
||||||
'no-control-regex': ['error'], // Don't match control characters (ASCII 0-31) in regex
|
'no-control-regex': [ERROR], // Don't match control characters (ASCII 0-31) in regex
|
||||||
'no-debugger': ['error'], // Disallow use of debugger statements
|
'no-debugger': [ERROR], // Disallow use of debugger statements
|
||||||
'no-dupe-args': ['error'], // No duplicate function arguments
|
'no-div-regex': [ERROR],
|
||||||
'no-dupe-keys': ['error'], // No duplicate keys in object literals
|
'no-dupe-args': [ERROR], // No duplicate function arguments
|
||||||
'no-duplicate-case': ['error'], // No duplicate case labels in switch statements
|
'no-dupe-keys': [ERROR], // No duplicate keys in object literals
|
||||||
'no-empty-character-class': ['error'], // No empty character classes in regex
|
'no-duplicate-case': [ERROR], // No duplicate case labels in switch statements
|
||||||
'no-extra-boolean-cast': ['error'], // Disable unneeded boolean casts
|
'no-else-return': [ERROR],
|
||||||
quotes: ['warn', 'single', {
|
'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,
|
allowTemplateLiterals: true,
|
||||||
}],
|
}],
|
||||||
|
'use-isnan': [ERROR], // Use isNan() to check for NaN
|
||||||
|
'valid-jsdoc': [ERROR],
|
||||||
},
|
},
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user