-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc
137 lines (137 loc) · 4.44 KB
/
.eslintrc
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
133
134
135
136
137
// TODO: add default parameters tsdoc comments https://tsdoc.org/pages/tags/defaultvalue/
// TODO: consider consistent aliasing, create vs add/upload, StorageHostname vs storageEndpoint, all those region aliases
// - then remove them from intentionallyNotExported
{
"extends": [
"xo",
"xo-typescript",
"xo-typescript/space",
"plugin:sort/recommended",
"prettier"
],
"ignorePatterns": ["**/dist/**", "**/docs/**"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"root": true,
"rules": {
// example https://typescript-eslint.io/rules/ban-types/
"@typescript-eslint/ban-types": [
"error",
{
"types": {
// un-ban a type that is banned by default
"null": false
},
"extendDefaults": true
}
],
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
// default options for @typescript-eslint/naming-convention https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/naming-convention.md#options
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "default",
"format": ["camelCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
{
"selector": "variable",
"format": ["camelCase", "UPPER_CASE"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
// example https://typescript-eslint.io/rules/naming-convention/#how-does-the-rule-evaluate-a-names-format
{
"selector": "default",
"format": ["PascalCase"],
"filter": {
"regex": "AccessKey",
"match": true
}
},
// example https://stackoverflow.com/a/74818459
{
"selector": "property",
"format": null,
"filter": {
"regex": "(GET|POST|PUT|PATCH|DELETE) /.*",
"match": true
}
},
{
"selector": "property",
"format": null,
"filter": {
"regex": "content-type",
"match": true
}
},
// example https://typescript-eslint.io/rules/naming-convention/#allowed-selectors-modifiers-and-types
{
"selector": "typeAlias",
"format": ["PascalCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
{
"selector": "interface",
"format": ["PascalCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
{
"selector": "class",
"format": ["PascalCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
// TODO: remove and normalize properties returned from the API
// - use https://github.com/sindresorhus/camelcase-keys#stoppaths
// - can also convert keys back to pascal case
// - may still fail for EnableGeoZoneASIA (perhaps only change first letter?)
// - drop commonjs https://github.com/egoist/tsup/issues/628
// - unfortunately, jsdoc comments are lost, so that will need to be redone
{
"selector": "typeProperty",
"format": ["camelCase", "PascalCase"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
}
],
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
// TODO: remove https://eslint.org/docs/latest/rules/no-warning-comments
"no-warning-comments": "off",
"sort/string-enums": "error",
// sort groups default https://github.com/mskelton/eslint-plugin-sort/blob/main/src/index.ts
// sort typeOrder https://github.com/mskelton/eslint-plugin-sort/blob/HEAD/docs/rules/imports.md
"sort/exports": [
"error",
{
"groups": [
{ "type": "default", "order": 50 },
{ "type": "sourceless", "order": 40 },
{ "regex": "^\\.+\\/", "order": 30 },
{ "type": "dependency", "order": 10 },
{ "type": "other", "order": 20 }
],
"typeOrder": "first"
}
],
"sort/imports": [
"error",
{
"groups": [
{ "type": "side-effect", "order": 10 },
{ "regex": "^\\.+\\/", "order": 40 },
{ "type": "dependency", "order": 20 },
{ "type": "other", "order": 30 }
],
"typeOrder": "first"
}
],
"sort/string-unions": "error",
"sort/type-properties": "error"
}
}