All Projects → cyrilletuzi → typescript-strictly-typed

cyrilletuzi / typescript-strictly-typed

Licence: MIT license
Enable configurations for strictly typed TypeScript, ESLint, and optionally Angular. Because TypeScript strict mode is not enough.

TypeScript Strictly Typed

Enable configurations for strictly typed TypeScript, ESLint, and optionally Angular. Because TypeScript strict mode is not enough.

A blog post explains the motivation of this lib.

Status of this lib

Given my current professional situation and the lack of support for my open source work, this tool is just provided as is.

How to help?

My open source work represents months of full time unpaid work, with for example the Angular schematics extension for VS Code, used by 600 000 developers.

So if you want to help, I released Schematics Pro, a paid code automation tool for Angular, React, Vue, Ionic, Svelte, Stencil, Lit, Nest and more.

Warning

Going fully strict is a choice to make at the very beginning of a project.

Enabling all strict options at once in an existing project is strongly discouraged, as hundred of errors would appear. Converting an existing project to full strict mode is still possible, but it should be done incrementally, by activating each option one by one.

On the other hand, it's recommended to redo the command when doing major updates of your tools (TypeScript, ESLint or Angular) to add newly introduced strict options, to stay up to date with best practices.

Getting started

Check the Git (or equivalent) status is clean, to be able to revert easily if needed, then just run the following commands in your terminal:

cd path/to/my-project-with-tsconfig
npx typescript-strictly-typed

What does it do?

Adding configuration for:

  • TypeScript compiler options
    • strict (which includes in particular noImplicitAny and strictNullChecks)
    • noFallthroughCasesInSwitch
    • noImplicitReturns
    • noPropertyAccessFromIndexSignature
    • forceConsistentCasingInFileNames
    • noImplicitOverride
  • ESLint rules
    • @typescript-eslint/no-explicit-any
    • @typescript-eslint/explicit-module-boundary-types
  • Angular compiler options
    • strictInjectionParameters
    • strictTemplates
    • strictInputAccessModifiers
  • Angular ESLint options
    • @angular-eslint/template/no-any

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].