-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy path.eslintrc.cjs
126 lines (126 loc) · 2.98 KB
/
.eslintrc.cjs
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
/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: [
'xo',
'xo-typescript',
'plugin:jsdoc/recommended',
],
parserOptions: {
project: './tsconfig.eslint.json',
},
rules: {
'@typescript-eslint/naming-convention': [
// Allow for OBS in class/interface name, UPPER_CASE const
'error',
{
// selector: ['variableLike', 'memberLike', 'property', 'method'],
// Note: Leaving out `parameter` and `typeProperty` because of the mentioned known issues.
// Note: We are intentionally leaving out `enumMember` as it's usually pascal-case or upper-snake-case.
selector: ['function', 'classProperty', 'objectLiteralProperty', 'parameterProperty', 'classMethod', 'objectLiteralMethod', 'typeMethod', 'accessor'],
format: [
'strictCamelCase',
],
// We allow double underscope because of GraphQL type names and some React names.
leadingUnderscore: 'allowSingleOrDouble',
trailingUnderscore: 'allow',
// Ignore `{'Retry-After': retryAfter}` type properties.
filter: {
regex: '[- ]',
match: false,
},
},
// MOD: Variable separately to allow for UPPER_CASE const
{
selector: ['variable'],
modifiers: ['const'],
format: ['strictCamelCase', 'UPPER_CASE'],
},
{
selector: ['variable'],
format: [
'strictCamelCase',
],
// We allow double underscope because of GraphQL type names and some React names.
leadingUnderscore: 'allowSingleOrDouble',
trailingUnderscore: 'allow',
},
{
selector: 'typeLike',
format: [
// MOD: Allow for OBS
'PascalCase',
],
},
{
selector: 'variable',
types: [
'boolean',
],
format: [
'StrictPascalCase',
],
prefix: [
'is',
'has',
'can',
'should',
'will',
'did',
],
},
{
// Interface name should not be prefixed with `I`.
selector: 'interface',
filter: /^(?!I)[A-Z]/.source,
format: [
// MOD: Allow for OBS
'PascalCase',
],
},
{
// Type parameter name should either be `T` or a descriptive name.
selector: 'typeParameter',
filter: /^T$|^[A-Z][a-zA-Z]+$/.source,
format: [
'StrictPascalCase',
],
},
// Allow these in non-camel-case when quoted.
{
selector: [
'classProperty',
'objectLiteralProperty',
],
format: null,
modifiers: [
'requiresQuotes',
],
},
],
'capitalized-comments': 'off',
'jsdoc/check-tag-names': ['warn', {
definedTags: ['category', 'complexity', 'defaultValue', 'initialVersion', 'restrictions', 'rpcVersion'],
}],
'@typescript-eslint/consistent-type-definitions': 'off',
// Better handled by typescript
'jsdoc/require-param-type': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/valid-types': 'off',
},
settings: {
jsdoc: {
ignorePrivate: true,
},
},
overrides: [
{
files: ['tests/**/*.{js,ts}'],
extends: [
'plugin:ava/recommended',
],
rules: {
'jsdoc/require-jsdoc': 'off',
},
},
],
};