auto-install icon indicating copy to clipboard operation
auto-install copied to clipboard

Could not parse ... syntax error

Open calebeby opened this issue 8 years ago • 5 comments

This module doesn't work with code that has async/await

const adapter = require('../adapters/github')
const remark = require('remark')

const remarkConfig = remark().use(require('foobar'))

const checkReadme = async repo => {
  const readme = await adapter.getReadme(repo)
  const results = await remarkConfig().process(readme)
  return results
}

module.exports = checkReadme
Could not parse checkers/readme.js. There is a syntax error in file

calebeby avatar Aug 15 '17 22:08 calebeby

Thanks!

I'll look into it.

If you want to take a shot at it, auto-install uses detective and detective-es6 to parse code.

siddharthkp avatar Aug 16 '17 03:08 siddharthkp

Hm. detective-es6 uses node-source-walk, which uses babylon. Babylon supports async/await. I'm not sure why this isn't working. A useful feature of auto-install would be to print the syntax error, rather than just saying that there is a syntax error.

calebeby avatar Aug 16 '17 04:08 calebeby

That's a great idea 👍

siddharthkp avatar Aug 16 '17 04:08 siddharthkp

OK, I did some digging.

The error is coming from detective, not detective-es6. detective uses acorn instead of babylon, but acorn supports async/await as well

calebeby avatar Aug 16 '17 13:08 calebeby

i got the same issue

Mrgaton avatar Nov 08 '23 10:11 Mrgaton