ts-refactor
TypeScript icon, indicating that this package has built-in type declarations

0.0.11 • Public • Published

Build Status

CLI interactive TypeScript refactor tool.

WIP / RESEARCH

Examples

Organize imports

npx ts-refactor organizeImports \"src/**/*.ts*\" \"spec/**/*.ts*\" \"probes/**/*.ts*\" --dontAsk

Format code

npx ts-refactor format \"src/**/*.ts*\" \"spec/**/*.ts*\" \
  \"probes/**/*.ts*\" ./formatCodeSettings.json --tsConfigPath \
  ./tsconfig.json --dontAsk

TODO / STATUS / ROADMAP

TODO.md

Design first thoughts (OLD)

interactive

  • all arguments are optional, if not provided they will be inquired

Example:

$ ts-refactor fix src/foo/bar.ts
Choose a fix for src/foo/bar.ts:
 · implement interface
 · fix missing imports
 · infer type form usage  # <-- user select this one  
Select code to fix: # (1) 
 · Parameter Foo#bar#param1
 · Variable foo
 

categorized fixes

convert

it will convert code that is not necessarily incorrect to an equivalent code.

Examples: remove/add braces to arrow functions, convert namespaced imports to named imports (and vice versa)

fix

it will fix an existing error.

Examples: implement interface, fix missing imports, etc

move

remove

file, declarations like classes, interfaces, functions, variable, parameters, etc.

rename

renames a file or declaration or variable, etc

easy CLI

ts-refactor convert organizeImports src/foo/foo.ts ts-refactor move declaration FooImpl src/foo/impl.ts src/bar/bar.ts

Package Sidebar

Install

npm i ts-refactor

Weekly Downloads

4

Version

0.0.11

License

MIT

Unpacked Size

92.3 kB

Total Files

58

Last publish

Collaborators

  • cancerberosgx