From 6409e34c8beb4242c575b4f53b9df0202898def4 Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Fri, 15 Dec 2023 21:58:04 -0500 Subject: [PATCH] docs: Auto-generate configs list with eslint-doc-generator (#146) docs: auto-generate configs list with eslint-doc-generator --- .eslint-doc-generatorrc.js | 2 ++ README.md | 26 +++++++++++++++++++------- package.json | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.eslint-doc-generatorrc.js b/.eslint-doc-generatorrc.js index 526d133c..83d06d78 100644 --- a/.eslint-doc-generatorrc.js +++ b/.eslint-doc-generatorrc.js @@ -1,4 +1,6 @@ "use strict" + +/** @type {import('eslint-doc-generator').GenerateOptions} */ const config = { urlConfigs: "https://github.com/eslint-community/eslint-plugin-n#-configs", configEmoji: [ diff --git a/README.md b/README.md index d2296baf..cda9b4f5 100644 --- a/README.md +++ b/README.md @@ -150,18 +150,30 @@ For [Shareable Configs](https://eslint.org/docs/latest/developer-guide/shareable ## 🔧 Configs -This plugin provides three configs: + -| Name | Description | -| :-- | :-- | -| `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. | -| `plugin:n/recommended-module` | Considers all files as ES Modules. | -| `plugin:n/recommended-script` | Considers all files as CommonJS. | +| | Name | +| :- | :------------------------ | +| 🟠 | `flat/mixed-esm-and-cjs` | +| ☑️ | `flat/recommended` | +| 🟢 | `flat/recommended-module` | +| ✅ | `flat/recommended-script` | +| ☑️ | `recommended` | +| 🟢 | `recommended-module` | +| ✅ | `recommended-script` | + + + +About each config: + +- `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. +- `recommended-module`: Considers all files as ES Modules. +- `recommended-script`: Considers all files as CommonJS. These preset configs: - 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()`. -- enable plugin rules which are given ✅ in the above table. +- enable plugin rules indicated by emojis in the [rules table](#-rules). - add `{ecmaVersion: 2021}` and etc into `parserOptions`. - add proper globals into `globals`. - add this plugin into `plugins`. diff --git a/package.json b/package.json index 3a2ee6d6..c9a44889 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "esbuild": "^0.18.7", "eslint": "^8.53.0", "eslint-config-prettier": "^8.8.0", - "eslint-doc-generator": "^1.4.3", + "eslint-doc-generator": "^1.6.1", "eslint-plugin-eslint-plugin": "^5.1.0", "eslint-plugin-n": "file:.", "fast-glob": "^3.2.12",