-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
lint: wrap lines which include RegEx exceeding 80 chars #14607
Conversation
test/parallel/test-repl.js
Outdated
@@ -142,7 +142,7 @@ function error_test() { | |||
expect: prompt_unix }, | |||
// But passing the same string to eval() should throw | |||
{ client: client_unix, send: 'eval("function test_func() {")', | |||
expect: /\bSyntaxError: Unexpected end of input/ }, | |||
expect: /^\bSyntaxError: Unexpected end of input/ }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
There are some RegExps with the same pattern which are left unchanged (lines 193, 198, 203 etc).
-
It seems the
\b
symbol after the^
is unneeded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Well I tried that. On introducing a
^
in L193 which uses strict mode, I get theOctal literals are not allowed in strict mode
error as below: (Same case as in other lines you had mentioned )
Unix data: "(function() { \"use strict\"; return 0755; })()\n
^^^^\n\nSyntaxError: Octal literals are not allowed in strict mode.\n\nnode via Unix socket> node via Unix socket> ", expecting /^SyntaxError: Octal literals are not allowed in strict mode/
assert.js:42
- Yeah makes sense. Will do that! Can I go ahead and remove the
\b
even where I can't introduce a^
cause of strict mode ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Oh, sorry, I did not think this broke matching.
-
I think that removing the
\b
is safe only if we place^
before)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack and taken care of ^_^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 on the wrapping!
test/parallel/test-v8-serdes.js
Outdated
() => { v8.Deserializer(); }, | ||
/^TypeError: Class constructor Deserializer cannot be invoked without 'new'$/ | ||
); | ||
assert.throws(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Now the whole thing would fit in a single line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thefourtheye True! But doesn't it look cleaner this way ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm with @thefourtheye, also could drop the () => { }
to get:
assert.throws(v8.Serializer, serializerTypeError);
Now that's clean ✨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well two against one !! Ack and taken care
5279834
to
91b76ad
Compare
// strict mode syntax errors should be caught (GH-5178) | ||
{ client: client_unix, | ||
send: '(function() { "use strict"; return 0755; })()', | ||
expect: /\bSyntaxError: Octal literals are not allowed in strict mode/ }, | ||
{ | ||
client: client_unix, | ||
send: '(function(a, a, b) { "use strict"; return a + b + c; })()', | ||
expect: /\bSyntaxError: Duplicate parameter name not allowed in this context/ | ||
expect: | ||
/\bSyntaxError: Duplicate parameter name not allowed in this context/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit \b
-> ^
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(And below two instances too?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this somehow breaks matching: #14607 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some error messages quote erroneous code before the error message itself, so for these messages, we can't use ^
anchor (or we should add the /m
flag beside).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, then \b
it is!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if CI is green.
One aix fail in CI seems unrelated ( |
Format commit wrapping lines containing RegEx and exceeding 80 chars. Fixes: nodejs#14586
91b76ad
to
59d037f
Compare
CI failures seem unrelated. |
Format commit wrapping lines containing RegEx and exceeding 80 chars. PR-URL: nodejs#14607 Fixes: nodejs#14586 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Landed in ad664ea |
Format commit wrapping lines containing RegEx and exceeding 80 chars. PR-URL: #14607 Fixes: #14586 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This does not land cleanly in LTS. Please feel free to manually backport by following the guide. Please also feel free to replace do-not-land if it is being backported |
Format commit wrapping lines containing RegEx and exceeding 80
chars.
Fixes: #14586
Files Changed:
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test