linter-js-standard icon indicating copy to clipboard operation
linter-js-standard copied to clipboard

Markdown fenced code excessive useless errors

Open ricardofbarros opened this issue 9 years ago • 7 comments

So now if you lint the markdown files you will have the following errors pop up most of the time:

  • no-unused-vars
  • no-undef

I already had pointed out this could happen and it would be annoying.

My solution is to under the hood wrap the fenced code block in the following manner:

/*eslint-disable no-unused-vars  no-undef*/
{ ...code ... }
/*eslint-enable no-unused-vars  no-undef*/

ricardofbarros avatar Sep 03 '15 01:09 ricardofbarros

@blakeembrey and @despairblue What are your thoughts on this issue?

ricardofbarros avatar Sep 03 '15 02:09 ricardofbarros

@ricardofbarros I don't have too much of an issue with excessive errors in my markdown since I try to make it runnable most of the time. Maybe if it's a config option on the module for the people who do have an issue though. Aside from that, yeah, I'm happy with a comment when needed.

blakeembrey avatar Sep 03 '15 02:09 blakeembrey

Okay, it seems plausible having a sub option to ignore those pesty warnings.

ricardofbarros avatar Sep 03 '15 14:09 ricardofbarros

Maybe just have a text option to enter whatever eslint options?

despairblue avatar Sep 03 '15 15:09 despairblue

@ricardofbarros The only error that I'm getting and doesn't make sense is the "newline required at end of file".

blakeembrey avatar Sep 05 '15 01:09 blakeembrey

Yeah, it doesn't make any sense at all. To ignore your error you need to have your code formatted like this:

/```js var sumthing = require('sumthing') sumthing.useAwesomeApi()

/```

That's why I feel strongly about having a small list of rules disabled (as of now 3) when we are linting fenced code blocks.

ricardofbarros avatar Sep 05 '15 04:09 ricardofbarros

It would probably be best to disable the same rules standard-markdown disables.

sonicdoe avatar Jul 31 '17 19:07 sonicdoe