Skip to content

Commit 2c6077e

Browse files
committed
feature: @putout/processor-html: no semicolon
1 parent cfa9ce5 commit 2c6077e

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

packages/processor-html/lib/html.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@ export const merge = (rawSource, [first]) => fromJS(first).replaceAll('className
1919
const SUFFIX = ';\n';
2020

2121
function fromJS(source) {
22+
if (!source.endsWith(SUFFIX))
23+
return source;
24+
2225
return source.slice(0, -SUFFIX.length);
2326
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
<ul data-name="menu" class="menu menu-hidden" "=" ">
3+
</ul>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<ul data-name="menu" class="menu menu-hidden" "="">
2+
</ul>

packages/processor-html/test/html.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ test('putout: processor: html: class', async ({process}) => {
2626
}],
2727
]);
2828
});
29+
30+
test('putout: processor: html: semicolon', async ({process}) => {
31+
await process('no-semicolon');
32+
});

0 commit comments

Comments
 (0)