Skip to content

fix(comment-directive): re-enable rules on <!-- eslint-enable --> the same way ESLint does - #3231

Open
NgoQuocViet2001 wants to merge 2 commits into
vuejs:masterfrom
NgoQuocViet2001:fix-comment-directive-eslint-enable
Open

NgoQuocViet2001 wants to merge 2 commits into
vuejs:masterfrom
NgoQuocViet2001:fix-comment-directive-eslint-enable

Conversation

@NgoQuocViet2001

Copy link
Copy Markdown
Contributor

In <template>, a bare <!-- eslint-enable --> did not undo an earlier <!-- eslint-disable vue/x -->, and <!-- eslint-enable vue/x --> did not undo an earlier bare <!-- eslint-disable -->. The rule stayed off until </template>, while ESLint's own directives (and the same comments in <script>) turn it back on.

<template><div>
  <!-- eslint-disable vue/no-v-html -->
  <div v-html="trusted" />
  <!-- eslint-enable -->
  <div v-html="userInput" />
</div></template>

Before: no messages. After: vue/no-v-html on line 5, matching ESLint. A bare eslint-enable now also clears per-rule block disables. Rules re-enabled with eslint-enable rule while a bare eslint-disable is active are no longer suppressed by it, and a later <!-- eslint-disable --> turns them off again. Line directives are unchanged.

  • Ran: vitest run tests/lib/rules/comment-directive.test.ts: 3 of the 4 new cases fail on master, all 33 pass with the change.
  • Ran: vitest run tests/lib (11771 passed), vitest run tests/integrations (2 passed), npm run tsc, eslint and prettier on the changed files.

@changeset-bot

changeset-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 567c8fa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-vue Patch

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

@FloEdelmann FloEdelmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@FloEdelmann
FloEdelmann requested a review from a team October 30, 2026 07:57

@ota-meshi ota-meshi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for this PR!

Comment thread lib/processor.ts Resolved
@FloEdelmann
FloEdelmann requested a review from ota-meshi November 9, 2026 12:16

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants