"vue/no-deprecated-slot-attribute" doesn't accept any properties
Closed this issue ยท 7 comments
Checklist
- I have tried restarting my IDE and the issue persists.
- I have read the FAQ and my problem is not listed.
Tell us about your environment
- ESLint version: 9.31.0
- eslint-plugin-vue version: 10.3.0
- Vue version: 3.5.16
- Node version: 22.13.0
- Operating System: MacOS (issue also is present on Windows 11)
Please show your full configuration:
eslint.config.ts
import { globalIgnores } from 'eslint/config';
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript';
import pluginVue from 'eslint-plugin-vue';
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
export default defineConfigWithVueTs(
{
name: 'app/files-to-lint',
files: ['**/*.{ts,mts,tsx,vue}'],
},
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
pluginVue.configs['flat/essential'],
vueTsConfigs.recommended,
skipFormatting,
{
rules: {
'vue/no-deprecated-slot-attribute': [
'error',
{
ignore: [/^shine-/], // also doesn't work when using a string
ignoreParents: [/^shine-/],
},
],
},
},
);What did you do?
<shine-dialog>
<div slot="header-text">{{ actionTextDialogHeader }}</div>
</shine-dialog>What did you expect to happen?
ESLint should run and allow the usage of the native slot attribute with all components starting with shine- and all its descendents.
What actually happened?
As per https://eslint.vuejs.org/rules/no-deprecated-slot-attribute, the rule accepts props, but an error occurs when running eslint:
Oops! Something went wrong! :(
ESLint: 9.31.0
Error: Key "rules": Key "vue/no-deprecated-slot-attribute":
Value {"ignore":["/^shine-/"],"ignoreParents":["/^shine-/"]} should NOT have additional properties.
Unexpected property "ignoreParents". Expected properties: "ignore".
Repository to reproduce this issue
git clone, npm i, npm run dev and npx eslint ./src/App.vue on this repo:
https://github.com/MaxGeldner/eslint-deprecated-slots-reproducer
ignoreParents was added in 9140c63
It's unreleased for now. Just wait for the release.
ignoreParentswas added in 9140c63It's unreleased for now. Just wait for the release.
Thanks for the clarification!
We were a little confused that it was already mentioned in the documentation. But then we'll wait.
I'll close the issue.
@MaxGeldner This is now available in v10.4.0.
It seems using RegExp doesn't work, whereas the documentation seems to allow it even with version 10.5.0.
"ignoreParents"(string[]) An array of tags or regular expression patterns (e.g./^custom-/) for parents that ignore these rules. This option is especially useful for Web-Components. Default is empty.
When I use this config,
'vue/no-deprecated-slot-attribute': ['error', { ignoreParents: [/^Prefix/] }]I get this error:
> eslint --max-warnings=0 --cache
Oops! Something went wrong! :(
ESLint: 9.35.0
Error: Key "rules": Key "vue/no-deprecated-slot-attribute":
Value {} should be string.
try "/^Prefix/" instead of /^Prefix/
Thank you, it is working.
I was not expecting this behavior when reading the documentation. Real RegExp should be allowed, IMHO.
PR welcome ๐