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

add rule to disallow octal literals and escapes #204

Closed
ajafff opened this issue Apr 19, 2018 · 2 comments
Closed

add rule to disallow octal literals and escapes #204

ajafff opened this issue Apr 19, 2018 · 2 comments

Comments

@ajafff
Copy link
Member

ajafff commented Apr 19, 2018

ES5 deprecated octal literals (010) and octal escape sequences ('\41'). https://mathiasbynens.be/notes/javascript-escapes#octal

TypeScript currently only forbids octal literals in strict mode. But it allows octal escapes in string literals even in strict mode. And it allows octal escapes in template strings (always forbidden).
That is tracked by microsoft/TypeScript#396

The new rule should forbid all octal literals and escape sequences regardless of strict mode.
The autofixer should convert them to unicode escapes.

This rule is similar to #203

@ajafff
Copy link
Member Author

ajafff commented Apr 19, 2018

Note that this rule should only forbid the legacy octal literal syntax 010 while allowing and even fixing to the newer octal syntax 0o10 introduced in ES2015.

@ajafff ajafff mentioned this issue May 17, 2018
3 tasks
@ajafff
Copy link
Member Author

ajafff commented May 17, 2018

octal literals are actually handled quite good in the compiler. so this is only about octal escape sequences. additionally they should be fixed to hex escape sequences to avoid useless bloat in the code.

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

No branches or pull requests

1 participant