@canonical/typescript-config-react

0.9.0-experimental.12 • Public • Published

Canonical React Typescript Configuration

This package provides a central configuration for Canonical's React Typescript projects.

This configuration extends a base configuration, which provides more general TypeScript settings and is suitable for non-React projects.

Getting Started

  1. Install Typescript: bun add -d typescript
  2. Install this configuration: bun add -d @canonical/typescript-config-react
  3. Create a tsconfig.json file in the root of your project and extend this configuration.
{
  "extends": "@canonical/typescript-config-react"
}

Configuration

This configuration enables the following behavior:

  1. DOM library inclusion: Includes the DOM library, providing types for the DOM and browser APIs.
  2. react-jsx transform: Emits .jsx as .js with the new React JSX transform, optimized for production usage.

History

This configuration is rooted in the Canonical React Components Typescript config. It has been generalized to support non-React projects and be more minimal.

React-specific changes to the original config are listed below. For non-React relevant changes, see the base configuration README.

  • "jsx": "react""jsx": "react-jsx": Transforms JSX to JS with modern React JSX optimizations, instead of with React.createElement. Enables usage of JSX without importing React.

Readme

Keywords

none

Package Sidebar

Install

npm i @canonical/typescript-config-react

Weekly Downloads

1,777

Version

0.9.0-experimental.12

License

LGPL-3.0

Unpacked Size

14.7 kB

Total Files

6

Last publish

Collaborators

  • frankban
  • huwshimi
  • anthonydillon
  • steverydz
  • amylily1011
  • bartaz
  • jpmartinspt
  • petesfrench
  • jmuzina
  • mtruj
  • edlerd
  • lukewh
  • canonical-organization
  • ad.vl
  • ando.gq
  • ninfa_jeon
  • ndv99