Atom Packages Directory

a package directory for a text editor of the 21st Century

Javascript Refactor by Clint Ayres

Install with:
    apm install javascript-refactor
  

atom-javascript-refactor package

Build Status Coverage Status Dependency Status devDependency Status

Atom JavaScript ES6 Module and CommonJS refactoring support

atom-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.

atom-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

js import cat from './meow';

Let’s rename the file src/meow.js to src/kitten.js.

src/animals.js is transformed to

js import cat from './kitten';

atom-javascript-refactor also updates all locally referenced Modules inside of the moved file.

For example, given the following files:

src/meow.js

js import { RAINBOW } from '../constants';

src/animals.js

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

js import { RAINBOW } from '../../constants';

src/animals.js is transformed to

js import cat from './city-kitty/meow';

Usage

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.

Install

bash apm i javascript-refactor

Develop

bash > cd atom-javascript-refactor > npm i > apm link

Contribute

Keywords: refactor, rename, move, javascript, ide Suggest keywords
Fork me on GitHub