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.8.1 to 17.9.0

9

lib/rules/no-unpublished-import.js

@@ -32,2 +32,3 @@ /**

ignoreTypeImport: { type: "boolean", default: false },
ignorePrivate: { type: "boolean", default: true },
},

@@ -42,6 +43,4 @@ additionalProperties: false,

const options = context.options[0] || {}
const ignoreTypeImport =
options.ignoreTypeImport === void 0
? false
: options.ignoreTypeImport
const ignoreTypeImport = options.ignoreTypeImport ?? false
const ignorePrivate = options.ignorePrivate ?? true

@@ -53,5 +52,5 @@ if (filePath === "<input>") {

return visitImport(context, { ignoreTypeImport }, targets => {
checkPublish(context, filePath, targets)
checkPublish(context, filePath, targets, { ignorePrivate })
})
},
}

@@ -33,2 +33,3 @@ /**

tryExtensions: getTryExtensions.schema,
ignorePrivate: { type: "boolean", default: true },
},

@@ -42,2 +43,5 @@ additionalProperties: false,

const filePath = context.filename ?? context.getFilename()
const options = context.options[0] || {}
const ignorePrivate = options.ignorePrivate ?? true
if (filePath === "<input>") {

@@ -48,5 +52,5 @@ return {}

return visitRequire(context, {}, targets => {
checkPublish(context, filePath, targets)
checkPublish(context, filePath, targets, { ignorePrivate })
})
},
}

@@ -21,5 +21,11 @@ /**

* @param {import('./import-target.js')[]} targets - A list of target information to check.
* @param {{ignorePrivate: boolean}} options - Configuration options for checking for published files.
* @returns {void}
*/
exports.checkPublish = function checkPublish(context, filePath, targets) {
exports.checkPublish = function checkPublish(
context,
filePath,
targets,
options
) {
const packageJson = getPackageJson(filePath)

@@ -30,5 +36,7 @@ if (typeof packageJson?.filePath !== "string") {

// Private packages are never published so we don't need to check the imported dependencies either.
// Flag to ignore checking imported dependencies in private packages.
// For projects that need to be deployed to a server checking for imported dependencies may still be desireable
// while making it a private package.
// More information: https://docs.npmjs.com/cli/v8/configuring-npm/package-json#private
if (packageJson.private === true) {
if (options.ignorePrivate && packageJson.private === true) {
return

@@ -35,0 +43,0 @@ }

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

@@ -5,0 +5,0 @@ "engines": {

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