Skip to content

Commit e625e30

Browse files
authored
Tweak README (#302)
1 parent 1f20905 commit e625e30

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ npm i --save-dev eslint-doc-generator
4646
Add scripts to `package.json`:
4747

4848
- Both a lint script to ensure everything is up-to-date in CI and an update script for contributors to run locally
49-
- Add any [config options](#configuration-options) in the `update:eslint-docs` script only
49+
- Add any [config options](#configuration-options) in the `update:eslint-docs` script only (or use a [config file](#configuration-file))
5050
- Alternative scripts may be needed with [build tools](#build-tools) or [prettier](#prettier)
5151

5252
```json
5353
{
5454
"scripts": {
5555
"lint": "npm-run-all \"lint:*\"",
5656
"lint:docs": "markdownlint \"**/*.md\"",
57-
"lint:eslint-docs": "npm-run-all \"update:eslint-docs -- --check\"",
57+
"lint:eslint-docs": "npm run update:eslint-docs -- --check",
5858
"lint:js": "eslint .",
5959
"update:eslint-docs": "eslint-doc-generator"
6060
}
@@ -68,7 +68,7 @@ Delete any old rules list from your `README.md`. A new one will be automatically
6868
<!-- end auto-generated rules list -->
6969
```
7070

71-
Delete any old recommended/fixable/etc. notices from your rule docs. A new title and notices will be automatically added to the top of each rule doc (along with a marker comment if it doesn't exist yet).
71+
Delete any old recommended/fixable/etc. notices from your rule docs. A new title and notices will be automatically added to the top of each rule doc (along with a marker comment if it doesn't already exist).
7272

7373
```md
7474
<!-- end auto-generated rule header -->
@@ -116,7 +116,9 @@ And how it looks:
116116

117117
These can be provided as CLI options or as [config file](#configuration-file) options. All options are optional.
118118

119-
There's also an optional path argument if you need to point the CLI to an ESLint plugin directory that isn't just the current directory.
119+
The CLI has an optional path argument if you need to point the CLI to an ESLint plugin directory that isn't just the current directory.
120+
121+
There's also a `postprocess` option that's only available via a [config file](#configuration-file).
120122

121123
| Name | Description |
122124
| :-- | :-- |
@@ -151,14 +153,14 @@ Where `no-foo` is the rule name, `Disallow use of foo` is the rule description,
151153

152154
### Configuration file
153155

154-
There are a few ways to create a config file:
156+
There are a few ways to create a config file (as an alternative to passing the options via CLI):
155157

156158
- An object exported by `.eslint-doc-generatorrc.js`, `.eslint-doc-generatorrc.json`, or any other config file format/name supported by [cosmiconfig](https://github.com/davidtheclark/cosmiconfig#searchplaces)
157159
- An object under the `eslint-doc-generator` key in `package.json`
158160

159161
Config files support all the [CLI options](#configuration-options) but in camelCase.
160162

161-
Using a JavaScript-based config file also allows you to provide a `postprocess` function to be called with the generated content and file path for each processed file. Useful for applying custom transformations such as formatting with tools like [`prettier`](#prettier).
163+
Using a JavaScript-based config file also allows you to provide a `postprocess` function to be called with the generated content and file path for each processed file. This is useful for applying custom transformations such as formatting with tools like prettier (see [prettier example](#prettier)).
162164

163165
Example `.eslint-doc-generatorrc.js`:
164166

@@ -175,7 +177,7 @@ module.exports = config;
175177

176178
### Build tools
177179

178-
If you have a build step for your code like [Babel](https://babeljs.io/) or [TypeScript](https://www.typescriptlang.org/), you may need to adjust your scripts to run your build before this tool:
180+
If you have a build step for your code like [Babel](https://babeljs.io/) or [TypeScript](https://www.typescriptlang.org/), you may need to adjust your scripts to run your build before this tool to ensure the documentation is generated from the latest plugin information:
179181

180182
```json
181183
{
@@ -194,7 +196,7 @@ const { prettier: prettierRC } = require('./package.json'); // or wherever your
194196

195197
/** @type {import('eslint-doc-generator').GenerateOptions} */
196198
const config = {
197-
postprocess: content =>
199+
postprocess: (content, path) =>
198200
prettier.format(content, { ...prettierRC, parser: 'markdown' }),
199201
};
200202

0 commit comments

Comments
 (0)