Skip to content

Commit 23a03c2

Browse files
Merge pull request #81 from NullVoxPopuli/remove-uncessary-code
remove unnecessary code
2 parents 2daef64 + 114cbd1 commit 23a03c2

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/parser/transforms.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -566,21 +566,16 @@ module.exports.transformForLint = function transformForLint(code) {
566566
*/
567567
const result = processor.parse(code);
568568
for (const tplInfo of result.reverse()) {
569-
const specialChars = [...tplInfo.contents].reduce(
570-
(prev, curr) => (prev + ['`', '$'].includes(curr.codePointAt(0)) ? 1 : 0),
571-
0
572-
);
573569
const content = tplInfo.contents.replace(/`/g, '\\`').replace(/\$/g, '\\$');
574570
if (tplInfo.type === 'class-member') {
575571
const tplLength = tplInfo.range.end - tplInfo.range.start;
576-
const spaces =
577-
tplLength - byteLength(content) - 'static{`'.length - '`}'.length - specialChars;
572+
const spaces = tplLength - byteLength(content) - 'static{`'.length - '`}'.length;
578573
const total = content + ' '.repeat(spaces);
579574
const replacementCode = `static{\`${total}\`}`;
580575
jsCode = replaceRange(jsCode, tplInfo.range.start, tplInfo.range.end, replacementCode);
581576
} else {
582577
const tplLength = tplInfo.range.end - tplInfo.range.start;
583-
const spaces = tplLength - byteLength(content) - '`'.length - '`'.length - specialChars;
578+
const spaces = tplLength - byteLength(content) - '`'.length - '`'.length;
584579
const total = content + ' '.repeat(spaces);
585580
const replacementCode = `\`${total}\``;
586581
jsCode = replaceRange(jsCode, tplInfo.range.start, tplInfo.range.end, replacementCode);

0 commit comments

Comments
 (0)