-
-
Notifications
You must be signed in to change notification settings - Fork 696
Added ignoredObjectNames
option to vue/no-async-in-computed-properties
#2927
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: d5805cf 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 |
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.
For some more elaborate tests 😄
(The non-null assertion !
needs the typescript-eslint parser, so maybe this should be a separate 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.
Just pushed a commit that adds a skipWrapper
function to handle complex member expression chains with optional chaining support.
Decided not to use TypeScript AST node types directly since that could lead to a bunch of type conflicts...
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.
Pull Request Overview
This PR adds an ignoredObjectNames
option to the vue/no-async-in-computed-properties
rule to allow certain object names to be ignored when using promise-like methods. This is useful for validation libraries like Zod that use .then()
, .catch()
, and .finally()
method names for non-promise purposes.
- Adds schema validation for the new
ignoredObjectNames
array option - Implements logic to extract root object names from member expression chains and skip reporting when they match ignored names
- Updates documentation with examples showing how to ignore Zod validation chains
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
lib/rules/no-async-in-computed-properties.js | Implements core logic for the ignoredObjectNames option with root object name extraction |
tests/lib/rules/no-async-in-computed-properties.js | Adds comprehensive test cases for valid and invalid usage with the new option |
docs/rules/no-async-in-computed-properties.md | Updates documentation with option details and Zod usage examples |
.changeset/cute-bears-sneeze.md | Adds changelog entry for the minor version feature |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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 function parameter memberExpr
suggests it expects a MemberExpression
, but the function accesses memberExpr.object
without validation. If a non-MemberExpression node is passed, this will cause a runtime error when trying to access the object
property.
Copilot uses AI. Check for mistakes.
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 getRootObjectName
function expects a MemberExpression
but callee
is already confirmed to be a MemberExpression
at line 84. However, the function should validate its input parameter or the call should be made more explicit about the type being passed.
Copilot uses AI. Check for mistakes.
Co-authored-by: Flo Edelmann <git@flo-edelmann.de>
Co-authored-by: Flo Edelmann <git@flo-edelmann.de>
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!
resolve #2917