From aeec0f411ee0bd30cc9df61e8658d1f3718b5452 Mon Sep 17 00:00:00 2001
From: Michael Kriese <michael.kriese@visualon.de>
Date: Wed, 22 Jun 2022 12:20:34 +0200
Subject: [PATCH] chore: enforce ts as cast (#16164)

---
 .eslintrc.js                       | 6 ++++++
 docs/development/best-practices.md | 1 +
 2 files changed, 7 insertions(+)

diff --git a/.eslintrc.js b/.eslintrc.js
index ffb596076a..31c4faa441 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -71,11 +71,17 @@ module.exports = {
 
     // disallow direct `nock` module usage as it causes memory issues.
     // disallow `parse-link-header` to allow override ENV https://github.com/thlorenz/parse-link-header#environmental-variables
+    // disallow `path` in favor of `upath`
     'no-restricted-imports': [
       2,
       { paths: ['nock', 'parse-link-header', 'path'] },
     ],
 
+    '@typescript-eslint/consistent-type-assertions': [
+      'error',
+      { assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' },
+    ],
+
     // Makes no sense to allow type inference for expression parameters, but require typing the response
     '@typescript-eslint/explicit-function-return-type': [
       'error',
diff --git a/docs/development/best-practices.md b/docs/development/best-practices.md
index fb72949ded..b9155bbdd9 100644
--- a/docs/development/best-practices.md
+++ b/docs/development/best-practices.md
@@ -11,6 +11,7 @@ Follow these best practices when you're working on our code.
 - Always add unit tests for full code coverage
   - Only use `istanbul` comments for unreachable code coverage that is needed for `codecov` completion
   - Use descriptive `istanbul` comments
+- Avoid cast or prefer `x as T` instead of `<T>x` cast.
 
 ```ts
 // istanbul ignore next: can never happen
-- 
GitLab