npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mysten/prettier-plugin-move

v0.2.2

Published

Move Plugin for Prettier

Downloads

1,039

Readme

Prettier Move Plugin

This is a Move language plugin for the Prettier code formatter. It uses a Move parser built on top of the tree-sitter parser generator and maintained by Tim Zakian.

The plugin is platform-independent by utilizing a WASM-ified version of the Move parser included in this repository at (./tree-sitter-move.wasm). You can re-generate the WASM-ified version of the parser by running the scripts/treesitter-wasm-gen.sh script (prerequisites for this are listed in the script itself). You should be careful when doing so, as certain changes to the parser may break the plugin (e.g., if parse tree node types are modified).

Prerequisites

Requires nodejs 18+ installed.

Usage (Global, CLI)

For CLI usage, you can install the plugin globally by running the following command:

npm i -g prettier @mysten/prettier-plugin-move

Then there will be a registered executable prettier-move which works exactly like a regular prettier one, except that it automatically inserts the path to the plugin as an argument.

prettier-move -c sources/example.move # to check
prettier-move -w sources/example.move # to write

This command is identical to the following:

prettier --plugin /path/to/local/npm/node_modules/@mysten/prettier-plugin-move/out/index.js -c sources/example.move # to check
prettier --plugin /path/to/local/npm/node_modules/@mysten/prettier-plugin-move/out/index.js -w sources/example.move # to write

Installation (Per-Project)

If you decide to use the plugin per-project, you can install it in the project's directory. This way, the plugin will be available via prettier call in the project's directory.

# install as a dev-dependency
npm i -D prettier @mysten/prettier-plugin-move

Add the .prettierrc or a similar configuration file (see all supported formats):

{
	"printWidth": 100,
	"tabWidth": 4,
	"useModuleLabel": true,
	"autoGroupImports": "module",
	"plugins": ["@mysten/prettier-plugin-move"]
}

Then you can run prettier either via adding a script to package.json:

{
	"scripts": {
		"prettier": "prettier --write ."
	}
}
npm run prettier -w sources/example.move

Or, if you have prettier installed globally, you can run it directly:

prettier --write sources/example.move

VSCode integration

There is a bundled Move Formatter extension for VSCode. It will detect prettier configuration for the workspace and use the plugin automatically.

Alternatively, if you follow the per-project installation, regular Pretter extension should work as well.

Known Integrations

Contribute

See CONTRIBUTING.