1 | var config = require('./config');
|
2 | var ERROR = config.ERROR;
|
3 | var WARNING = config.WARNING;
|
4 | var IGNORE = config.IGNORE;
|
5 |
|
6 | /**
|
7 | * ### Ruleset: Possible Errors
|
8 | *
|
9 | * The following rules point out areas where you might have made mistakes.
|
10 | *
|
11 | * @see http://eslint.org/docs/rules/#possible-errors
|
12 | */
|
13 | module.exports = {
|
14 | rules: {
|
15 | // disallow trailing commas in object literals
|
16 | /**
|
17 | * @differ - This is what transform tools are for.
|
18 | */
|
19 | 'comma-dangle': [ERROR, 'never'],
|
20 | // disallow assignment in conditional expressions
|
21 | 'no-cond-assign': [ERROR, 'always'],
|
22 | // disallow use of console
|
23 | 'no-console': WARNING,
|
24 | // disallow use of constant expressions in conditions
|
25 | 'no-constant-condition': WARNING,
|
26 | // disallow control characters in regular expressions
|
27 | 'no-control-regex': ERROR,
|
28 | // disallow use of debugger
|
29 | 'no-debugger': WARNING,
|
30 | // disallow duplicate arguments in functions
|
31 | 'no-dupe-args': ERROR,
|
32 | // disallow duplicate keys when creating object literals
|
33 | 'no-dupe-keys': ERROR,
|
34 | // disallow a duplicate case label.
|
35 | 'no-duplicate-case': ERROR,
|
36 | // disallow the use of empty character classes in regular expressions
|
37 | 'no-empty-character-class': ERROR,
|
38 | // disallow empty statements
|
39 | 'no-empty': ERROR,
|
40 | // disallow assigning to the exception in a catch block
|
41 | 'no-ex-assign': ERROR,
|
42 | // disallow double-negation boolean casts in a boolean context
|
43 | 'no-extra-boolean-cast': IGNORE,
|
44 | // disallow unnecessary parentheses
|
45 | 'no-extra-parens': [ERROR, 'functions'],
|
46 | // disallow unnecessary semicolons
|
47 | 'no-extra-semi': ERROR,
|
48 | // disallow overwriting functions written as function declarations
|
49 | 'no-func-assign': ERROR,
|
50 | // disallow function or variable declarations in nested blocks
|
51 | 'no-inner-declarations': ERROR,
|
52 | // disallow invalid regular expression strings in the RegExp constructor
|
53 | 'no-invalid-regexp': ERROR,
|
54 | // disallow irregular whitespace outside of strings and comments
|
55 | 'no-irregular-whitespace': ERROR,
|
56 | // disallow negation of the left operand of an in expression
|
57 | 'no-negated-in-lhs': ERROR,
|
58 | // disallow the use of object properties of the global object (Math and JSON) as functions
|
59 | 'no-obj-calls': ERROR,
|
60 | // disallow multiple spaces in a regular expression literal
|
61 | 'no-regex-spaces': ERROR,
|
62 | // disallow sparse arrays
|
63 | 'no-sparse-arrays': ERROR,
|
64 | // disallow unreachable statements after a return, throw, continue, or break statement
|
65 | 'no-unreachable': ERROR,
|
66 | // disallow comparisons with the value NaN
|
67 | 'use-isnan': ERROR,
|
68 | // ensure JSDoc comments are valid
|
69 | /**
|
70 | * @differ - No sense in requiring useless strings that need to be maintained
|
71 | * manually that should be maintained by a default in tooling, e.g.
|
72 | * no @return supplied and it takes a {Function}? then its always
|
73 | * @return {Void}. Also, requiring descriptions leads to nothing but
|
74 | * rushed, copy+paste crap we don't want in there anyway.
|
75 | */
|
76 | 'valid-jsdoc': [WARNING, {
|
77 | requireReturn: false,
|
78 | requireParamDescription: false,
|
79 | requireReturnDescription: false
|
80 | }],
|
81 | // ensure that the results of typeof are compared against a valid string
|
82 | 'valid-typeof': ERROR,
|
83 | // Avoid code that looks like two expressions but is actually one
|
84 | 'no-unexpected-multiline': WARNING
|
85 | }
|
86 | };
|