Skip to content

ESLint Config Migration: Remove no-inferrable-types rule#1041

Merged
filmaj merged 1 commit intotslint-to-eslintfrom
no-inferrable-types
Aug 23, 2021
Merged

ESLint Config Migration: Remove no-inferrable-types rule#1041
filmaj merged 1 commit intotslint-to-eslintfrom
no-inferrable-types

Conversation

@filmaj
Copy link
Copy Markdown
Contributor

@filmaj filmaj commented Aug 6, 2021

Summary

This is a PR that should be merged into #1024 and incrementally addresses #842.

This PR turns off the no-inferrable-types rule. My thinking behind this is that, while extraneous, being specific about the type of a variable even when it can be inferred from its initialization value may be helpful to folks, especially those whom may be unfamiliar with TypeScript.

Example code that failed this rule previously:

export function delay(ms: number = 0): Promise<void> {

In the above, because the default value of ms is set to 0, it can be inferred from the default value that the type of ms is number. Thus, the no-inferrable-types rule would fail.

What do folks think?

Impact

Before

✖ 362 problems (173 errors, 189 warnings)
  76 errors and 0 warnings potentially fixable with the `--fix` option.

After

✖ 358 problems (169 errors, 189 warnings)
  72 errors and 0 warnings potentially fixable with the `--fix` option.

Requirements (place an x in each [ ])

@filmaj filmaj added the tests M-T: Testing work only label Aug 6, 2021
@filmaj filmaj self-assigned this Aug 6, 2021
@filmaj filmaj force-pushed the no-inferrable-types branch from 0cb5020 to 5d1368d Compare August 9, 2021 23:54
Copy link
Copy Markdown
Contributor

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabling this rule makes sense a lot to me. No need to be strict about this at all

@filmaj filmaj merged commit a773144 into tslint-to-eslint Aug 23, 2021
@filmaj filmaj deleted the no-inferrable-types branch August 23, 2021 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests M-T: Testing work only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants