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

feat: implement derived-has-same-inputs-outputs #249

Merged

Conversation

baseballyama
Copy link
Member

@changeset-bot
Copy link

changeset-bot bot commented Sep 3, 2022

🦋 Changeset detected

Latest commit: 02da482

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-svelte Minor

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

@baseballyama
Copy link
Member Author

baseballyama commented Sep 3, 2022

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 5, 2022

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.

Copy link
Member

@ota-meshi ota-meshi left a 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: "",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description must be set.

Suggested change
description: "",
description: "derived store should use same variable names between values and callback",

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meta: {
docs: {
description: "",
category: "Best Practices",
Copy link
Member

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.

Suggested change
category: "Best Practices",
category: "Stylistic Issues",

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated! ota-meshi/eslint-plugin-svelte@ba6dccc
conflictWithPrettier should be false right?🤔

Comment on lines 55 to 58
loc: {
start: fnParam.loc?.start ?? { line: 1, column: 0 },
end: fnParam.loc?.end ?? { line: 1, column: 0 },
},
Copy link
Member

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

Suggested change
loc: {
start: fnParam.loc?.start ?? { line: 1, column: 0 },
end: fnParam.loc?.end ?? { line: 1, column: 0 },
},
loc: fnParam.loc!,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed! ota-meshi/eslint-plugin-svelte@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]}`
Copy link
Member

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.

Copy link
Member Author

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! ota-meshi/eslint-plugin-svelte@ba6dccc

Comment on lines 85 to 88
loc: {
start: element.loc?.start ?? { line: 1, column: 0 },
end: element.loc?.end ?? { line: 1, column: 0 },
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
loc: {
start: element.loc?.start ?? { line: 1, column: 0 },
end: element.loc?.end ?? { line: 1, column: 0 },
},
loc: element.loc!,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed! ota-meshi/eslint-plugin-svelte@ba6dccc
And my previous PR also should do the same way, so I updated.

@baseballyama
Copy link
Member Author

baseballyama commented Sep 5, 2022

@ota-meshi And I added a few more tests. Thank you for your review!
ota-meshi/eslint-plugin-svelte@02da482

Copy link
Member

@ota-meshi ota-meshi left a 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!

@ota-meshi ota-meshi merged commit 6d0b89f into sveltejs:main Sep 5, 2022
@baseballyama baseballyama deleted the feature/derived-inputs-outputs branch September 5, 2022 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants