Skip to content

prettier config default values #266

@gko

Description

@gko

Hello,

Thank you very much for plugin. I use it every day and love it! ❤️

I wanted to ask whether it's really necessary to set the default values for prettier within the plugin:

let g:prettier#config#print_width = get(g:, 'prettier#config#print_width', 'auto')
" number of spaces per indentation level: a number or 'auto' (use
" softtabstop)
" default: 'auto'
" See more: https://prettier.io/docs/en/options.html#tab-width
let g:prettier#config#tab_width = get(g:,'prettier#config#tab_width', 'auto')
" use tabs instead of spaces: true, false, or auto (use the expandtab setting).
" default: 'auto'
" See more: https://prettier.io/docs/en/options.html#tabs
let g:prettier#config#use_tabs = get(g:,'prettier#config#use_tabs', 'auto')
" flow|babylon|typescript|css|less|scss|json|graphql|markdown or empty string
" (let prettier choose).
" default: ''
" See more: https://prettier.io/docs/en/options.html#parser
let g:prettier#config#parser = get(g:,'prettier#config#parser', '')
" cli-override|file-override|prefer-file
" default: 'file-override'
" See more: https://prettier.io/docs/en/cli.html#--config-precedence
let g:prettier#config#config_precedence = get(g:, 'prettier#config#config_precedence', 'file-override')
" always|never|preserve
" default: 'preserve'
" See more: https://prettier.io/docs/en/options.html#prose-wrap
let g:prettier#config#prose_wrap = get(g:, 'prettier#config#prose_wrap', 'preserve')
" css|strict|ignore
" default: 'css'
" See more: https://prettier.io/docs/en/options.html#html-whitespace-sensitivity
let g:prettier#config#html_whitespace_sensitivity = get(g:, 'prettier#config#html_whitespace_sensitivity', 'css')
" print semicolons
" default: 'true'
" See more: https://prettier.io/docs/en/options.html#semicolons
let g:prettier#config#semi = get(g:,'prettier#config#semi', 'true')
" Use single quotes instead of double quotes.
" default: 'false'
" See more: https://prettier.io/docs/en/options.html#quotes
let g:prettier#config#single_quote = get(g:,'prettier#config#single_quote', 'false')
" print spaces between brackets
" default: 'true'
" See more: https://prettier.io/docs/en/options.html#bracket-spacing
let g:prettier#config#bracket_spacing = get(g:,'prettier#config#bracket_spacing', 'true')
" put > on the last line instead of new line
" default: 'false'
" See more: https://prettier.io/docs/en/options.html#jsx-brackets
let g:prettier#config#jsx_bracket_same_line = get(g:,'prettier#config#jsx_bracket_same_line', 'false')
" avoid wrapping a single arrow function param in parens
" avoid|always
" default: 'always'
" See more: https://prettier.io/docs/en/options.html#arrow-function-parentheses
let g:prettier#config#arrow_parens = get(g:,'prettier#config#arrow_parens', 'always')
" Define the flavor of line endings
" lf|crlf|cr|all
" defaut: 'lf'
let g:prettier#config#end_of_line = get(g:, 'prettier#config#end_of_line', 'lf')
" Print trailing commas wherever possible when multi-line.
" none|es5|all
" default: 'es5'
" See more: https://prettier.io/docs/en/options.html#trailing-commas
let g:prettier#config#trailing_comma = get(g:,'prettier#config#trailing_comma', 'es5')
" restrict itself to only format files that contain a special comment @prettier or @format
" See more: https://prettier.io/docs/en/options.html#require-pragma
let g:prettier#config#require_pragma= get(g:, 'prettier#config#require_pragma', 'false')

The defaults that are present in the plugin are for prettier 2.x, so if you happen to work on a project with prettier 1.9 and forget to set arrow-parens to avoid in your config it will become always and then you will have conflicts with eslint.

Do you think that we probably should not pass the option at all if its value is not specified in prettier config and user .vimrc?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions