{"id":13576377,"url":"https://github.com/dollarshaveclub/es-check","last_synced_at":"2025-04-05T05:31:40.247Z","repository":{"id":56628533,"uuid":"105327415","full_name":"dollarshaveclub/es-check","owner":"dollarshaveclub","description":"Checks the version of ES in JavaScript files with simple shell commands  🏆","archived":true,"fork":false,"pushed_at":"2020-10-27T23:40:49.000Z","size":446,"stargazers_count":459,"open_issues_count":18,"forks_count":38,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-11-05T12:33:31.946Z","etag":null,"topics":["bundling","ecmascript","es6","es6-modules","modules","test-automation","testing","testing-tools"],"latest_commit_sha":null,"homepage":"https://github.com/yowainwright/es-check","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dollarshaveclub.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2017-09-30T00:19:33.000Z","updated_at":"2024-10-16T20:04:13.000Z","dependencies_parsed_at":"2022-08-15T22:10:59.458Z","dependency_job_id":null,"html_url":"https://github.com/dollarshaveclub/es-check","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dollarshaveclub%2Fes-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dollarshaveclub%2Fes-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dollarshaveclub%2Fes-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dollarshaveclub%2Fes-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dollarshaveclub","download_url":"https://codeload.github.com/dollarshaveclub/es-check/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294468,"owners_count":20915335,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bundling","ecmascript","es6","es6-modules","modules","test-automation","testing","testing-tools"],"created_at":"2024-08-01T15:01:09.720Z","updated_at":"2025-04-05T05:31:35.235Z","avatar_url":"https://github.com/dollarshaveclub.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003e\n    This software is maintained under a new repository located at \u003ca href=\"https://github.com/yowainwright/es-check\"\u003eyowainwright/es-check\u003c/a\u003e\n  \u003c/strong\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️\u003c/p\u003e\n\n***\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://yowainwright.imgix.net/gh/es-check.svg\" alt=\"ES Check ✔️\" width=\"120\" /\u003e\n\u003c/p\u003e\n\n----\n\n\u003cp align=\"center\"\u003eCheck JavaScript files ES version against a specified ES version 🏆\u003c/p\u003e\n\n----\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://circleci.com/gh/dollarshaveclub/es-check/tree/master\"\u003e\n    \u003cimg alt=\"Build Status\" src=\"https://circleci.com/gh/dollarshaveclub/es-check/tree/master.svg?style=svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/es-check\"\u003e\n    \u003cimg alt=\"npm version\" src=\"https://badge.fury.io/js/es-check.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://greenkeeper.io/\"\u003e\n    \u003cimg alt=\"Greenkeeper\" src=\"https://badges.greenkeeper.io/dollarshaveclub/es-check.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/dollarshaveclub/es-check\"\u003e\n    \u003cimg src=\"https://codecov.io/gh/dollarshaveclub/es-check/branch/master/graph/badge.svg\" alt=\"Codecov\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://twitter.com/intent/tweet?text=ES%20Check%E2%80%94Checks%20the%20version%20of%20ES%20in%20JavaScript%20files%20with%20simple%20shell%20commands%20%40dollarshaveclub%20https%3A%2F%2Fgithub.com%2Fdollarshaveclub%2Fes-check\"\u003e\n    \u003cimg alt=\"Share on Twitter\" src=\"https://img.shields.io/twitter/url/http/shields.io.svg?style=social\u0026maxAge=2592000\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n----\n\n\u003ch1 align=\"center\"\u003eES Check ✔️\u003c/h1\u003e\n\n**Version 5** release! 🎉 Thanks to [@BrandonOCasey](https://github.com/brandonocasey).\nRemoves need for `boolean` in argument; post [Caporal **1.1.0**](https://github.com/mattallty/Caporal.js/commit/ae5d2c3cc1acef1b89a13608033b250fa7750c4e).\nThis will require an update for any boolean cli flags, in example `--module`, `--allow-hash-bang`.\n\nExample of CLI boolean flag in previous versions (Versions 0-4.*)\n\n```sh\n\n// the \"true\" argument was required\nes-check --module true es6 ./tests/modules/*.js'\n\n```\n\nNow, with Version 5\n\n```sh\n\n// the \"true\" argument must be removed if used\nes-check --module es6 ./tests/modules/*.js'\n\n```\n\n----\n\n**ES Check** checks JavaScript files against a specified version of ECMAScript (ES) with a shell command. If a specified file's ES version doesn't match the ES version argument passed in the ES Check command, ES Check will throw an error and log the files that didn't match the check.\n\nEnsuring that JavaScript files can pass ES Check is important in a [modular and bundled](https://www.sitepoint.com/javascript-modules-bundling-transpiling/) world. Read more about [why](#why).\n\n----\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#get-started\"\u003eGet Started\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"#why-es-check\"\u003eWhy ES Check?\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"#walk-through\"\u003eWalk Through\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"#api\"\u003eAPI\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"#debugging\"\u003eDebugging\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"/issues\"\u003eIssues\u003c/a\u003e\n\u003c/p\u003e\n\n----\n\n## Get Started\n\nInstall\n\n```sh\n\nnpm i es-check --save-dev   # locally\nnpm i es-check -g           # or globally\n\n```\n\nCheck if an array or glob of files matches a specified ES version.\n\n- **Note:** adds quotation around globs. Globs are patterns like so, `\u003csomething\u003e/*.js`.\n\n```sh\n\nes-check es5 './vendor/js/*.js' './dist/**/*.js'\n\n```\n\n- The ES Check script (above) checks `/dist/*.js` files to see if they're ES5. It throws an error and logs files are that do not pass the check.\n\n----\n\n## Why ES Check?\n\nIn 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. Sometimes there is an issue where files are not transpiled. There was no efficient way to test for files that weren't transpiled—until now. That's what ES Check does.\n\n----\n\n## Walk through\n\nThe images below demonstrate command line scripts and their corresponding logged results.\n\nPass\n![pass](https://user-images.githubusercontent.com/1074042/31471487-d7be22ee-ae9d-11e7-86e2-2c0f71cfffe6.jpg)\n\nFail\n![fail](https://user-images.githubusercontent.com/1074042/31471486-d65c3a80-ae9d-11e7-94fd-68b7acdb2d89.jpg)\n\n**ES Check** is run above with node commands. It can also be run within npm scripts, ci tools, or testing suites.\n\n----\n\n## API\n\n**ES Check** provides the necessities. It accepts its place as a JavaScript matcher/tester.\n\n### General Information\n\n```sh\n\n# USAGE\n\nindex.js es-check \u003cecmaVersion\u003e [files...]\n\n```\n\n### Arguments\n\n```sh\n\n\u003cecmaVersion\u003e 'define the ECMAScript version to check for against a glob of JavaScript files' required\n[files...] 'a glob of files to test the ECMAScript version against' required\n\n```\n\n### Options\n\n**Modules Flag**\n\n```sh\n\n--module use ES modules, default false\n\n```\n\n**Allow Hash Bang**\n\n```sh\n\n--allow-hash-bang supports files that start with hash bang, default false\n\n```\n\n**Not**\n```sh\n--not=folderName1,folderName2 An array of file/folder names that you would like to ignore. Defaults to `[]`.\n```\n\n### Global Options\n\n```sh\n\n-h, --help         Display help\n-V, --version      Display version\n--no-color         Disable colors\n--quiet            Quiet mode - only displays warn and error messages\n-v, --verbose      Verbose mode - will also output debug messages\n\n```\n\n----\n\n## Usage\n\nES Check is a shell command CLI. It is run in [shell tool](http://linuxcommand.org/lc3_learning_the_shell.php) like Terminal, ITerm, or Hyper. It takes in two arguments: an [ECMAScript version](https://www.w3schools.com/js/js_versions.asp) (`\u003cECMAScript version\u003e`) and files (`[files]`) in [globs](http://searchsecurity.techtarget.com/definition/globbing).\n\nHere are some example of **es check** scripts that could be run:\n\n```sh\n# globs\nes-check ./js/*.js\n\n# array of arguments\nes-check ./js/*.js ./dist/*.js\n```\n\n----\n\n## Configuration\n\nIf you're using a consistent configuration, you can create a `.escheckrc` file in JSON format with the `ecmaVersion` and `files` arguments so you can conveniently run `es-check` standalone from the command line.\n\nHere's an example of what an `.escheckrc` file will look like:\n\n```json\n{\n  \"ecmaVersion\": \"es6\",\n  \"module\": false,\n  \"files\": \"./dist/**/*.js\"\n}\n```\n\n⚠️ **NOTE:** Using command line arguments while there is an `.escheckrc` file in the project directory will override the configuration values in `.escheckrc`.\n\n## Debugging\n\nAs of ES-Check version **2.0.2**, a better debugging interface is provided. When a file errors, An error object will be logged with:\n\n- the erroring file\n- the error\n- the error stack\n\n⚠️ **NOTE:** Error logs are from the Acorn parser while parsing JavaScript related to specific versions of ECMAScript. This means error messaging is not specific to ECMAScript version. It still offers context into parsing issues!\n\n----\n\n## Acknowledgements\n\nES Check is a small utility using powerful tools that [Isaac Z. Schlueter](https://github.com/isaacs), [Marijn Haverbeke](https://github.com/marijnh), and [Matthias Etienne](https://github.com/mattallty) built. [ES Checker](https://github.com/ruanyf/es-checker) by [Ruan YiFeng](https://github.com/ruanyf) checks the JavaScript version supported within a [browser](http://ruanyf.github.io/es-checker/) at run time. ES Check offers similar feedback to ES Checker but at build time and is specific to the product that is using it. ES Check was started after reading this [post](https://philipwalton.com/articles/deploying-es2015-code-in-production-today/) about [deploying es2015 code to production today] by [Philip Walton](https://github.com/philipwalton).\n\n----\n\n## Contributing\n\nES Check has 3 main dependencies: [acorn](https://github.com/ternjs/acorn/), [glob](https://www.npmjs.com/package/glob), and [caporal](https://github.com/mattallty/Caporal.js). To contribute, file an [issue](https://github.com/dollarshaveclub/es-check/issues) or submit a pull request.\n\n### Contributors\n\n- [Jeff Wainwright](https://github.com/yowainwright/)\n- [Brian Gonzalez](https://github.com/briangonzalez/)\n- [Jon Ong](https://github.com/jonathanong/)\n- [Suhas Karanth](https://github.com/sudo-suhas)\n- [Ben Junya](https://github.com/MrBenJ)\n- [Jeff Barczewski](https://github.com/jeffbski)\n- [Brandon Casey](https://github.com/BrandonOCasey)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdollarshaveclub%2Fes-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdollarshaveclub%2Fes-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdollarshaveclub%2Fes-check/lists"}