Socket
Socket
Sign inDemoInstall

eslint-plugin-n

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-n - npm Package Compare versions

Comparing version 17.9.0 to 17.10.0

lib/unsupported-features/node-builtins-modules/sqlite.js

6

lib/unsupported-features/node-builtins-modules/fs.js

@@ -14,3 +14,3 @@ "use strict"

copyFile: { [READ]: { supported: ["10.0.0"] } },
cp: { [READ]: { experimental: ["16.7.0"] } },
cp: { [READ]: { supported: ["22.3.0"], experimental: ["16.7.0"] } },
glob: { [READ]: { experimental: ["22.0.0"] } },

@@ -51,3 +51,3 @@ lchmod: { [READ]: { supported: ["10.0.0"], deprecated: ["10.0.0"] } },

copyFile: { [READ]: { supported: ["8.5.0"] } },
cp: { [READ]: { experimental: ["16.7.0"] } },
cp: { [READ]: { supported: ["22.3.0"], experimental: ["16.7.0"] } },
createReadStream: { [READ]: { supported: ["0.1.31"] } },

@@ -109,3 +109,3 @@ createWriteStream: { [READ]: { supported: ["0.1.31"] } },

copyFileSync: { [READ]: { supported: ["8.5.0"] } },
cpSync: { [READ]: { experimental: ["16.7.0"] } },
cpSync: { [READ]: { supported: ["22.3.0"], experimental: ["16.7.0"] } },
existsSync: { [READ]: { supported: ["0.1.21"] } },

@@ -112,0 +112,0 @@ fchmodSync: { [READ]: { supported: ["0.4.7"] } },

@@ -23,2 +23,3 @@ "use strict"

OutgoingMessage: { [READ]: { supported: ["0.1.17"] } },
WebSocket: { [READ]: { supported: ["22.5.0"] } },
}

@@ -25,0 +26,0 @@

@@ -13,2 +13,3 @@ "use strict"

format: { [READ]: { supported: ["0.11.15"] } },
matchesGlob: { [READ]: { experimental: ["22.5.0"] } },
isAbsolute: { [READ]: { supported: ["0.11.2"] } },

@@ -15,0 +16,0 @@ join: { [READ]: { supported: ["0.1.16"] } },

@@ -20,2 +20,8 @@ "use strict"

