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

New lint: prefer-ascii for Deno's internal JS #832

Closed
magurotuna opened this issue Sep 1, 2021 · 5 comments · Fixed by #837
Closed

New lint: prefer-ascii for Deno's internal JS #832

magurotuna opened this issue Sep 1, 2021 · 5 comments · Fixed by #837

Comments

@magurotuna
Copy link
Member

Optimization around deno_core is being made now in denoland/deno#9713. This optimization requires that all the JS code that is eventually bundled in Deno is fully written only in ASCII i.e. one-byte characters. So it would be great to have a new lint rule that makes sure of that.

Similar to prefer-primordials, the new lint will be dedicated to the internal of Deno. Not intended to be used by Deno users.

CC @AaronO @bartlomieju

@magurotuna
Copy link
Member Author

I'd love to work on it

@grian32
Copy link

grian32 commented Sep 1, 2021

I believe this rule may also be of use to regular code, as you don't usually find yourself using chars outside of ASCII and if you do it might be a mistake(accidentally copy pasting a minus unicode character instead of - which while looking pretty similar, the minus unicode character is not valid javascript AFAIK).

@bartlomieju
Copy link
Member

I believe this rule may also be of use to regular code, as you don't usually find yourself using chars outside of ASCII and if you do it might be a mistake(accidentally copy pasting a minus unicode character instead of - which while looking pretty similar, the minus unicode character is not valid javascript AFAIK).

Once denoland/deno#11776 lands it will be possible to enable this rule, but I don't think it should be part of "recommended" set

@grian32
Copy link

grian32 commented Sep 1, 2021

I don't think it should be part of "recommended" set

I agree @bartlomieju

@magurotuna
Copy link
Member Author

I thought what @grian32 said made a lot of sense and tried to deal with characters outside of ASCII in JavaScript syntax, like the case where (this is not an ASCII, unicode code point is U+2010) is placed at the position of binary operation. However, it seems like we can't handle this case, because swc only accepts valid JavaScript. Therefore, even without this rule, using (U+2010) mistakenly would be detected by running the linter as a result of the parse error.

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 a pull request may close this issue.

3 participants