prettier/tests_integration/__tests__/__snapshots__/early-exit.js.snap

855 lines
28 KiB
Plaintext
Raw Normal View History

2017-09-03 16:31:33 +03:00
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`show detailed usage with --help arrow-parens (stderr) 1`] = `""`;
exports[`show detailed usage with --help arrow-parens (stdout) 1`] = `
"--arrow-parens <avoid|always>
Include parentheses around a sole arrow function parameter.
Valid options:
avoid Omit parens when possible. Example: \`x => x\`
always Always include parens. Example: \`(x) => x\`
Default: avoid
"
`;
exports[`show detailed usage with --help arrow-parens (write) 1`] = `Array []`;
exports[`show detailed usage with --help bracket-spacing (stderr) 1`] = `""`;
exports[`show detailed usage with --help bracket-spacing (stdout) 1`] = `
"--bracket-spacing
Print spaces between brackets.
Default: true
"
`;
exports[`show detailed usage with --help bracket-spacing (write) 1`] = `Array []`;
exports[`show detailed usage with --help color (stderr) 1`] = `""`;
exports[`show detailed usage with --help color (stdout) 1`] = `
"--color
Colorize error messages.
Default: true
"
`;
exports[`show detailed usage with --help color (write) 1`] = `Array []`;
exports[`show detailed usage with --help config (stderr) 1`] = `""`;
exports[`show detailed usage with --help config (stdout) 1`] = `
"--config <path>
Path to a Prettier configuration file (.prettierrc, package.json, prettier.config.js).
"
`;
exports[`show detailed usage with --help config (write) 1`] = `Array []`;
exports[`show detailed usage with --help config-precedence (stderr) 1`] = `""`;
exports[`show detailed usage with --help config-precedence (stdout) 1`] = `
"--config-precedence <cli-override|file-override|prefer-file>
Define in which order config files and CLI options should be evaluated.
Valid options:
cli-override CLI options take precedence over config file
file-override Config file take precedence over CLI options
prefer-file If a config file is found will evaluate it and ignore other CLI options.
If no config file is found CLI options will evaluate as normal.
Default: cli-override
"
`;
exports[`show detailed usage with --help config-precedence (write) 1`] = `Array []`;
exports[`show detailed usage with --help cursor-offset (stderr) 1`] = `""`;
exports[`show detailed usage with --help cursor-offset (stdout) 1`] = `
"--cursor-offset <int>
Print (to stderr) where a cursor at the given position would move to after formatting.
This option cannot be used with --range-start and --range-end.
Default: -1
"
`;
exports[`show detailed usage with --help cursor-offset (write) 1`] = `Array []`;
Re-add EditorConfig support (undo #3213) (#3255) * Revert "Revert "Respect EditorConfig settings" (#3213)" This reverts commit d2241fc0d52d807701d9a5ac580bc01010e7a93b. * Comment out EditorConfig docs See https://github.com/prettier/prettier/pull/3213#issuecomment-343009769 * editorconfig: Support `indent_size = 0` See https://github.com/prettier/prettier/pull/2760#discussion_r137447715 and https://github.com/josephfrazier/editorconfig-to-prettier/commit/c38b84c42a2e022067c104c494298a8c9533e7a7 * Revert "Comment out EditorConfig docs" This reverts commit ddfa529c55cac4853a1e76e00c8b5e3ef158c01f. * Mark EditorConfig functionality as v1.9.0+ See https://github.com/prettier/prettier/pull/3255#discussion_r150432508 * editorconfig: Upgrade editorconfig-to-prettier to 0.0.4 * editorconfig: Only enable for CLI, by default https://github.com/prettier/prettier/pull/3255#issuecomment-348420546 * editorconfig: Add tests confirming that editorconfig is ignored by default in the API https://github.com/prettier/prettier/pull/3255#issuecomment-348420546 * editorconfig: Add/fix CLI option parsing * editorconfig: Move docs from configuration.md to options.md * editorconfig: Add `oppositeDescription` to show docs for `--no-editorconfig` Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154542792 * editorconfig: Update test snapshots * editorconfig: Remove unnecessary options parsing code Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154544560 * editorconfig: Move docs from options.md to api.md and cli.md Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154545979 * resolveConfig: return null if both .prettierrc and .editorconfig are missing Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154574613 * Don't add now-failing tests The way these tests work, both `tests_integration/cli/config/.prettierrc` and `.prettierrc` apply to `tests_integration/cli/config/editorconfig/file.shouldnotexist`, so the test wouldn't work even on master. Here's a way to confirm that: ```js const path = require('path') const assert = require('assert') const prettier = require('./') const file = './tests_integration/cli/config/editorconfig/file.shouldnotexist' console.log(prettier.resolveConfig.sync(file)) assert(prettier.resolveConfig.sync(file) === null) ```
2017-12-05 01:28:27 +03:00
exports[`show detailed usage with --help editorconfig (stderr) 1`] = `""`;
exports[`show detailed usage with --help editorconfig (stdout) 1`] = `
"--editorconfig
Take .editorconfig into account when parsing configuration.
Default: true
"
`;
exports[`show detailed usage with --help editorconfig (write) 1`] = `Array []`;
exports[`show detailed usage with --help file-info (stderr) 1`] = `""`;
exports[`show detailed usage with --help file-info (stdout) 1`] = `
"--file-info <path>
Extract the following info (as JSON) for a given file path. Reported fields:
* ignored (boolean) - true if file path is filtered by --ignore-path
* inferredParser (string | null) - name of parser inferred from file path
"
`;
exports[`show detailed usage with --help file-info (write) 1`] = `Array []`;
exports[`show detailed usage with --help find-config-path (stderr) 1`] = `""`;
exports[`show detailed usage with --help find-config-path (stdout) 1`] = `
"--find-config-path <path>
Find and print the path to a configuration file for the given input file.
"
`;
exports[`show detailed usage with --help find-config-path (write) 1`] = `Array []`;
exports[`show detailed usage with --help help (stderr) 1`] = `""`;
exports[`show detailed usage with --help help (stdout) 1`] = `
"-h, --help <flag>
Show CLI usage, or details about the given flag.
Example: --help write
"
`;
exports[`show detailed usage with --help help (write) 1`] = `Array []`;
exports[`show detailed usage with --help ignore-path (stderr) 1`] = `""`;
exports[`show detailed usage with --help ignore-path (stdout) 1`] = `
"--ignore-path <path>
Path to a file with patterns describing files to ignore.
Default: .prettierignore
"
`;
exports[`show detailed usage with --help ignore-path (write) 1`] = `Array []`;
exports[`show detailed usage with --help insert-pragma (stderr) 1`] = `""`;
exports[`show detailed usage with --help insert-pragma (stdout) 1`] = `
"--insert-pragma
Insert @format pragma into file's first docblock comment.
Default: false
"
`;
exports[`show detailed usage with --help insert-pragma (write) 1`] = `Array []`;
exports[`show detailed usage with --help jsx-bracket-same-line (stderr) 1`] = `""`;
exports[`show detailed usage with --help jsx-bracket-same-line (stdout) 1`] = `
"--jsx-bracket-same-line
Put > on the last line instead of at a new line.
Default: false
"
`;
exports[`show detailed usage with --help jsx-bracket-same-line (write) 1`] = `Array []`;
exports[`show detailed usage with --help l (alias) (stderr) 1`] = `""`;
exports[`show detailed usage with --help l (alias) (stdout) 1`] = `
"-l, --list-different
Print the names of files that are different from Prettier's formatting.
"
`;
exports[`show detailed usage with --help l (alias) (write) 1`] = `Array []`;
exports[`show detailed usage with --help list-different (stderr) 1`] = `""`;
exports[`show detailed usage with --help list-different (stdout) 1`] = `
"-l, --list-different
Print the names of files that are different from Prettier's formatting.
"
`;
exports[`show detailed usage with --help list-different (write) 1`] = `Array []`;
exports[`show detailed usage with --help loglevel (stderr) 1`] = `""`;
exports[`show detailed usage with --help loglevel (stdout) 1`] = `
"--loglevel <silent|error|warn|log|debug>
What level of logs to report.
Valid options:
silent
error
warn
log
debug
Default: log
"
`;
exports[`show detailed usage with --help loglevel (write) 1`] = `Array []`;
exports[`show detailed usage with --help no-bracket-spacing (stderr) 1`] = `""`;
exports[`show detailed usage with --help no-bracket-spacing (stdout) 1`] = `
"--no-bracket-spacing
Do not print spaces between brackets.
"
`;
exports[`show detailed usage with --help no-bracket-spacing (write) 1`] = `Array []`;
exports[`show detailed usage with --help no-color (stderr) 1`] = `""`;
exports[`show detailed usage with --help no-color (stdout) 1`] = `
"--no-color
Do not colorize error messages.
"
`;
exports[`show detailed usage with --help no-color (write) 1`] = `Array []`;
exports[`show detailed usage with --help no-config (stderr) 1`] = `""`;
exports[`show detailed usage with --help no-config (stdout) 1`] = `
"--no-config
Do not look for a configuration file.
"
`;
exports[`show detailed usage with --help no-config (write) 1`] = `Array []`;
Re-add EditorConfig support (undo #3213) (#3255) * Revert "Revert "Respect EditorConfig settings" (#3213)" This reverts commit d2241fc0d52d807701d9a5ac580bc01010e7a93b. * Comment out EditorConfig docs See https://github.com/prettier/prettier/pull/3213#issuecomment-343009769 * editorconfig: Support `indent_size = 0` See https://github.com/prettier/prettier/pull/2760#discussion_r137447715 and https://github.com/josephfrazier/editorconfig-to-prettier/commit/c38b84c42a2e022067c104c494298a8c9533e7a7 * Revert "Comment out EditorConfig docs" This reverts commit ddfa529c55cac4853a1e76e00c8b5e3ef158c01f. * Mark EditorConfig functionality as v1.9.0+ See https://github.com/prettier/prettier/pull/3255#discussion_r150432508 * editorconfig: Upgrade editorconfig-to-prettier to 0.0.4 * editorconfig: Only enable for CLI, by default https://github.com/prettier/prettier/pull/3255#issuecomment-348420546 * editorconfig: Add tests confirming that editorconfig is ignored by default in the API https://github.com/prettier/prettier/pull/3255#issuecomment-348420546 * editorconfig: Add/fix CLI option parsing * editorconfig: Move docs from configuration.md to options.md * editorconfig: Add `oppositeDescription` to show docs for `--no-editorconfig` Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154542792 * editorconfig: Update test snapshots * editorconfig: Remove unnecessary options parsing code Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154544560 * editorconfig: Move docs from options.md to api.md and cli.md Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154545979 * resolveConfig: return null if both .prettierrc and .editorconfig are missing Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154574613 * Don't add now-failing tests The way these tests work, both `tests_integration/cli/config/.prettierrc` and `.prettierrc` apply to `tests_integration/cli/config/editorconfig/file.shouldnotexist`, so the test wouldn't work even on master. Here's a way to confirm that: ```js const path = require('path') const assert = require('assert') const prettier = require('./') const file = './tests_integration/cli/config/editorconfig/file.shouldnotexist' console.log(prettier.resolveConfig.sync(file)) assert(prettier.resolveConfig.sync(file) === null) ```
2017-12-05 01:28:27 +03:00
exports[`show detailed usage with --help no-editorconfig (stderr) 1`] = `""`;
exports[`show detailed usage with --help no-editorconfig (stdout) 1`] = `
"--no-editorconfig
Don't take .editorconfig into account when parsing configuration.
"
`;
exports[`show detailed usage with --help no-editorconfig (write) 1`] = `Array []`;
exports[`show detailed usage with --help no-semi (stderr) 1`] = `""`;
exports[`show detailed usage with --help no-semi (stdout) 1`] = `
"--no-semi
Do not print semicolons, except at the beginning of lines which may need them.
"
`;
exports[`show detailed usage with --help no-semi (write) 1`] = `Array []`;
exports[`show detailed usage with --help parser (stderr) 1`] = `""`;
exports[`show detailed usage with --help parser (stdout) 1`] = `
"--parser <flow|babylon|typescript|css|less|scss|json|json5|graphql|markdown|vue>
Which parser to use.
Valid options:
flow Flow
babylon JavaScript
typescript TypeScript
css CSS
less Less
scss SCSS
json JSON
json5 JSON5
graphql GraphQL
markdown Markdown
vue Vue
Default: babylon
"
`;
exports[`show detailed usage with --help parser (write) 1`] = `Array []`;
exports[`show detailed usage with --help plugin (stderr) 1`] = `""`;
exports[`show detailed usage with --help plugin (stdout) 1`] = `
"--plugin <path>
Add a plugin. Multiple plugins can be passed as separate \`--plugin\`s.
Default: []
"
`;
exports[`show detailed usage with --help plugin (write) 1`] = `Array []`;
exports[`show detailed usage with --help plugin-search-dir (stderr) 1`] = `""`;
exports[`show detailed usage with --help plugin-search-dir (stdout) 1`] = `
"--plugin-search-dir <path>
Custom directory that contains prettier plugins in node_modules subdirectory.
Overrides default behavior when plugins are searched relatively to the location of Prettier.
Multiple values are accepted.
Default: []
"
`;
exports[`show detailed usage with --help plugin-search-dir (write) 1`] = `Array []`;
exports[`show detailed usage with --help print-width (stderr) 1`] = `""`;
exports[`show detailed usage with --help print-width (stdout) 1`] = `
"--print-width <int>
The line length where Prettier will try wrap.
Default: 80
"
`;
exports[`show detailed usage with --help print-width (write) 1`] = `Array []`;
exports[`show detailed usage with --help prose-wrap (stderr) 1`] = `""`;
exports[`show detailed usage with --help prose-wrap (stdout) 1`] = `
"--prose-wrap <always|never|preserve>
How to wrap prose. (markdown)
Valid options:
always Wrap prose if it exceeds the print width.
never Do not wrap prose.
preserve Wrap prose as-is.
Default: preserve
"
`;
exports[`show detailed usage with --help prose-wrap (write) 1`] = `Array []`;
exports[`show detailed usage with --help range-end (stderr) 1`] = `""`;
exports[`show detailed usage with --help range-end (stdout) 1`] = `
"--range-end <int>
Format code ending at a given character offset (exclusive).
The range will extend forwards to the end of the selected statement.
This option cannot be used with --cursor-offset.
Default: Infinity
"
`;
exports[`show detailed usage with --help range-end (write) 1`] = `Array []`;
exports[`show detailed usage with --help range-start (stderr) 1`] = `""`;
exports[`show detailed usage with --help range-start (stdout) 1`] = `
"--range-start <int>
Format code starting at a given character offset.
The range will extend backwards to the start of the first line containing the selected statement.
This option cannot be used with --cursor-offset.
Default: 0
"
`;
exports[`show detailed usage with --help range-start (write) 1`] = `Array []`;
exports[`show detailed usage with --help require-pragma (stderr) 1`] = `""`;
exports[`show detailed usage with --help require-pragma (stdout) 1`] = `
"--require-pragma
Require either '@prettier' or '@format' to be present in the file's first docblock comment
in order for it to be formatted.
Default: false
"
`;
exports[`show detailed usage with --help require-pragma (write) 1`] = `Array []`;
exports[`show detailed usage with --help semi (stderr) 1`] = `""`;
exports[`show detailed usage with --help semi (stdout) 1`] = `
"--semi
Print semicolons.
Default: true
"
`;
exports[`show detailed usage with --help semi (write) 1`] = `Array []`;
exports[`show detailed usage with --help single-quote (stderr) 1`] = `""`;
exports[`show detailed usage with --help single-quote (stdout) 1`] = `
"--single-quote
Use single quotes instead of double quotes.
Default: false
"
`;
exports[`show detailed usage with --help single-quote (write) 1`] = `Array []`;
exports[`show detailed usage with --help stdin (stderr) 1`] = `""`;
exports[`show detailed usage with --help stdin (stdout) 1`] = `
"--stdin
Force reading input from stdin.
"
`;
exports[`show detailed usage with --help stdin (write) 1`] = `Array []`;
exports[`show detailed usage with --help stdin-filepath (stderr) 1`] = `""`;
exports[`show detailed usage with --help stdin-filepath (stdout) 1`] = `
"--stdin-filepath <path>
Path to the file to pretend that stdin comes from.
"
`;
exports[`show detailed usage with --help stdin-filepath (write) 1`] = `Array []`;
exports[`show detailed usage with --help support-info (stderr) 1`] = `""`;
exports[`show detailed usage with --help support-info (stdout) 1`] = `
"--support-info
Print support information as JSON.
"
`;
exports[`show detailed usage with --help support-info (write) 1`] = `Array []`;
exports[`show detailed usage with --help tab-width (stderr) 1`] = `""`;
exports[`show detailed usage with --help tab-width (stdout) 1`] = `
"--tab-width <int>
Number of spaces per indentation level.
Default: 2
"
`;
exports[`show detailed usage with --help tab-width (write) 1`] = `Array []`;
exports[`show detailed usage with --help trailing-comma (stderr) 1`] = `""`;
exports[`show detailed usage with --help trailing-comma (stdout) 1`] = `
"--trailing-comma <none|es5|all>
Print trailing commas wherever possible when multi-line.
Valid options:
none No trailing commas.
es5 Trailing commas where valid in ES5 (objects, arrays, etc.)
all Trailing commas wherever possible (including function arguments).
Default: none
"
`;
exports[`show detailed usage with --help trailing-comma (write) 1`] = `Array []`;
exports[`show detailed usage with --help use-tabs (stderr) 1`] = `""`;
exports[`show detailed usage with --help use-tabs (stdout) 1`] = `
"--use-tabs
Indent with tabs instead of spaces.
Default: false
"
`;
exports[`show detailed usage with --help use-tabs (write) 1`] = `Array []`;
exports[`show detailed usage with --help version (stderr) 1`] = `""`;
exports[`show detailed usage with --help version (stdout) 1`] = `
"-v, --version
Print Prettier version.
"
`;
exports[`show detailed usage with --help version (write) 1`] = `Array []`;
exports[`show detailed usage with --help with-node-modules (stderr) 1`] = `""`;
exports[`show detailed usage with --help with-node-modules (stdout) 1`] = `
"--with-node-modules
Process files inside 'node_modules' directory.
"
`;
exports[`show detailed usage with --help with-node-modules (write) 1`] = `Array []`;
exports[`show detailed usage with --help write (stderr) 1`] = `""`;
exports[`show detailed usage with --help write (stdout) 1`] = `
"--write
Edit files in-place. (Beware!)
"
`;
exports[`show detailed usage with --help write (write) 1`] = `Array []`;
exports[`show detailed usage with plugin options (automatic resolution) (stderr) 1`] = `""`;
exports[`show detailed usage with plugin options (automatic resolution) (stdout) 1`] = `
"--tab-width <int>
Number of spaces per indentation level.
Default: 2
Plugin defaults:
* prettier-plugin-bar: 4
"
`;
exports[`show detailed usage with plugin options (automatic resolution) (write) 1`] = `Array []`;
exports[`show detailed usage with plugin options (manual resolution) (stderr) 1`] = `""`;
exports[`show detailed usage with plugin options (manual resolution) (stdout) 1`] = `
"--tab-width <int>
Number of spaces per indentation level.
Default: 2
Plugin defaults:
* ../plugins/automatic/node_modules/prettier-plugin-bar: 4
"
`;
exports[`show detailed usage with plugin options (manual resolution) (write) 1`] = `Array []`;
exports[`show usage with --help (stderr) 1`] = `""`;
exports[`show usage with --help (stdout) 1`] = `
2017-09-13 13:10:48 +03:00
"Usage: prettier [options] [file/glob ...]
By default, output is written to stdout.
2017-09-13 13:10:48 +03:00
Stdin is read if it is piped to Prettier and no files are given.
Output options:
-l, --list-different Print the names of files that are different from Prettier's formatting.
--write Edit files in-place. (Beware!)
2017-09-03 16:31:33 +03:00
2017-09-08 11:52:09 +03:00
Format options:
--arrow-parens <avoid|always>
Include parentheses around a sole arrow function parameter.
Defaults to avoid.
2017-09-07 08:39:39 +03:00
--no-bracket-spacing Do not print spaces between brackets.
--jsx-bracket-same-line Put > on the last line instead of at a new line.
Defaults to false.
--parser <flow|babylon|typescript|css|less|scss|json|json5|graphql|markdown|vue>
Which parser to use.
Defaults to babylon.
--print-width <int> The line length where Prettier will try wrap.
Defaults to 80.
--prose-wrap <always|never|preserve>
How to wrap prose. (markdown)
Defaults to preserve.
--no-semi Do not print semicolons, except at the beginning of lines which may need them.
2017-09-07 08:39:39 +03:00
--single-quote Use single quotes instead of double quotes.
Defaults to false.
--tab-width <int> Number of spaces per indentation level.
Defaults to 2.
2017-09-07 08:39:39 +03:00
--trailing-comma <none|es5|all>
Print trailing commas wherever possible when multi-line.
Defaults to none.
2017-09-12 19:37:14 +03:00
--use-tabs Indent with tabs instead of spaces.
Defaults to false.
2017-09-08 11:52:09 +03:00
2017-09-10 08:45:18 +03:00
Config options:
2017-09-12 19:37:14 +03:00
--config <path> Path to a Prettier configuration file (.prettierrc, package.json, prettier.config.js).
--no-config Do not look for a configuration file.
2017-09-10 08:45:18 +03:00
--config-precedence <cli-override|file-override|prefer-file>
Define in which order config files and CLI options should be evaluated.
2017-09-12 19:37:14 +03:00
Defaults to cli-override.
Re-add EditorConfig support (undo #3213) (#3255) * Revert "Revert "Respect EditorConfig settings" (#3213)" This reverts commit d2241fc0d52d807701d9a5ac580bc01010e7a93b. * Comment out EditorConfig docs See https://github.com/prettier/prettier/pull/3213#issuecomment-343009769 * editorconfig: Support `indent_size = 0` See https://github.com/prettier/prettier/pull/2760#discussion_r137447715 and https://github.com/josephfrazier/editorconfig-to-prettier/commit/c38b84c42a2e022067c104c494298a8c9533e7a7 * Revert "Comment out EditorConfig docs" This reverts commit ddfa529c55cac4853a1e76e00c8b5e3ef158c01f. * Mark EditorConfig functionality as v1.9.0+ See https://github.com/prettier/prettier/pull/3255#discussion_r150432508 * editorconfig: Upgrade editorconfig-to-prettier to 0.0.4 * editorconfig: Only enable for CLI, by default https://github.com/prettier/prettier/pull/3255#issuecomment-348420546 * editorconfig: Add tests confirming that editorconfig is ignored by default in the API https://github.com/prettier/prettier/pull/3255#issuecomment-348420546 * editorconfig: Add/fix CLI option parsing * editorconfig: Move docs from configuration.md to options.md * editorconfig: Add `oppositeDescription` to show docs for `--no-editorconfig` Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154542792 * editorconfig: Update test snapshots * editorconfig: Remove unnecessary options parsing code Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154544560 * editorconfig: Move docs from options.md to api.md and cli.md Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154545979 * resolveConfig: return null if both .prettierrc and .editorconfig are missing Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154574613 * Don't add now-failing tests The way these tests work, both `tests_integration/cli/config/.prettierrc` and `.prettierrc` apply to `tests_integration/cli/config/editorconfig/file.shouldnotexist`, so the test wouldn't work even on master. Here's a way to confirm that: ```js const path = require('path') const assert = require('assert') const prettier = require('./') const file = './tests_integration/cli/config/editorconfig/file.shouldnotexist' console.log(prettier.resolveConfig.sync(file)) assert(prettier.resolveConfig.sync(file) === null) ```
2017-12-05 01:28:27 +03:00
--no-editorconfig Don't take .editorconfig into account when parsing configuration.
--find-config-path <path>
Find and print the path to a configuration file for the given input file.
2017-09-12 19:37:14 +03:00
--ignore-path <path> Path to a file with patterns describing files to ignore.
Defaults to .prettierignore.
--plugin <path> Add a plugin. Multiple plugins can be passed as separate \`--plugin\`s.
Defaults to [].
--plugin-search-dir <path>
Custom directory that contains prettier plugins in node_modules subdirectory.
Overrides default behavior when plugins are searched relatively to the location of Prettier.
Multiple values are accepted.
Defaults to [].
2017-09-10 08:45:18 +03:00
--with-node-modules Process files inside 'node_modules' directory.
Editor options:
2017-09-08 11:52:09 +03:00
--cursor-offset <int> Print (to stderr) where a cursor at the given position would move to after formatting.
2017-09-12 19:37:14 +03:00
This option cannot be used with --range-start and --range-end.
Defaults to -1.
--range-end <int> Format code ending at a given character offset (exclusive).
The range will extend forwards to the end of the selected statement.
This option cannot be used with --cursor-offset.
Defaults to Infinity.
--range-start <int> Format code starting at a given character offset.
The range will extend backwards to the start of the first line containing the selected statement.
This option cannot be used with --cursor-offset.
Defaults to 0.
Other options:
--no-color Do not colorize error messages.
--file-info <path> Extract the following info (as JSON) for a given file path. Reported fields:
* ignored (boolean) - true if file path is filtered by --ignore-path
* inferredParser (string | null) - name of parser inferred from file path
-h, --help <flag> Show CLI usage, or details about the given flag.
Example: --help write
--insert-pragma Insert @format pragma into file's first docblock comment.
Defaults to false.
--loglevel <silent|error|warn|log|debug>
What level of logs to report.
Defaults to log.
--require-pragma Require either '@prettier' or '@format' to be present in the file's first docblock comment
in order for it to be formatted.
Defaults to false.
--stdin Force reading input from stdin.
2017-09-12 19:37:14 +03:00
--stdin-filepath <path> Path to the file to pretend that stdin comes from.
--support-info Print support information as JSON.
-v, --version Print Prettier version.
"
`;
exports[`show usage with --help (write) 1`] = `Array []`;
exports[`show version with --version (stderr) 1`] = `""`;
exports[`show version with --version (write) 1`] = `Array []`;
exports[`show warning with --help not-found (stderr) 1`] = `
"[warn] Unknown option name \\"not-found\\"
"
`;
exports[`show warning with --help not-found (stdout) 1`] = `
"-h, --help <flag>
Show CLI usage, or details about the given flag.
Example: --help write
"
`;
exports[`show warning with --help not-found (typo) (stderr) 1`] = `
"[warn] Unknown option name \\"parserr\\", did you mean \\"parser\\"?
"
`;
exports[`show warning with --help not-found (typo) (stdout) 1`] = `
"--parser <flow|babylon|typescript|css|less|scss|json|json5|graphql|markdown|vue>
Which parser to use.
Valid options:
flow Flow
babylon JavaScript
typescript TypeScript
css CSS
less Less
scss SCSS
json JSON
json5 JSON5
graphql GraphQL
markdown Markdown
vue Vue
Default: babylon
"
`;
exports[`show warning with --help not-found (typo) (write) 1`] = `Array []`;
2017-09-03 16:31:33 +03:00
exports[`show warning with --help not-found (write) 1`] = `Array []`;
2017-09-03 16:31:33 +03:00
exports[`throw error and show usage with something unexpected (stderr) 1`] = `""`;
2017-09-03 16:31:33 +03:00
exports[`throw error and show usage with something unexpected (stdout) 1`] = `
2017-09-13 13:10:48 +03:00
"Usage: prettier [options] [file/glob ...]
By default, output is written to stdout.
2017-09-13 13:10:48 +03:00
Stdin is read if it is piped to Prettier and no files are given.
Output options:
-l, --list-different Print the names of files that are different from Prettier's formatting.
--write Edit files in-place. (Beware!)
2017-09-09 06:49:22 +03:00
Format options:
--arrow-parens <avoid|always>
Include parentheses around a sole arrow function parameter.
Defaults to avoid.
2017-09-09 06:49:22 +03:00
--no-bracket-spacing Do not print spaces between brackets.
--jsx-bracket-same-line Put > on the last line instead of at a new line.
Defaults to false.
--parser <flow|babylon|typescript|css|less|scss|json|json5|graphql|markdown|vue>
Which parser to use.
Defaults to babylon.
--print-width <int> The line length where Prettier will try wrap.
Defaults to 80.
--prose-wrap <always|never|preserve>
How to wrap prose. (markdown)
Defaults to preserve.
--no-semi Do not print semicolons, except at the beginning of lines which may need them.
2017-09-09 06:49:22 +03:00
--single-quote Use single quotes instead of double quotes.
Defaults to false.
--tab-width <int> Number of spaces per indentation level.
Defaults to 2.
2017-09-09 06:49:22 +03:00
--trailing-comma <none|es5|all>
Print trailing commas wherever possible when multi-line.
Defaults to none.
2017-09-12 19:37:14 +03:00
--use-tabs Indent with tabs instead of spaces.
Defaults to false.
2017-09-09 06:49:22 +03:00
2017-09-10 08:45:18 +03:00
Config options:
2017-09-12 19:37:14 +03:00
--config <path> Path to a Prettier configuration file (.prettierrc, package.json, prettier.config.js).
--no-config Do not look for a configuration file.
2017-09-10 08:45:18 +03:00
--config-precedence <cli-override|file-override|prefer-file>
Define in which order config files and CLI options should be evaluated.
2017-09-12 19:37:14 +03:00
Defaults to cli-override.
Re-add EditorConfig support (undo #3213) (#3255) * Revert "Revert "Respect EditorConfig settings" (#3213)" This reverts commit d2241fc0d52d807701d9a5ac580bc01010e7a93b. * Comment out EditorConfig docs See https://github.com/prettier/prettier/pull/3213#issuecomment-343009769 * editorconfig: Support `indent_size = 0` See https://github.com/prettier/prettier/pull/2760#discussion_r137447715 and https://github.com/josephfrazier/editorconfig-to-prettier/commit/c38b84c42a2e022067c104c494298a8c9533e7a7 * Revert "Comment out EditorConfig docs" This reverts commit ddfa529c55cac4853a1e76e00c8b5e3ef158c01f. * Mark EditorConfig functionality as v1.9.0+ See https://github.com/prettier/prettier/pull/3255#discussion_r150432508 * editorconfig: Upgrade editorconfig-to-prettier to 0.0.4 * editorconfig: Only enable for CLI, by default https://github.com/prettier/prettier/pull/3255#issuecomment-348420546 * editorconfig: Add tests confirming that editorconfig is ignored by default in the API https://github.com/prettier/prettier/pull/3255#issuecomment-348420546 * editorconfig: Add/fix CLI option parsing * editorconfig: Move docs from configuration.md to options.md * editorconfig: Add `oppositeDescription` to show docs for `--no-editorconfig` Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154542792 * editorconfig: Update test snapshots * editorconfig: Remove unnecessary options parsing code Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154544560 * editorconfig: Move docs from options.md to api.md and cli.md Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154545979 * resolveConfig: return null if both .prettierrc and .editorconfig are missing Addresses https://github.com/prettier/prettier/pull/3255#discussion_r154574613 * Don't add now-failing tests The way these tests work, both `tests_integration/cli/config/.prettierrc` and `.prettierrc` apply to `tests_integration/cli/config/editorconfig/file.shouldnotexist`, so the test wouldn't work even on master. Here's a way to confirm that: ```js const path = require('path') const assert = require('assert') const prettier = require('./') const file = './tests_integration/cli/config/editorconfig/file.shouldnotexist' console.log(prettier.resolveConfig.sync(file)) assert(prettier.resolveConfig.sync(file) === null) ```
2017-12-05 01:28:27 +03:00
--no-editorconfig Don't take .editorconfig into account when parsing configuration.
--find-config-path <path>
Find and print the path to a configuration file for the given input file.
2017-09-12 19:37:14 +03:00
--ignore-path <path> Path to a file with patterns describing files to ignore.
Defaults to .prettierignore.
--plugin <path> Add a plugin. Multiple plugins can be passed as separate \`--plugin\`s.
Defaults to [].
--plugin-search-dir <path>
Custom directory that contains prettier plugins in node_modules subdirectory.
Overrides default behavior when plugins are searched relatively to the location of Prettier.
Multiple values are accepted.
Defaults to [].
2017-09-10 08:45:18 +03:00
--with-node-modules Process files inside 'node_modules' directory.
Editor options:
2017-09-09 06:49:22 +03:00
--cursor-offset <int> Print (to stderr) where a cursor at the given position would move to after formatting.
2017-09-12 19:37:14 +03:00
This option cannot be used with --range-start and --range-end.
Defaults to -1.
--range-end <int> Format code ending at a given character offset (exclusive).
The range will extend forwards to the end of the selected statement.
This option cannot be used with --cursor-offset.
Defaults to Infinity.
--range-start <int> Format code starting at a given character offset.
The range will extend backwards to the start of the first line containing the selected statement.
This option cannot be used with --cursor-offset.
Defaults to 0.
Other options:
--no-color Do not colorize error messages.
--file-info <path> Extract the following info (as JSON) for a given file path. Reported fields:
* ignored (boolean) - true if file path is filtered by --ignore-path
* inferredParser (string | null) - name of parser inferred from file path
-h, --help <flag> Show CLI usage, or details about the given flag.
Example: --help write
--insert-pragma Insert @format pragma into file's first docblock comment.
Defaults to false.
--loglevel <silent|error|warn|log|debug>
What level of logs to report.
Defaults to log.
--require-pragma Require either '@prettier' or '@format' to be present in the file's first docblock comment
in order for it to be formatted.
Defaults to false.
--stdin Force reading input from stdin.
2017-09-12 19:37:14 +03:00
--stdin-filepath <path> Path to the file to pretend that stdin comes from.
--support-info Print support information as JSON.
-v, --version Print Prettier version.
2017-09-09 06:49:22 +03:00
"
`;
exports[`throw error and show usage with something unexpected (write) 1`] = `Array []`;
2017-09-09 06:49:22 +03:00
exports[`throw error with --file-info + multiple files (stderr) 1`] = `
"[error] Cannot use --file-info with multiple files
"
`;
exports[`throw error with --file-info + multiple files (stdout) 1`] = `""`;
exports[`throw error with --file-info + multiple files (write) 1`] = `Array []`;
exports[`throw error with --find-config-path + multiple files (stderr) 1`] = `
"[error] Cannot use --find-config-path with multiple files
2017-09-03 16:31:33 +03:00
"
`;
exports[`throw error with --find-config-path + multiple files (stdout) 1`] = `""`;
exports[`throw error with --find-config-path + multiple files (write) 1`] = `Array []`;
exports[`throw error with --write + --debug-check (stderr) 1`] = `
"[error] Cannot use --write and --debug-check together.
2017-09-03 16:31:33 +03:00
"
`;
exports[`throw error with --write + --debug-check (stdout) 1`] = `""`;
exports[`throw error with --write + --debug-check (write) 1`] = `Array []`;