Skip to content
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

Access current file name/path in custom rule #30

Closed
WickyNilliams opened this issue Jun 9, 2021 · 5 comments · Fixed by #42
Closed

Access current file name/path in custom rule #30

WickyNilliams opened this issue Jun 9, 2021 · 5 comments · Fixed by #42

Comments

@WickyNilliams
Copy link
Contributor

Is there some way to access the name/path for the current file in a custom rule? It doesn't seem to be available on any of the arguments passed to the function.

@WickyNilliams
Copy link
Contributor Author

Seems like you could add a 4th info param like:

rule(reporter, cheerioParsed, ast, { path: this.path })

https://github.com/birjolaxew/svglint/blob/bfbc47ab9d16872aa9c6fc05684eab530723d405/src/lib/linting.js#L108

@birjj
Copy link
Contributor

birjj commented Jun 9, 2021

As mentioned in another issue (#11) I'm unfortunately unable to dedicate any real time to svglint. I'll have a bit of time at the end of the month, but otherwise plan to rewrite the programmatic interface a fair bit once my schedule clears up in a few months.

If you'd like this before then, I'd be happy to review a PR.

@WickyNilliams
Copy link
Contributor Author

No worries, I completely understand that your time is limited and open source often has to take a backseat!

I'll see if i can whip up a PR. Should be pretty easy if you're happy with the approach i outlined above?

@birjj
Copy link
Contributor

birjj commented Jun 9, 2021

Sounds good. Your approach seems reasonable, I'd be happy with it in a PR (plus a test to avoid regressions during the upcoming rewrite).

@github-actions
Copy link

🎉 This issue has been resolved in version 1.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants