@@ -90,7 +90,7 @@ export function getAllRules(): RuleSpec[] {
90
90
rule ( "IgnoreAfterLineComment" , SyntaxKind . SingleLineCommentTrivia , anyToken , anyContext , RuleAction . StopProcessingSpaceActions ) ,
91
91
92
92
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 ) ,
94
94
rule ( "NoSpaceBeforeQuestionMark" , anyToken , SyntaxKind . QuestionToken , [ isNonJsxSameLineTokenContext , isNotBinaryOpContext , isNotTypeAnnotationContext ] , RuleAction . DeleteSpace ) ,
95
95
// insert space after '?' only when it is used in conditional operator
96
96
rule ( "SpaceAfterQuestionMarkInConditionalOperator" , SyntaxKind . QuestionToken , anyToken , [ isNonJsxSameLineTokenContext , isConditionalOperatorContext ] , RuleAction . InsertSpace ) ,
@@ -179,6 +179,8 @@ export function getAllRules(): RuleSpec[] {
179
179
rule ( "NoSpaceBeforeGreaterThanTokenInJsxOpeningElement" , SyntaxKind . SlashToken , SyntaxKind . GreaterThanToken , [ isJsxSelfClosingElementContext , isNonJsxSameLineTokenContext ] , RuleAction . DeleteSpace ) ,
180
180
rule ( "NoSpaceBeforeEqualInJsxAttribute" , anyToken , SyntaxKind . EqualsToken , [ isJsxAttributeContext , isNonJsxSameLineTokenContext ] , RuleAction . DeleteSpace ) ,
181
181
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 ) ,
182
184
183
185
// TypeScript-specific rules
184
186
// Use of module as a function call. e.g.: import m2 = module("m2");
@@ -756,6 +758,14 @@ function isJsxAttributeContext(context: FormattingContext): boolean {
756
758
return context . contextNode . kind === SyntaxKind . JsxAttribute ;
757
759
}
758
760
761
+ function isNextTokenParentNotJsxNamespacedName ( context : FormattingContext ) : boolean {
762
+ return context . nextTokenParent . kind !== SyntaxKind . JsxNamespacedName ;
763
+ }
764
+
765
+ function isNextTokenParentJsxNamespacedName ( context : FormattingContext ) : boolean {
766
+ return context . nextTokenParent . kind === SyntaxKind . JsxNamespacedName ;
767
+ }
768
+
759
769
function isJsxSelfClosingElementContext ( context : FormattingContext ) : boolean {
760
770
return context . contextNode . kind === SyntaxKind . JsxSelfClosingElement ;
761
771
}
0 commit comments