Skip to content

Commit

Permalink
fix: re-gen docs & fix n/recommended
Browse files Browse the repository at this point in the history
  • Loading branch information
aladdin-add committed Aug 28, 2023
1 parent 1c618ba commit 3ae5ea7
Show file tree
Hide file tree
Showing 20 changed files with 78 additions and 73 deletions.
12 changes: 12 additions & 0 deletions .eslint-doc-generatorrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict"
const config = {
urlConfigs: "https://github.com/eslint-community/eslint-plugin-n#-configs",
configEmoji: [
["recommended-script", "✅"],
["recommended-module", "✅"],
["flat/recommended-script", "✅"],
["flat/recommended-module", "✅"],
],
}

module.exports = config
99 changes: 46 additions & 53 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/rules/no-deprecated-api.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow deprecated APIs (`n/no-deprecated-api`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-exports-assign.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow the assignment to `exports` (`n/no-exports-assign`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-extraneous-import.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow `import` declarations which import extraneous modules (`n/no-extraneous-import`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-extraneous-require.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow `require()` expressions which import extraneous modules (`n/no-extraneous-require`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-missing-import.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow `import` declarations which import non-existence modules (`n/no-missing-import`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-missing-require.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow `require()` expressions which import non-existence modules (`n/no-missing-require`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-process-exit.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow the use of `process.exit()` (`n/no-process-exit`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-unpublished-bin.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow `bin` files that npm ignores (`n/no-unpublished-bin`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-unpublished-import.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow `import` declarations which import private modules (`n/no-unpublished-import`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-unpublished-require.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow `require()` expressions which import private modules (`n/no-unpublished-require`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-unsupported-features/es-builtins.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow unsupported ECMAScript built-ins on the specified version (`n/no-unsupported-features/es-builtins`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-unsupported-features/es-syntax.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow unsupported ECMAScript syntax on the specified version (`n/no-unsupported-features/es-syntax`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-unsupported-features/node-builtins.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow unsupported Node.js built-in APIs on the specified version (`n/no-unsupported-features/node-builtins`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/process-exit-as-throw.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Require that `process.exit()` expressions use the same code path as `throw` (`n/process-exit-as-throw`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/shebang.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Require correct usage of shebang (`n/shebang`)

💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`.
💼 This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): `flat/recommended-module`, `flat/recommended-script`, ✅ `recommended`, ✅ `recommended-module`, ✅ `recommended-script`.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
6 changes: 3 additions & 3 deletions lib/configs/recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ module.exports = () => {
const isModule = (packageJson && packageJson.type) === "module"

return {
...(isModule ? moduleConfig : scriptConfig),
...(isModule ? moduleConfig.eslintrc : scriptConfig.eslintrc),
overrides: [
{ files: ["*.cjs", ".*.cjs"], ...scriptConfig },
{ files: ["*.mjs", ".*.mjs"], ...moduleConfig },
{ files: ["*.cjs", ".*.cjs"], ...scriptConfig.eslintrc },
{ files: ["*.mjs", ".*.mjs"], ...moduleConfig.eslintrc },
],
}
}
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ mod.configs = {
cjsConfigs.eslintrc
),
get recommended() {
return require("./configs/recommended")()
return { plugins: ["n"], ...require("./configs/recommended")() }
},
"flat/recommended-module": Object.assign(
{ plugins: { n: mod } },
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"test": "nyc npm run -s test:_mocha",
"test:_mocha": "_mocha \"tests/lib/**/*.js\" --reporter progress --timeout 4000",
"test:ci": "nyc npm run -s test:_mocha",
"update:eslint-docs": "eslint-doc-generator --config-emoji recommended-module,☑️ --config-emoji recommended-script,✔️ --rule-list-split meta.docs.category --ignore-config recommended-module --ignore-config recommended-script --url-configs \"https://github.com/eslint-community/eslint-plugin-n#-configs\"",
"update:eslint-docs": "eslint-doc-generator",
"version": "npm run -s build && eslint lib/rules --fix && git add .",
"watch": "npm run test:_mocha -- --watch --growl"
},
Expand Down

0 comments on commit 3ae5ea7

Please sign in to comment.