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
[Docs] Auto-generate list of rules in README #2541
Conversation
2219bae
to
ecfccfb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is great!
package.json
Outdated
@@ -11,7 +11,9 @@ | |||
"pretest": "npm run lint", | |||
"test": "npm run unit-test", | |||
"type-check": "tsc", | |||
"unit-test": "istanbul cover node_modules/mocha/bin/_mocha tests/lib/**/*.js tests/util/**/*.js tests/index.js" | |||
"unit-test": "istanbul cover node_modules/mocha/bin/_mocha tests/lib/**/*.js tests/util/**/*.js tests/index.js", | |||
"generate-list-of-rules": "./scripts/generate-list-of-rules.js README.md", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would be great as a published package, so we can use it in eslint-plugin-react and eslint-plugin-jsx-a11y as well :-D (but we should wait until this PR lands to do that)
scripts/generate-list-of-rules.js
Outdated
const TAG_BASIC_RULES = '<!-- BASIC_RULES_SECTION -->'; | ||
const TAG_JSX_RULES = '<!-- JSX_RULES_SECTION -->'; | ||
|
||
const newContent = targetFileContent.replace( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps it would be worth using something like https://www.npmjs.com/package/markdown-magic rather than messing with regexes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I will try it on this PR later, thanks! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try it with #1742.
I've synced this PR with #1742, so closing this. |
To be clear, i need both to stay open until both are merged :-) |
Sorry, I see 👍 |
ecfccfb
to
182b045
Compare
This adds a script to auto-generate the list of rules and embeds special tags to README.
Usage:
Check whether the auto-generated changes are committed:
See also #1742