Skip to content

Commit 8b62a1e

Browse files
committed
feature: @putout/plugin-apply-consistent-blocks: leadingComments: exclude
1 parent 7d2324a commit 8b62a1e

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

packages/plugin-conditions/lib/apply-consistent-blocks/fixture/comment.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ if (noTrailingComment(path) && (length > 1 || manyLines))
77

88
// maybe.print(index !== n || trailingComma, ',');
99
const a = 5;
10+
11+
if (CloudCmd.config('menu') === 'aleman') {
12+
//const {createMenu} = await import(`https://esm.sh/[email protected]/menu?alias=putout:@putout/bundle`);
13+
return createMe;
14+
}

packages/plugin-conditions/lib/apply-consistent-blocks/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ export const filter = (path) => {
7878

7979
if (isVariableDeclaration(first))
8080
continue;
81+
82+
if (first.leadingComments?.length)
83+
continue;
8184
}
8285

8386
blocks.push(is);

packages/plugin-conditions/lib/apply-consistent-blocks/index.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ test('putout: apply-consistent-blocks: no report: consequent', (t) => {
6767
t.end();
6868
});
6969

70+
test('putout: apply-consistent-blocks: no report: comment', (t) => {
71+
t.noReport('comment');
72+
t.end();
73+
});
74+
7075
test('putout: apply-consistent-blocks: no report after transform: nested', (t) => {
7176
t.noReportAfterTransform('nested');
7277
t.end();

0 commit comments

Comments
 (0)