Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rust-based static analysis tool designed to enhance runtime type safety in TypeScript applications

NotificationsYou must be signed in to change notification settings

Stephen-Collins-tech/ts-validator

Repository files navigation

npm versionMIT License

Rust-powered static analysis for TypeScript APIs.
Find unvalidatedreq.body,req.query, andreq.params — before they cause runtime errors or security vulnerabilities.


🚀 Quickstart

No install needed. Just run:

npx @stephen-collins-tech/ts-validator path/to/entry-file.ts

Options:

npx @stephen-collins-tech/ts-validator --help

✨ What It Does

  • Recursively parses.ts and.tsx files.
  • Detects raw access to external inputs likereq.body.
  • Flags usage that may lack proper runtime validation.
  • Supports flags:--json,--fail-on-warning,--help,--version.

🛡️ Why ts-validator?

TypeScript protects you atcompile time.
ts-validator protects you atruntime — when external data actually hits your app.

Don't trust unvalidated input. Catch it automatically.


🧰 For Contributors

Want to build locally or extend the tool?
SeeCONTRIBUTING.md.


Example Usage

npx @stephen-collins-tech/ts-validator src/index.ts

Output:

example output

JSON Output Mode

For CI/CD pipelines or programmatic usage, you can output the results as JSON:

npx @stephen-collins-tech/ts-validator src/index.ts --json

This outputs a single JSON string with the following structure:

{"files_parsed":10,"violations_count":3,"elapsed_time_ms":256,"violations": [    {"file":"src/controllers/user.ts","line":12,"column":23,"kind":"DirectAccess","message":"Unvalidated direct access: req.body"    }  ]}

Exit Codes

By default, ts-validator always returns an exit code of 0 even when violations are found.

If you want to fail CI pipelines or scripts when violations are detected, use the--fail-on-warning flag:

npx @stephen-collins-tech/ts-validator src/index.ts --json --fail-on-warning

This will output the JSON data and exit with code 1 if any violations are found.


📦 Installation

Global Installation

npm install -g @stephen-collins-tech/ts-validatorts-validator --version

Project Installation

npm install --save-dev @stephen-collins-tech/ts-validator

Then in your package.json:

"scripts": {"validate":"ts-validator src/index.ts"}

📈 Roadmap

  • Smarter validation detection (schema.parse(req.body))

License

MIT License.

About

Rust-based static analysis tool designed to enhance runtime type safety in TypeScript applications

Resources

Contributing

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2026 Movatter.jp