es-check-min
v1.0.13
Published
CLI tool and library to find the minimum compatible ECMAScript version of a JavaScript file.
Downloads
251
Maintainers
Readme
es-check-min
CLI tool and library to find the minimum compatible ECMAScript version of a JavaScript file.
Overview
A simple tool built on es-check to find the lowest supported ECMAScript version of a JavaScript file.
The es-check-min tool does not require any arguments, and simply runs a loop to determine the file's lowest compatible ECMAScript version. This is in slight contrast to es-check which checks a file against a specified ECMAScript version.
Detection of the following ECMAScript versions is supported:
- ES5
- ES6 / ES2015
- ES7 / ES2016
- ES8 / ES2017
- ES9 / ES2018
- ES10 / ES2019
- ES11 / ES2020
- ES12 / ES2021
- ES13 / ES2022
Note: The underlying es-check implementation technically supports ES3 and ES14 / ES2023, but certain tests aren't passing against these targets so they are not currently returned.
Getting started
Dependencies
- Node.js 24.16.0 or newer (specifically
^24.16.0 || >=26.3.0)
The exported library APIs are ESM-only.
Installation
Pick the option that matches how you plan to use it.
As a library
Add it to your project to import the TypeScript API. This also puts the es-check-min CLI on your project's path:
npm install es-check-minAs a CLI tool
Run it once without installing:
npx es-check-min <file>Or install it globally with Homebrew:
brew install kitschpatrol/tap/es-check-minOr install it globally with npm:
npm install --global es-check-minUsage
CLI
Example
es-check-min ./mystery-file.jsprints...
es6/es2015Commands
Command: es-check-min
Get the minimum supported ECMAScript version of a JavaScript file.
Usage:
es-check-min <file>| Positional Argument | Description | Type |
| ------------------- | ------------------------------------- | -------- |
| file | Path to the JavaScript file to check. | string |
| Option | Description | Type |
| ------------------- | ------------------- | --------- |
| --help-h | Show help | boolean |
| --version-v | Show version number | boolean |
Library
A single function is exported:
function esCheckMin(path: string): Promise<EsVersion | undefined>Background
Requests for something like this have come up once or twice:
- Make babel tell me the minimum version of target that supports my code
- Feature Request: Wrapper command for "minimum ES version" for a file
Maintainers
Acknowledgments
es-check-min is just a trivial wrapper over es-check. All credit goes to Jeff Wainwright and contributors for creating and maintaining es-check.
Contributing
Issues are welcome and appreciated.
Please open an issue to discuss changes before submitting a pull request. Unsolicited PRs (especially AI-generated ones) are unlikely to be merged.
This repository uses @kitschpatrol/shared-config (via its ksc CLI) for linting and formatting, plus MDAT for readme placeholder expansion.
