dollarshaveclub / es-check

Checks the version of ES in JavaScript files with simple shell commands 馃弳
https://github.com/yowainwright/es-check
MIT License
459 stars 38 forks source link

feat(index.js): supports printing source code logs #119

Open xiaoxiaojx opened 4 years ago

xiaoxiaojx commented 4 years ago

why

I'm a user of this library. I often find it hard to locate the source code, so I want to add this function

after

ES-Check: there were 1 ES version matching errors.

Source code file path:
  es6/test.js?

Source code snippets:
  2  var isTest = true
  3  const version = window.version   <------ Error(3:0)
  4  console.log(version)

ES-Check Error:
----
路 erroring file: ./build/static/js/main.4e7cf41f.js
路 error: SyntaxError: The keyword 'const' is reserved (1:44871)
路 see the printed err.stack below for context
----
            SyntaxError: The keyword 'const' is reserved (1:44871)
    at Parser.pp$4.raise (/Users/xxxx/Work/me/es-check/node_modules/_acorn@6.1.1@acorn/dist/acorn.js:2844:13)