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

Warning is not showing up? #2

Closed
why-jay opened this issue Sep 12, 2015 · 12 comments
Closed

Warning is not showing up? #2

why-jay opened this issue Sep 12, 2015 · 12 comments

Comments

@why-jay
Copy link
Owner

why-jay commented Sep 12, 2015

I've seen cases where the file.warn is reached but at the end of the linting I don't see any yellow warnings from this rule on the CLI.

@wooorm Could you do me a favor and see if there is more than what I did in the code in order to render a warning on the CLI?

@wooorm
Copy link

wooorm commented Sep 12, 2015

I’m not sure what use case you were referring to. I’m assuming regarding to mdast-lint-sentence-newline? I ran your example and it was ignored because HTML needs an extra black line after it:

The following is just two HTML blocks:

<!-- Invalid -->
Hello, world. This sentence should be on a second line.

<!-- Valid -->
Hello, world.
This sentence should be on a second line.

But this is HTML comments and text:

<!-- Invalid -->

Hello, world. This sentence should be on a second line.

<!-- Valid -->

Hello, world.
This sentence should be on a second line.

The last one is warned about about:

screen shot 2015-09-12 at 9 13 26 a m

why-jay pushed a commit that referenced this issue Sep 12, 2015
@why-jay
Copy link
Owner Author

why-jay commented Sep 12, 2015

@wooorm Sorry for not being clearer - yes, I am talking about my custom rule. And, ah, I didn't know about the HTML comments thing, thanks. Just pushed a commit that fixes the example.

But there's another test case where what I mentioned above is still happening - let me come back with a test case to show you.

@why-jay
Copy link
Owner Author

why-jay commented Sep 12, 2015

Fuck, I'm too tired - I'll ping you tomorrow. Thanks for your help.

@wooorm
Copy link

wooorm commented Sep 12, 2015

Sure!

@why-jay
Copy link
Owner Author

why-jay commented Sep 12, 2015

@wooorm I'm writing tests - can I get some more help? According to the mdast-lint API doc, I'm supposed to use file.messages inside the callback to #process(). But on this line in my test suite, I keep getting undefined for file.messages:

https://github.com/chcokr/mdast-lint-sentence-newline/blob/master/test/test.js#L26

@wooorm
Copy link

wooorm commented Sep 12, 2015

err, res, file > err, file, res. Did you get this from an example?

@why-jay
Copy link
Owner Author

why-jay commented Sep 12, 2015

Ah, thanks! Yes, from here: https://github.com/wooorm/mdast-lint/blob/master/doc/api.md

Looks like it needs to be fixed over there!

@wooorm
Copy link

wooorm commented Sep 12, 2015

on it

wooorm added a commit to remarkjs/remark-lint that referenced this issue Sep 12, 2015
Refer to `vfile` for more up-to-date docs.

Related: why-jay/remark-lint-sentence-newline#2
@why-jay
Copy link
Owner Author

why-jay commented Sep 12, 2015

@wooorm Thanks, you the man.

Alright, so I just added my mysterious test case. It's actually not mysterious any more - I know why it's breaking. When there's a header, unist-util-visit doesn't seem to visit the section's child text nodes properly. Shouldn't it visit all text nodes, even ones in children, when I do visit(ast, 'text')?

https://github.com/chcokr/mdast-lint-sentence-newline/blob/master/test/header-body/file.md

@wooorm
Copy link

wooorm commented Sep 12, 2015

Shouldn’t the done(); be outside visit? Maybe that’s it?

@wooorm
Copy link

wooorm commented Sep 12, 2015

Yup, changing that fixed your tests.

@why-jay
Copy link
Owner Author

why-jay commented Sep 12, 2015

Ah, silly me! Closed via 4c302fd. Thank you so much for all your work - mdast is very well maintained and I hope it gets even more attention and adoption. Is there any way to donate to your open-source efforts?

@why-jay why-jay closed this as completed Sep 12, 2015
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

No branches or pull requests

2 participants