Skip to content

Commit

Permalink
chore: enforce ts as cast (#16164)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Jun 22, 2022
1 parent 07b98a9 commit aeec0f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions docs/development/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aeec0f4

Please sign in to comment.