-
-
Notifications
You must be signed in to change notification settings - Fork 644
feat(lint): implement noVueReservedProps
rule
#6757
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: cc6e247 The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
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 |
CodSpeed Performance ReportMerging #6757 will not alter performanceComparing Summary
|
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.
Overall looks good, but I think there is a case you have missed (correct me if i'm wrong)
It's possible to use the composition api inside a export default {}
defined component. Example: https://github.com/dyc3/opentogethertube/blob/2b680f4200d9d2e00cfd67dba4b08a0edc8f2009/client/src/views/RoomList.vue#L68
<script setup>
and the compiler macros are effectively syntax sugar for this way of defining components.
crates/biome_js_analyze/tests/specs/nursery/noVueReservedProps/falidNotVue.js
Outdated
Show resolved
Hide resolved
crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_props.rs
Outdated
Show resolved
Hide resolved
pub NoVueReservedProps { | ||
version: "next", | ||
name: "noVueReservedProps", | ||
language: "js", | ||
recommended: false, | ||
severity: Severity::Warning, | ||
domains: &[RuleDomain::Vue], | ||
} |
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.
is the original rule recommended by the plugin? if so, we should follow that.
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.
Yes, it is. Changed.
crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_props.rs
Outdated
Show resolved
Hide resolved
pub enum VueComponent { | ||
/// This is referred to as "normal script" Vue component. | ||
/// <script> export default { props: [ ... ], data: { ... }, ... }; </script> | ||
Normal(VueNormalComponent), | ||
/// A component may be defined right in the createApp call. | ||
/// createApp({ props: [ ... ], ... }); | ||
CreateApp(VueCreateApp), | ||
/// Define Component is one of the ways to define a Vue component. | ||
/// defineComponent({ props: [ ... ], ... }); | ||
DefineComponent(VueDefineComponent), | ||
/// Setup component is a Vue 3 component that uses the Composition API. | ||
/// <script setup> defineProps({ ... }); const someData = { ... }; </script> | ||
/// FIXME: Remove `allow(dead_code)` when <script setup> is supported. | ||
#[expect(dead_code)] | ||
Setup(VueSetupComponent), | ||
} |
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.
nit: the code examples should go in markdown code blocks
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.
Done.
@dyc3 Thanks for reminding, I know about this case. I just need control flow for that to work. Working on it in order to support both |
@dyc3 I believe I've addressed all the issues. Also:
|
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.
Looking good!
.changeset/lovely-moments-join.md
Outdated
"@biomejs/biome": minor | ||
--- | ||
|
||
Added the rule [`noVueReservedProps`](https://biomejs.dev/linter/rules/no-vue-reserved-props/). |
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.
nit: Link to the issue
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.
Added.
Co-authored-by: Carson McManus <dyc3@users.noreply.github.com>
Summary
Implementation of
noVueReservedProps
rule.Includes an abstraction to work with Vue components.
What is supported:
What doesn't work:
script
tag hassetup
attribute, setup-components are not returned.data()
method is not yet supported, need control flow graph (work in progress).setup()
method is not yet supported, need control flow graph (work in progress).These points don't prevent this rule from being compatible with eslint rule.
Test Plan
Tests are included.
Closes #6309