-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
jsdoc.js
60 lines (58 loc) · 1.35 KB
/
jsdoc.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
const globals = require( 'globals' );
/**
* Helpful utilities that are globally defined and known to the TypeScript compiler.
*
* @see http://www.typescriptlang.org/docs/handbook/utility-types.html
*/
const typescriptUtilityTypes = [
'ArrayLike',
'Exclude',
'Extract',
'InstanceType',
'Iterable',
'IterableIterator',
'NonNullable',
'Omit',
'Partial',
'Pick',
'PromiseLike',
'Readonly',
'ReadonlyArray',
'ReadonlyMap',
'ReadonlySet',
'Record',
'Required',
'ReturnType',
'ThisType',
];
module.exports = {
extends: [
'plugin:jsdoc/recommended',
],
settings: {
jsdoc: {
preferredTypes: {
object: 'Object',
},
tagNamePreference: {
returns: 'return',
yields: 'yield',
},
},
},
rules: {
'jsdoc/no-undefined-types': [ 'warn', {
definedTypes: [
// Required to reference browser types because we don't have the `browser` environment enabled for the project.
// Here we filter out all browser globals that don't begin with an uppercase letter because those
// generally refer to window-level event listeners and are not a valid type to reference (e.g. `onclick`).
...Object.keys( globals.browser ).filter( ( k ) => /^[A-Z]/.test( k ) ),
...typescriptUtilityTypes,
'void',
],
} ],
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param-description': 'off',
'jsdoc/require-returns': 'off',
},
};