exitCode: { [READ]: { supported: ["0.11.8"] } },
finalization: {
register: { [READ]: { experimental: ["22.5.0"] } },
registerBeforeExit: { [READ]: { experimental: ["22.5.0"] } },
unregister: { [READ]: { experimental: ["22.5.0"] } },
},
getBuiltinModule: { [READ]: { supported: ["22.3.0", "20.16.0"] } },
mainModule: {

@@ -22,0 +28,0 @@ [READ]: {

@@ -33,3 +33,9 @@ "use strict"

afterEach: { [READ]: { supported: ["18.8.0", "16.18.0"] } },
snapshot: {
[READ]: { experimental: ["22.3.0"] },
setDefaultSnapshotSerializers: { [READ]: { experimental: ["22.3.0"] } },
setResolveSnapshotPath: { [READ]: { experimental: ["22.3.0"] } },
},
MockFunctionContext: { [READ]: { supported: ["19.1.0", "18.13.0"] } },
MockModuleContext: { [READ]: { experimental: ["22.3.0"] } },
MockTracker: { [READ]: { supported: ["19.1.0", "18.13.0"] } },

@@ -36,0 +42,0 @@ MockTimers: { [READ]: { experimental: ["20.4.0"] } },

@@ -22,2 +22,3 @@ "use strict"

moveMessagePortToContext: { [READ]: { supported: ["11.13.0"] } },
postMessageToThread: { [READ]: { experimental: ["22.5.0"] } },
receiveMessageOnPort: { [READ]: { supported: ["12.3.0"] } },

@@ -24,0 +25,0 @@ setEnvironmentData: {

@@ -8,3 +8,3 @@ "use strict"

constants: { [READ]: { supported: ["7.0.0"] } },
crc32: { [READ]: { supported: ["22.2.0"] } },
crc32: { [READ]: { supported: ["22.2.0", "20.15.0"] } },
createBrotliCompress: { [READ]: { supported: ["11.7.0", "10.16.0"] } },

@@ -11,0 +11,0 @@ createBrotliDecompress: { [READ]: { supported: ["11.7.0", "10.16.0"] } },

@@ -93,3 +93,8 @@ "use strict"

WebAssembly: { [READ]: { supported: ["8.0.0"] } },
WebSocket: { [READ]: { experimental: ["21.0.0", "20.10.0"] } },
WebSocket: {
[READ]: {
experimental: ["21.0.0", "20.10.0"],
supported: ["22.4.0"],
},
},

@@ -113,2 +118,7 @@ fetch: {

// --experimental-webstorage
localStorage: { [READ]: { experimental: ["22.4.0"] } },
sessionStorage: { [READ]: { experimental: ["22.4.0"] } },
Storage: { [READ]: { experimental: ["22.4.0"] } },
// module.buffer

@@ -115,0 +125,0 @@ Blob: buffer.Blob,

{
"name": "eslint-plugin-n",
"version": "17.9.0",
"version": "17.10.0",
"description": "Additional ESLint's rules for Node.js",

@@ -23,34 +23,34 @@ "engines": {

"get-tsconfig": "^4.7.0",
"globals": "^15.0.0",
"globals": "^15.8.0",
"ignore": "^5.2.4",
"minimatch": "^9.0.0",
"minimatch": "^9.0.5",
"semver": "^7.5.3"
},
"devDependencies": {
"@eslint/js": "^9.0.0",
"@eslint/js": "^9.6.0",
"@types/eslint": "^8.56.7",
"@types/estree": "^1.0.5",
"@types/node": "^20.11.0",
"@typescript-eslint/parser": "^7.0.0",
"@typescript-eslint/typescript-estree": "^7.0.0",
"eslint": "^9.0.0",
"@types/node": "^20.14.9",
"@typescript-eslint/parser": "^7.15.0",
"@typescript-eslint/typescript-estree": "^7.15.0",
"eslint": "^9.6.0",
"eslint-config-prettier": "^9.1.0",
"eslint-doc-generator": "^1.6.1",
"eslint-plugin-eslint-plugin": "^6.0.0",
"eslint-plugin-eslint-plugin": "^6.2.0",
"eslint-plugin-n": "file:.",
"fast-glob": "^3.2.12",
"husky": "^9.0.0",
"lint-staged": "^15.2.0",
"lint-staged": "^15.2.7",
"markdownlint-cli": "^0.41.0",
"mocha": "^10.2.0",
"npm-run-all2": "^6.1.1",
"nyc": "^15.1.0",
"mocha": "^10.6.0",
"npm-run-all2": "^6.2.2",
"nyc": "^17.0.0",
"opener": "^1.5.2",
"prettier": "^3.1.1",
"prettier": "^3.3.2",
"punycode": "^2.3.0",
"release-it": "^17.0.0",
"rimraf": "^5.0.1",
"release-it": "^17.4.1",
"rimraf": "^5.0.7",
"ts-ignore-import": "^4.0.1",
"type-fest": "^4.9.0",
"typescript": "^5.1.3"
"type-fest": "^4.21.0",
"typescript": "^5.5.3"
},

@@ -57,0 +57,0 @@ "scripts": {

@@ -29,17 +29,18 @@ # eslint-plugin-n

### **[.eslintrc.json](https://eslint.org/docs/latest/use/configure/configuration-files)** (An example)
### [`eslint.config.js`](https://eslint.org/docs/latest/use/configure/configuration-files-new) (requires eslint>=v8.23.0)
```jsonc
{
"extends": ["eslint:recommended", "plugin:n/recommended"],
"parserOptions": {
"ecmaVersion": 2021
},
"rules": {
"n/exports-style": ["error", "module.exports"]
```js
const nodePlugin = require("eslint-plugin-n")
module.exports = [
nodePlugin.configs["flat/recommended-script"],
{
rules: {
"n/exports-style": ["error", "module.exports"]
}
}
}
]
```
### [`eslint.config.js`](https://eslint.org/docs/latest/use/configure/configuration-files-new) (requires eslint>=v8.23.0)
To setup without the recommended configs, you'll need to add the plugin:

@@ -50,4 +51,4 @@ ```js

module.exports = [
nodePlugin.configs["flat/recommended-script"],
{
plugins: {n: nodePlugin},
rules: {

@@ -60,2 +61,30 @@ "n/exports-style": ["error", "module.exports"]

### **[.eslintrc.json](https://eslint.org/docs/latest/use/configure/configuration-files)** (legacy example)
```jsonc
{
"extends": ["eslint:recommended", "plugin:n/recommended"],
"parserOptions": {
"ecmaVersion": 2021
},
"rules": {
"n/exports-style": ["error", "module.exports"]
}
}
```
To setup without the recommended rules you'll need to add the plugin:
```jsonc
{
"parserOptions": {
"ecmaVersion": 2021
},
"plugins": ["n"],
"rules": {
"n/exports-style": ["error", "module.exports"]
}
}
```
**package.json** (An example)

@@ -104,6 +133,2 @@

πŸ’Ό [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).\
🟒 Set in the `recommended-module` [configuration](https://github.com/eslint-community/eslint-plugin-n#-configs).\

@@ -114,44 +139,44 @@ βœ… Set in the `recommended-script` [configuration](https://github.com/eslint-community/eslint-plugin-n#-configs).\

| 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 | | | |
| [hashbang](docs/rules/hashbang.md) | require correct usage of hashbang | β˜‘οΈ 🟒 βœ… β˜‘οΈ 🟒 βœ… | πŸ”§ | |
| [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/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-node-protocol](docs/rules/prefer-node-protocol.md) | enforce using the `node:` protocol when importing Node.js builtin modules. | | πŸ”§ | |
| [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 hashbang | | πŸ”§ | ❌ |
| 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 | | | |
| [hashbang](docs/rules/hashbang.md) | require correct usage of hashbang | 🟒 βœ… | πŸ”§ | |
| [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/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-node-protocol](docs/rules/prefer-node-protocol.md) | enforce using the `node:` protocol when importing Node.js builtin modules. | | πŸ”§ | |
| [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 hashbang | | πŸ”§ | ❌ |

@@ -164,11 +189,6 @@ <!-- end auto-generated rules list -->

| | Name |
| :- | :------------------------ |
| 🟠 | `flat/mixed-esm-and-cjs` |
| β˜‘οΈ | `flat/recommended` |
| 🟒 | `flat/recommended-module` |
| βœ… | `flat/recommended-script` |
| β˜‘οΈ | `recommended` |
| 🟒 | `recommended-module` |
| βœ… | `recommended-script` |
| | Name |
| :- | :------------------- |
| 🟒 | `recommended-module` |
| βœ… | `recommended-script` |

@@ -175,0 +195,0 @@ <!-- end auto-generated configs list -->

@@ -16,27 +16,4 @@ export = plugin;

// @ts-ignore
declare const plugin: import('eslint').ESLint.Plugin & {
declare const plugin: import("eslint").ESLint.Plugin & {
configs: Configs;
};
type Configs = {
// @ts-ignore
'recommended-module': import('eslint').ESLint.ConfigData;
// @ts-ignore
'recommended-script': import('eslint').ESLint.ConfigData;
// @ts-ignore
'recommended': import('eslint').ESLint.ConfigData;
// @ts-ignore
'flat/recommended-module': import('eslint').Linter.FlatConfig;
// @ts-ignore
'flat/recommended-script': import('eslint').Linter.FlatConfig;
// @ts-ignore
'flat/recommended': import('eslint').Linter.FlatConfig;
// @ts-ignore
'flat/mixed-esm-and-cjs': import('eslint').Linter.FlatConfig[];
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc