Configuration Guide
@masumdev/tscheck automatically searches for a configuration file in your current working directory. You can configure your audit rules using JSON, YAML, or TypeScript/JavaScript.
Supported Config Formats & Priority
The CLI searches for configuration files in the following order of priority:
tscheck.config.json.tscheckrc.jsontscheck.config.yaml/tscheck.config.yml.tscheckrc.yaml/.tscheckrc.yml.tscheckrc(JSON)tscheck.config.ts/tscheck.config.js/tscheck.config.mjs
Configuration Examples
Use the official $schema from GitHub (or local node_modules) to get instant autocompletion, type validation, and hover tooltips in VS Code, Cursor, and WebStorm:
{ "$schema": "https://raw.githubusercontent.com/masumrpg/react-native-library/main/packages/tscheck/schema.json", "rootDir": ".", "workspaces": ["packages/*", "apps/*"], "exclude": ["node_modules", "dist", "build", ".expo", ".turbo", ".temp"], "rules": { "deprecated": true, "unused": true, "noExplicitAny": true, "circular": true, "packageBoundary": true }, "reporters": { "outputDir": ".temp/tscheck", "json": true, "markdown": true, "html": true, "githubAnnotations": false, "jsonFileName": "audit-report.json", "markdownFileName": "audit-report.md", "htmlFileName": "audit-report.html" }, "failOnWarning": false}Tip: You can also use the local package path:
"$schema": "node_modules/@masumdev/tscheck/schema.json".
Configure cleanly with YAML syntax and yaml-language-server schema integration:
# yaml-language-server: $schema=https://raw.githubusercontent.com/masumrpg/react-native-library/main/packages/tscheck/schema.jsonrootDir: .workspaces: - packages/* - apps/*exclude: - node_modules - dist - build - .expo - .turbo - .temprules: deprecated: true unused: true noExplicitAny: true circular: true packageBoundary: truereporters: outputDir: .temp/tscheck json: true markdown: true html: true githubAnnotations: falsefailOnWarning: falseUse defineConfig() for type-safety and JSDoc metadata in TypeScript:
import { defineConfig } from "@masumdev/tscheck";
export default defineConfig({ rootDir: process.cwd(), workspaces: ["packages/*", "apps/*"], exclude: ["node_modules", "dist", "build", ".expo", ".turbo", ".temp"], rules: { deprecated: true, unused: true, noExplicitAny: true, circular: true, packageBoundary: true, }, reporters: { outputDir: ".temp/tscheck", json: true, markdown: true, html: true, }, failOnWarning: false,});Inline Comment Suppression
You can selectively disable inspections for individual lines or blocks of code using comment annotations:
// 1. Ignore next line for a specific rule// tscheck-ignore-next-line anyconst rawData: any = JSON.parse(response);
// 2. Ignore multiple rules on next line// tscheck-ignore-next-line any, deprecatedconst result: any = legacyHelper();
// 3. Ignore all rules on next line// tscheck-ignore-next-lineconst oldItem: any = oldApi();
// 4. Block-level suppression/* tscheck-disable any */const a: any = 1;const b: any = 2;/* tscheck-enable any */Supported Rule Keywords in Comments
deprecatedunusedany/noExplicitAnycircularboundary/packageBoundaryall
Configuration Options Reference
rootDir
- Type:
string - Default:
"."(resolved toprocess.cwd()) - Base directory where the audit engine executes.
workspaces
- Type:
string[] - Default:
["packages/*", "apps/*"](or fallback to roottsconfig.json) - Glob patterns or relative directory paths to scan.
exclude
- Type:
string[] - Default:
["node_modules", "dist", "build", ".expo", ".turbo", ".temp"] - Directory names and path patterns to ignore during file discovery.
staged
- Type:
boolean - Default:
false - When enabled, only scans files currently staged in Git (ideal for pre-commit hooks).
since
- Type:
string - Example:
"main"or"HEAD~1" - When provided, only scans files modified since the specified Git reference.
fix
- Type:
boolean - Default:
false - Automatically fixes safe issues like prefixing unused variables and parameters with
_.
format
- Type:
"pretty" | "json" | "github" - Default:
"pretty" - Output format for CLI stdout.
"github"emits native GitHub Actions workflow annotations.
rules
- Type:
objectdeprecated?: boolean(Default:true): Checks for functions, classes, and properties tagged with JSDoc@deprecated.unused?: boolean(Default:true): Checks for unused variables, parameters, and imports.noExplicitAny?: boolean(Default:true): Checks for explicitanytype annotations, assertions (as any), and generics.circular?: boolean(Default:true): Traces import/export graphs to detect circular module dependency cycles.packageBoundary?: boolean(Default:true): Checks for illegal deep internal imports from workspace packages.
reporters
- Type:
objectoutputDir?: string(Default:".temp/tscheck"): Destination folder for generated reports.json?: boolean(Default:true): Generatesaudit-report.json.markdown?: boolean(Default:true): Generatesaudit-report.md.html?: boolean(Default:true): Generates interactiveaudit-report.htmlwith real-time search, filters, dark/light theme, and clickable links.githubAnnotations?: boolean(Default:false): Emits GitHub Actions workflow annotations.jsonFileName?: string(Default:"audit-report.json").markdownFileName?: string(Default:"audit-report.md").htmlFileName?: string(Default:"audit-report.html").
failOnWarning
- Type:
boolean - Default:
false - If set to
true, the CLI will exit with code1whenever any violations are found.
tsconfigName
- Type:
string - Default:
"tsconfig.json" - Custom project tsconfig file name to search for across workspaces.
TypeScript Type System & Extending Types
@masumdev/tscheck is fully typed out of the box. You can leverage TypeScript for type safety, autocompletion, and even extend the configuration interfaces for your custom scripts or CI pipelines.
1. Using defineConfig() Helper
The recommended way to author TypeScript configs is via defineConfig(). It provides instant IDE IntelliSense without having to manually type annotations:
import { defineConfig } from "@masumdev/tscheck";
export default defineConfig({ rootDir: process.cwd(), workspaces: ["packages/*", "apps/*"], rules: { deprecated: true, unused: true, noExplicitAny: true, circular: true, packageBoundary: true, }, reporters: { outputDir: ".temp/tscheck", json: true, markdown: true, html: true, },});2. Extending Config Types
If your project or company maintains custom wrappers, CI metadata, or Slack alert channels, you can extend TsCheckConfig:
import type { TsCheckConfig } from "@masumdev/tscheck";
export interface CustomAuditConfig extends TsCheckConfig { metadata?: { team: string; slackChannel?: string; complianceLevel: "strict" | "standard"; };}
export const auditConfig: CustomAuditConfig = { rootDir: process.cwd(), rules: { deprecated: true, noExplicitAny: true, circular: true, }, metadata: { team: "Mobile Core Architecture", slackChannel: "#dev-alerts", complianceLevel: "strict", },};