Socket
Socket
Sign inDemoInstall

eslint-plugin-jsdoc

Package Overview
Dependencies
106
Maintainers
0
Versions
628
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 48.2.15 to 48.3.0

dist/import-worker.cjs

9

package.json

@@ -14,4 +14,6 @@ {

"esquery": "^1.5.0",
"parse-imports": "^2.1.0",
"semver": "^7.6.2",
"spdx-expression-parse": "^4.0.0"
"spdx-expression-parse": "^4.0.0",
"synckit": "^0.9.0"
},

@@ -47,2 +49,3 @@ "description": "JSDoc linting rules for ESLint.",

"babel-plugin-istanbul": "^6.1.1",
"babel-plugin-transform-import-meta": "^2.2.1",
"c8": "^9.1.0",

@@ -130,3 +133,3 @@ "camelcase": "^6.3.0",

"tsc-build": "tsc -p tsconfig-prod.json",
"build": "rimraf ./dist && cross-env NODE_ENV=production babel ./src --out-file-extension .cjs --out-dir ./dist --copy-files --source-maps --ignore ./src/bin/*.js --no-copy-ignored && replace 'require\\(\"\\.(.*?)\\.[^.]*?\"\\)' 'require(\".$1.cjs\")' 'dist' -r --include=\"*.cjs\" && pnpm tsc-build",
"build": "rimraf ./dist && cross-env NODE_ENV=production babel ./src --out-file-extension .cjs --out-dir ./dist --copy-files --source-maps --ignore ./src/bin/*.js --no-copy-ignored && replace 'require\\(\"\\.(.*?)\\.[^.]*?\"\\)' 'require(\".$1.cjs\")' 'dist' -r --include=\"*.cjs\" && cp src/import-worker.mjs dist/import-worker.mjs && pnpm tsc-build",
"check-docs": "babel-node ./src/bin/generateDocs.js --check",

@@ -146,3 +149,3 @@ "create-docs": "npm run create-options && babel-node ./src/bin/generateDocs.js",

},
"version": "48.2.15"
"version": "48.3.0"
}

@@ -1,5 +0,12 @@

import iterateJsdoc from '../iterateJsdoc.js';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { createSyncFn } from 'synckit';
import semver from 'semver';
import spdxExpressionParse from 'spdx-expression-parse';
import iterateJsdoc from '../iterateJsdoc.js';
const __dirname = dirname(fileURLToPath(import.meta.url));
const pathName = join(__dirname, '../import-worker.mjs');
const allowedKinds = new Set([

@@ -23,2 +30,3 @@ 'class',

context,
settings,
}) => {

@@ -161,2 +169,23 @@ const options = context.options[0] || {};

if (settings.mode === 'typescript') {
utils.forEachPreferredTag('import', (tag) => {
const {
type, name, description
} = tag;
const typePart = type ? `{${type}} `: '';
const imprt = 'import ' + (description
? `${typePart}${name} ${description}`
: `${typePart}${name}`);
const getImports = createSyncFn(pathName);
if (!getImports(imprt)) {
report(
`Bad @import tag`,
null,
tag,
);
}
});
}
utils.forEachPreferredTag('author', (jsdocParameter, targetTagName) => {

@@ -163,0 +192,0 @@ const author = /** @type {string} */ (

@@ -1,4 +0,5 @@

import iterateJsdoc, {
parseComment,
} from '../iterateJsdoc.js';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { createSyncFn } from 'synckit';
import {

@@ -10,3 +11,9 @@ getJSDocComment,

} from '@es-joy/jsdoccomment';
import iterateJsdoc, {
parseComment,
} from '../iterateJsdoc.js';
const __dirname = dirname(fileURLToPath(import.meta.url));
const pathName = join(__dirname, '../import-worker.mjs');
const extraTypes = [

@@ -113,3 +120,3 @@ 'null', 'undefined', 'void', 'string', 'boolean', 'object',

const typedefDeclarations = sourceCode.getAllComments()
const comments = sourceCode.getAllComments()
.filter((comment) => {

@@ -120,3 +127,5 @@ return (/^\*\s/u).test(comment.value);

return parseComment(commentNode, '');
})
});
const typedefDeclarations = comments
.flatMap((doc) => {

@@ -133,2 +142,44 @@ return doc.tags.filter(({

const importTags = settings.mode === 'typescript' ? /** @type {string[]} */ (comments.flatMap((doc) => {
return doc.tags.filter(({
tag,
}) => {
return tag === 'import';
});
}).flatMap((tag) => {
const {
type, name, description
} = tag;
const typePart = type ? `{${type}} `: '';
const imprt = 'import ' + (description
? `${typePart}${name} ${description}`
: `${typePart}${name}`);
const getImports = createSyncFn(pathName);
const imports = /** @type {import('parse-imports').Import[]} */ (getImports(imprt));
if (!imports) {
return null;
}
return imports.flatMap(({importClause}) => {
/* c8 ignore next */
const {default: dflt, named, namespace} = importClause || {};
const types = [];
if (dflt) {
types.push(dflt);
}
if (namespace) {
types.push(namespace);
}
if (named) {
for (const {binding} of named) {
types.push(binding);
}
}
return types;
});
}).filter(Boolean)) : [];
const ancestorNodes = [];

@@ -200,2 +251,3 @@

.concat(typedefDeclarations)
.concat(importTags)
.concat(definedTypes)

@@ -202,0 +254,0 @@ .concat(/** @type {string[]} */ (definedPreferredTypes))

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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