forked from web-scrobbler/web-scrobbler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
180 lines (173 loc) · 5.93 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
'use strict';
module.exports = {
'env': {
'browser': true,
'es6': true,
'node': true,
'mocha': true
},
'globals': {
'$': true,
'chrome': true,
'Require': true,
'define': true
},
'rules': {
/**
* Possible errors
*/
// Enforce “for” loop update clause moving the counter
// in the right direction
'for-direction': 'error',
// Disallow assignment operators in conditional expressions
'no-cond-assign': 'error',
// Disallow constant expressions in conditions
'no-constant-condition': 'error',
// Disallow duplicate arguments in function definitions
'no-dupe-args': 'error',
// Disallow duplicate keys in object literals
'no-dupe-keys': 'error',
// Disallow duplicate case labels
'no-duplicate-case': 'error',
// Disallow empty block statements
'no-empty': 'error',
// Disallow reassigning exceptions in `catch` clauses
'no-ex-assign': 'error',
// Disallow unnecessary boolean casts
'no-extra-boolean-cast': 'error',
// Disallow unnecessary semicolons
'no-extra-semi': 'error',
// Disallow reassigning function declarations
'no-func-assign': 'error',
// Disallow calling global object properties as functions
'no-obj-calls': 'error',
// Disallow template literal placeholder syntax in regular string
'no-template-curly-in-string': 'error',
// Disallow unreachable code after return, throw, continue,
// and break statements
'no-unreachable': 'error',
// Require calls to `isNaN()` when checking for `NaN`
'no-unsafe-negation': 'error',
// Disallow negating the left operand of relational operators
'use-isnan': 'error',
// Enforce valid JSDoc comments
// 'valid-jsdoc': ['error', { 'requireReturn': false }],
// Enforce comparing `typeof` expressions against valid strings
'valid-typeof': 'error',
/**
* Best practices
*/
// Enforce consistent brace style for all control statements
'curly': 'error',
// Require the use of === and !==
'eqeqeq': 'error',
// Disallow `else` blocks after `return` statements in `if` statements
'no-else-return': 'error',
// Disallow empty functions
// 'no-empty-function': 'error',
// Disallow assignments to native objects or read-only global variables
'no-global-assign': 'error',
// Disallow function declarations and expressions inside loop statements
'no-loop-func': 'error',
// Disallow new operators with the String, Number, and Boolean objects
'no-new-wrappers': 'error',
// Disallow variable redeclaration
'no-redeclare': 'error',
// Disallow assignments where both sides are exactly the same
'no-self-assign': 'error',
// Disallow redundant return statements
'no-useless-return': 'error',
/**
* Strict mode
*/
// Require global strict mode directive
'strict': ['error', 'global'],
/**
* Variables
*/
// Disallow deleting variables
'no-delete-var': 'error',
// Disallow the use of undeclared variables
'no-undef': 'error',
// Disallow unused variables
'no-unused-vars': 'error',
/**
* Stylistic Issues
*/
// Require 'one true brace style', in which the opening brace
// of a block is placed on the same line as its corresponding
// statement or declaration
// 'brace-style': ['error', '1tbs'],
// Disallow spaces inside of brackets
'array-bracket-spacing': ['error', 'never'],
// Require space after comma
'comma-spacing': ['error', { 'after': true }],
// Require or Disallow newline at the end of files
'eol-last': ['error', 'always'],
// Disallow spacing between function identifiers and their invocations
'func-call-spacing': 'error',
// use tabs as indentation
'indent': ['error', 'tab', {
// enforces indentation level for case clauses in switch statements
'SwitchCase': 1,
}],
// Require space after colon in object literal properties
'key-spacing': ['error', { 'afterColon': true }],
// Require space before and after keywords
'keyword-spacing': ['error'],
// Require Unix line endings
'linebreak-style': ['error', 'unix'],
// Disallow empty block statements
'no-empty': ['error', { 'allowEmptyCatch': true }],
// Disallow `if` statements as the only statement in `else` blocks
'no-lonely-if': 'error',
// Disallow mixed spaces and tabs for indentation
'no-mixed-spaces-and-tabs': 'error',
// Disallow multiple spaces
'no-multi-spaces': 'error',
// Disallow nested ternary expressions
'no-nested-ternary': 'error',
// Disallow trailing whitespace at the end of lines
'no-trailing-spaces': 'error',
// Disallow ternary operators when simpler alternatives exist
'no-unneeded-ternary': 'error',
// Disallow whitespace before properties
'no-whitespace-before-property': 'error',
// Require spaces inside curly braces
'object-curly-spacing': ['error', 'always'],
// Require single quotes
'quotes': ['error', 'single'],
// Require space before blocks
'space-before-blocks': ['error', 'always'],
// Disallow spaces inside of parentheses
'space-in-parens': 'error',
// Require spacing around infix operators
'space-infix-ops': 'error',
// Require semicolon at the end of statement
'semi': ['error', 'always'],
// Enforce spacing around colons of switch statements
'switch-colon-spacing': ['error', { 'after': true, 'before': false }],
/**
* ECMAScript 6
*/
// Disallow reassigning class members
'no-class-assign': 'error',
// Disallow modifying variables that are declared using `const`
'no-const-assign': 'error',
// Disallow duplicate class members
'no-dupe-class-members': 'error',
// Disallow `this` or `super` before calling super() in constructors
'no-this-before-super': 'error',
// Disallow spacing around embedded expressions of template strings
'template-curly-spacing': 'error',
/**
* Warnings
*/
// Disallow fallthrough of case statements
//
// This approach could be used as a trick, but we should warn
// the developer to make sure they suppress warning in the code
// and (possibly) put the explanation of fallthrougt in comments.
'no-fallthrough': 'warn',
}
};