Skip to content

feat: add vue/no-smart-quotes rule - #3289

Open
saroj321r-cmd wants to merge 1 commit into
vuejs:masterfrom
saroj321r-cmd:feat/no-smart-quotes
Open

saroj321r-cmd wants to merge 1 commit into
vuejs:masterfrom
saroj321r-cmd:feat/no-smart-quotes

Conversation

@saroj321r-cmd

Copy link
Copy Markdown

Summary

Closes #3088

Adds the vue/no-smart-quotes rule to disallow smart (curly) quote characters (‘, ’, “, ”) in Vue <template> blocks and autofix them to straight quotes (', ").

Implementation Details

  • Added lib/rules/no-smart-quotes.ts (type: 'layout', fixable: 'code'):
    • Checks VText, VLiteral, string Literal, and TemplateElement nodes inside <template> using sourceCode.getText(node) (so HTML entities like &rsquo; and JS Unicode escapes like '\u2019' are not falsely reported).
    • Autofixes each smart quote character in-place with proper escaping for single/double-quoted JS string literals (\', \") and HTML attribute values (&apos;, &quot;).
  • Added unit tests in tests/lib/rules/no-smart-quotes.test.ts covering valid and invalid cases (mustache expressions, template literals, VText, VLiteral with single/double/unquoted attributes, HTML entities, Unicode escapes, HTML comments, and <script> blocks).
  • Added rule documentation in docs/rules/no-smart-quotes.md and changeset in .changeset/no-smart-quotes.md.
  • Ran npm run update to update lib/plugin.ts, lib/configs/no-layout-rules.ts, and docs/rules/index.md.

Test Results

  • npx vitest run tests/lib/rules/no-smart-quotes.test.ts tests/lib/meta.test.ts tests/lib/autofix.test.ts: 3 test files passed, 18 tests passed.
  • npm run build: passed.
  • npm run tsc: passed (0 errors).
  • npm run lint: passed (0 errors).

@changeset-bot

changeset-bot Bot commented Nov 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0c250d5

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 Minor

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No smart quotes

1 participant