Skip to content

Conversation

@danieldelcore
Copy link
Contributor

@changeset-bot
Copy link

changeset-bot bot commented May 9, 2023

🦋 Changeset detected

Latest commit: 4f7b5b5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@codeshift/mod-javascript Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

});

return output.code;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderaiser You'll probably be able to spot the issue instantly, but I keep running into this:

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const output = putout(file.source, {
    plugins: [
        ['remove-unused-variables', removeUnusedVariables]
    ]
});

Let's use full name remove-unused-variables :).

Copy link
Contributor Author

@danieldelcore danieldelcore May 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That worked thanks!!

Do you know of a way to preserve formatting via recast?
image

Copy link
Contributor

@coderaiser coderaiser May 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how recast works when it has a little code to work with 🤷. I usually fix this with eslint-plugin-putout which solves all formatting issues.

Anyways I’m working on @putout/printer which just makes good formatting each time, not trying to preserve anything. It is much easier in maintenance and faster then recast.

You can try it using:

const output = putout(file.source, {
    printer: 'putout',
    plugins: [
        'remove-unused-variables',
    ]
});

@danieldelcore danieldelcore merged commit 7e74584 into main Jun 1, 2023
@danieldelcore danieldelcore deleted the putout branch June 1, 2023 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants