-
Notifications
You must be signed in to change notification settings - Fork 18
/
.eslintrc.js
99 lines (88 loc) · 3.31 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
/**
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module.exports = {
root: true,
extends: ['eslint:recommended', 'google', 'plugin:jsdoc/recommended'],
env: {
node: true, // Things like require()
es6: true, // Things like Promise
},
parserOptions: {
ecmaVersion: 2019, // Arrow functions, generators, etc.
},
settings: {
jsdoc: {
// Closure is not used here, but Closure conventions for things like
// "@private {string}" are used in this project.
mode: 'closure',
// Google style enforces @return over @returns via valid-jsdoc. The
// recommended settings in the jsdoc plugin conflict, so we tweak them to
// match.
tagNamePreference: {
returns: 'return',
},
},
},
rules: {
// Project-specific rules go here.
// The Google recommendations use the deprecated "require-jsdoc", which is
// superceded by the more flexible and configurable jsdoc plugin.
'require-jsdoc': 'off',
// Allow multiple spaces before a comment at the end of the line.
// Sometimes useful for alignment.
'no-multi-spaces': ['error', {ignoreEOLComments: true}],
'jsdoc/require-jsdoc': ['error', {
// Require jsdoc on non-exported things, too.
publicOnly: false,
// Where to require jsdoc:
require: {
ArrowFunctionExpression: false,
ClassDeclaration: true,
ClassExpression: true,
FunctionDeclaration: true,
FunctionExpression: false,
MethodDefinition: true,
},
// Because we documented the class declaration, constructors only need
// docs for their parameters. Therefor those that take no arguments are
// exempt from the general requirement to document methods.
exemptEmptyConstructors: true,
}],
'jsdoc/require-description': ['error', {
// Constructors don't need a description in addition to the class-level
// description. Only constructor parameters must be documented.
checkConstructors: false,
// The @description and @desc tags are implied and should not be used.
descriptionStyle: 'body',
}],
// Google style does not require descriptions of every return value.
'jsdoc/require-returns-description': 'off',
'jsdoc/no-undefined-types': ['error', {
definedTypes: [
// Unlike a browser environment, NodeJS has a Timeout type that is
// returned by setTimeout. https://nodejs.org/api/timers.html
'Timeout',
// NodeJS also defines a Console type, of which the global console is an
// instance. https://nodejs.org/api/console.html
'Console',
// Yargs is our command-line parser module.
'Yargs',
// NodeSSH is the type created by the node-ssh module.
'NodeSSH',
],
}],
},
};