-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Linter rule: use ASCII quotes not Unicode ones #11209
Comments
Two things:
|
We could do something like this ( - match: '’'
replacement: '\''
- match: '[—–]'
replacement: '-'
- match: '[^\x00-\x7F]'
replacement: '' The last one might be a bit extreme :) |
@silverwind I'd also add replacements for “” and «» to ASCII double quotes. |
You can always contribute improvements later, above is just about the general rule config layout. |
This is an open issue looking for someone to raise a PR. If whoever raises it wants to include those then that sounds good to me. |
If the goal is to allow files to be stored as one-byte strings, would it be better for the rule to just disallow all non-ascii characters in files? edit: Never mind, I see @addaleax also mentioned this above. |
@gibfahn I'll give this a go if no one else is assigned. |
@hkal go for it! |
Do we still need this after #11129? cc @bnoordhuis |
Would be good to enforce it because Unicode files take up twice as much space in the binary as plain ASCII files. |
Detects if files in lib/ contain non-ASCII characters and raises a linting error. Also removes non-ASCII characters from lib/console.js comments Fixes: nodejs#11209
This is for quotation marks inside of strings only, right? I think we should be able to use ESLint's /cc @not-an-aardvark |
Yes, that should be possible to do. A selector like |
If we ban all the non-ASCII chars, this could be Currently, we have non-ASCII chars in 4
|
Hi. First time contributing here, so please bear with some doubts. I was able to follow @Trott and @not-an-aardvark 's comments, and added two new linter rules. Now
Doubts:
|
Non-ASCII characters in /lib get compiled into the node binary, and may bloat the binary size unnecessarily. A linter rule may help prevent this. Fixes: nodejs#11209
Non-ASCII characters in /lib get compiled into the node binary, and may bloat the binary size unnecessarily. A linter rule may help prevent this. PR-URL: #18043 Fixes: #11209 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Non-ASCII characters in /lib get compiled into the node binary, and may bloat the binary size unnecessarily. A linter rule may help prevent this. PR-URL: #18043 Fixes: #11209 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Non-ASCII characters in /lib get compiled into the node binary, and may bloat the binary size unnecessarily. A linter rule may help prevent this. PR-URL: #18043 Fixes: #11209 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Non-ASCII characters in /lib get compiled into the node binary, and may bloat the binary size unnecessarily. A linter rule may help prevent this. PR-URL: nodejs#18043 Fixes: nodejs#11209 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Non-ASCII characters in /lib get compiled into the node binary, and may bloat the binary size unnecessarily. A linter rule may help prevent this. PR-URL: nodejs#18043 Fixes: nodejs#11209 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Non-ASCII characters in /lib get compiled into the node binary, and may bloat the binary size unnecessarily. A linter rule may help prevent this. PR-URL: #18043 Backport-PR-URL: #19499 Fixes: #11209 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Non-ASCII characters in /lib get compiled into the node binary, and may bloat the binary size unnecessarily. A linter rule may help prevent this. PR-URL: nodejs#18043 Fixes: nodejs#11209 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
See: #11129 (comment)
Basically we need a lint rule that checks for U+2019 quotes:
’
, and suggests that they be replaced with ASCII quotes:'
.cc/ @bnoordhuis @richardlau
The text was updated successfully, but these errors were encountered: