forked from mozilla/qbrt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
63 lines (55 loc) · 2.14 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
'use strict';
module.exports = {
env: {
es6: true,
node: true,
},
extends: 'eslint:recommended',
// All of these globals rules apply only to certain files, so we might
// move them into file-specific settings, although it's a pain.
globals: {
Components: false,
document: false,
dump: false,
MutationObserver: false,
pref: false,
window: false,
},
parserOptions: {
ecmaVersion: 8,
},
rules: {
'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
'comma-dangle': ['error', 'always-multiline'],
'indent': [ 'error', 2, { SwitchCase: 1, MemberExpression: 0 }],
'keyword-spacing': ['error'],
'linebreak-style': ['error', 'unix'],
'max-len': ['error', { code: 120 }],
'no-console': 'off',
'no-constant-condition': ['error', { checkLoops: false }],
'no-empty': ['error', { allowEmptyCatch: true }],
// Cc, Ci, Cr, and Cu are effectively default globals that we define
// in many scripts as shorthands for properties of the Components global.
// Their definition is boilerplate that we don't want to customize
// for each script, so we ignore their nonuse via a varsIgnorePattern.
//
// Some of our function definitions are XPCOM interface implementations,
// and they don't always use all the arguments defined by the interface,
// but it's still useful to declare their parameters, to make the interface
// specification more obvious, so we ignore their nonuse via args: none.
//
'no-unused-vars': ['error', { varsIgnorePattern: 'Cc|Ci|Cr|Cu', args: 'none' }],
// We should include 'todo' in the terms list, at which point we could
// remove the terms list, since it defaults to ["todo", "fixme", "xxx"].
// But we'll need to get rid of all of the TODO comments first.
'no-warning-comments': ['error', { terms: ['fixme', 'xxx'] }],
'quotes': ['error', 'single'],
'quote-props': ['error', 'consistent-as-needed'],
'semi': ['error', 'always', { omitLastInOneLineBlock: true }],
'space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
},
};