-
Notifications
You must be signed in to change notification settings - Fork 1
/
sauron.js
132 lines (121 loc) · 4.22 KB
/
sauron.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
'use strict';
module.exports = {
extends: ['./index.js', 'plugin:no-unsanitized/DOM'],
settings: {
jsdoc: {
preferredTypes: {
'*': {
message: 'Use a more precise type or if necessary use `any` or add to a `typedef`.',
replacement: 'any'
},
any: {
message: 'Use a more precise type or if necessary use in a `typedef`',
replacement: false
},
Any: {
message: 'Use a more precise type or if necessary use `any` or add to a `typedef`.',
replacement: 'any'
},
Function: {
message: 'Point to a `@callback` namepath or add to a `typedef` if truly arbitrary in form',
replacement: false
},
function: {
message: 'Point to a `@callback` namepath or add `Function` to a `typedef` if truly arbitrary in form',
replacement: 'Function'
},
Promise: {
message: 'Specify the specific Promise type, including, if necessary, pointing to the type `any`',
replacement: false
},
'.<>': {
message: 'Prefer type form without dot',
replacement: '<>'
},
Object: {
message: 'Use the specific object type or add `object` to a typedef if truly arbitrary',
replacement: 'object'
},
'object<>': {
message: 'Use the upper-case form for current TypeScript JSDoc compatibility and generic-like appearance for a parent',
replacement: 'Object<>'
},
// May be useful as a standard root placeholder so the child params can be
// documented and not needing to use a typedef; filed https://github.com/gajus/eslint-plugin-jsdoc/issues/863
// object: {
// message: 'Use the specific object type or add to a typedef if truly arbitrary',
// replacement: false
// },
Array: {
message: 'Use the specific array type or add it to a typedef if it is truly arbitrary.',
replacement: false
},
array: {
message: 'Use the specific array type or add `Array` to a typedef if it is truly arbitrary.',
replacement: false
}
}
}
},
rules: {
'@stylistic/max-len': ['warn', {
ignoreUrls: true,
ignoreRegExpLiterals: true
}],
'class-methods-use-this': ['warn'],
'consistent-this': ['warn'],
'default-case': ['warn'],
'no-alert': ['warn'],
'no-console': ['warn'],
'no-empty-function': ['warn'],
'no-shadow': ['warn', {builtinGlobals: true, hoist: 'functions', allow: ['parent', 'top', 'open', 'close', 'stop', 'blur', 'status', 'name', 'closed', 'start']}],
'prefer-named-capture-group': ['warn'],
'prefer-numeric-literals': ['warn'],
'require-unicode-regexp': ['warn'],
'vars-on-top': ['warn'],
'no-implicit-globals': ['error', {lexicalBindings: true}],
'import/unambiguous': 'warn',
'import/no-commonjs': 'warn',
'jsdoc/require-jsdoc': ['warn', {
require: {
// ArrowFunctionExpression: true,
ClassDeclaration: true,
ClassExpression: true,
FunctionDeclaration: true, // Default is true
// FunctionExpression: true,
MethodDefinition: true
}
}],
'jsdoc/implements-on-classes': ['error', {
contexts: ['any']
}],
'jsdoc/require-returns': ['warn', {
forceRequireReturn: true,
forceReturnsWithAsync: true,
contexts: ['any']
}],
'jsdoc/require-param-name': ['warn', {
contexts: ['any']
}],
'jsdoc/require-param-type': ['warn', {
contexts: ['any']
}],
'jsdoc/require-returns-type': ['warn', {
contexts: ['any']
}],
'jsdoc/require-throws': ['warn', {
contexts: ['any']
}],
'promise/no-nesting': 'warn',
'promise/no-promise-in-callback': 'warn',
'promise/no-callback-in-promise': 'warn',
'promise/avoid-new': 'warn',
'promise/no-return-in-finally': 'warn',
'promise/valid-params': 'warn',
'promise/prefer-await-to-callbacks': 'warn',
'unicorn/no-array-callback-reference': 'warn',
'unicorn/prefer-number-properties': 'warn',
'unicorn/prefer-string-slice': 'error',
'eslint-comments/require-description': 'error'
}
};