Skip to content

Enable more linter checks in tsconfig.json by default  #21279

Description

@prabh-62

🚀 Feature request

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Description

❯ npx @angular/cli@12 new web-apps --create-application falsecd web-apps && yarn ng g app admin-console --routing --style scss

Currently, base tsconfig.json only contains strict, noImplicitReturns and noFallthroughCasesInSwitch flags

{
    "compileOnSave": false,
    "compilerOptions": {
      ...
      // all strict checks
      "strict": true,
      //  Linter checks
      "noImplicitReturns": true,
      "noFallthroughCasesInSwitch": true,
      ...
    }
}

Describe the solution you'd like

Enable new linter flags exposed by typescript in recent versions by defalt

{
  "compileOnSave": false,
  "compilerOptions": {
    ...
    // all strict checks
    "strict": true,
    //  Linter checks
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
	// TS 4.1
    "noUncheckedIndexedAccess": true,
	// TS 4.2
    "noPropertyAccessFromIndexSignature": true,
	// TS 4.3
    "noImplicitOverride": true,
	// TS 4.4
    "useUnknownInCatchVariables": true,
    "exactOptionalPropertyTypes": true,
    ...
  }
}

angular_strict_tsconfig_ts_4_4

Relevant blog posts:

Describe alternatives you've considered

I just have to add these flags manually to tsconfig.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions