Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(no-shadow-native-events): initial implementation #2558

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

Open
JoCa96 wants to merge 34 commits into vuejs:master
base: master
Choose a base branch
Loading
from JoCa96:joca96/feat-no-shadow-native

Conversation

Copy link

@JoCa96 JoCa96 commented Sep 16, 2024

Implementation of my proposed rule #2557 Rule Proposal: Disallow shadowing of native HTML event names.
The implementation is heavily based on require-explicit-emits.
The dom-events.json file is based on the Events interface of @vue/runtime-dom/dist/runtime-dom.d.ts.

Copy link
Member

Could you please fix the lint and test failures?

JoCa96 reacted with thumbs up emoji

Copy link
Author

JoCa96 commented Sep 16, 2024

@FloEdelmann Of course! Done!

JoCa96 added a commit to SchwarzIT/onyx that referenced this pull request Sep 17, 2024
...lint-plugin-vue" until its released (#1877)
Duplicate "no-shadow-native-events" from "eslint-plugin-vue" until it is
released:
- PR with `eslint-plugin-vue`:
vuejs/eslint-plugin-vue#2558
 - Tests can also be found in that PR
- Official Rule proposal:
vuejs/eslint-plugin-vue#2557
Relates to #1603 
Copy link
Member

@FloEdelmann FloEdelmann left a comment

Choose a reason for hiding this comment

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

I haven't looked at the code yet, only at docs and tests. Apart from a few minor suggestions, those look good already!

Comment on lines +904 to +923
{
filename: 'test.vue',
code: `
<template>
<div @click="$emit('click')"/>
</template>
<script setup>
defineEmits(['click'])
</script>
`,
errors: [
{
messageId: 'violation',
line: 6,
column: 20,
endLine: 6,
endColumn: 27
}
]
},
Copy link
Member

@FloEdelmann FloEdelmann Sep 19, 2024

Choose a reason for hiding this comment

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

Shouldn't this report both the $emit() call and the defineEmits definition?

Comment on lines +1114 to +1127
{
messageId: 'violation',
line: 4,
column: 32,
endLine: 4,
endColumn: 37
},
{
messageId: 'violation',
line: 4,
column: 32,
endLine: 4,
endColumn: 37
}
Copy link
Author

Choose a reason for hiding this comment

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

Should only report once

FloEdelmann reacted with thumbs up emoji
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@FloEdelmann FloEdelmann FloEdelmann requested changes

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Rule Proposal: Disallow shadowing of native HTML event names

AltStyle によって変換されたページ (->オリジナル) /