This GitHub Action checks JavaScript files against a specified version of ECMAScript (ES). If a specified file's ES version doesn't match the ES version argument, this action will throw an error and log the files that didn't match the check.
In modern JavaScript builds, files are bundled up so they can be served in an optimized manner in the browsers. It is assumed by developers that future JavaScript—like ES8 will be transpiled (changed from future JavaScript to current JavaScript) appropriately by a tool like Babel or TypeScript. Sometimes there is an issue where files are not transpiled which would cause issues in browsers who don't support all the latest features (e.g. IE11).
Check out my blog post about this topic.
- Speed: this check shouldn't take more than a few seconds
- Flexibility: choose which files should be checked
- Compatibility: choose the ES version you want to target.
ES5
is a good choice to have maximum compatibility
directory
- Directory which should be checkedecmaVersion
- The ECMAScript version to check for against a glob of JavaScript filesfiles
- A glob of files to test the ECMAScript version against
Create a workflow and paste this
- uses: actions/es-check-action@1.0.2
with:
directory: 'dist'
ecmaVersion: 'es5'
files: '*.js'
- Download the repository.
- Install Node.js if you haven't already.
- Use
npm ci
to install the necessary dependencies. - The source code is written in TypeScript in the
src
directory. - Run
npm run build
to build the library. - Run
npm test
to run the tests using Jest.
Pull requests and feature requests are welcome!
- es-check is under the hood to make this possible