Repository navigation
Expand file tree
/
Copy path.eslintrc.json
More file actions
138 lines (138 loc) · 4.28 KB
/
Copy path.eslintrc.json
File metadata and controls
138 lines (138 loc) · 4.28 KB
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
138
{
"extends": [
"./node_modules/gts",
"plugin:prettier/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:promise/recommended"
],
"root": true,
"rules": {
"import/no-unresolved": "off",
"import/no-extraneous-dependencies": "error",
"promise/catch-or-return": "error",
"promise/always-return": "error",
// Enforces the standard on handwritten code, but permits class/interface extensions
"@typescript-eslint/no-empty-interface": [
"error",
{
"allowSingleExtends": true
}
]
},
"overrides": [
// The overrides below were migrated from handwritten/firestore/.eslintrc.json
// during monorepo ESLint consolidation to maintain Firestore-specific rules.
{
"files": ["handwritten/firestore/dev/src/**/*.ts"],
"excludedFiles": [
"handwritten/firestore/dev/src/v1/*.ts",
"handwritten/firestore/dev/src/v1beta1/*.ts"
],
"parser": "@typescript-eslint/parser",
"rules": {
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true,
"allowTypedFunctionExpressions": true
}
],
"no-console": ["error", {"allow": ["error"]}],
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_"
}
]
}
},
{
"files": [
"handwritten/firestore/dev/test/**/*.ts",
"handwritten/firestore/dev/system-test/**/*.ts"
],
"parser": "@typescript-eslint/parser",
"rules": {
"no-restricted-properties": [
"error",
{
"object": "describe",
"property": "only"
},
{
"object": "it",
"property": "only"
}
],
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-floating-promises": "warn",
"promise/always-return": "off",
"promise/catch-or-return": "off"
}
},
{
"files": [
"handwritten/firestore/dev/src/v1/**/*.ts",
"handwritten/firestore/dev/src/v1beta1/**/*.ts",
"handwritten/firestore/dev/test/gapic_firestore_v1.ts",
"handwritten/firestore/dev/test/gapic_firestore_admin_v1.ts",
"handwritten/firestore/dev/test/gapic_firestore_admin_v1.ts"
],
"rules": {
"@typescript-eslint/no-explicit-any": ["off"],
"@typescript-eslint/no-floating-promises": ["off"]
}
},
// Generated GAPIC surfaces (clients + their generated unit tests) are
// emitted verbatim by gapic-generator-typescript and cannot be hand-edited,
// so rules they violate have to be handled here rather than in the output.
{
"files": [
"packages/*/src/v*/**/*.ts",
"packages/*/esm/src/v*/**/*.ts",
"packages/*/test/gapic_*.ts",
"packages/*/esm/test/gapic_*.ts"
],
"rules": {
// Restores pre-#8458 behavior. Generated packages each shipped a
// `root: true` .eslintrc.json extending only gts, so when the promise
// plugin was added to this config in #8446 it never reached them.
"promise/always-return": "off",
"promise/catch-or-return": "off",
// TODO(#9432): temporary. Unlike the promise rules above, these two
// were reachable via gts before #8458, so this is a new relaxation.
// Removable once librarian.yaml pins a `gapic-generator-v*` release
// containing the template fixes -- note that merging a template fix to
// main is NOT sufficient, since librarian.yaml pins the generator by
// tag + tarball checksum.
"@typescript-eslint/no-floating-promises": "off",
"prefer-const": "off"
}
}
],
// LINT.IfChange(ignorePatterns)
"ignorePatterns": [
"**/node_modules",
"**/build",
"**/dist",
"**/system-test",
"**/test/fixtures",
"**/test-fixtures",
"**/fixtures",
"**/baselines",
"**/baselines-esm",
"**/samples/generated",
"**/.coverage",
"**/coverage",
"**/.nyc_output",
"**/protos",
"**/*.d.ts"
]
// LINT.ThenChange(bin/linter.mjs:ignored_path_segments)
}