-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add a reference to context settings and options #1
Conversation
As reference here is the implementation or the extended rule: https://github.com/dwightjack/eslint-plugin-vue-types/blob/develop/lib/rules/require-default-prop.js |
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.
Thanks for the pull request! Can you update the documentation in README.md
to note these new properties?
@not-an-aardvark Thanks for the review. Added documentation and tests as well. |
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.
Thanks, I left a few minor comments about the documentation.
README.md
Outdated
(problem, metadata) => { | ||
const firstToken = metadata.sourceCode.getFirstToken(problem.node); | ||
const whitelist = settings.tokenWhitelist; | ||
return whitelist.includes(value) === false |
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.
Nitpick: Can you replace this with return !whitelist.includes(value)
?
README.md
Outdated
|
||
{ | ||
"settings": { | ||
"tokenWhitelist": ["expect", "test"] |
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.
I'm a bit confused about this example -- shouldn't tokenWhitelist
be in the rule options rather than settings
? It seems like the option is only applicable to this one rule.
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.
The ability to read settings
for the configuration is provided to make it possibile to setup rules like eslint-plugin-import
resolvers.
Maybe the example doesn't fit well and could be confusiong. Any hint on a better example?
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.
To clarify, I agree that it's useful to have access to settings -- I just think this isn't a good example of the utility because this type of configuration would be better in options
. (I was initially confused because I didn't see the similar options
example above it.)
It's probably not really necessary to have separate examples for options
and settings
, so it might be simplest to just remove this example.
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.
You're right. I removed the example and merged the two text descriptions.
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!
Hi great project!
I'm using this library's
filterReports
to modify a rule i eslint-plugin-vue but I'd like to be able to access rules'options
and globalsettings
.For what I can understand reading the sourcecode, right now there's no way to access those property, so I extracted them from the context object and exposed them on the
metadata
object.