2017-09-03 16:31:33 +03:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
exports[`show detailed usage with --help l (alias) (stderr) 1`] = `""`;
|
|
|
|
|
|
|
|
exports[`show detailed usage with --help l (alias) (stdout) 1`] = `
|
2017-09-21 08:54:13 +03:00
|
|
|
"-l, --list-different
|
|
|
|
|
|
|
|
Print the names of files that are different from Prettier's formatting.
|
|
|
|
"
|
|
|
|
`;
|
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
exports[`show detailed usage with --help l (alias) (write) 1`] = `Array []`;
|
|
|
|
|
2018-02-27 16:20:02 +03:00
|
|
|
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 []`;
|
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
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 ...]
|
2017-09-13 09:09:01 +03:00
|
|
|
|
|
|
|
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.
|
2017-09-13 09:09:01 +03:00
|
|
|
|
|
|
|
Output options:
|
|
|
|
|
2017-09-21 08:54:13 +03:00
|
|
|
-l, --list-different Print the names of files that are different from Prettier's formatting.
|
2017-09-13 09:09:01 +03:00
|
|
|
--write Edit files in-place. (Beware!)
|
2017-09-03 16:31:33 +03:00
|
|
|
|
2017-09-08 11:52:09 +03:00
|
|
|
Format options:
|
|
|
|
|
2017-11-28 08:23:32 +03:00
|
|
|
--arrow-parens <avoid|always>
|
2017-11-27 01:51:48 +03:00
|
|
|
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.
|
2017-09-10 09:10:42 +03:00
|
|
|
--jsx-bracket-same-line Put > on the last line instead of at a new line.
|
2017-09-21 08:54:13 +03:00
|
|
|
Defaults to false.
|
2018-06-21 05:29:42 +03:00
|
|
|
--parser <flow|babylon|typescript|css|less|scss|json|json5|json-stringify|graphql|markdown|vue|yaml>
|
2017-09-21 08:54:13 +03:00
|
|
|
Which parser to use.
|
|
|
|
--print-width <int> The line length where Prettier will try wrap.
|
|
|
|
Defaults to 80.
|
2017-12-02 01:48:40 +03:00
|
|
|
--prose-wrap <always|never|preserve>
|
|
|
|
How to wrap prose. (markdown)
|
|
|
|
Defaults to preserve.
|
2017-09-10 09:10:42 +03:00
|
|
|
--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.
|
2017-09-21 08:54:13 +03:00
|
|
|
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>
|
2017-09-21 08:54:13 +03:00
|
|
|
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.
|
2017-09-21 08:54:13 +03:00
|
|
|
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).
|
2017-09-10 09:10:42 +03:00
|
|
|
--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>
|
2017-09-21 08:54:13 +03:00
|
|
|
Define in which order config files and CLI options should be evaluated.
|
2017-09-12 19:37:14 +03:00
|
|
|
Defaults to cli-override.
|
2017-12-05 01:28:27 +03:00
|
|
|
--no-editorconfig Don't take .editorconfig into account when parsing configuration.
|
2017-09-12 19:39:38 +03:00
|
|
|
--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.
|
2017-09-21 08:54:13 +03:00
|
|
|
Defaults to .prettierignore.
|
2017-12-26 04:23:50 +03:00
|
|
|
--plugin <path> Add a plugin. Multiple plugins can be passed as separate \`--plugin\`s.
|
2018-01-18 10:26:27 +03:00
|
|
|
Defaults to [].
|
2018-05-09 14:17:12 +03:00
|
|
|
--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.
|
|
|
|
|
2017-09-13 09:09:01 +03:00
|
|
|
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.
|
2017-09-21 08:54:13 +03:00
|
|
|
Defaults to -1.
|
2017-09-12 19:39:38 +03:00
|
|
|
--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.
|
2017-09-13 09:09:01 +03:00
|
|
|
|
|
|
|
Other options:
|
|
|
|
|
|
|
|
--no-color Do not colorize error messages.
|
2018-05-09 19:53:44 +03:00
|
|
|
--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
|
2017-09-21 08:54:13 +03:00
|
|
|
-h, --help <flag> Show CLI usage, or details about the given flag.
|
|
|
|
Example: --help write
|
2017-10-06 11:37:14 +03:00
|
|
|
--insert-pragma Insert @format pragma into file's first docblock comment.
|
|
|
|
Defaults to false.
|
2017-12-18 15:22:07 +03:00
|
|
|
--loglevel <silent|error|warn|log|debug>
|
2017-10-14 04:17:01 +03:00
|
|
|
What level of logs to report.
|
2017-12-18 15:22:07 +03:00
|
|
|
Defaults to log.
|
2017-09-14 07:49:07 +03:00
|
|
|
--require-pragma Require either '@prettier' or '@format' to be present in the file's first docblock comment
|
|
|
|
in order for it to be formatted.
|
2017-09-21 08:54:13 +03:00
|
|
|
Defaults to false.
|
2017-09-13 09:09:01 +03:00
|
|
|
--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.
|
2017-11-03 10:06:25 +03:00
|
|
|
--support-info Print support information as JSON.
|
2017-09-21 08:54:13 +03:00
|
|
|
-v, --version Print Prettier version.
|
|
|
|
|
|
|
|
|
|
|
|
"
|
|
|
|
`;
|
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
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`] = `
|
2017-10-14 04:17:01 +03:00
|
|
|
"[warn] Unknown option name \\"not-found\\"
|
2017-10-02 19:08:34 +03:00
|
|
|
"
|
|
|
|
`;
|
|
|
|
|
|
|
|
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`] = `
|
2017-10-14 04:17:01 +03:00
|
|
|
"[warn] Unknown option name \\"parserr\\", did you mean \\"parser\\"?
|
2017-10-02 19:08:34 +03:00
|
|
|
"
|
|
|
|
`;
|
|
|
|
|
|
|
|
exports[`show warning with --help not-found (typo) (stdout) 1`] = `
|
2018-06-21 05:29:42 +03:00
|
|
|
"--parser <flow|babylon|typescript|css|less|scss|json|json5|json-stringify|graphql|markdown|vue|yaml>
|
2017-09-21 08:54:13 +03:00
|
|
|
|
|
|
|
Which parser to use.
|
|
|
|
|
|
|
|
Valid options:
|
|
|
|
|
2018-05-14 04:12:25 +03:00
|
|
|
flow Flow
|
|
|
|
babylon JavaScript
|
|
|
|
typescript TypeScript
|
|
|
|
css CSS
|
|
|
|
less Less
|
|
|
|
scss SCSS
|
|
|
|
json JSON
|
|
|
|
json5 JSON5
|
|
|
|
json-stringify JSON.stringify
|
|
|
|
graphql GraphQL
|
|
|
|
markdown Markdown
|
|
|
|
vue Vue
|
2018-06-21 05:29:42 +03:00
|
|
|
yaml YAML
|
2017-09-21 08:54:13 +03:00
|
|
|
"
|
|
|
|
`;
|
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
exports[`show warning with --help not-found (typo) (write) 1`] = `Array []`;
|
2017-09-03 16:31:33 +03:00
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
exports[`show warning with --help not-found (write) 1`] = `Array []`;
|
2017-09-03 16:31:33 +03:00
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
exports[`throw error and show usage with something unexpected (stderr) 1`] = `""`;
|
2017-09-03 16:31:33 +03:00
|
|
|
|
2017-10-02 19:08:34 +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 ...]
|
2017-09-13 09:09:01 +03:00
|
|
|
|
|
|
|
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.
|
2017-09-13 09:09:01 +03:00
|
|
|
|
|
|
|
Output options:
|
|
|
|
|
2017-09-21 08:54:13 +03:00
|
|
|
-l, --list-different Print the names of files that are different from Prettier's formatting.
|
2017-09-13 09:09:01 +03:00
|
|
|
--write Edit files in-place. (Beware!)
|
2017-09-09 06:49:22 +03:00
|
|
|
|
|
|
|
Format options:
|
|
|
|
|
2017-11-28 08:23:32 +03:00
|
|
|
--arrow-parens <avoid|always>
|
2017-11-27 01:51:48 +03:00
|
|
|
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.
|
2017-09-10 09:10:42 +03:00
|
|
|
--jsx-bracket-same-line Put > on the last line instead of at a new line.
|
2017-09-21 08:54:13 +03:00
|
|
|
Defaults to false.
|
2018-06-21 05:29:42 +03:00
|
|
|
--parser <flow|babylon|typescript|css|less|scss|json|json5|json-stringify|graphql|markdown|vue|yaml>
|
2017-09-21 08:54:13 +03:00
|
|
|
Which parser to use.
|
|
|
|
--print-width <int> The line length where Prettier will try wrap.
|
|
|
|
Defaults to 80.
|
2017-12-02 01:48:40 +03:00
|
|
|
--prose-wrap <always|never|preserve>
|
|
|
|
How to wrap prose. (markdown)
|
|
|
|
Defaults to preserve.
|
2017-09-10 09:10:42 +03:00
|
|
|
--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.
|
2017-09-21 08:54:13 +03:00
|
|
|
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>
|
2017-09-21 08:54:13 +03:00
|
|
|
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.
|
2017-09-21 08:54:13 +03:00
|
|
|
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).
|
2017-09-10 09:10:42 +03:00
|
|
|
--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>
|
2017-09-21 08:54:13 +03:00
|
|
|
Define in which order config files and CLI options should be evaluated.
|
2017-09-12 19:37:14 +03:00
|
|
|
Defaults to cli-override.
|
2017-12-05 01:28:27 +03:00
|
|
|
--no-editorconfig Don't take .editorconfig into account when parsing configuration.
|
2017-09-12 19:39:38 +03:00
|
|
|
--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.
|
2017-09-21 08:54:13 +03:00
|
|
|
Defaults to .prettierignore.
|
2017-12-26 04:23:50 +03:00
|
|
|
--plugin <path> Add a plugin. Multiple plugins can be passed as separate \`--plugin\`s.
|
2018-01-18 10:26:27 +03:00
|
|
|
Defaults to [].
|
2018-05-09 14:17:12 +03:00
|
|
|
--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.
|
|
|
|
|
2017-09-13 09:09:01 +03:00
|
|
|
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.
|
2017-09-21 08:54:13 +03:00
|
|
|
Defaults to -1.
|
2017-09-12 19:39:38 +03:00
|
|
|
--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.
|
2017-09-13 09:09:01 +03:00
|
|
|
|
|
|
|
Other options:
|
|
|
|
|
|
|
|
--no-color Do not colorize error messages.
|
2018-05-09 19:53:44 +03:00
|
|
|
--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
|
2017-09-21 08:54:13 +03:00
|
|
|
-h, --help <flag> Show CLI usage, or details about the given flag.
|
|
|
|
Example: --help write
|
2017-10-06 11:37:14 +03:00
|
|
|
--insert-pragma Insert @format pragma into file's first docblock comment.
|
|
|
|
Defaults to false.
|
2017-12-18 15:22:07 +03:00
|
|
|
--loglevel <silent|error|warn|log|debug>
|
2017-10-14 04:17:01 +03:00
|
|
|
What level of logs to report.
|
2017-12-18 15:22:07 +03:00
|
|
|
Defaults to log.
|
2017-09-14 07:49:07 +03:00
|
|
|
--require-pragma Require either '@prettier' or '@format' to be present in the file's first docblock comment
|
|
|
|
in order for it to be formatted.
|
2017-09-21 08:54:13 +03:00
|
|
|
Defaults to false.
|
2017-09-13 09:09:01 +03:00
|
|
|
--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.
|
2017-11-03 10:06:25 +03:00
|
|
|
--support-info Print support information as JSON.
|
2017-09-21 08:54:13 +03:00
|
|
|
-v, --version Print Prettier version.
|
2017-09-09 06:49:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
"
|
|
|
|
`;
|
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
exports[`throw error and show usage with something unexpected (write) 1`] = `Array []`;
|
2017-09-09 06:49:22 +03:00
|
|
|
|
2018-05-09 19:53:44 +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 []`;
|
|
|
|
|
2017-10-02 19:08:34 +03:00
|
|
|
exports[`throw error with --find-config-path + multiple files (stderr) 1`] = `
|
2017-10-14 04:17:01 +03:00
|
|
|
"[error] Cannot use --find-config-path with multiple files
|
2017-09-03 16:31:33 +03:00
|
|
|
"
|
|
|
|
`;
|
|
|
|
|
2017-10-02 19:08:34 +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`] = `
|
2017-10-14 04:17:01 +03:00
|
|
|
"[error] Cannot use --write and --debug-check together.
|
2017-09-03 16:31:33 +03:00
|
|
|
"
|
|
|
|
`;
|
2017-10-02 19:08:34 +03:00
|
|
|
|
|
|
|
exports[`throw error with --write + --debug-check (stdout) 1`] = `""`;
|
|
|
|
|
|
|
|
exports[`throw error with --write + --debug-check (write) 1`] = `Array []`;
|