Eliminate is a utility that analyzes your TypeScript code to identify
variables that are defined but only used once and are not exported. It then
eliminates these variable definitions and replaces their usage with their
initializers, optimizing your code for better readability and performance.
| Before | After |
|---|---|
let a = 5; let b = 10; let c = a + b; console.log(c); |
console.log(5 + 10); |
TypeScript support with type-checkingInstall the package as a development dependency:
npm install -D -E @playform/eliminate
Run the build tool from the command line:
npx @playform/eliminate Configuration.ts
See an example configuration file in: Configuration.ts
Usage: Eliminate Eliminate
Arguments:
Eliminate ↘️ Eliminate configuration file
Options:
-V, --version Output the version number
-h, --help Display help information
Add Eliminate to your package.json scripts:
{
"scripts": {
"Eliminate": "Eliminate Configuration.ts"
}
}
Contributions are welcome! Please see CONTRIBUTING.md for
guidelines and feel free to submit a Pull Request.
See CHANGELOG.md for a history of changes to this component.