Skip to content
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

Closed

Conversation

ybiquitous
Copy link
Contributor

This adds a script to auto-generate the list of rules and embeds special tags to README.

Usage:

$ npm run generate-list-of-rules

Check whether the auto-generated changes are committed:

$ npm run generate-list-of-rules:check

See also #1742

@ybiquitous ybiquitous marked this pull request as ready for review January 13, 2020 07:37
Copy link
Member

@ljharb ljharb left a 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",
Copy link
Member

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)

const TAG_BASIC_RULES = '<!-- BASIC_RULES_SECTION -->';
const TAG_JSX_RULES = '<!-- JSX_RULES_SECTION -->';

const newContent = targetFileContent.replace(
Copy link
Member

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?

Copy link
Contributor Author

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! 👍

Copy link
Contributor Author

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.

@ybiquitous
Copy link
Contributor Author

I've synced this PR with #1742, so closing this.

@ybiquitous ybiquitous closed this Jan 14, 2020
@ljharb
Copy link
Member

ljharb commented Jan 14, 2020

To be clear, i need both to stay open until both are merged :-)

@ljharb ljharb reopened this Jan 14, 2020
@ybiquitous
Copy link
Contributor Author

Sorry, I see 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants