Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmt: allow configuration of Prettier options #3314

merged 10 commits into from Nov 13, 2019


Copy link

axetroy commented Nov 11, 2019

close #3033

Added flag for deno fmt to set Prettier options

current deno fmt output

$ ./target/release/deno fmt --help
Auto-format JavaScript/TypeScript source code using Prettier

Automatically downloads Prettier dependencies on first run.

  deno fmt myfile1.ts myfile2.ts

    deno fmt [OPTIONS] <files>...

            Include parentheses around a sole arrow function parameter. [possible values: avoid, always]

    -c, --config <FILE>                                  
            Load tsconfig.json configuration file

            Use tokio::runtime::current_thread

            Which end of line characters to apply. [possible values: auto, lf, crlf, cr]

    -h, --help                                           
            Prints help information

        --importmap <FILE>                               
            Load import map file
            Put the > of a multi-line JSX element at the end of the last line
            instead of being alone on the next line (does not apply to self closing elements).
            Use single quotes instead of double quotes in JSX.

        --lock <FILE>                                    
            Check the specified lock file

            Write lock file. Use with --lock.

    -L, --log-level <log-level>                          
            Set log level [possible values: debug, info]

            Print spaces between brackets in object literals.

            Print semicolons at the ends of statements.

            Specify the line length that the printer will wrap on.

            How to wrap prose. [possible values: always, never, preserve]

            Change when properties in objects are quoted. [possible values: as-needed, consistent, preserve]

    -r, --reload=<CACHE_BLACKLIST>                       
            Reload source code cache (recompile TypeScript)
                        Reload everything
                        Reload all standard modules
                        Reloads specific modules
        --seed <NUMBER>                                  
            Seed Math.random()

            Use single quotes instead of double quotes.

            Output formated code to stdout

            Specify the number of spaces per indentation-level.

            Print trailing commas wherever possible when multi-line.

            Indent lines with tabs instead of spaces.

            Set V8 command line options

            Print V8 command line options

axetroy added 3 commits Nov 11, 2019
cli/ Outdated Show resolved Hide resolved
Copy link

ry left a comment

Actually these flags should only be present in the fmt sub command - so there should be no need to prefix them. I think you can just do —print-width

axetroy added 6 commits Nov 12, 2019

This comment has been minimized.

Copy link
Contributor Author

axetroy commented Nov 13, 2019

/cc @ry already for review

ry approved these changes Nov 13, 2019
Copy link

ry left a comment


@ry ry merged commit 80b1371 into denoland:master Nov 13, 2019
10 checks passed
10 checks passed
test macOS-latest
test_std macOS-latest
test windows-2019
test_std windows-2019
test ubuntu-16.04
test_debug ubuntu-16.04
test_std ubuntu-16.04
bench ubuntu-16.04
lint ubuntu-16.04
license/cla Contributor License Agreement is signed.
@axetroy axetroy deleted the axetroy:fmt_opts branch Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.