Skip to content

Commit

Permalink
feature: @putout/plugin-convert-const-to-let: exclude: declare
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Jun 22, 2024
1 parent fbc82dc commit 798a45c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ module.exports.fix = (path) => {

module.exports.traverse = ({push}) => ({
VariableDeclaration: (path) => {
for (const binding of values(path.scope.bindings)) {
const {scope} = path;
const {declare} = path.node;

if (declare)
return;

for (const binding of values(scope.bindings)) {
const {parentPath, node} = binding.path;
const {init} = node;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ test('plugin-convert-const-to-let: no report: no-reassign', (t) => {
t.end();
});

test('plugin-convert-const-to-let: no report: declare', (t) => {
t.noReport('declare');
t.end();
});

test('plugin-convert-const-to-let: transform: split-variable-declarations', (t) => {
t.transform('split-variable-declarations', {
'split-variable-declaration': splitVariableDeclarations,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare const skip: typeof test;

0 comments on commit 798a45c

Please sign in to comment.