GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — tools: non-Ascii linter for /lib only by SirR4T · Pull Request #18043 · nodejs/node Conversation
|
|
oh? then @hkal 's approach of parsing all tokens would be preferred? I had assumed the eslint selector would select the source code too, i see where i might have gone wrong 😅 Also, doubts:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@SirR4T I’m not sure how to do it, but yes, you want all tokens and even comments.
It’s fine to have the escape sequences spelled out as escape sequences in the source code. What matters is whether the files themselves contain characters that don’t fit into the ASCII range, because that’s what the script that bakes those files into the I hope that’s helpful. :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
now I'm running into a very peculiar error, while doing I'm unable to disable the below error, via the regular methods ( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@addaleax : review latest commit? This was the approach followed in the (now closed) pull #11371, but I think that this is catching much lesser violations. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm a bit confused about why non-ascii characters would bloat the binary size. Aren't the files encoded as UTF-8? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@not-an-aardvark that is what I understood, from #11129 (comment) :
Is that not correct? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@SirR4T Yes, that is correct. Files that don’t fit into ASCII are currently saved as UTF-16 instead: Lines 230 to 240 in 1e0f331
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I mean, this still looks fine to me, but I’m not an expert for eslint anyway.
If it doesn’t catch the diagram in lib/timers.js and the check mark in lib/internal/test/unicode.js (for both of which we’ll want eslint-disable comments), it’s probably not quite strict enough, though.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to use a RegExp literal like this?:
const nonAsciiRegexPattern = /[^\r\n\x20-\x7e]/;
Seems more readable to me and also more in line with our general coding style. (I'm kind of surprised this isn't caught by a lint rule itself, to be honest. Or maybe it is?)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It might be better to match on source.text rather than each individual token, to ensure that non-ascii whitespace is detected (which would not be part of any token or comment).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yay! 🎉 Could catch the Any ideas? @Trott @not-an-aardvark |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
cc: @Trott @not-an-aardvark @addaleax can someone help me out here? I'm unable to skip the lint checks, inside |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think there are a few issues:
If you make both of those changes, I think the disable comments will work as expected. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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
the linter should detect not just literals, but also source code and all comments too.
|
Thanks @not-an-aardvark ! worked like a charm! pushing the latest changes, once the build is done. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CI https://ci.nodejs.org/job/node-test-pull-request/12908/ @not-an-aardvark PTAL |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed in c45afe8 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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 <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Teddy Katz <[email protected]>
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 <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Teddy Katz <[email protected]>
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 <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Teddy Katz <[email protected]>
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 <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Teddy Katz <[email protected]>
|
Should this be backported to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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 <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Teddy Katz <[email protected]>
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 <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Teddy Katz <[email protected]>
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 <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Teddy Katz <[email protected]>
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 <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Teddy Katz <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Linter rule: use ASCII quotes not Unicode ones
There was an error while loading. Please reload this page.