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

es-check fails on async arrow function #97

Closed ColCh closed 5 years ago

ColCh commented 5 years ago

Requested Update

bugfix

crashes with this source code in file (a.js)

CLI launch: npx es-check es6 a.js

module.exports = async (foo) => alert('foo');

stacktrace

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

          ES-Check Error:
          ----
          · erroring file: a.js
          · error: SyntaxError: Unexpected token (1:29)
          · see the printed err.stack below for context
          ----

          SyntaxError: Unexpected token (1:29)
    at Parser.pp$4.raise (/Users/colch/.npm/_npx/93411/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:2769:13)
    at Parser.pp.unexpected (/Users/colch/.npm/_npx/93411/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:680:8)
    at Parser.pp.semicolon (/Users/colch/.npm/_npx/93411/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:657:64)
    at Parser.pp$1.parseExpressionStatement (/Users/colch/.npm/_npx/93411/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:1127:8)
    at Parser.pp$1.parseStatement (/Users/colch/.npm/_npx/93411/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:851:24)
    at Parser.pp$1.parseTopLevel (/Users/colch/.npm/_npx/93411/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:739:23)
    at Parser.parse (/Users/colch/.npm/_npx/93411/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:550:15)
    at Function.parse (/Users/colch/.npm/_npx/93411/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:572:35)
    at Object.parse (/Users/colch/.npm/_npx/93411/lib/node_modules/es-check/node_modules/acorn/dist/acorn.js:5288:17)
    at globbedFiles.forEach (/Users/colch/.npm/_npx/93411/lib/node_modules/es-check/index.js:160:17)
    at Array.forEach (<anonymous>)
    at files.forEach (/Users/colch/.npm/_npx/93411/lib/node_modules/es-check/index.js:155:20)
    at Array.forEach (<anonymous>)
    at Command.prog.version.argument.argument.option.option.action [as _action] (/Users/colch/.npm/_npx/93411/lib/node_modules/es-check/index.js:144:11)
    at Command._run (/Users/colch/.npm/_npx/93411/lib/node_modules/es-check/node_modules/caporal/lib/command.js:413:40)
    at Program._run (/Users/colch/.npm/_npx/93411/lib/node_modules/es-check/node_modules/caporal/lib/program.js:170:16)

Why Is This Update Needed?

program crashes

Are There Examples Of This Requested Update Elsewhere?

no

Read about references issues here. Provide paragraph text responses to each header.

ColCh commented 5 years ago

bug comes from acorn: https://astexplorer.net/#/gist/2221218305b24021ceb284af712af2ea/9c18cf459abeb9963454ef145818e165b6c489a2

ColCh commented 5 years ago

Opps my bad 😯wrong es versiion

this cli launch works: npx es-check es2017 a.js