Skip to content

Commit b6aa13b

Browse files
Benjamin SÉGAULTBenjamin SÉGAULT
authored andcommitted
fix(rules): relax a bit some rules that we cannot apply easily
1 parent d5fc608 commit b6aa13b

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

.eslintrc.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ module.exports = {
214214
"@typescript-eslint/no-unsafe-enum-comparison": "off",
215215
"@typescript-eslint/no-unsafe-member-access": "off",
216216

217+
// Allow to serialize caught variables like `${err}` (because err would have unknown type by default)
218+
"@typescript-eslint/restrict-template-expressions": "off",
219+
217220
// Relax some @typescript-eslint/stylistic rules
218221
// Allow to use indexed objects
219222
"@typescript-eslint/consistent-indexed-object-style": "off",
@@ -237,6 +240,18 @@ module.exports = {
237240
// Allow assertion operator in unit tests because TS does not recognize
238241
// jest expects such as toBeDefined() or not.toBeNull() as type-validating
239242
"@typescript-eslint/no-non-null-assertion": "off",
243+
// Lots of tests can have async test callback, for consistency and easy update
244+
// Allow to have them without await in the callback body, because side effect in tests are minimal
245+
"@typescript-eslint/require-await": "off",
246+
},
247+
},
248+
// TSOA/Nest Overrides
249+
{
250+
files: ["**/controllers/**"],
251+
rules: {
252+
// Some annotations helpers must be used but explicitly return any
253+
// Disable them for those cases
254+
"@typescript-eslint/no-unsafe-return": "off",
240255
},
241256
},
242257
// Storybook overrides

config.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@
187187
"@typescript-eslint/no-unsafe-member-access": [
188188
"off"
189189
],
190+
"@typescript-eslint/restrict-template-expressions": [
191+
"off"
192+
],
190193
"@typescript-eslint/consistent-indexed-object-style": [
191194
"off"
192195
],
@@ -1024,9 +1027,6 @@
10241027
"@typescript-eslint/restrict-plus-operands": [
10251028
"error"
10261029
],
1027-
"@typescript-eslint/restrict-template-expressions": [
1028-
"error"
1029-
],
10301030
"@typescript-eslint/triple-slash-reference": [
10311031
"error"
10321032
],

sandbox.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,5 @@ console.log(fs.readSync);
2323

2424
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
2525
export const getDummy = (param: unknown) => {
26-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
2726
console.log(`${dummy} and ${param} a, ${first}, ${pkg.version}`);
2827
};

0 commit comments

Comments
 (0)