Skip to content

docs: don't pass filename when linting rule examples #19571

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

Merged
merged 2 commits into from
Mar 24, 2025
Merged

Conversation

mdjermanovic
Copy link
Member

Prerequisites checklist

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

[x] Documentation update
[ ] 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:

While reviewing #19493, I noticed that the docs site code that lints rule examples for the purpose of underlining errors gets a parsing error when checking TypeScript examples of correct code added in that PR. On the other hand, tools/check-rule-examples.js parses the same code successfully. The difference turned out to be that the former passes filename: "code.js" to linter.verify() whereas the latter doesn't.

What changes did you make? (Give an overview)

Removed filename: "code.js" from the linter.verify() call used for underlining errors.

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

This fixes the problem, though I don't understand why it makes a difference for the typescript-eslint parser.

@mdjermanovic mdjermanovic requested a review from a team as a code owner March 24, 2025 15:39
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Mar 24, 2025
@eslint-github-bot eslint-github-bot bot added the documentation Relates to ESLint's documentation label Mar 24, 2025
Copy link

netlify bot commented Mar 24, 2025

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 161364a
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/67e192cef95b3a0007339e94

@JoshuaKGoldberg
Copy link
Contributor

why it makes a difference for the typescript-eslint parser.

There are some settings with behavior/defaults based on how TypeScript interprets the file extension: i.e. https://typescript-eslint.io/packages/parser/#ecmafeatures. We'd have to dig more internally to get a specific answer but it's not uncommon for edge cases in syntax like <as>/JSX to pop up based on .js/.ts vs. .jsx/.tsx file name differences.

@JoshuaKGoldberg JoshuaKGoldberg moved this from Needs Triage to Second Review Needed in Triage Mar 24, 2025
@snitin315
Copy link
Contributor

The CI / Types (eslint-webpack-plugin) check is failing.

@snitin315 snitin315 added the accepted There is consensus among the team that this change meets the criteria for inclusion label Mar 24, 2025
@snitin315 snitin315 moved this from Second Review Needed to Merge Candidates in Triage Mar 24, 2025
@snitin315 snitin315 moved this from Merge Candidates to Second Review Needed in Triage Mar 24, 2025
@mdjermanovic
Copy link
Member Author

Copy link
Contributor

@snitin315 snitin315 left a comment

Choose a reason for hiding this comment

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

LGTM

@snitin315 snitin315 merged commit 0c65c62 into main Mar 24, 2025
30 of 31 checks passed
@snitin315 snitin315 deleted the docs-lint-filename branch March 24, 2025 17:41
@github-project-automation github-project-automation bot moved this from Second Review Needed to Complete in Triage Mar 24, 2025
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 documentation Relates to ESLint's documentation
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy