Skip to content

jsdoc/check-values crashes with --permission #1371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JoshuaKGoldberg opened this issue Apr 22, 2025 · 5 comments · Fixed by #1372
Closed

jsdoc/check-values crashes with --permission #1371

JoshuaKGoldberg opened this issue Apr 22, 2025 · 5 comments · Fixed by #1372

Comments

@JoshuaKGoldberg
Copy link
Contributor

Expected behavior

Linting should work with the new Node.js --permission flag enabled.

Actual behavior

Coming over from eslint/eslint#19647, once the bug in ESLint around deleting the cache is fixed, jsdoc/check-values crashes with:

Error: Access to this API has been restricted
Occurred while linting /Users/josh/repos/eslint/lib/config/flat-config-helpers.js:6
Rule: "jsdoc/check-values"
    at new Worker (node:internal/worker:215:21)
    at startWorkerThread (/Users/josh/repos/eslint/node_modules/synckit/lib/index.cjs:319:18)
    at createSyncFn (/Users/josh/repos/eslint/node_modules/synckit/lib/index.cjs:89:18)
    at /Users/josh/repos/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/checkValues.cjs:101:52
    at utils.forEachPreferredTag (/Users/josh/repos/eslint/node_modules/eslint-plugin-jsdoc/dist/iterateJsdoc.cjs:1491:7)
    at exports.default.iterateAllJsdocs (/Users/josh/repos/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/checkValues.cjs:93:11)
    at iterate (/Users/josh/repos/eslint/node_modules/eslint-plugin-jsdoc/dist/iterateJsdoc.cjs:1744:3)
    at callIterator (/Users/josh/repos/eslint/node_modules/eslint-plugin-jsdoc/dist/iterateJsdoc.cjs:1883:7)
    at Program:exit (/Users/josh/repos/eslint/node_modules/eslint-plugin-jsdoc/dist/iterateJsdoc.cjs:1949:11)
    at ruleErrorHandler (/Users/josh/repos/eslint/lib/linter/linter.js:1311:33)

ESLint Config

Sorry, I don't have a minimum repro right now - but the steps in eslint/eslint#19647 do work.

git clone https://github.com/eslint/eslint
cd eslint
npm i
# comment out the fs.unlink in lib/eslint/eslint.js
node --permission --allow-fs-read '*' bin/eslint

## ESLint sample

n/a

## Environment

- Node version: 23.9.0
- ESLint version 9.25.1
- `eslint-plugin-jsdoc` version: both 48.2.3 and 50.6.9
@brettz9
Copy link
Collaborator

brettz9 commented Apr 23, 2025

We'd need to avoid synckit and use some synchronous replacement for parse-imports.

@brettz9
Copy link
Collaborator

brettz9 commented Apr 23, 2025

@JoshuaKGoldberg Would you like to check whether #1372 does the trick?

brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue Apr 23, 2025
@JoshuaKGoldberg
Copy link
Contributor Author

💯 that works on ESLint locally for me, awesome!

Copy link

🎉 This issue has been resolved in version 50.6.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

@JounQin
Copy link

JounQin commented Apr 24, 2025

OMG, so synckit will be broken with --permission? What's the root cause? I have to use synckit in several ESLint plugins like eslint-mdx. (And that's why I've developed synckit actually...)


Edit: OK, I found https://nodejs.org/api/cli.html#--allow-worker, just --allow-worker must be enabled in these cases which is totally fine to me personally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants