eslint-plugin-n
Advanced tools
Comparing version 17.8.1 to 17.9.0
@@ -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": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
435660
11522