Skip to content

Commit d80ebed

Browse files
committed
feature: @putout/plugin-remove-unreachable-code: report
1 parent 2f989d0 commit d80ebed

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

packages/plugin-remove-unreachable-code/lib/remove-unreachable-code.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const {
1111

1212
const not = (fn) => (...a) => !fn(...a);
1313

14-
module.exports.report = () => `Unreachable code`;
14+
module.exports.report = () => `Avoid unreachable code`;
1515

1616
module.exports.fix = ({siblings}) => {
1717
siblings.map(remove);

packages/plugin-remove-unreachable-code/test/fixture/backtrack-normal.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function fun3(f) {
88
return 3;
99
return 5;
1010
return 7;
11+
return 9;
1112
}
1213

1314
fun3(x3);

packages/plugin-remove-unreachable-code/test/remove-unreachable-code.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const test = createTest(__dirname, {
1010
});
1111

1212
test('plugin-remove-unreachable-code: report: return', (t) => {
13-
t.report('return', 'Unreachable code');
13+
t.report('return', 'Avoid unreachable code');
1414
t.end();
1515
});
1616

@@ -45,7 +45,12 @@ test('plugin-remove-unreachable-code: transform: backtrack-normal', (t) => {
4545
});
4646

4747
test('plugin-remove-unreachable-code: report: backtrack-normal', (t) => {
48-
t.report('backtrack-normal', ['Unreachable code', 'Unreachable code', 'Unreachable code']);
48+
t.report('backtrack-normal', [
49+
'Avoid unreachable code',
50+
'Avoid unreachable code',
51+
'Avoid unreachable code',
52+
'Avoid unreachable code',
53+
]);
4954
t.end();
5055
});
5156

0 commit comments

Comments
 (0)