Skip to content

Fix no-comment-textnodes incorrectly catching urls (fixes #664) #665

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

Merged

Conversation

petersendidit
Copy link
Contributor

@petersendidit petersendidit commented Jul 6, 2016

Fixes #664.

@petersendidit petersendidit force-pushed the no-comment-textnodes-url-fix branch from e5c6fea to 9b37d2d Compare July 6, 2016 14:50
@ljharb
Copy link
Member

ljharb commented Jul 6, 2016

LGTM. Test failures appear to be related to eslint 3 dropping pre-node-4 support.

@ljharb
Copy link
Member

ljharb commented Jul 6, 2016

@petersendidit if you rebase on latest master, your tests should pass.

@ljharb ljharb added the bug label Jul 6, 2016
@petersendidit petersendidit force-pushed the no-comment-textnodes-url-fix branch from 9b37d2d to 3354ca3 Compare July 6, 2016 16:05
@petersendidit petersendidit force-pushed the no-comment-textnodes-url-fix branch from 3354ca3 to 554eceb Compare July 6, 2016 16:19
@@ -19,7 +19,7 @@ module.exports = function(context) {

return {
Literal: function(node) {
if (/\s*\/(\/|\*)/.test(node.value)) {
if (/^\s*\/(\/|\*)/m.test(node.value)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is just testing the start of a quasi-comment, does it need the "m"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the m modifier things like this would fail:

<div>
  asdjfl
  /* invalid */
  foo
</div>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah right, i'm assuming the text node will be split up by lines, and that's not likely to be the case.

Could we add your example as a test, to prevent a regression?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, understood, thanks for clarifying :-)

@ljharb
Copy link
Member

ljharb commented Jul 8, 2016

@yannickcr ping :-)

@yannickcr yannickcr merged commit f998882 into jsx-eslint:master Jul 8, 2016
@yannickcr
Copy link
Member

Merged, thanks!

@petersendidit petersendidit deleted the no-comment-textnodes-url-fix branch August 8, 2016 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants