-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 all JavaScript in markdown files by default #1355
Comments
Brilliant. I'd love that. Would probably break some projects. Would that be supported merely by extending from |
We'd put it directly in |
One requirement for this is that generated HTML (like a code coverage report) is excluded. Such HTML is typically git-ignored though, which tells |
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 |
@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 |
I attempted to get this working for Here's what I tried: eslint-config-standard
standard
observed behavior
Rules like
https://github.com/eslint/eslint-plugin-markdown#frequently-disabled-rules Help appreciated! |
bump. would like to see this land |
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
, runstandard
with the--plugin
flag. 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-md
or--no-html
escape hatch for those who need it. But ideally, this just does the right thing 99.9% of the time.Thoughts?
The text was updated successfully, but these errors were encountered: