@@ -76,8 +76,8 @@ module.exports = {
7676
7777 fixable : "code" ,
7878 messages : {
79- replaced : "Assignment (=) can be replaced with operator assignment ({{operator}})." ,
80- unexpected : "Unexpected operator assignment ({{operator}}) shorthand."
79+ replaced : "Assignment (=) can be replaced with operator assignment ({{operator}}= )." ,
80+ unexpected : "Unexpected operator assignment ({{operator}}= ) shorthand."
8181 }
8282 } ,
8383
@@ -109,13 +109,11 @@ module.exports = {
109109 const operator = expr . operator ;
110110
111111 if ( isCommutativeOperatorWithShorthand ( operator ) || isNonCommutativeOperatorWithShorthand ( operator ) ) {
112- const replacementOperator = `${ operator } =` ;
113-
114112 if ( astUtils . isSameReference ( left , expr . left , true ) ) {
115113 context . report ( {
116114 node,
117115 messageId : "replaced" ,
118- data : { operator : replacementOperator } ,
116+ data : { operator } ,
119117 fix ( fixer ) {
120118 if ( canBeFixed ( left ) && canBeFixed ( expr . left ) ) {
121119 const equalsToken = getOperatorToken ( node ) ;
@@ -128,7 +126,7 @@ module.exports = {
128126 return null ;
129127 }
130128
131- return fixer . replaceText ( node , `${ leftText } ${ replacementOperator } ${ rightText } ` ) ;
129+ return fixer . replaceText ( node , `${ leftText } ${ expr . operator } = ${ rightText } ` ) ;
132130 }
133131 return null ;
134132 }
@@ -143,7 +141,7 @@ module.exports = {
143141 context . report ( {
144142 node,
145143 messageId : "replaced" ,
146- data : { operator : replacementOperator }
144+ data : { operator }
147145 } ) ;
148146 }
149147 }
0 commit comments