Open locks opened 9 years ago
@rwjblue is there something in the Ember.js codebase that could be re-used here?
I'm interested in this issue. Here's my initial thoughts after doing a little digging
Gemfile
, tho.@mtthgn Thanks for your interest in helping out with this! I don't know that I can add anything to points 1 and 2, but for 3, I'd suggest checking out https://github.com/emberjs/ember.js. My understanding is that PRs against ember.js are linted against their style guide, but I don't know where the style guide is tested against and if that code could be re-used - @rwjblue may know.
Actually, regarding 1, what about https://github.com/damian/jshint?
@michaelrkn dunno how I didn't see that one! I'll see what I can get done on this over the weekend.
:) Also, maybe instead of extracting the code snippets from our Markdown files, saving them into files, and then having the linter check them, you could fork the linter and add a way to create new input sources. Something like creating an API that can be passed a string of JavaScript to be linted, and then separating out the actually getting of the JS into another class, so that anybody can provide an arbitrary source of JS. Then turn the existing file scanning logic into one source, and create your own input source that looks through our Markdown files for code fences that end in js
. Maybe that's more trouble than it's worth, though. Just another thought.
@michaelrkn I've got a PR opened here to add the ability to lint JS strings as opposed to only files. In the meantime, I'll reference my fork of the gem and get started on linting our snippets.
What's the process normally like for opening PRs? Does the team like "In Progress" PRs to be opened against issues, or would you rather wait to have a completely reviewable PR first?
The Contributing Document mostly talks about opening issues and PRs against the guides content itself, not necessarily the source code.
@mtthgn Awesome! Generally early PRs are better so that you can get feedback on any potential problems before heading too far down the wrong path :)
Lint code snippets and fail the build if they don't pass.
Edit by acorncom: This is a good library to look into: https://github.com/Widdershin/markdown-doctest