dprint
TypeScript and JSONC code formatter.
Last updated a month ago by dsherret .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install dprint 
SYNC missed versions from official npm registry.

dprint

npm version Build Status

TypeScript and JSONC code formatter.

Install

Install dprint and the plugins you want to use as a dev dependency.

For example:

yarn add --dev dprint dprint-plugin-typescript dprint-plugin-jsonc
# or
npm install --save-dev dprint dprint-plugin-typescript dprint-plugin-jsonc

Usage

Create a dprint.config.js file in the repo. Here's an example (you don't need to copy this... use your own config):

// @ts-check
const { TypeScriptPlugin } = require("dprint-plugin-typescript");
const { JsoncPlugin } = require("dprint-plugin-jsonc");

/** @type { import("dprint").Configuration } */
module.exports.config = {
    projectType: "openSource",
    lineWidth: 160,
    plugins: [
        new TypeScriptPlugin({
            useBraces: "preferNone",
            "tryStatement.nextControlFlowPosition": "sameLine"
        }),
        new JsoncPlugin({
            indentWidth: 2
        })
    ]
};

Add a format script to your package.json's "scripts" section (see npx dprint --help for usage):

{
  "name": "your-package-name",
  "scripts": {
    "format": "dprint \"**/*.{ts,tsx,json,js,jsx}\""
  }
}

Format:

yarn format
# or
npm run format

Current Tags

  • 0.12.0                                ...           latest (a month ago)

30 Versions

  • 0.12.0                                ...           a month ago
  • 0.11.1                                ...           2 months ago
  • 0.11.0                                ...           2 months ago
  • 0.10.0                                ...           2 months ago
  • 0.9.1                                ...           2 months ago
  • 0.9.0                                ...           4 months ago
  • 0.8.0                                ...           4 months ago
  • 0.7.3                                ...           9 months ago
  • 0.7.2                                ...           9 months ago
  • 0.7.1                                ...           9 months ago
  • 0.7.0                                ...           9 months ago
  • 0.6.2                                ...           9 months ago
  • 0.6.1                                ...           10 months ago
  • 0.6.0                                ...           10 months ago
  • 0.5.0                                ...           10 months ago
  • 0.4.1                                ...           10 months ago
  • 0.4.0                                ...           10 months ago
  • 0.3.4                                ...           10 months ago
  • 0.3.3                                ...           10 months ago
  • 0.3.2                                ...           10 months ago
  • 0.3.1                                ...           10 months ago
  • 0.3.0                                ...           10 months ago
  • 0.2.4                                ...           10 months ago
  • 0.2.3                                ...           10 months ago
  • 0.2.2                                ...           10 months ago
  • 0.2.1                                ...           10 months ago
  • 0.2.0                                ...           10 months ago
  • 0.1.0                                ...           10 months ago
  • 0.0.2                                ...           a year ago
  • 0.0.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 97
Dependencies (4)
Dev Dependencies (17)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |