Movatterモバイル変換


[0]ホーム

URL:


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: AddignorePattern tono-v-html#2857

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@lucaswerkmeister
Copy link
Contributor

This allows configuring the rule such that certain variables are allowed inv-html=. For instance, we would like to allowlist variables named “*Html” (as in the test), where the name already marks them as containing safe HTML that’s expected to be used withv-html=.


I tried to follow existing code style in here, but still, this is my first time contributing to any eslint plugin (I think), so let me know if anything needs to be changed or improved :) the option name mimics e.g.no-unused-vars but could of course be changed. (Also, I’m not completely sure if it’s correct that the option value seems to require slashes around it in order to not be interpreted as a literal string.)

@changeset-bot
Copy link

changeset-botbot commentedJul 29, 2025
edited
Loading

🦋 Changeset detected

Latest commit:18fc869

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

This PR includes changesets to release 1 package
NameType
eslint-plugin-vueMinor

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 allows configuring the rule such that certain variables are allowedin v-html=. For instance, we would like to allowlist variables named“*Html” (as in the test), where the name already marks them ascontaining safe HTML that’s expected to be used with v-html=.
@lucaswerkmeister
Copy link
ContributorAuthor

(Also, I’m not completely sure if it’s correct that the option value seems to require slashes around it in order to not be interpreted as a literal string.)

Huh, apparentlyvue/no-unused-vars just usesnew RegExp(ignorePattern, 'u') rather than thetoRegExp helper. (I found thetoRegExp helper in some other rule, don’t remember which one.)

wmfgerrit pushed a commit to wikimedia/mediawiki-extensions that referenced this pull requestJul 29, 2025
* Update Wikibase from branch 'master'  to 47afac06a696e77eac205da4c5df7ce3fdd07e87  - Disable vue/no-v-html rule in wbui2025 directory        The v-html directive is part of our expected workflow for reusing    server-rendered HTML (property links, snak values; see the upcoming ADR    of T399832). As such, this eslint rule is not currently useful for us.    If eslint adds the ignorePattern (or similar) option suggested in [1],    then we may later use it again (but note that this will require us to    upgrade to the latest version of eslint-plugin-vue first).        [1]:vuejs/eslint-plugin-vue#2857        Change-Id: I8926d09a67927dc36b0bd5cfdb3e5c6a7256842e
wmfgerrit pushed a commit to wikimedia/mediawiki-extensions-Wikibase that referenced this pull requestJul 29, 2025
The v-html directive is part of our expected workflow for reusingserver-rendered HTML (property links, snak values; see the upcoming ADRofT399832). As such, this eslint rule is not currently useful for us.If eslint adds the ignorePattern (or similar) option suggested in [1],then we may later use it again (but note that this will require us toupgrade to the latest version of eslint-plugin-vue first).[1]:vuejs/eslint-plugin-vue#2857Change-Id: I8926d09a67927dc36b0bd5cfdb3e5c6a7256842e
Copy link
Member

@FloEdelmannFloEdelmann left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! I have some suggestions / requested changes.

lucaswerkmeisterand others added3 commitsJuly 29, 2025 19:29
@lucaswerkmeister
Copy link
ContributorAuthor

lucaswerkmeister commentedJul 30, 2025
edited
Loading

(I’ve been adding commits under the assumption that you’ll squash them on merge and throw away the intermediate commit messages – let me know if you’d like the Git history cleaned up into a version that would be suitable for a merge commit ^^)

FloEdelmann reacted with thumbs up emoji

Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds anignorePattern configuration option to theno-v-html ESLint rule, allowing developers to allowlist variables with names matching a specific pattern for use with thev-html directive. This enables safer use ofv-html when variables are intentionally named to indicate they contain safe HTML content.

  • AddsignorePattern option to rule schema that accepts a regex pattern string
  • Implements logic to skip reporting violations when variable names match the configured pattern
  • Updates documentation with configuration examples and usage guidelines

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
lib/rules/no-v-html.jsImplements the ignorePattern option with regex matching logic
tests/lib/rules/no-v-html.jsAdds test cases for valid and invalid usage with ignorePattern option
docs/rules/no-v-html.mdDocuments the new ignorePattern option with configuration examples
docs/rules/no-v-text.mdAdds related rules section for cross-referencing
docs/rules/no-v-text-v-html-on-component.mdAdds related rules section for cross-referencing
.changeset/purple-lights-invite.mdDocuments the feature addition for changelog

lucaswerkmeister reacted with confused emoji
Copy link
Member

@FloEdelmannFloEdelmann left a comment

Choose a reason for hiding this comment

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

Thank you for patiently implementing my feedback! 🙂
Looks good to me now 🙂

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@waynzhwaynzh left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks you!

@waynzhwaynzh merged commita198b52 intovuejs:masterAug 1, 2025
4 checks passed
@github-actionsgithub-actionsbot mentioned this pull requestAug 1, 2025
@lucaswerkmeisterlucaswerkmeister deleted the no-v-html-ignorePattern branchAugust 1, 2025 09:59
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@FloEdelmannFloEdelmannFloEdelmann approved these changes

Copilot code reviewCopilotCopilot left review comments

@waynzhwaynzhwaynzh approved these changes

@ota-meshiota-meshiAwaiting requested review from ota-meshi

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@lucaswerkmeister@FloEdelmann@waynzh

[8]ページ先頭

©2009-2025 Movatter.jp