Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork698
Description
Checklist
- I have tried restarting my IDE and the issue persists.
- I have read theFAQ and my problem is not listed.
Tell us about your environment
- ESLint version: 9.39.1
- eslint-plugin-vue version: 10.5.1
- Vue version: 3.5.22
- Node version: 24.3.0
- Operating System: macOS
Please show your full configuration:
importjsfrom"@eslint/js";importtsfrom"typescript-eslint";importprettierConfigfrom"eslint-plugin-prettier/recommended";importglobalsfrom"globals";importvuefrom"eslint-plugin-vue";importvueA11yfrom"eslint-plugin-vuejs-accessibility";importstorybookfrom"eslint-plugin-storybook";constignoredFiles=[];exportdefault[{ignores:ignoredFiles},js.configs.recommended, ...ts.configs.recommendedTypeChecked, ...vue.configs["flat/recommended"], ...vueA11y.configs["flat/recommended"], ...storybook.configs["flat/recommended"],prettierConfig,{languageOptions:{parserOptions:{ecmaVersion:2020,parser:ts.parser,sourceType:"module",project:["./tsconfig.json"],extraFileExtensions:[".vue"],},globals:{ ...globals.browser, ...globals.node,},},},{rules:{"prettier/prettier":"error","no-console":"error",eqeqeq:"error","@typescript-eslint/consistent-type-imports":"error","@typescript-eslint/no-import-type-side-effects":"error","@typescript-eslint/no-unused-vars":["error",{argsIgnorePattern:"^_",varsIgnorePattern:"^_",caughtErrorsIgnorePattern:"^_",},],"vue/no-v-html":["error",{ignorePattern:"/^\$sanitize\(/",},],},},];
What did you do?
<template> <divv-html="$sanitize(contentHtml)"></div></template>
I configured thevue/no-v-html rule with anignorePattern option to ignore v-html usage when the content is sanitized using$sanitize() function.
What did you expect to happen?
TheignorePattern option should work consistently both in VS Code and when running ESLint via CLI. When using the pattern/^\\$sanitize\\(/, it should properly ignore the v-html usage for expressions starting with$sanitize( without causing syntax errors.
What actually happened?
There are two different behaviors depending on how the regular expression is written:
With pattern
/^\$sanitize\(/:- VS Code shows no lint errors (works correctly in IDE)
- CLI execution fails with syntax error:
SyntaxError: Error while loading rule 'vue/no-v-html': Invalid regular expression: //^$sanitize(//u: Unterminated group
With pattern
/^\\$sanitize\\(/:- CLI execution works without errors
- VS Code still shows lint errors for the ignored pattern (ignorePattern not working in IDE)
TheignorePattern option behaves inconsistently between VS Code extension and CLI execution, and proper escaping of the regular expression seems to cause different issues in different environments.
Repository to reproduce this issue