Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upLint all JavaScript in markdown files by default #1355
Comments
feross
added this to the standard v15 milestone
Aug 13, 2019
feross
added
the
question
label
Aug 13, 2019
This comment has been minimized.
This comment has been minimized.
|
Brilliant. I'd love that. Would probably break some projects. Would that be supported merely by extending from |
This comment has been minimized.
This comment has been minimized.
|
We'd put it directly in |
This comment has been minimized.
This comment has been minimized.
vweevers
commented
Aug 23, 2019
One requirement for this is that generated HTML (like a code coverage report) is excluded. Such HTML is typically git-ignored though, which tells |
This comment has been minimized.
This comment has been minimized.
vweevers
commented
Aug 23, 2019
|
I've seen and written code examples in READMEs that are not 100% correct, for example to quickly demonstrate two ways to achieve the same thing: const x = doItOneWay()
// Alternatively:
const x = doItAnotherWay()I guess |
This comment has been minimized.
This comment has been minimized.
|
@vweevers Yeah, we'd certainly need to disable some of the rules for examples, like unused variables for example. I think we can look at what |
feross commentedAug 13, 2019
•
edited
ESLint supports the notion of "processors" which allows us to extract JS from markdown files and lint it to ensure it is in standard style. https://eslint.org/docs/user-guide/configuring#specifying-processor
That would let us eliminate this whole section of the readme which describes how to install
eslint-plugin-markdown, runstandardwith the--pluginflag. In the end you need to actually run standard twice if you do this:standard && standard --plugin markdown '**/*.md'I think we can do better. Let's just do the right thing out of the box.
We should probably do the same for <script> tags in HTML files too, while we're at it.
We can provide a
--no-mdor--no-htmlescape hatch for those who need it. But ideally, this just does the right thing 99.9% of the time.Thoughts?