refactor: sort category
parent
b9bc54aab6
commit
0c3fe2bc9f
|
@ -336,8 +336,16 @@ function createUsage() {
|
|||
|
||||
let usage = "Usage: prettier [opts] [filename ...]\n\n";
|
||||
|
||||
usage += Object.keys(groupedUsages)
|
||||
.sort()
|
||||
const categoryOrder = ["Command", "Format", "Config", "Other"];
|
||||
|
||||
Object.keys(groupedUsages).forEach(category => {
|
||||
if (categoryOrder.indexOf(category) === -1) {
|
||||
// put unordered category before 'Other'
|
||||
categoryOrder.splice(-1, 0, category);
|
||||
}
|
||||
});
|
||||
|
||||
usage += categoryOrder
|
||||
.map(category => {
|
||||
return `${category} options:\n\n${indent(
|
||||
groupedUsages[category].join("\n"),
|
||||
|
|
|
@ -12,21 +12,6 @@ Command options:
|
|||
--version or -v Print Prettier version.
|
||||
--write Edit the file in-place. (Beware!)
|
||||
|
||||
Config options:
|
||||
|
||||
--config <path> Path to a prettier configuration file (.prettierrc, package.json, prettier.config.js).
|
||||
--config-precedence <cli-override|file-override|prefer-file>
|
||||
Defines how config file should be evaluated in combination of CLI options
|
||||
cli-override | default config => config file => CLI options
|
||||
file-override | default config => CLI options => config file
|
||||
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
|
||||
--ignore-path <path> Path to a file containing patterns that describe files to ignore.
|
||||
Defaults to ./.prettierignore.
|
||||
--no-config Do not look for a configuration file.
|
||||
--with-node-modules Process files inside 'node_modules' directory.
|
||||
|
||||
Format options:
|
||||
|
||||
--jsx-bracket-same-line Put > on the last line instead of at a new line.
|
||||
|
@ -49,6 +34,21 @@ Format options:
|
|||
Print trailing commas wherever possible when multi-line. Defaults to none.
|
||||
--use-tabs Indent lines with tabs instead of spaces.
|
||||
|
||||
Config options:
|
||||
|
||||
--config <path> Path to a prettier configuration file (.prettierrc, package.json, prettier.config.js).
|
||||
--config-precedence <cli-override|file-override|prefer-file>
|
||||
Defines how config file should be evaluated in combination of CLI options
|
||||
cli-override | default config => config file => CLI options
|
||||
file-override | default config => CLI options => config file
|
||||
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
|
||||
--ignore-path <path> Path to a file containing patterns that describe files to ignore.
|
||||
Defaults to ./.prettierignore.
|
||||
--no-config Do not look for a configuration file.
|
||||
--with-node-modules Process files inside 'node_modules' directory.
|
||||
|
||||
Other options:
|
||||
|
||||
--cursor-offset <int> Print (to stderr) where a cursor at the given position would move to after formatting.
|
||||
|
@ -73,21 +73,6 @@ Command options:
|
|||
--version or -v Print Prettier version.
|
||||
--write Edit the file in-place. (Beware!)
|
||||
|
||||
Config options:
|
||||
|
||||
--config <path> Path to a prettier configuration file (.prettierrc, package.json, prettier.config.js).
|
||||
--config-precedence <cli-override|file-override|prefer-file>
|
||||
Defines how config file should be evaluated in combination of CLI options
|
||||
cli-override | default config => config file => CLI options
|
||||
file-override | default config => CLI options => config file
|
||||
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
|
||||
--ignore-path <path> Path to a file containing patterns that describe files to ignore.
|
||||
Defaults to ./.prettierignore.
|
||||
--no-config Do not look for a configuration file.
|
||||
--with-node-modules Process files inside 'node_modules' directory.
|
||||
|
||||
Format options:
|
||||
|
||||
--jsx-bracket-same-line Put > on the last line instead of at a new line.
|
||||
|
@ -110,6 +95,21 @@ Format options:
|
|||
Print trailing commas wherever possible when multi-line. Defaults to none.
|
||||
--use-tabs Indent lines with tabs instead of spaces.
|
||||
|
||||
Config options:
|
||||
|
||||
--config <path> Path to a prettier configuration file (.prettierrc, package.json, prettier.config.js).
|
||||
--config-precedence <cli-override|file-override|prefer-file>
|
||||
Defines how config file should be evaluated in combination of CLI options
|
||||
cli-override | default config => config file => CLI options
|
||||
file-override | default config => CLI options => config file
|
||||
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
|
||||
--ignore-path <path> Path to a file containing patterns that describe files to ignore.
|
||||
Defaults to ./.prettierignore.
|
||||
--no-config Do not look for a configuration file.
|
||||
--with-node-modules Process files inside 'node_modules' directory.
|
||||
|
||||
Other options:
|
||||
|
||||
--cursor-offset <int> Print (to stderr) where a cursor at the given position would move to after formatting.
|
||||
|
|
Loading…
Reference in New Issue