Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to unicode escape sequences for compatibility with strict mode #2835

Closed
wants to merge 1 commit into from
Closed

switch to unicode escape sequences for compatibility with strict mode #2835

wants to merge 1 commit into from

Conversation

awalgarg
Copy link

@awalgarg awalgarg commented Mar 6, 2016

Presently, when requiring less for pragmatic usage with strict mode enabled, a syntax error is thrown because of use of octal escape sequences which are disabled in ES5 strict mode.

> node --use_strict
> var less = require('less');
/home/awal/dev/someProject/node_modules/less/lib/less-node/lessc-helper.js:19
               '\033[' + styles[style][1] + 'm';
                 ^^

This patch replaces them with the more universal unicode escape sequences, which fixes the above issue. I wasn't able to find any other places where strict-mode would throw at runtime, but I'd be happy to fix them as I find them and submit additional PRs if the feedback for this one is positive.

I realize this is not a priority and might not even be worth fixing for some, but our current setup enforces strict mode. It'd be great if this could be landed within less.js :)

@awalgarg
Copy link
Author

awalgarg commented Mar 7, 2016

Hmm, the appveyor failure for node 4 looks unrelated to this patch - or am I missing something?

@SomMeri
Copy link
Member

SomMeri commented Mar 10, 2016

Appveyor was a bit unstable lately, most likely, you are not missing anything.

@awalgarg
Copy link
Author

Anything here that I need to improve? :)

@matthew-dean
Copy link
Member

#2866 was opened with pretty much to same thing, so I merged that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants