Sublime 3 plugin that provides refactoring support for JavaScript
sublime-javascript-refactor simplifies ES6 Module and CommonJS refactoring, by allowing you to rename or move any file within your project and have all references updated automatically.
sublime-javascript-refactor allows you to rename a file, and all referencing Modules will be updated with new path.
For example, given the following file:
src/animals.js
import cat from './meow';
Let's rename the file src/meow.js to src/kitten.js.
src/animals.js is transformed to
import cat from './kitten';
sublime-javascript-refactor also updates all locally referenced Modules inside of the moved file.
For example, given the following files:
src/meow.js
import { RAINBOW } from '../constants';
src/animals.js
import cat from './meow';
Let's move the file src/meow.js to src/city-kitty/meow.js.
src/city-kitty/meow.js is transformed to
import { RAINBOW } from '../../constants';
src/animals.js is transformed to
import cat from './city-kitty/meow';
Using the TreeView, Right click on any .js file or directory to expose the Rename (with refactor support) option. Selecting this option will open a modal that will allow you to update the file name or path. Pressing Enter Key will apply the file rename/move and then run a codemod on the root folder.
Note: there currently is no support for Drag and Drop.
TODO
> cd sublime-javascript-refactor
> npm i
TODO