typescript-strict-plugin icon indicating copy to clipboard operation
typescript-strict-plugin copied to clipboard

Allow passing an env var for the strict mode ignore comment

Open Eric162 opened this issue 5 months ago • 0 comments

Added the explanation to the readme:

You can customize the ignore comment used by the plugin through the TS_STRICT_IGNORE_COMMENT environment variable. This is particularly useful for teams migrating to strict mode who want different behavior between their development environment and CI pipeline.

Example:

// @ts-strict-cli-ignore
const str: string | null = null;
const len = str.length; // error in IDE, passes cli with proper env var

in package.json scripts:

{
  "scripts": {
    "typecheck": "tsc && TS_STRICT_IGNORE_COMMENT=@ts-strict-ci-ignore tsc-strict"
  }
}
  • Files marked with e.g @ts-strict-cli-ignore will be ignored only by the CLI tool in CI
  • This allows gradual migration where developers see and fix issues locally without breaking the build

Have this running in my company repo through patch-package and it is working great!

Eric162 avatar Jul 24 '25 13:07 Eric162