Skip to content

Commit 6409e34

Browse files
authoredDec 16, 2023
docs: Auto-generate configs list with eslint-doc-generator (#146)
docs: auto-generate configs list with eslint-doc-generator
1 parent 0d6a0fe commit 6409e34

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed
 

‎.eslint-doc-generatorrc.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
"use strict"
2+
3+
/** @type {import('eslint-doc-generator').GenerateOptions} */
24
const config = {
35
urlConfigs: "https://github.com/eslint-community/eslint-plugin-n#-configs",
46
configEmoji: [

‎README.md

+19-7
Original file line numberDiff line numberDiff line change
@@ -150,18 +150,30 @@ For [Shareable Configs](https://eslint.org/docs/latest/developer-guide/shareable
150150

151151
## 🔧 Configs
152152

153-
This plugin provides three configs:
153+
<!-- begin auto-generated configs list -->
154154

155-
| Name | Description |
156-
| :-- | :-- |
157-
| `plugin:n/recommended` | Considers both CommonJS and ES Modules. If [`"type":"module"` field](https://medium.com/@nodejs/announcing-a-new-experimental-modules-1be8d2d6c2ff#b023) existed in package.json then it considers files as ES Modules. Otherwise it considers files as CommonJS. In addition, it considers `*.mjs` files as ES Modules and `*.cjs` files as CommonJS. |
158-
| `plugin:n/recommended-module` | Considers all files as ES Modules. |
159-
| `plugin:n/recommended-script` | Considers all files as CommonJS. |
155+
| | Name |
156+
| :- | :------------------------ |
157+
| 🟠 | `flat/mixed-esm-and-cjs` |
158+
| ☑️ | `flat/recommended` |
159+
| 🟢 | `flat/recommended-module` |
160+
|| `flat/recommended-script` |
161+
| ☑️ | `recommended` |
162+
| 🟢 | `recommended-module` |
163+
|| `recommended-script` |
164+
165+
<!-- end auto-generated configs list -->
166+
167+
About each config:
168+
169+
- `recommended`: Considers both CommonJS and ES Modules. If [`"type":"module"` field](https://medium.com/@nodejs/announcing-a-new-experimental-modules-1be8d2d6c2ff#b023) existed in package.json then it considers files as ES Modules. Otherwise it considers files as CommonJS. In addition, it considers `*.mjs` files as ES Modules and `*.cjs` files as CommonJS.
170+
- `recommended-module`: Considers all files as ES Modules.
171+
- `recommended-script`: Considers all files as CommonJS.
160172

161173
These preset configs:
162174

163175
- enable [no-process-exit](http://eslint.org/docs/rules/no-process-exit) rule because [the official document](https://nodejs.org/api/process.html#process_process_exit_code) does not recommend a use of `process.exit()`.
164-
- enable plugin rules which are given ✅ in the above table.
176+
- enable plugin rules indicated by emojis in the [rules table](#-rules).
165177
- add `{ecmaVersion: 2021}` and etc into `parserOptions`.
166178
- add proper globals into `globals`.
167179
- add this plugin into `plugins`.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"esbuild": "^0.18.7",
3333
"eslint": "^8.53.0",
3434
"eslint-config-prettier": "^8.8.0",
35-
"eslint-doc-generator": "^1.4.3",
35+
"eslint-doc-generator": "^1.6.1",
3636
"eslint-plugin-eslint-plugin": "^5.1.0",
3737
"eslint-plugin-n": "file:.",
3838
"fast-glob": "^3.2.12",

0 commit comments

Comments
 (0)
Please sign in to comment.