From 91f25b7be22190e54f0a6f5a2bc89fa823dbd3ed Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Fri, 1 Apr 2022 11:49:09 -0400 Subject: [PATCH] add documentation Signed-off-by: Sebastian Malton --- docs/rules/jsx-tag-spacing.md | 49 +++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/docs/rules/jsx-tag-spacing.md b/docs/rules/jsx-tag-spacing.md index fbf47aea8d..9651370a54 100644 --- a/docs/rules/jsx-tag-spacing.md +++ b/docs/rules/jsx-tag-spacing.md @@ -62,7 +62,7 @@ Examples of **correct** code for this rule, when configured with `{ "closingSlas ### `beforeSelfClosing` -This check can be set to `"always"`, `"never"` or `"allow"` (to disable it). +This check can be set to `"always"`, `"never"`, `"multiline-always"`, or `"allow"` (to disable it). If it is `"always"`, the check warns whenever a space is missing before the closing bracket. If `"never"` then it warns if a space is present before the closing bracket. The default value of this check is `"always"`. @@ -102,6 +102,26 @@ Examples of **correct** code for this rule, when configured with `{ "beforeSelfC /> ``` +Examples of **incorrect** code for this rule, when configured with `{ "beforeSelfClosing": "multiline-always" }`: + +```jsx + + +``` + +Examples of **correct** code for this rule, when configured with `{ "beforeSelfClosing": "multiline-always" }`: + +```jsx + +``` + ### `afterOpening` This check can be set to `"always"`, `"never"`, `"allow-multiline"` or `"allow"` (to disable it). @@ -179,7 +199,7 @@ Examples of **correct** code for this rule, when configured with `{ "afterOpenin ### `beforeClosing` -This check can be set to `"always"`, `"never"`, or `"allow"` (to disable it). +This check can be set to `"always"`, `"never"`, `"multiline-always"`, or `"allow"` (to disable it). If it is `"always"` the check warns whenever whitespace is missing before the closing bracket of a JSX opening element or whenever a space is missing before the closing bracket closing element. If `"never"`, then it warns if a space is present before the closing bracket of either a JSX opening element or closing element. This rule will never warn for self closing JSX elements. The default value of this check is `"allow"`. @@ -219,6 +239,31 @@ Examples of **correct** code for this rule, when configured with `{ "beforeClosi ``` +Examples of **incorrect** code for this rule, when configured with `{ "beforeClosing": "multiline-always" }`: + +```jsx + + + + Goodbye + +``` + +Examples of **correct** code for this rule, when configured with `{ "beforeClosing": "multiline-always" }`: + +```jsx + + Goodbye + +``` + ## When Not To Use It You can turn this rule off if you are not concerned with the consistency of spacing in or around JSX brackets.