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
merged 10 commits into from Nov 13, 2019

Conversation

@axetroy
Copy link
Contributor

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
deno-fmt 
Auto-format JavaScript/TypeScript source code using Prettier

Automatically downloads Prettier dependencies on first run.

  deno fmt myfile1.ts myfile2.ts

USAGE:
    deno fmt [OPTIONS] <files>...

OPTIONS:
        --arrow-parens=<avoid|always>
            Include parentheses around a sole arrow function parameter. [possible values: avoid, always]

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

        --current-thread                                 
            Use tokio::runtime::current_thread

        --end-of-line=<auto|lf|crlf|cr>
            Which end of line characters to apply. [possible values: auto, lf, crlf, cr]

    -h, --help                                           
            Prints help information

        --importmap <FILE>                               
            Load import map file
            Specification: https://wicg.github.io/import-maps/
            Examples: https://github.com/WICG/import-maps#the-import-map
        --jsx-bracket-same-line
            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).
        --jsx-single-quote                               
            Use single quotes instead of double quotes in JSX.

        --lock <FILE>                                    
            Check the specified lock file

        --lock-write                                     
            Write lock file. Use with --lock.

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

        --no-bracket-spacing                             
            Print spaces between brackets in object literals.

        --no-semi                                        
            Print semicolons at the ends of statements.

        --print-width=<int>                              
            Specify the line length that the printer will wrap on.

        --prose-wrap=<always|never|preserve>             
            How to wrap prose. [possible values: always, never, preserve]

        --quote-props=<as-needed|consistent|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
                        Reload everything
                      --reload=https://deno.land/std
                        Reload all standard modules
                      --reload=https://deno.land/std/fs/utils.ts,https://deno.land/std/fmt/colors.ts
                        Reloads specific modules
        --seed <NUMBER>                                  
            Seed Math.random()

        --single-quote                                   
            Use single quotes instead of double quotes.

        --stdout                                         
            Output formated code to stdout

        --tab-width=<int>                                
            Specify the number of spaces per indentation-level.

        --trailing-comma                                 
            Print trailing commas wherever possible when multi-line.

        --use-tabs                                       
            Indent lines with tabs instead of spaces.

        --v8-flags=<v8-flags>                            
            Set V8 command line options

        --v8-options                                     
            Print V8 command line options


ARGS:
    <files>...    
            
axetroy added 3 commits Nov 11, 2019
fix
cli/flags.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

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
@axetroy

This comment has been minimized.

Copy link
Contributor Author

axetroy commented Nov 13, 2019

/cc @ry already for review

@ry
ry approved these changes Nov 13, 2019
Copy link
Collaborator

ry left a comment

LGTM

@ry ry merged commit 80b1371 into denoland:master Nov 13, 2019
10 checks passed
10 checks passed
test macOS-latest
Details
test_std macOS-latest
Details
test windows-2019
Details
test_std windows-2019
Details
test ubuntu-16.04
Details
test_debug ubuntu-16.04
Details
test_std ubuntu-16.04
Details
bench ubuntu-16.04
Details
lint ubuntu-16.04
Details
license/cla Contributor License Agreement is signed.
Details
@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.