Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[language server] Apply codefix to all files #33195

Open
5 tasks done
anka-213 opened this issue Sep 2, 2019 · 1 comment
Open
5 tasks done

[language server] Apply codefix to all files #33195

anka-213 opened this issue Sep 2, 2019 · 1 comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@anka-213
Copy link

anka-213 commented Sep 2, 2019

Search Terms

  • File is a CommonJS module; it may be converted to an ES6 module.
  • Apply codefixes to all files (vscode, visual studio code)
  • Convert all files from CommonJS to ES6

Suggestion

I would like to have some way to apply a specific codefix to all files in a directory. For example, convert a bunch of files from CommonJS format to the new ES6 module format using the codefix here.

Use Cases

I have a few hundred files in CommonJS module format that I want to convert to ES6 module syntax (export/import instead of exports/require).

Currently, my text editor (vscode) shows after some delay three dots at the top of the current file which, when hovered over with the mouse shows after a few more seconds delay a "quickFix" button that, when clicked, causes the current file to be converted. To convert all of my files with this method would take hours of tedious clicking.

I want some method of automating this process.

Examples

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.
@sandersn sandersn added the Suggestion An idea for TypeScript label Sep 3, 2019
@sandersn
Copy link
Member

sandersn commented Sep 3, 2019

There are a number of external tools that do this, like https://github.com/JoshuaKGoldberg/TypeStat, so you may be able to use one of those for now.

@sandersn sandersn added the Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature label Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants