Skip to content

POC to create typescript configs that include only changed files vastly improving lint speeds for staged files. Mostly applicable to medium to monorepo size projects.

License

Notifications You must be signed in to change notification settings

VirtualizeLLC/typescript-diff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typescript-diff monorepo

Issues Code Coverage Commitizen Friendly [Semantic Release[semantic-release-ur]]

A combination of helpful typescript packages that make tools like jest and eslint to behave more efficiently for projects that need to scale.

Please reference the individual packages below.

Packages

npm package Build Status Downloads

npm package Build Status Downloads

Disclaimer

This repo is WIP. Please wait for an official release before attempting to use this package.

If you cannot wait, please reference the develop branch for experimental features.

This tool also may be slightly less useful in higher versions of @typescript/eslint-parser as there is a experimental key which will compile only project files EXPERIMENTAL_useProjectService

modules.export = {
  parserOptions: {
    EXPERIMENTAL_useProjectService: true,
  },
}

Link to repo docs

  • If you have massive typescript projects, using something like NX for caching typescript builds and running typescript compile only on staged or upstream files is still the way to go for linting fast.

Features

This monorepo encompasses 1 utility tsc-diff which is used to run eslint and jest. There are two packages specific to eslint.

If you have a tool/test-runner that you think needs to be supported please file an issue and consider contributing to add support for this tool.

  • Adds the ability to run tsc with your project's current config but only include specific files.

Compatibility

  • @vllc/tsc-diff: Node 12.x.x - 20.x.x
  • @vllc/eslint-tsc-diff: Eslint >=6 (using 8.x.x - locally)

Getting started

typescript-diff monorepo packages

Install

@vllc/eslint-tsc-diff

Install this package for eslint to run tsc only on the test files dependency tree.

npm install -D @vllc/tsc-diff-eslint

@vllc/jest-tsc-diff

Install this package for jest to run tsc only on the test files dependency tree

npm install -D @vllc/eslint-ts-diff

@vllc/tsc-diff

Install this package for getting the staged and upstream diff file output with flexibility such as @vllc/tsc-diff- start and @vllc/tsc-diff- stop to cleanup the dynamic tsconfig.json file generated.

npm install -D @vllc/tsc-diff

Usage

WIP

Upcoming Features

jest to make running pre-commit and pre-push hooks easier. jest-tsc-diff will also fully supports being run in isolatation and piping changes to custom test runners.

  • @vllc/jest-tsc-diff - NOT BUILT YET. jest support
    • Adds a compatibility script to directly mutate the tsconfig.json file (with backups) for babel-jest, which may work well with esbuild and swc-jest
    • Adds wrapper around jest so it runs ts-jest with the staged tsconfig file.

API

WIP, this will be dynamically generated

tsc-diff(input, options?)

input

Type: string

Lorem ipsum.

options

Type: object

postfix

Type: string Default: rainbows

About

POC to create typescript configs that include only changed files vastly improving lint speeds for staged files. Mostly applicable to medium to monorepo size projects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published