jscs-dev / node-jscs

:arrow_heading_up: JavaScript Code Style checker (unmaintained)
https://jscs-dev.github.io
MIT License
4.96k stars 513 forks source link

jscs 3.0.3: Multiline strings with a # incorrectly flagged as "Unterminated string constant"? #2228

Closed sverweij closed 8 years ago

sverweij commented 8 years ago

running jscs multistr-with-hash-NOK.js yields

Unterminated string constant (1:22) at multistr-with-hash-NOK.js :
     1 |var multilinestring = "x\n\
------------------------------^
     2 |#";
     3 |console.log(multilinestring);

1 code style error found.

Whereas running jscs multistr-without-hash-OK.js validates AOK.

Inputs

multistr-with-hash-NOK.js:

var multilinestring = "x\n\
#";
console.log(multilinestring);

multistr-without-hash-OK.js:

var multilinestring = "x\n\
y";
console.log(multilinestring);

Version information

qfox commented 8 years ago

@mdevils Is this issue about CST?

mdevils commented 8 years ago

I think it's actually for Babel

mdevils commented 8 years ago

Since this is a parse error from Babel

sverweij commented 8 years ago

With the latest babel version it seems to work OK

$npm i -g babel-cli
(...)

$ babel --version
6.7.7 (babel-core 6.7.7)

$ babel multistr-with-hash-NOK.js
var multilinestring = "x\n\
#";
console.log(multilinestring);

$ babel multistr-without-hash-OK.js
var multilinestring = "x\n\
y";
console.log(multilinestring);

The babel (core) version installed with CST is 6.6.1 - so if babel is the culprit upgrading might be a solution?

markelog commented 8 years ago

CST doesn't use babel it uses babylon and CST uses last available version.

Not sure what to update there

markelog commented 8 years ago

Since there is nothing we can do here, i'm closing it, track the babylon issue - https://github.com/babel/babylon/issues/32