Incentro IC - Code Standards - Typescript
๐ซ Introduction
This package provides a set of shared Typescriptย configuration files that can be used across different projects.
- ๐ Base -
@incentro-ic/config-typescript/base - ๐ฆ App - NestJS -
@incentro-ic/config-typescript/app-nest - ๐ผ App - Next.js -
@incentro-ic/config-typescript/app-next - ๐ด App - React Router -
@incentro-ic/config-typescript/app-react-router - ๐ฆ Package -
@incentro-ic/config-typescript/package - ๐ Package - Browser -
@incentro-ic/config-typescript/package-browser/ - ๐ฉ Package - Node -
@incentro-ic/config-typescript/package-node/ - โ๏ธ Package - React -
@incentro-ic/config-typescript/package-react
๐พ Installation
To install the package, use the following command:
pnpm add -D typescript @incentro-ic/config-typescript๐ช Usage
After installing the package you can use the provided configuration as a basis by using the extends keyword in your tsconfig.json.
Hereโs an example:
{
"extends": "@incentro-ic/config-typescript"
}The configuration files do not include any includes, files, exclude or compilerOptions.outDir options. You will need to add these options according to your projectโs requirements.
โ๏ธ Configs
๐ Base
This is the base Typescript configuration that is applicable to all projects. The settings in this configuration are primarily related to the strictness of Typescript and should rarely be overridden as they do not affect the output or the compilation target.
๐ช Usage
{
"extends": "@incentro-ic/config-typescript"
}๐ฆ App - NestJS
This is the Typescript configuration for all NestJS projects. It extends the base configuration and adds settings that are related to working with NestJS projects, like accepting unused class properties which is a common pattern in NestJS projects.
๐ช Usage
{
"extends": "@incentro-ic/config-typescript/app-nest"
}๐ผ App - Next.js
This is the Typescript configuration for all Next.js projects. It extends the base configuration and adds settings that are related to working with React and Next.jsโ Typescript plugin and type helpers.
๐ช Usage
{
"extends": "@incentro-ic/config-typescript/app-next"
}๐ด App - React Router
This is the Typescript configuration for all React Router projects. It extends the base configuration and adds settings that are related to working with React and React Router projects.
๐ช Usage
{
"extends": "@incentro-ic/config-typescript/app-react-router"
}๐ฆ Package
This is the base Typescript configuration for all projects that are meant to be published as a package and do not specifically target the browser or a Node.js environment. It extends the base configuration and adds settings that are related to the output of the Typescript compiler.
๐ช Usage
{
"extends": "@incentro-ic/config-typescript/package"
}๐ Package - Browser
This is the Typescript configuration for all projects that are meant to be published as package targeting browser environments. It extends the package configuration and adds settings that are specific to browser environments, like enabling types for methods only available in DOM environments. It targets the latest versions of most major browsers.
This config disables file emission by the Typescript compilerย as it is expected that youโll be using a bundler to transform the source files for use in browser environments.
๐ช Usage
{
"extends": "@incentro-ic/config-typescript/package-browser"
}๐ฉ Package - Node
This is the Typescript configuration for all projects that are meant to be published as Node.js packages. It extends the package configuration and adds settings that are related to Node.js, specifically the LTS version.
๐ช Usage
{
"extends": "@incentro-ic/config-typescript/package-node"
}โ๏ธ Package - React
This is the Typescript configuration for all projects that are meant to be published as React packages. It extends the browser package configuration and adds settings that are related to interpreting JSX.
This config disables file emission by the Typescript compilerย as it is expected that youโll be using a bundler to transform the source files for use in browser environments.
๐ช Usage
{
"extends": "@incentro-ic/config-typescript/package-react"
}