-
-
Notifications
You must be signed in to change notification settings - Fork 687
Add new vue/no-negated-condition
rule
#2795
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: 702e432 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.
Pull Request Overview
Introduce the new vue/no-negated-condition
rule that wraps ESLint’s core no-negated-condition
to enforce no negated conditions in Vue templates.
- Add rule implementation with
wrapCoreRule
- Register the rule in the plugin index
- Provide tests, documentation, and a changelog entry
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tests/lib/rules/no-negated-condition.js | New RuleTester suite with valid and invalid cases |
lib/rules/no-negated-condition.js | Wraps the core ESLint rule via wrapCoreRule |
lib/index.js | Registers no-negated-condition in the plugin exports |
docs/rules/no-negated-condition.md | Docs for the rule with basic details and links |
docs/rules/index.md | Adds rule to the rules index table |
.changeset/true-pumas-open.md | Changelog entry for the new minor release |
Comments suppressed due to low confidence (2)
tests/lib/rules/no-negated-condition.js:37
- Add tests for negated conditions in structural directives like
v-if
andv-show
(e.g.,<div v-if="!foo">
) to ensure the rule flags those cases.
invalid: [
docs/rules/no-negated-condition.md:16
- [nitpick] Include a dedicated
## Examples
section with clear code blocks showing valid vs. invalid negated conditions in templates for better developer guidance.
This rule is the same rule as core [no-negated-condition] rule but it applies to the expressions in `<template>`.
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! 🙂
Resolve #2769
Related PR #2794