JSPM

  • Created
  • Published
  • Downloads 16949
  • Score
    100M100P100Q133738F
  • License MIT

CLI for prettier-eslint

Package Exports

  • prettier-standard

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (prettier-standard) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

(✿◠‿◠) prettier-standard Build Status version

prettier and standard brought together

Installation

yarn add --dev prettier-standard

If you're using the npm client: npm install --save-dev prettier-standard

Usage

Typically you'll use this in your npm scripts (or package scripts):

{
  "scripts": {
    "format": "prettier-standard \"src/**/*.js\""
  }
}

This will format all .js files in the src directory. The argument you pass to the CLI is a glob and you can pass as many as you wish. You can also pass options.

Vim

Vim users can add the following to their .vimrc:

autocmd FileType javascript set formatprg=prettier-standard\ --stdin

This makes prettier-standard power the gq command for automatic formatting without any plugins. You can also add the following to your .vimrc to run prettier-standard when .js files are saved:

autocmd BufWritePre *.js :normal gggqG

CLI Options

prettier-standard --help
Usage: prettier-standard <globs>... [--option-1 option-1-value --option-2]

Options:
  -h, --help       Show help                                           [boolean]
  --version        Show version number                                 [boolean]
  --stdin          Read input via stdin               [boolean] [default: false]
  --log-level, -l  The log level to use
        [choices: "silent", "error", "warn", "info", "debug", "trace"]

Any number of globs you wish to use to match the files you wish to format. By default, glob will ignore **/node_modules/** unless the glob you provide includes the string node_modules.

--stdin

By default prettier-standard will overwrite the files. If you don't want that, you can use thi flag.

Accept input via stdin. For example:

echo "var   foo =    'bar'" | prettier-standard --stdin
# results in: "var foo = 'bar'" (depending on your eslint config)

--log-level

Can be one of the following: 'trace', 'debug', 'info', 'warn', 'error', 'silent'.

Default: process.env.LOG_LEVEL || 'warn'

--no-eslint-ignore

Disables application of .eslintignore to the files resolved from the glob. By default, prettier-standard will exclude files if they are matched by a .eslintignore. Add this flag to disable this behavior.

Note: You can also set the LOG_LEVEL environment variable to control logging in prettier-standard

LICENSE

MIT