Socket
Socket
Sign inDemoInstall

eslint-plugin-jsdoc

Package Overview
Dependencies
112
Maintainers
1
Versions
628
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 46.2.5 to 46.2.6

49

dist/rules/importsAsDependencies.js

@@ -14,20 +14,24 @@ "use strict";

/**
* @type {Set<string>}
* @type {Set<string>|null}
*/
let deps;
try {
const pkg = JSON.parse(
// @ts-expect-error It's ok
(0, _fs.readFileSync)((0, _path.join)(process.cwd(), './package.json')));
deps = new Set([...(pkg.dependencies ? Object.keys(pkg.dependencies) :
// istanbul ignore next
[]), ...(pkg.devDependencies ? Object.keys(pkg.devDependencies) :
// istanbul ignore next
[])]);
} catch (error) {
/* eslint-disable no-console -- Inform user */
// istanbul ignore next
console.log(error);
/* eslint-enable no-console -- Inform user */
}
const setDeps = function () {
try {
const pkg = JSON.parse(
// @ts-expect-error It's ok
(0, _fs.readFileSync)((0, _path.join)(process.cwd(), './package.json')));
deps = new Set([...(pkg.dependencies ? Object.keys(pkg.dependencies) :
// istanbul ignore next
[]), ...(pkg.devDependencies ? Object.keys(pkg.devDependencies) :
// istanbul ignore next
[])]);
} catch (error) {
// istanbul ignore next -- our package.json exists
deps = null;
/* eslint-disable no-console -- Inform user */
// istanbul ignore next -- our package.json exists
console.log(error);
/* eslint-enable no-console -- Inform user */
}
};

@@ -41,3 +45,8 @@ const moduleCheck = new Map();

// istanbul ignore if
if (!deps) {
if (deps === undefined) {
setDeps();
}
// istanbul ignore if -- our package.json exists
if (deps === null) {
return;

@@ -55,3 +64,9 @@ }

}
// eslint-disable-next-line no-loop-func -- Safe
(0, _jsdoccomment.traverse)(typeAst, nde => {
// istanbul ignore if -- TS guard
if (deps === null) {
return;
}
if (nde.type === 'JsdocTypeImport') {

@@ -58,0 +73,0 @@ let mod = nde.element.value.replace(/^(@[^/]+\/[^/]+|[^/]+).*$/u, '$1');

@@ -139,3 +139,3 @@ {

},
"version": "46.2.5"
"version": "46.2.6"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc