From 901d3fea30ee1e6193b60fe2965041273859a123 Mon Sep 17 00:00:00 2001 From: Gavyn McKenzie Date: Fri, 12 Nov 2021 11:46:55 +0000 Subject: [PATCH 1/5] feat: add labelComponents option to form control has label --- CHANGELOG.md | 4 ++++ docs/form-control-has-label.md | 17 +++++++++++++++++ package.json | 2 +- src/rules/form-control-has-label.ts | 25 +++++++++++++++++-------- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c75fd0d..39ab6d34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +### Added + +- `labelComponents` options to add custom label components in `form-control-has-label` + ### Changed - Deprecate the accessible-emoji rule. See https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/627 for details. diff --git a/docs/form-control-has-label.md b/docs/form-control-has-label.md index 2865efa4..11cc8f5c 100644 --- a/docs/form-control-has-label.md +++ b/docs/form-control-has-label.md @@ -8,6 +8,23 @@ _References:_ ## Rule details +This rule takes one optional object argument of type object: + +```json +{ + "rules": { + "vuejs-accessibility/form-control-has-label": [ + "error", + { + "labelComponents": ["CustomLabel"], + } + ] + } +} +``` + +For the `labelComponents` option, these strings determine which elements (**always including** `