-
-
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
feat: add no-duplicate-store-ids #15
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.
Thanks for your contribution, I have some minor feedback, then we can merge it 🙂
src/rules/no-duplicate-store-ids.ts
Outdated
}, | ||
schema: [], | ||
messages: { | ||
duplicatedStoreIds: 'No duplicated store ids allowed.' |
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.
Let's add more context here:
duplicatedStoreIds: 'No duplicated store ids allowed.' | |
duplicatedStoreIds: 'No duplicated store ids allowed: {{storeId}}' |
src/rules/no-duplicate-store-ids.ts
Outdated
|
||
if (usingStoreIds.has(value)) { | ||
context.report({ | ||
node, |
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.
We can report on the actual literal node to make it more clear.
node, | |
node: storeId, |
src/rules/no-duplicate-store-ids.ts
Outdated
if (usingStoreIds.has(value)) { | ||
context.report({ | ||
node, | ||
messageId: 'duplicatedStoreIds' |
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.
And add the context here:
messageId: 'duplicatedStoreIds' | |
messageId: 'duplicatedStoreIds', | |
data: { | |
storeId: storeId.value | |
} |
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.
Hi @9romise, I tested your change here locally and you're right that it can only report across the files with the Set outside the eslint context. I'm not 100% if this might cause side effects, but it seems to work, so we can try adding it for now. I think we can just add a little bit more context and report closer to where the actual node is:
Hi @lisilinhart, I think your suggestion is correct, I've completed these changes. |
🎉 This PR is included in version 0.1.13 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Pull request type
Please check the type of change your PR introduces:
What did you change?
Add no-duplicate-store-ids, closes #5
Why did you change it?
This is a new rule
Other information
I'm intersted on it and willing to contribute. Here is a commit with my rough idea. I'm not sure if there's a better one. If you have any suggestions, I'm looking forward to hearing them.