Skip to content

Commit

Permalink
feature: @putout/plugin-remove-unused-expressions: use client: exclude (
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Jun 26, 2024
1 parent 936bc8d commit cb3b146
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/plugin-remove-unused-expressions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-remove-unused-expressions.svg?style=flat&longCache=true
[NPMURL]: https://npmjs.org/package/@putout/plugin-remove-unused-expressions"npm"

🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove `unused expressions`.
🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove `unused expressions`, excluding directives: [`use strict`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) and [`use client`](https://react.dev/reference/rsc/use-client).

## Install

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ module.exports.traverse = ({push}) => ({
if (path.node.value === 'use strict')
return;

if (path.node.value === 'use client')
return;

push(path.parentPath);
},
ExpressionStatement(path) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'use client';
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,8 @@ test('remove unused expression: no report: iife', (t) => {
t.noReport('iife');
t.end();
});

test('remove unused expression: no report: use-client', (t) => {
t.noReport('use-client');
t.end();
});

0 comments on commit cb3b146

Please sign in to comment.