From 257afca5882dcdd6fc732b49c9f3a325aed0e363 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 9 Jul 2025 23:25:04 +0200 Subject: [PATCH 1/7] feat(no-deprecated-slot-attribute): add ignoreParents option --- docs/rules/no-deprecated-slot-attribute.md | 37 +++++- lib/rules/no-deprecated-slot-attribute.js | 5 + lib/rules/syntaxes/slot-attribute.js | 22 +++- lib/utils/index.js | 2 +- .../lib/rules/no-deprecated-slot-attribute.js | 108 ++++++++++++++++++ 5 files changed, 168 insertions(+), 6 deletions(-) diff --git a/docs/rules/no-deprecated-slot-attribute.md b/docs/rules/no-deprecated-slot-attribute.md index df4575cc4..df9e3340b 100644 --- a/docs/rules/no-deprecated-slot-attribute.md +++ b/docs/rules/no-deprecated-slot-attribute.md @@ -43,16 +43,18 @@ This rule reports deprecated `slot` attribute in Vue.js v2.6.0+. ```json { "vue/no-deprecated-slot-attribute": ["error", { - "ignore": ["my-component"] + "ignore": ["my-component"], + "ignoreParents": ["my-web-component"], }] } ``` - `"ignore"` (`string[]`) An array of tags or regular expression patterns (e.g. `/^custom-/`) that ignore these rules. This option will check both kebab-case and PascalCase versions of the given tag names. Default is empty. +- `"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. This option will check both kebab-case and PascalCase versions of the given tag names. Default is empty. ### `"ignore": ["my-component"]` - + ```vue `, options: [{ ignore: ['/one/', '/^Two$/i', '/^my-.*/i'] }] + }, + { + code: ``, + options: [{ ignoreParents: ['LinkList'] }] + }, + { + code: ``, + options: [{ ignoreParents: ['/^Link/'] }] } ], invalid: [ @@ -732,6 +756,90 @@ tester.run('no-deprecated-slot-attribute', rule, { } ] }, + { + code: ` + `, + output: ` + `, + options: [ + { + ignoreParents: ['my-component'] + } + ], + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 9, + column: 16, + endLine: 9, + endColumn: 20 + } + ] + }, + { + code: ` + `, + output: ` + `, + options: [ + { + ignoreParents: ['/component$/'] + } + ], + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 9, + column: 16, + endLine: 9, + endColumn: 20 + } + ] + }, { code: `