-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
Bug: eslint-scope
requires assert
#625
Comments
eslint-scope scope
requires assert
eslint-scope
requires assert
it's to avoid the rollup warnings: https://rollupjs.org/troubleshooting/#warning-treating-module-as-external-dependency. I'd suggest not using if(this.__currentScope !== null) {throw new Error("an error happened.")} |
This is left over from when we forked escope. I don't think there's any reason to reference the I think the easiest thing is just to create and use our own assert function: function assert(condition, message = "Assertion failed.") {
if (!condition) {
throw new Error(message);
}
} And then replace the references to @amareshsm do you want to take a look at this? |
Sure. I will look into this. |
The test files also contain references. Should we leave them as is, since they won’t be included in the bundle? |
Yes. |
Which packages are affected?
espree
eslint-scope
eslint-visitor-keys
Environment
Node version: v20.16.0
npm version: 10.8.1
ESLint version: 8.57.0
Operating System: macOS
What did you do?
In Code Explorer, I aimed to clean up the dependencies by removing unused development and runtime dependencies. I identified the dependencies that were not being used in the repository and then removed them.
What did you expect to happen?
Code Explorer should work as expected since I removed only the unused dependencies.
What actually happened?
code explorer scope view was breaking got the below error:
When I reviewed the scope-manager logic in response to the error, I found that it utilizes
assert
.js/packages/eslint-scope/lib/scope-manager.js
Line 187 in 79c6e93
Also
assert
package was intentionally ignored in the config.js/packages/eslint-scope/rollup.config.js
Line 3 in 79c6e93
This means the
assert
package was intentionally marked as external and is expected to be present in the environment where the package is used.Do we have a specific reason for marking
assert
as external? There might be cases whereassert
is not available in the environment where the package (scope-manager) is being used.Link to Minimal Reproducible Example
https://deploy-preview-33--eslint-code-explorer.netlify.app
Participation
Additional comments
No response
The text was updated successfully, but these errors were encountered: