@@ -90,7 +90,7 @@ export function getAllRules(): RuleSpec[] {
9090 rule ( "IgnoreAfterLineComment" , SyntaxKind . SingleLineCommentTrivia , anyToken , anyContext , RuleAction . StopProcessingSpaceActions ) ,
9191
9292 rule ( "NotSpaceBeforeColon" , anyToken , SyntaxKind . ColonToken , [ isNonJsxSameLineTokenContext , isNotBinaryOpContext , isNotTypeAnnotationContext ] , RuleAction . DeleteSpace ) ,
93- rule ( "SpaceAfterColon" , SyntaxKind . ColonToken , anyToken , [ isNonJsxSameLineTokenContext , isNotBinaryOpContext ] , RuleAction . InsertSpace ) ,
93+ rule ( "SpaceAfterColon" , SyntaxKind . ColonToken , anyToken , [ isNonJsxSameLineTokenContext , isNotBinaryOpContext , isNextTokenParentNotJsxNamespacedName ] , RuleAction . InsertSpace ) ,
9494 rule ( "NoSpaceBeforeQuestionMark" , anyToken , SyntaxKind . QuestionToken , [ isNonJsxSameLineTokenContext , isNotBinaryOpContext , isNotTypeAnnotationContext ] , RuleAction . DeleteSpace ) ,
9595 // insert space after '?' only when it is used in conditional operator
9696 rule ( "SpaceAfterQuestionMarkInConditionalOperator" , SyntaxKind . QuestionToken , anyToken , [ isNonJsxSameLineTokenContext , isConditionalOperatorContext ] , RuleAction . InsertSpace ) ,
@@ -179,6 +179,8 @@ export function getAllRules(): RuleSpec[] {
179179 rule ( "NoSpaceBeforeGreaterThanTokenInJsxOpeningElement" , SyntaxKind . SlashToken , SyntaxKind . GreaterThanToken , [ isJsxSelfClosingElementContext , isNonJsxSameLineTokenContext ] , RuleAction . DeleteSpace ) ,
180180 rule ( "NoSpaceBeforeEqualInJsxAttribute" , anyToken , SyntaxKind . EqualsToken , [ isJsxAttributeContext , isNonJsxSameLineTokenContext ] , RuleAction . DeleteSpace ) ,
181181 rule ( "NoSpaceAfterEqualInJsxAttribute" , SyntaxKind . EqualsToken , anyToken , [ isJsxAttributeContext , isNonJsxSameLineTokenContext ] , RuleAction . DeleteSpace ) ,
182+ rule ( "NoSpaceBeforeJsxNamespaceColon" , SyntaxKind . Identifier , SyntaxKind . ColonToken , [ isNextTokenParentJsxNamespacedName ] , RuleAction . DeleteSpace ) ,
183+ rule ( "NoSpaceAfterJsxNamespaceColon" , SyntaxKind . ColonToken , SyntaxKind . Identifier , [ isNextTokenParentJsxNamespacedName ] , RuleAction . DeleteSpace ) ,
182184
183185 // TypeScript-specific rules
184186 // Use of module as a function call. e.g.: import m2 = module("m2");
@@ -749,13 +751,23 @@ function isJsxExpressionContext(context: FormattingContext): boolean {
749751}
750752
751753function isNextTokenParentJsxAttribute ( context : FormattingContext ) : boolean {
752- return context . nextTokenParent . kind === SyntaxKind . JsxAttribute ;
754+ return context . nextTokenParent . kind === SyntaxKind . JsxAttribute || (
755+ context . nextTokenParent . kind === SyntaxKind . JsxNamespacedName && context . nextTokenParent . parent . kind === SyntaxKind . JsxAttribute
756+ ) ;
753757}
754758
755759function isJsxAttributeContext ( context : FormattingContext ) : boolean {
756760 return context . contextNode . kind === SyntaxKind . JsxAttribute ;
757761}
758762
763+ function isNextTokenParentNotJsxNamespacedName ( context : FormattingContext ) : boolean {
764+ return context . nextTokenParent . kind !== SyntaxKind . JsxNamespacedName ;
765+ }
766+
767+ function isNextTokenParentJsxNamespacedName ( context : FormattingContext ) : boolean {
768+ return context . nextTokenParent . kind === SyntaxKind . JsxNamespacedName ;
769+ }
770+
759771function isJsxSelfClosingElementContext ( context : FormattingContext ) : boolean {
760772 return context . contextNode . kind === SyntaxKind . JsxSelfClosingElement ;
761773}
0 commit comments