diff --git a/.eslintrc.js b/.eslintrc.js index ffb596076a199d1da66c1ab47573eb3957511636..31c4faa44113d2a3d936e07a2923c68bc179aaee 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 fb72949dedf83feb63a4004a3f7e9459b371632f..b9155bbdd9a177536fc4b5ba3aac12d334a77b71 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