BenoitZugmeyer / eslint-plugin-html

An ESLint plugin to extract and lint scripts from HTML files.
ISC License
430 stars 51 forks source link

Warning: Unexpected token ... #71

Closed jscharett closed 7 years ago

jscharett commented 7 years ago

Getting the error 'Warning: Unexpected token ... Use --force to continue' when running version 3.1.0. Did not happen in 3.0.0.

BenoitZugmeyer commented 7 years ago

Could you provide a gist or something to reproduce?

jscharett commented 7 years ago

I will see if I can, but I'm not sure what file(s) are causing the problem. There are hundreds of html files in the particular app I'm working on, and not sure if its something with one of them or something else. We are using node version 4.4.3 and npm version 2.15.11 if that helps.

hlapp commented 7 years ago

This is caused by code in eslint-plugin-html, not code in html or other files being linted. The error happens during loading of eslint-plugin-html as an eslint plugin.

Specifically, the following line in src/extract.js is causing this:

cdata.push(...chunks[i].cdata)

Apparently this was introduced in ade9021cb612f69c9c4cc1102f7b1dafcbd76566. The spread operator was introduced in ES6. It seems that nodejs 4.x doesn't support it.