All Projects → madskristensen → Javascriptprettier

madskristensen / Javascriptprettier

Licence: other
A Visual Studio extension

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Javascriptprettier

Typescript Express Starter
🚀 TypeScript Express Starter
Stars: ✭ 238 (+101.69%)
Mutual labels:  prettier, formatter
prettier-check
Check that all files match prettier code style.
Stars: ✭ 54 (-54.24%)
Mutual labels:  formatter, prettier
plugin-pug
Prettier Pug Plugin
Stars: ✭ 163 (+38.14%)
Mutual labels:  formatter, prettier
Poetic
Automatically install and maintain ESLint, Prettier, EditorConfig and Airbnb rules for JavaScript, TypeScript and React.
Stars: ✭ 165 (+39.83%)
Mutual labels:  prettier, formatter
Prettier Atom
An atom package for the prettier formatter.
Stars: ✭ 750 (+535.59%)
Mutual labels:  prettier, formatter
Prettier Plugin Csharp
Prettier C# Plugin
Stars: ✭ 224 (+89.83%)
Mutual labels:  prettier, formatter
csharpier
CSharpier is an opinionated code formatter for c#.
Stars: ✭ 337 (+185.59%)
Mutual labels:  formatter, prettier
pre-commit-hooks
Standardizing our code quality tooling 🛠️
Stars: ✭ 44 (-62.71%)
Mutual labels:  formatter, prettier
Prettier Eslint Cli
CLI for prettier-eslint
Stars: ✭ 451 (+282.2%)
Mutual labels:  prettier, formatter
Prettier Eslint
Code ➡️ prettier ➡️ eslint --fix ➡️ Formatted Code ✨
Stars: ✭ 3,435 (+2811.02%)
Mutual labels:  prettier, formatter
Spotless
Keep your code spotless
Stars: ✭ 2,285 (+1836.44%)
Mutual labels:  prettier, formatter
Parallel Prettier
Concurrent prettier runner
Stars: ✭ 84 (-28.81%)
Mutual labels:  prettier, formatter
Pettier
Prettier config that randomizes options and arbitrarily switches between spaces and tabs 🙄
Stars: ✭ 149 (+26.27%)
Mutual labels:  prettier, formatter
Prettyhtml
💅 The formatter for the modern web https://prettyhtml.netlify.com/
Stars: ✭ 241 (+104.24%)
Mutual labels:  prettier, formatter
Prettier Plugin Apex
Code formatter for the Apex Programming Language
Stars: ✭ 138 (+16.95%)
Mutual labels:  prettier, formatter
prettier-eslint-atom
DEPRECATED IN FAVOR OF prettier-atom + ESLint integration
Stars: ✭ 64 (-45.76%)
Mutual labels:  formatter, prettier
Plugin Php
Prettier PHP Plugin
Stars: ✭ 1,243 (+953.39%)
Mutual labels:  prettier, formatter
Prettier
Prettier is an opinionated code formatter.
Stars: ✭ 41,411 (+34994.07%)
Mutual labels:  prettier, formatter
React Boilerplate
This project is deprecated. Please use CRA instead.
Stars: ✭ 88 (-25.42%)
Mutual labels:  prettier
Conf
Landing page for event React Conf Brazil
Stars: ✭ 104 (-11.86%)
Mutual labels:  prettier

JavaScript Prettier

Build status

Download this extension from the Marketplace or get the CI build.


Prettier is an opinionated JavaScript formatter inspired by refmt with advanced support for language features from ES2017, JSX, TypeScript and Flow. It removes all original styling and ensures that all outputted JavaScript conforms to a consistent style.

See the change log for changes and road map.

Features

  • Prettifies JavaScript or TypeScript files
  • Uses Prettier node module
    • If a version of Prettier can be found installed via npm locally (relative to the current file), it will be used.
    • If no local Prettier installation is found, the extension falls back to an embedded Prettier.
  • Reads the standard Prettier configuration file

Prettify

This extension calls the Prettier node module behind the scenes to format any JavaScript document to its standards.

For example, take the following code:

foo(arg1, arg2, arg3, arg4);

That looks like the right way to format it. However, we've all run into this situation:

foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());

Suddenly our previous format for calling function breaks down because this is too long. What you would probably do is this instead:

foo(
  reallyLongArg(),
  omgSoManyParameters(),
  IShouldRefactorThis(),
  isThereSeriouslyAnotherOne()
);

Invoke the command from the context menu in the JavaScript editor.

Context Menu

FAQ

Updating from 1.1 to 2.0

Depending on your Visual Studio Configuration, you might experience that 2.0's output differs from the one you got with 1.1.

Most likely it is the tab size that has been changed from 4 spaces to 2. Please read the configuration section below on details how to get 4 spaces as tabsize.

Configuration via .prettierrc

It is quite easy to setup Prettier to format a little bit differently, like having 4 spaces instead of 2 spaces per tab.

The easiest way is to create a .prettierrc file in your project root.

Here is an example containing the two most common settings that people want to change: tabWidth is how many spaces it uses for indentation, and printWidth is how long a line can be before it breaks down:

  {
    "tabWidth": 4,
    "printWidth": 100
  }

Read more about Prettier configuration options here.

Settings

Access extension settings within Visual Studio via Tools >>> Options, Prettier.

  1. Format on Save
    • If true, run Prettier whenever a JavaScript file is saved.
    • (Try setting to true. This is where the magic happens, instantly snapping your code into place! Never fret with whitespace again!)
  2. Prettier version for embedded usage:
    • If your solution does not have a local version of Prettier installed via npm, the extension will attempt to download and use the version noted here.
    • Extension will download a requested version once and reuse that now embedded Prettier install until the setting requests another version.
    • If the version declared cannot be found via npm, the extension will revert to 2.2.1, a known good Prettier version.
    • NOTE: To preserve legacy behavior, note that previous 2.x versions of this extension used Prettier 1.12.1.

Can it use my bundled version of Prettier?

Yes, the plugin will search for a locally (relative to the open file) installed Prettier version before falling back to its own version.

It does not currently support using a globally installed version of Prettier, and will use its embedded version instead.

Contribute

Check out the contribution guidelines if you want to contribute to this project.

For cloning and building this project yourself, make sure to install the Extensibility Tools 2015 extension for Visual Studio which enables some features used by this project.

License

Apache 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].