From 78595c42642349c5f5bb2e0ae9986da9ae93fed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Fri, 8 Sep 2023 01:41:47 -0500 Subject: [PATCH] feat: add config `flat/recommended` and `flat/mixed-esm-and-cjs` (#111) --- .eslint-doc-generatorrc.js | 2 + README.md | 83 ++++++++++--------- docs/rules/no-deprecated-api.md | 2 +- docs/rules/no-exports-assign.md | 2 +- docs/rules/no-extraneous-import.md | 2 +- docs/rules/no-extraneous-require.md | 2 +- docs/rules/no-missing-import.md | 2 +- docs/rules/no-missing-require.md | 2 +- docs/rules/no-process-exit.md | 2 +- docs/rules/no-unpublished-bin.md | 2 +- docs/rules/no-unpublished-import.md | 2 +- docs/rules/no-unpublished-require.md | 2 +- .../no-unsupported-features/es-builtins.md | 2 +- .../no-unsupported-features/es-syntax.md | 2 +- .../no-unsupported-features/node-builtins.md | 2 +- docs/rules/process-exit-as-throw.md | 2 +- docs/rules/shebang.md | 2 +- lib/index.js | 6 ++ 18 files changed, 65 insertions(+), 56 deletions(-) diff --git a/.eslint-doc-generatorrc.js b/.eslint-doc-generatorrc.js index 157c8efa..a7f61e00 100644 --- a/.eslint-doc-generatorrc.js +++ b/.eslint-doc-generatorrc.js @@ -7,6 +7,8 @@ const config = { ["recommended", "β˜‘οΈ"], ["flat/recommended-script", "βœ…"], ["flat/recommended-module", "🟒"], + ["flat/recommended", "β˜‘οΈ"], + ["flat/mixed-esm-and-cjs", "🟠"], ], } diff --git a/README.md b/README.md index d5125fd3..c65c4d1e 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ For [Shareable Configs](https://eslint.org/docs/latest/developer-guide/shareable πŸ’Ό [Configurations](https://github.com/eslint-community/eslint-plugin-n#-configs) enabled in.\ +β˜‘οΈ Set in the `flat/recommended` [configuration](https://github.com/eslint-community/eslint-plugin-n#-configs).\ 🟒 Set in the `flat/recommended-module` [configuration](https://github.com/eslint-community/eslint-plugin-n#-configs).\ βœ… Set in the `flat/recommended-script` [configuration](https://github.com/eslint-community/eslint-plugin-n#-configs).\ β˜‘οΈ Set in the `recommended` [configuration](https://github.com/eslint-community/eslint-plugin-n#-configs).\ @@ -97,47 +98,47 @@ For [Shareable Configs](https://eslint.org/docs/latest/developer-guide/shareable πŸ”§ Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\ ❌ Deprecated. -| NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  | Description | πŸ’Ό | πŸ”§ | ❌ | -| :------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------- | :----------- | :- | :- | -| [callback-return](docs/rules/callback-return.md) | require `return` statements after callbacks | | | | -| [exports-style](docs/rules/exports-style.md) | enforce either `module.exports` or `exports` | | πŸ”§ | | -| [file-extension-in-import](docs/rules/file-extension-in-import.md) | enforce the style of file extensions in `import` declarations | | πŸ”§ | | -| [global-require](docs/rules/global-require.md) | require `require()` calls to be placed at top-level module scope | | | | -| [handle-callback-err](docs/rules/handle-callback-err.md) | require error handling in callbacks | | | | -| [no-callback-literal](docs/rules/no-callback-literal.md) | enforce Node.js-style error-first callback pattern is followed | | | | -| [no-deprecated-api](docs/rules/no-deprecated-api.md) | disallow deprecated APIs | 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | -| [no-exports-assign](docs/rules/no-exports-assign.md) | disallow the assignment to `exports` | 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | -| [no-extraneous-import](docs/rules/no-extraneous-import.md) | disallow `import` declarations which import extraneous modules | 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | -| [no-extraneous-require](docs/rules/no-extraneous-require.md) | disallow `require()` expressions which import extraneous modules | 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | -| [no-hide-core-modules](docs/rules/no-hide-core-modules.md) | disallow third-party modules which are hiding core modules | | | ❌ | -| [no-missing-import](docs/rules/no-missing-import.md) | disallow `import` declarations which import non-existence modules | 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | -| [no-missing-require](docs/rules/no-missing-require.md) | disallow `require()` expressions which import non-existence modules | 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | -| [no-mixed-requires](docs/rules/no-mixed-requires.md) | disallow `require` calls to be mixed with regular variable declarations | | | | -| [no-new-require](docs/rules/no-new-require.md) | disallow `new` operators with calls to `require` | | | | -| [no-path-concat](docs/rules/no-path-concat.md) | disallow string concatenation with `__dirname` and `__filename` | | | | -| [no-process-env](docs/rules/no-process-env.md) | disallow the use of `process.env` | | | | -| [no-process-exit](docs/rules/no-process-exit.md) | disallow the use of `process.exit()` | 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | -| [no-restricted-import](docs/rules/no-restricted-import.md) | disallow specified modules when loaded by `import` declarations | | | | -| [no-restricted-require](docs/rules/no-restricted-require.md) | disallow specified modules when loaded by `require` | | | | -| [no-sync](docs/rules/no-sync.md) | disallow synchronous methods | | | | -| [no-unpublished-bin](docs/rules/no-unpublished-bin.md) | disallow `bin` files that npm ignores | 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | -| [no-unpublished-import](docs/rules/no-unpublished-import.md) | disallow `import` declarations which import private modules | 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | -| [no-unpublished-require](docs/rules/no-unpublished-require.md) | disallow `require()` expressions which import private modules | 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | -| [no-unsupported-features](docs/rules/no-unsupported-features.md) | disallow unsupported ECMAScript features on the specified version | | | ❌ | -| [no-unsupported-features/es-builtins](docs/rules/no-unsupported-features/es-builtins.md) | disallow unsupported ECMAScript built-ins on the specified version | 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | -| [no-unsupported-features/es-syntax](docs/rules/no-unsupported-features/es-syntax.md) | disallow unsupported ECMAScript syntax on the specified version | 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | -| [no-unsupported-features/node-builtins](docs/rules/no-unsupported-features/node-builtins.md) | disallow unsupported Node.js built-in APIs on the specified version | 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | -| [prefer-global/buffer](docs/rules/prefer-global/buffer.md) | enforce either `Buffer` or `require("buffer").Buffer` | | | | -| [prefer-global/console](docs/rules/prefer-global/console.md) | enforce either `console` or `require("console")` | | | | -| [prefer-global/process](docs/rules/prefer-global/process.md) | enforce either `process` or `require("process")` | | | | -| [prefer-global/text-decoder](docs/rules/prefer-global/text-decoder.md) | enforce either `TextDecoder` or `require("util").TextDecoder` | | | | -| [prefer-global/text-encoder](docs/rules/prefer-global/text-encoder.md) | enforce either `TextEncoder` or `require("util").TextEncoder` | | | | -| [prefer-global/url](docs/rules/prefer-global/url.md) | enforce either `URL` or `require("url").URL` | | | | -| [prefer-global/url-search-params](docs/rules/prefer-global/url-search-params.md) | enforce either `URLSearchParams` or `require("url").URLSearchParams` | | | | -| [prefer-promises/dns](docs/rules/prefer-promises/dns.md) | enforce `require("dns").promises` | | | | -| [prefer-promises/fs](docs/rules/prefer-promises/fs.md) | enforce `require("fs").promises` | | | | -| [process-exit-as-throw](docs/rules/process-exit-as-throw.md) | require that `process.exit()` expressions use the same code path as `throw` | 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | -| [shebang](docs/rules/shebang.md) | require correct usage of shebang | 🟒 βœ… β˜‘οΈ 🟒 βœ… | πŸ”§ | | +| NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  | Description | πŸ’Ό | πŸ”§ | ❌ | +| :------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------- | :-------------- | :- | :- | +| [callback-return](docs/rules/callback-return.md) | require `return` statements after callbacks | | | | +| [exports-style](docs/rules/exports-style.md) | enforce either `module.exports` or `exports` | | πŸ”§ | | +| [file-extension-in-import](docs/rules/file-extension-in-import.md) | enforce the style of file extensions in `import` declarations | | πŸ”§ | | +| [global-require](docs/rules/global-require.md) | require `require()` calls to be placed at top-level module scope | | | | +| [handle-callback-err](docs/rules/handle-callback-err.md) | require error handling in callbacks | | | | +| [no-callback-literal](docs/rules/no-callback-literal.md) | enforce Node.js-style error-first callback pattern is followed | | | | +| [no-deprecated-api](docs/rules/no-deprecated-api.md) | disallow deprecated APIs | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | +| [no-exports-assign](docs/rules/no-exports-assign.md) | disallow the assignment to `exports` | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | +| [no-extraneous-import](docs/rules/no-extraneous-import.md) | disallow `import` declarations which import extraneous modules | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | +| [no-extraneous-require](docs/rules/no-extraneous-require.md) | disallow `require()` expressions which import extraneous modules | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | +| [no-hide-core-modules](docs/rules/no-hide-core-modules.md) | disallow third-party modules which are hiding core modules | | | ❌ | +| [no-missing-import](docs/rules/no-missing-import.md) | disallow `import` declarations which import non-existence modules | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | +| [no-missing-require](docs/rules/no-missing-require.md) | disallow `require()` expressions which import non-existence modules | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | +| [no-mixed-requires](docs/rules/no-mixed-requires.md) | disallow `require` calls to be mixed with regular variable declarations | | | | +| [no-new-require](docs/rules/no-new-require.md) | disallow `new` operators with calls to `require` | | | | +| [no-path-concat](docs/rules/no-path-concat.md) | disallow string concatenation with `__dirname` and `__filename` | | | | +| [no-process-env](docs/rules/no-process-env.md) | disallow the use of `process.env` | | | | +| [no-process-exit](docs/rules/no-process-exit.md) | disallow the use of `process.exit()` | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | +| [no-restricted-import](docs/rules/no-restricted-import.md) | disallow specified modules when loaded by `import` declarations | | | | +| [no-restricted-require](docs/rules/no-restricted-require.md) | disallow specified modules when loaded by `require` | | | | +| [no-sync](docs/rules/no-sync.md) | disallow synchronous methods | | | | +| [no-unpublished-bin](docs/rules/no-unpublished-bin.md) | disallow `bin` files that npm ignores | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | +| [no-unpublished-import](docs/rules/no-unpublished-import.md) | disallow `import` declarations which import private modules | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | +| [no-unpublished-require](docs/rules/no-unpublished-require.md) | disallow `require()` expressions which import private modules | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | +| [no-unsupported-features](docs/rules/no-unsupported-features.md) | disallow unsupported ECMAScript features on the specified version | | | ❌ | +| [no-unsupported-features/es-builtins](docs/rules/no-unsupported-features/es-builtins.md) | disallow unsupported ECMAScript built-ins on the specified version | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | +| [no-unsupported-features/es-syntax](docs/rules/no-unsupported-features/es-syntax.md) | disallow unsupported ECMAScript syntax on the specified version | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | +| [no-unsupported-features/node-builtins](docs/rules/no-unsupported-features/node-builtins.md) | disallow unsupported Node.js built-in APIs on the specified version | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | +| [prefer-global/buffer](docs/rules/prefer-global/buffer.md) | enforce either `Buffer` or `require("buffer").Buffer` | | | | +| [prefer-global/console](docs/rules/prefer-global/console.md) | enforce either `console` or `require("console")` | | | | +| [prefer-global/process](docs/rules/prefer-global/process.md) | enforce either `process` or `require("process")` | | | | +| [prefer-global/text-decoder](docs/rules/prefer-global/text-decoder.md) | enforce either `TextDecoder` or `require("util").TextDecoder` | | | | +| [prefer-global/text-encoder](docs/rules/prefer-global/text-encoder.md) | enforce either `TextEncoder` or `require("util").TextEncoder` | | | | +| [prefer-global/url](docs/rules/prefer-global/url.md) | enforce either `URL` or `require("url").URL` | | | | +| [prefer-global/url-search-params](docs/rules/prefer-global/url-search-params.md) | enforce either `URLSearchParams` or `require("url").URLSearchParams` | | | | +| [prefer-promises/dns](docs/rules/prefer-promises/dns.md) | enforce `require("dns").promises` | | | | +| [prefer-promises/fs](docs/rules/prefer-promises/fs.md) | enforce `require("fs").promises` | | | | +| [process-exit-as-throw](docs/rules/process-exit-as-throw.md) | require that `process.exit()` expressions use the same code path as `throw` | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | | | +| [shebang](docs/rules/shebang.md) | require correct usage of shebang | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | πŸ”§ | | diff --git a/docs/rules/no-deprecated-api.md b/docs/rules/no-deprecated-api.md index 416f2d6e..288e831e 100644 --- a/docs/rules/no-deprecated-api.md +++ b/docs/rules/no-deprecated-api.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `flat/recommended-module`, βœ… `flat/recommended-script`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. diff --git a/docs/rules/no-exports-assign.md b/docs/rules/no-exports-assign.md index 5524a915..b7cdca47 100644 --- a/docs/rules/no-exports-assign.md +++ b/docs/rules/no-exports-assign.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `flat/recommended-module`, βœ… `flat/recommended-script`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. diff --git a/docs/rules/no-extraneous-import.md b/docs/rules/no-extraneous-import.md index 3f26daab..97e56dd6 100644 --- a/docs/rules/no-extraneous-import.md +++ b/docs/rules/no-extraneous-import.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `flat/recommended-module`, βœ… `flat/recommended-script`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. diff --git a/docs/rules/no-extraneous-require.md b/docs/rules/no-extraneous-require.md index 1599c94d..9e6f1890 100644 --- a/docs/rules/no-extraneous-require.md +++ b/docs/rules/no-extraneous-require.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `flat/recommended-module`, βœ… `flat/recommended-script`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. diff --git a/docs/rules/no-missing-import.md b/docs/rules/no-missing-import.md index 9ffdeec4..0dff884a 100644 --- a/docs/rules/no-missing-import.md +++ b/docs/rules/no-missing-import.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `flat/recommended-module`, βœ… `flat/recommended-script`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. diff --git a/docs/rules/no-missing-require.md b/docs/rules/no-missing-require.md index 9b377ff0..0a2df2be 100644 --- a/docs/rules/no-missing-require.md +++ b/docs/rules/no-missing-require.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `flat/recommended-module`, βœ… `flat/recommended-script`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. diff --git a/docs/rules/no-process-exit.md b/docs/rules/no-process-exit.md index 816d9388..da883f57 100644 --- a/docs/rules/no-process-exit.md +++ b/docs/rules/no-process-exit.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `flat/recommended-module`, βœ… `flat/recommended-script`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. diff --git a/docs/rules/no-unpublished-bin.md b/docs/rules/no-unpublished-bin.md index 1b348d29..726a61e4 100644 --- a/docs/rules/no-unpublished-bin.md +++ b/docs/rules/no-unpublished-bin.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `flat/recommended-module`, βœ… `flat/recommended-script`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. diff --git a/docs/rules/no-unpublished-import.md b/docs/rules/no-unpublished-import.md index f0f93f68..850c3827 100644 --- a/docs/rules/no-unpublished-import.md +++ b/docs/rules/no-unpublished-import.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `flat/recommended-module`, βœ… `flat/recommended-script`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. diff --git a/docs/rules/no-unpublished-require.md b/docs/rules/no-unpublished-require.md index 7022cd10..a2759391 100644 --- a/docs/rules/no-unpublished-require.md +++ b/docs/rules/no-unpublished-require.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `flat/recommended-module`, βœ… `flat/recommended-script`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. diff --git a/docs/rules/no-unsupported-features/es-builtins.md b/docs/rules/no-unsupported-features/es-builtins.md index 786c9fad..a9647a4a 100644 --- a/docs/rules/no-unsupported-features/es-builtins.md +++ b/docs/rules/no-unsupported-features/es-builtins.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `flat/recommended-module`, βœ… `flat/recommended-script`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. diff --git a/docs/rules/no-unsupported-features/es-syntax.md b/docs/rules/no-unsupported-features/es-syntax.md index 41281851..6e35c563 100644 --- a/docs/rules/no-unsupported-features/es-syntax.md +++ b/docs/rules/no-unsupported-features/es-syntax.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `flat/recommended-module`, βœ… `flat/recommended-script`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. diff --git a/docs/rules/no-unsupported-features/node-builtins.md b/docs/rules/no-unsupported-features/node-builtins.md index 87ff8bfb..bc68812e 100644 --- a/docs/rules/no-unsupported-features/node-builtins.md +++ b/docs/rules/no-unsupported-features/node-builtins.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `flat/recommended-module`, βœ… `flat/recommended-script`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. diff --git a/docs/rules/process-exit-as-throw.md b/docs/rules/process-exit-as-throw.md index bac3dd8a..62080551 100644 --- a/docs/rules/process-exit-as-throw.md +++ b/docs/rules/process-exit-as-throw.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `flat/recommended-module`, βœ… `flat/recommended-script`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. diff --git a/docs/rules/shebang.md b/docs/rules/shebang.md index f3fe13fd..fc56e474 100644 --- a/docs/rules/shebang.md +++ b/docs/rules/shebang.md @@ -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`, β˜‘οΈ `recommended`, 🟒 `recommended-module`, βœ… `recommended-script`. +πŸ’Ό This rule is enabled in the following [configs](https://github.com/eslint-community/eslint-plugin-n#-configs): β˜‘οΈ `flat/recommended`, 🟒 `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). diff --git a/lib/index.js b/lib/index.js index 58c34925..def1bbf6 100644 --- a/lib/index.js +++ b/lib/index.js @@ -65,6 +65,12 @@ mod.configs = { recommended: { plugins: ["n"], ...recommendedConfig.eslintrc }, "flat/recommended-module": { plugins: { n: mod }, ...esmConfig.flat }, "flat/recommended-script": { plugins: { n: mod }, ...cjsConfig.flat }, + "flat/recommended": { plugins: { n: mod }, ...recommendedConfig.flat }, + "flat/mixed-esm-and-cjs": [ + { plugins: { n: mod }, files: ["**/*.js"], ...recommendedConfig.flat }, + { plugins: { n: mod }, files: ["**/*.mjs"], ...esmConfig.flat }, + { plugins: { n: mod }, files: ["**/*.cjs"], ...cjsConfig.flat }, + ], } module.exports = mod