-
-
Notifications
You must be signed in to change notification settings - Fork 48
feat: implement derived-has-same-inputs-outputs
#249
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: implement derived-has-same-inputs-outputs
#249
Conversation
🦋 Changeset detectedLatest commit: 02da482 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
4587184
to
69d57b1
Compare
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
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.
Thank you for this PR! I wrote some comments.
export default createRule("derived-has-same-inputs-outputs", { | ||
meta: { | ||
docs: { | ||
description: "", |
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.
description
must be set.
description: "", | |
description: "derived store should use same variable names between values and callback", |
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.
ah sorry!
ba6dccc
meta: { | ||
docs: { | ||
description: "", | ||
category: "Best Practices", |
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.
Perhaps "Stylistic Issues"
is a more appropriate category.
category: "Best Practices", | |
category: "Stylistic Issues", |
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.
updated! ba6dccc
conflictWithPrettier
should be false
right?🤔
loc: { | ||
start: fnParam.loc?.start ?? { line: 1, column: 0 }, | ||
end: fnParam.loc?.end ?? { line: 1, column: 0 }, | ||
}, |
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.
Nodes handled by ESLint always have a loc property, so non-null expressions can be used.
https://eslint.org/docs/latest/developer-guide/working-with-custom-parsers#all-nodes
loc: { | |
start: fnParam.loc?.start ?? { line: 1, column: 0 }, | |
end: fnParam.loc?.end ?? { line: 1, column: 0 }, | |
}, | |
loc: fnParam.loc!, |
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.
fixed! ba6dccc
And my previous PR also should do the same way, so I updated it.
}) | ||
fnParam.elements.forEach((element, index) => { | ||
if (element && element.type === "Identifier") { | ||
const expectedName = `$${argNames[index]}` |
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 think maybe if argNames[index]
is null
it should be ignored from the check.
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.
Sorry for that! I updated! ba6dccc
loc: { | ||
start: element.loc?.start ?? { line: 1, column: 0 }, | ||
end: element.loc?.end ?? { line: 1, column: 0 }, | ||
}, |
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.
loc: { | |
start: element.loc?.start ?? { line: 1, column: 0 }, | |
end: element.loc?.end ?? { line: 1, column: 0 }, | |
}, | |
loc: element.loc!, |
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.
fixed! ba6dccc
And my previous PR also should do the same way, so I updated.
@ota-meshi And I added a few more tests. Thank you for your review! |
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! Thank you for the great work!
Related to: #198 (derived-inputs-outputs)