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
New: add getPhysicalFilename()
method to rule context (fixes #11989)
#14616
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. Just one question.
getPhysicalFilename()
method to the rule context objectgetPhysicalFilename()
method to rule context (fixes #11989)
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks.
Thanks for contributing! |
@snitin315 @nzakas @mdjermanovic I find Before ruleTester.run('remark', remark, {
valid: [
{
code: '<header>Header2</header>',
parser,
parserOptions,
filename: path.resolve(__filename, '0-fake.mdx'), // virtual filename
},
],
}) But when I migrate to ruleTester.run('remark', remark, {
valid: [
{
code: '<header>Header2</header>',
parser,
parserOptions,
physicalFilename: __filename,
filename: path.resolve(__filename, '0-fake.mdx'), // virtual filename
},
],
}) |
@JounQin I'd guess we'll want to do that. Can you open an issue? People aren't as likely to see things that are part of finished discussions. |
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[X] Other, please explain:
What changes did you make? (Give an overview)
Fix #11989
add a new
getPhysicalFilename()
method to the rule context object. This method will return the full path of the file on disk without any code block information.Is there anything you'd like reviewers to focus on?
No