-
-
Notifications
You must be signed in to change notification settings - Fork 48
feat: add fixer for derived-has-same-inputs-outputs
#1163
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
Conversation
🦋 Changeset detectedLatest commit: 5b85027 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 |
Try the Instant Preview in Online PlaygroundInstall the Instant Preview to Your Local
Published Instant Preview Packages:
|
packages/eslint-plugin-svelte/src/rules/derived-has-same-inputs-outputs.ts
Outdated
Show resolved
Hide resolved
According to the official ESLint documentation, the following is stated about fixers.
https://eslint.org/docs/latest/extend/custom-rules#applying-fixes In addition to this PR, it would also require changes to the places where the argument is used. In that case, we would need to check for any variable name conflicts, otherwise it would violate "Avoid any fixes that could change the runtime behavior of code and cause it to stop working.". Therefore, implementing this as a fixer doesn’t seem appropriate. Would it be better to make it a suggestion at the very least? |
similar to the other PR, i am aware of the best practices. i just overlooked updating references to the parameters since we have no existing tests for those cases if this becomes more complex than expected, it can be a suggestion. i'll see where i get to |
Simply replaces the param names with the correct ones since we're already aware of what they should be.
397e365
to
d1f13d0
Compare
ok @baseballyama i've updated this to rename references of the variable in the current function scope if you want me to change it into a suggestion once you've re-reviewed, let me know and ill update EDIT just trying to fix a problem with the array pattern stuff... |
d1f13d0
to
16099cb
Compare
16099cb
to
6a4bfc3
Compare
Still figuring out what eslint is playing at.
packages/eslint-plugin-svelte/src/rules/derived-has-same-inputs-outputs.ts
Outdated
Show resolved
Hide resolved
this should be all good now it uses suggestions and only provides them if there are no conflicting variable names |
Can you add a changeset? |
packages/eslint-plugin-svelte/src/rules/derived-has-same-inputs-outputs.ts
Outdated
Show resolved
Hide resolved
packages/eslint-plugin-svelte/src/rules/derived-has-same-inputs-outputs.ts
Outdated
Show resolved
Hide resolved
22de667
to
1710e44
Compare
packages/eslint-plugin-svelte/src/rules/derived-has-same-inputs-outputs.ts
Show resolved
Hide resolved
h; | ||
}); | ||
}); | ||
derived([e, f], ([g, $f]) => { |
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.
it shouldn't as the suggestions apply one at a time. this is listing the output of each individual suggestion
Sorry! That's why I deleted the comment but you replied too fast😅 |
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!
#1163 (comment) is last remaining comment.
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!
Simply replaces the param names with the correct ones since we're already aware of what they should be.
Depends on #1162