Skip to content

Silent success when languageOptions.sourceType is incorrectly defined #483

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
DamienCassou opened this issue Jun 11, 2024 · 2 comments
Closed

Comments

@DamienCassou
Copy link

I'm migrating my eslint plugin to v9 and forgot to set languageOptions.sourceType to "commonjs" so the default value was "module". Running eslint on my rules would produce 0 warnings or errors because getRuleExportsESM() (from util.js) returns an empty object so getRuleInfo() returns null and no-missing-message-ids.js (for example) has this code:

const ruleInfo = utils.getRuleInfo(sourceCode);
if (!ruleInfo) {
  return {};
}

Would it be possible to get warnings/errors in such cases?

@aladdin-add
Copy link
Contributor

forgot to set languageOptions.sourceType to "commonjs" so the default value was "module".

in such cases, the rule no-undef could report an error when using require/module - they can only be used in cjs.

@DamienCassou
Copy link
Author

Thank you 👍

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

No branches or pull requests

2 participants