diff options
Diffstat (limited to 'prettier/main.ts')
-rwxr-xr-x | prettier/main.ts | 79 |
1 files changed, 45 insertions, 34 deletions
diff --git a/prettier/main.ts b/prettier/main.ts index 584b90b39..82a213d41 100755 --- a/prettier/main.ts +++ b/prettier/main.ts @@ -2,11 +2,23 @@ /** * Copyright © James Long and contributors * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // This script formats the given source files. If the files are omitted, it @@ -23,49 +35,47 @@ Formats the given files. If no arg is passed, then formats the all files. Usage: deno prettier/main.ts [options] [files...] Options: - -H, --help Show this help message and exit. - --check Check if the source files are formatted. - --write Whether to write to the file, otherwise it will output to stdout, Defaults to false. - --ignore <path> Ignore the given path(s). + -H, --help Show this help message and exit. + --check Check if the source files are formatted. + --write Whether to write to the file, otherwise + it will output to stdout, Defaults to + false. + --ignore <path> Ignore the given path(s). JS/TS Styling Options: - --print-width <int> The line length where Prettier will try wrap. - Defaults to 80. - --tab-width <int> Number of spaces per indentation level. - Defaults to 2. - --use-tabs Indent with tabs instead of spaces. - Defaults to false. - --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. - Defaults to false. - --trailing-comma <none|es5|all> - Print trailing commas wherever possible when multi-line. - Defaults to none. - --no-bracket-spacing Do not print spaces between brackets. - --arrow-parens <avoid|always> - Include parentheses around a sole arrow function parameter. - Defaults to avoid. - --end-of-line <auto|lf|crlf|cr> - Which end of line characters to apply. - Defaults to auto. + --print-width <int> The line length where Prettier will try + wrap. Defaults to 80. + --tab-width <int> Number of spaces per indentation level. + Defaults to 2. + --use-tabs Indent with tabs instead of spaces. + Defaults to false. + --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. Defaults to false. + --trailing-comma <none|es5|all> Print trailing commas wherever possible + when multi-line. Defaults to none. + --no-bracket-spacing Do not print spaces between brackets. + --arrow-parens <avoid|always> Include parentheses around a sole arrow + function parameter. Defaults to avoid. + --end-of-line <auto|lf|crlf|cr> Which end of line characters to apply. + Defaults to auto. Markdown Styling Options: - --prose-wrap <always|never|preserve> - How to wrap prose. - Defaults to preserve. + --prose-wrap <always|never|preserve> How to wrap prose. Defaults to preserve. Example: deno run prettier/main.ts --write script1.ts script2.js - Formats the files + Formats the files deno run prettier/main.ts --check script1.ts script2.js - Checks if the files are formatted + Checks if the files are formatted deno run prettier/main.ts --write - Formats the all files in the repository + Formats the all files in the repository deno run prettier/main.ts script1.ts - Print the formatted code to stdout + Print the formatted code to stdout `; // Available parsers @@ -230,7 +240,8 @@ async function formatSourceFiles( /** * Get the files to format. * @param selectors The glob patterns to select the files. - * eg `cmd/*.ts` to select all the typescript files in cmd directory. + * eg `cmd/*.ts` to select all the typescript files in cmd + * directory. * eg `cmd/run.ts` to select `cmd/run.ts` file as only. * @param ignore The glob patterns to ignore files. * eg `*_test.ts` to ignore all the test file. |