Tweak option categories
- Move Format options first, since they feel the most important. - Move --find-config-path to the Config category. - Merge Command into Other. It wasn't clear what "Command" options are, and the Other category isn't too long anyway. - Move --range-end and --range-start into Other. The aren't Format options.master
parent
c99f7e2e38
commit
5d435abe0a
|
@ -1,6 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const CATEGORY_COMMAND = "Command";
|
||||
const CATEGORY_CONFIG = "Config";
|
||||
const CATEGORY_FORMAT = "Format";
|
||||
const CATEGORY_OTHER = "Other";
|
||||
|
@ -115,7 +114,7 @@ const detailedOptions = normalizeDetailedOptions({
|
|||
},
|
||||
"find-config-path": {
|
||||
type: "path",
|
||||
category: CATEGORY_COMMAND,
|
||||
category: CATEGORY_CONFIG,
|
||||
description:
|
||||
"Find and print the path to a configuration file for the given input file."
|
||||
},
|
||||
|
@ -127,7 +126,6 @@ const detailedOptions = normalizeDetailedOptions({
|
|||
},
|
||||
help: {
|
||||
type: "boolean",
|
||||
category: CATEGORY_COMMAND,
|
||||
alias: "h",
|
||||
description: "Show help."
|
||||
},
|
||||
|
@ -148,7 +146,6 @@ const detailedOptions = normalizeDetailedOptions({
|
|||
},
|
||||
"list-different": {
|
||||
type: "boolean",
|
||||
category: CATEGORY_COMMAND,
|
||||
alias: "l",
|
||||
description:
|
||||
"Print the names of files that are different from Prettier's formatting."
|
||||
|
@ -170,7 +167,6 @@ const detailedOptions = normalizeDetailedOptions({
|
|||
},
|
||||
"range-end": {
|
||||
type: "int",
|
||||
category: CATEGORY_FORMAT,
|
||||
forwardToApi: true,
|
||||
exception: Infinity,
|
||||
description: dedent(`
|
||||
|
@ -182,7 +178,6 @@ const detailedOptions = normalizeDetailedOptions({
|
|||
},
|
||||
"range-start": {
|
||||
type: "int",
|
||||
category: CATEGORY_FORMAT,
|
||||
forwardToApi: true,
|
||||
description: dedent(`
|
||||
Format code starting at a given character offset.
|
||||
|
@ -240,7 +235,6 @@ const detailedOptions = normalizeDetailedOptions({
|
|||
},
|
||||
version: {
|
||||
type: "boolean",
|
||||
category: CATEGORY_COMMAND,
|
||||
alias: "v",
|
||||
description: "Print Prettier version."
|
||||
},
|
||||
|
@ -251,7 +245,6 @@ const detailedOptions = normalizeDetailedOptions({
|
|||
},
|
||||
write: {
|
||||
type: "boolean",
|
||||
category: CATEGORY_COMMAND,
|
||||
description: "Edit files in-place. (Beware!)"
|
||||
}
|
||||
});
|
||||
|
@ -325,7 +318,6 @@ const detailedOptionMap = detailedOptions.reduce(
|
|||
);
|
||||
|
||||
module.exports = {
|
||||
CATEGORY_COMMAND,
|
||||
CATEGORY_CONFIG,
|
||||
CATEGORY_FORMAT,
|
||||
CATEGORY_OTHER,
|
||||
|
|
|
@ -347,11 +347,7 @@ function createUsage() {
|
|||
|
||||
const usageSummary = "Usage: prettier [opts] [filename ...]";
|
||||
|
||||
const firstCategories = [
|
||||
constant.CATEGORY_COMMAND,
|
||||
constant.CATEGORY_FORMAT,
|
||||
constant.CATEGORY_CONFIG
|
||||
];
|
||||
const firstCategories = [constant.CATEGORY_FORMAT, constant.CATEGORY_CONFIG];
|
||||
const lastCategories = [constant.CATEGORY_OTHER];
|
||||
const restCategories = Object.keys(groupedOptions).filter(
|
||||
category =>
|
||||
|
|
|
@ -3,15 +3,6 @@
|
|||
exports[`show usage with --help 1`] = `
|
||||
"Usage: prettier [opts] [filename ...]
|
||||
|
||||
Command options:
|
||||
|
||||
--find-config-path <path>
|
||||
Find and print the path to a configuration file for the given input file.
|
||||
--help or -h Show help.
|
||||
--list-different or -l Print the names of files that are different from Prettier's formatting.
|
||||
--version or -v Print Prettier version.
|
||||
--write Edit files in-place. (Beware!)
|
||||
|
||||
Format options:
|
||||
|
||||
--no-bracket-spacing Do not print spaces between brackets.
|
||||
|
@ -19,14 +10,6 @@ Format options:
|
|||
--parser <flow|babylon|typescript|postcss|json|graphql>
|
||||
Which parser to use. Defaults to babylon.
|
||||
--print-width <int> The line length where Prettier will try wrap. Defaults to 80.
|
||||
--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.
|
||||
--no-semi Do not print semicolons, except at the beginning of lines which may need them.
|
||||
--single-quote Use single quotes instead of double quotes.
|
||||
--tab-width <int> Number of spaces per indentation level. Defaults to 2.
|
||||
|
@ -45,6 +28,8 @@ Config options:
|
|||
prefer-file | default config => config file (if config file is found) or
|
||||
default config => CLI options (if no config file is found)
|
||||
Defaults to cli-override.
|
||||
--find-config-path <path>
|
||||
Find and print the path to a configuration file for the given input file.
|
||||
--ignore-path <path> Path to a file with patterns describing files to ignore.
|
||||
Defaults to ./.prettierignore.
|
||||
--with-node-modules Process files inside 'node_modules' directory.
|
||||
|
@ -54,8 +39,20 @@ Other options:
|
|||
--no-color Do not colorize error messages.
|
||||
--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.
|
||||
--help or -h Show help.
|
||||
--list-different or -l Print the names of files that are different from Prettier's formatting.
|
||||
--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.
|
||||
--stdin Read input from stdin.
|
||||
--stdin-filepath <path> Path to the file to pretend that stdin comes from.
|
||||
--version or -v Print Prettier version.
|
||||
--write Edit files in-place. (Beware!)
|
||||
|
||||
|
||||
"
|
||||
|
@ -64,15 +61,6 @@ Other options:
|
|||
exports[`throw error and show usage with something unexpected 1`] = `
|
||||
"Usage: prettier [opts] [filename ...]
|
||||
|
||||
Command options:
|
||||
|
||||
--find-config-path <path>
|
||||
Find and print the path to a configuration file for the given input file.
|
||||
--help or -h Show help.
|
||||
--list-different or -l Print the names of files that are different from Prettier's formatting.
|
||||
--version or -v Print Prettier version.
|
||||
--write Edit files in-place. (Beware!)
|
||||
|
||||
Format options:
|
||||
|
||||
--no-bracket-spacing Do not print spaces between brackets.
|
||||
|
@ -80,14 +68,6 @@ Format options:
|
|||
--parser <flow|babylon|typescript|postcss|json|graphql>
|
||||
Which parser to use. Defaults to babylon.
|
||||
--print-width <int> The line length where Prettier will try wrap. Defaults to 80.
|
||||
--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.
|
||||
--no-semi Do not print semicolons, except at the beginning of lines which may need them.
|
||||
--single-quote Use single quotes instead of double quotes.
|
||||
--tab-width <int> Number of spaces per indentation level. Defaults to 2.
|
||||
|
@ -106,6 +86,8 @@ Config options:
|
|||
prefer-file | default config => config file (if config file is found) or
|
||||
default config => CLI options (if no config file is found)
|
||||
Defaults to cli-override.
|
||||
--find-config-path <path>
|
||||
Find and print the path to a configuration file for the given input file.
|
||||
--ignore-path <path> Path to a file with patterns describing files to ignore.
|
||||
Defaults to ./.prettierignore.
|
||||
--with-node-modules Process files inside 'node_modules' directory.
|
||||
|
@ -115,8 +97,20 @@ Other options:
|
|||
--no-color Do not colorize error messages.
|
||||
--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.
|
||||
--help or -h Show help.
|
||||
--list-different or -l Print the names of files that are different from Prettier's formatting.
|
||||
--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.
|
||||
--stdin Read input from stdin.
|
||||
--stdin-filepath <path> Path to the file to pretend that stdin comes from.
|
||||
--version or -v Print Prettier version.
|
||||
--write Edit files in-place. (Beware!)
|
||||
|
||||
|
||||
"
|
||||
|
|
Loading…
Reference in New Issue