-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.eslintrc.js
102 lines (90 loc) · 2.42 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
const fs = require('fs');
const escapeStringRegexp = require('escape-string-regexp');
/**
* ESLint configuration
* http://eslint.org/docs/user-guide/configuring
*/
const copyrightTemplate = fs.readFileSync(`${__dirname}/config/copyright.js`).toString();
const copyrightMatch = escapeStringRegexp(copyrightTemplate).replace('<%= YEAR %>', '20\\d\\d');
module.exports = {
extends: ['airbnb-base', 'prettier'],
plugins: ['prettier', 'json', 'notice', 'mocha'],
env: {
node: true,
mocha: true,
},
rules: {
'mocha/no-exclusive-tests': 'error',
'mocha/no-skipped-tests': 'error',
'mocha/no-global-tests': 'error',
'mocha/handle-done-callback': 'error',
'mocha/no-identical-title': 'error',
'mocha/no-nested-tests': 'error',
'mocha/no-top-level-hooks': 'error',
'notice/notice': ['error',
{
mustMatch: copyrightMatch,
template: copyrightTemplate,
},
],
// Validate Javascript documentation comments
// http://eslint.org/docs/rules/valid-jsdoc
'valid-jsdoc': ['error', {
"prefer": {
"arg": "param",
"argument": "param",
"class": "constructor",
"returns": "return",
"virtual": "abstract"
},
"preferType": {
"Boolean": "boolean",
"bool": "boolean",
"Number": "number",
"Object": "object",
"String": "string",
"Function": "function",
"Symbol": "symbol",
"array": "Array",
"buffer": "Buffer",
"promise": "Promise"
},
"requireParamDescription": false,
"requireReturnDescription": false,
}],
'import/no-extraneous-dependencies': [
'error', {
devDependencies: [
"test/*.js",
"**/test/*.js",
"**/test/**/*.js",
],
},
],
// Recommend not to leave any console.log in your code
// Use console.error, console.warn and console.info instead
'no-console': [
'error',
{
allow: ['warn', 'error', 'info'],
},
],
'no-warning-comments': [
'error',
{
terms: ['fixme'],
location: 'start',
},
],
// ESLint plugin for prettier formatting
// https://github.com/prettier/eslint-plugin-prettier
'prettier/prettier': [
'error',
{
// https://github.com/prettier/prettier#options
singleQuote: true,
trailingComma: 'es5',
},
],
},
};