1
- /* eslint-disable @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call */
2
- const xoTypescript = require ( 'eslint-config-xo-typescript' ) ;
3
-
4
1
/** @type {import('eslint').Linter.Config } */
5
2
module . exports = {
6
3
extends : [
@@ -13,21 +10,94 @@ module.exports = {
13
10
} ,
14
11
rules : {
15
12
'@typescript-eslint/naming-convention' : [
16
- // Allow for OBS in class/interface name
17
- ...xoTypescript . rules [ '@typescript-eslint/naming-convention' ] . map (
18
- options => {
19
- console . log ( { options} ) ;
20
- if ( options . selector === 'typeLike' || options . selector === 'interface' ) {
21
- return {
22
- ...options ,
23
- format : [ 'PascalCase' ] ,
24
- } ;
25
- }
26
-
27
- return options ;
13
+ // Allow for OBS in class/interface name, UPPER_CASE const
14
+ 'error' ,
15
+ {
16
+ // selector: ['variableLike', 'memberLike', 'property', 'method'],
17
+ // Note: Leaving out `parameter` and `typeProperty` because of the mentioned known issues.
18
+ // Note: We are intentionally leaving out `enumMember` as it's usually pascal-case or upper-snake-case.
19
+ selector : [ 'function' , 'classProperty' , 'objectLiteralProperty' , 'parameterProperty' , 'classMethod' , 'objectLiteralMethod' , 'typeMethod' , 'accessor' ] ,
20
+ format : [
21
+ 'strictCamelCase' ,
22
+ ] ,
23
+ // We allow double underscope because of GraphQL type names and some React names.
24
+ leadingUnderscore : 'allowSingleOrDouble' ,
25
+ trailingUnderscore : 'allow' ,
26
+ // Ignore `{'Retry-After': retryAfter}` type properties.
27
+ filter : {
28
+ regex : '[- ]' ,
29
+ match : false ,
28
30
} ,
29
- ) ,
31
+ } ,
32
+ // MOD: Variable separately to allow for UPPER_CASE const
33
+ {
34
+ selector : [ 'variable' ] ,
35
+ modifiers : [ 'const' ] ,
36
+ format : [ 'strictCamelCase' , 'UPPER_CASE' ] ,
37
+ } ,
38
+ {
39
+ selector : [ 'variable' ] ,
40
+ format : [
41
+ 'strictCamelCase' ,
42
+ ] ,
43
+ // We allow double underscope because of GraphQL type names and some React names.
44
+ leadingUnderscore : 'allowSingleOrDouble' ,
45
+ trailingUnderscore : 'allow' ,
46
+ } ,
47
+ {
48
+ selector : 'typeLike' ,
49
+ format : [
50
+ // MOD: Allow for OBS
51
+ 'PascalCase' ,
52
+ ] ,
53
+ } ,
54
+ {
55
+ selector : 'variable' ,
56
+ types : [
57
+ 'boolean' ,
58
+ ] ,
59
+ format : [
60
+ 'StrictPascalCase' ,
61
+ ] ,
62
+ prefix : [
63
+ 'is' ,
64
+ 'has' ,
65
+ 'can' ,
66
+ 'should' ,
67
+ 'will' ,
68
+ 'did' ,
69
+ ] ,
70
+ } ,
71
+ {
72
+ // Interface name should not be prefixed with `I`.
73
+ selector : 'interface' ,
74
+ filter : / ^ (? ! I ) [ A - Z ] / . source ,
75
+ format : [
76
+ // MOD: Allow for OBS
77
+ 'PascalCase' ,
78
+ ] ,
79
+ } ,
80
+ {
81
+ // Type parameter name should either be `T` or a descriptive name.
82
+ selector : 'typeParameter' ,
83
+ filter : / ^ T $ | ^ [ A - Z ] [ a - z A - Z ] + $ / . source ,
84
+ format : [
85
+ 'StrictPascalCase' ,
86
+ ] ,
87
+ } ,
88
+ // Allow these in non-camel-case when quoted.
89
+ {
90
+ selector : [
91
+ 'classProperty' ,
92
+ 'objectLiteralProperty' ,
93
+ ] ,
94
+ format : null ,
95
+ modifiers : [
96
+ 'requiresQuotes' ,
97
+ ] ,
98
+ } ,
30
99
] ,
100
+ 'capitalized-comments' : 'off' ,
31
101
} ,
32
102
overrides : [
33
103
{
0 commit comments