ni / ni/javascript-styleguide

Align `@typescript-eslint/no-inferrable-types` rule across angular and typescript

Open
#139 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
9
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Describe the issue

When adopting the Angular rules we had resolved to not adopt Angular's Recommended Extras configuration of @typescript-eslint/no-inferrable-types. See resolution comment.

However because we extended the angular recommended rules directly and did not override the configuration, we have effectively been using Angulars recommendation for the typescript configuration in Angular projects (because the typescript configuration was overwritten by angular) and the typescript configuration for only typescript only projects. See discussion about extending from recommended rules.

As part of https://github.com/ni/javascript-styleguide/pull/138 the Angular extras confiig was removed so rules are being inlined to result in an effective no change.

To avoid inconsistency, we should either:

  • Keep the accidental adoption of the rule and move it to the typescript configuration to make it intentional.
    Proposal: '@typescript-eslint/no-inferrable-types': ['error',{ ignoreParameters: true }] to the typescript config and remove it from angular rules
  • Adopt our initial resolution and rely on the exisiting configuration (i.e. the result of the TypeScript recommended ruleset)
    Proposal: Remove explicit configuration from Angular so it resolves to the current TypeScript configuration

Another option not being proposed but documenting is to keep the Vanilla TypeScript and Angular TypeScript rules inconsistent. I do not think we want to do that though.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Angular and TypeScript ESLint configurations and compare their effective @typescript-eslint/no-inferrable-types settings, including the changes associated with pull request 138. Resolve which of the two proposed consistent policies is intended, then verify that Angular and TypeScript-only projects produce the expected aligned configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, typescript
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.