Atom Packages Directory

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

Nuclide Format Js

Install with:
    apm install nuclide-format-js
  

nuclide-format-js

Build Status

This feature is a collection of codemods that automatically clean up different aspects of code so that you do not have to worry about every little formatting detail. Right now all of the codemods live in src/common feature.

usage

The default keyboard shortcut for nuclide-format-js:format is cmd-shift-i.

codemods

requires

This collection of codemods automatically adds, removes, and formats your requires. It is primarily a heuristic that works by requiring identifiers that are being used that were not declared. It is also aware of Flow types and will properly promote type imports to requires, and demote requires to type imports when appropriate.

There are a few best practices that you should follow in order to get the most benefit out of these transforms:

js var React = require('react'); var {PropTypes} = React;

There are also a few things that are not supported yet that would be nice to support:

Right now the recommended set up is to not run-on-save and instead use the default keyboard shortcut.

Make sure to verify the requires that are added by this plugin and report any issues. If anything is getting in your way when using this plugin you can generally work around it by modifying the plugin’s settings. It’s possible to adjust things like built-ins, aliases, and even blacklist particular transforms there.

developing

```sh # Clone the repo git clone git@github.com:facebooknuclide/nuclide-format-js.git

cd nuclide-format-js

To use as an Atom package

apm link

Install dependencies and start the transpiler watcher

npm install npm run watch ```

releasing

```sh # Bump the version number npm version patch –no-git-tag-version

Commit the version bump

git add package.json git commit -m “$(node -p ‘require(“./package.json”).version’)”

Run the release script

./tools/release.sh

Follow the printed instructions if everything looks good

```

Keywords: codemod, javascript, jscodeshift Suggest keywords
Fork me on GitHub