Skip to content

Conversation

JoshuaKGoldberg
Copy link
Contributor

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

Adds an if for the case of a falsy AST in JS's SourceCode > validate function.

Uses a more generalized, succinct error message than what I originally suggested in the issue. I found this one to align more with the rest of them.

Is there anything you'd like reviewers to focus on?

@JoshuaKGoldberg JoshuaKGoldberg requested a review from a team as a code owner February 24, 2025 18:14
@eslint-github-bot eslint-github-bot bot added the bug ESLint is working incorrectly label Feb 24, 2025
Copy link

netlify bot commented Feb 24, 2025

Deploy Preview for docs-eslint ready!

Name Link
🔨 Latest commit 765726d
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/67c18ed33a544200089724a7
😎 Deploy Preview https://deploy-preview-19458--docs-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@JoshuaKGoldberg
Copy link
Contributor Author

CI failures are external to this change.

@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion core Relates to ESLint's core APIs and features labels Feb 26, 2025
Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
@github-actions github-actions bot removed the core Relates to ESLint's core APIs and features label Feb 28, 2025
if (!ast.tokens) {
throw new Error("AST is missing the tokens array.");
throw new TypeError("AST is missing the tokens array.");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following #19458 (comment), I went ahead and updated the rest of the error classes too.

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@nzakas nzakas merged commit 49e624f into eslint:main Feb 28, 2025
30 checks passed
@github-project-automation github-project-automation bot moved this from Implementing to Complete in Triage Feb 28, 2025
@JoshuaKGoldberg JoshuaKGoldberg deleted the js-falsy-ast-handling branch February 28, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

3 participants