improve prettier configuration

This commit is contained in:
JulioJu 2018-04-12 19:02:05 +02:00
parent e63b4e957a
commit 87fff48941

View File

@ -21,6 +21,10 @@ if !exists('g:autoformat_verbosemode')
let g:autoformat_verbosemode = 0
endif
if !exists('g:formatdef_prettier')
let g:formatdef_prettier = '"prettier"'
endif
" Python
if !exists('g:formatdef_autopep8')
@ -159,12 +163,6 @@ if !exists('g:formatdef_standard_javascript')
let g:formatdef_standard_javascript = '"standard --fix --stdin"'
endif
if !exists('g:formatdef_prettier_javascript')
if filereadable('.prettierrc')
let g:formatdef_prettier_javascript = '"prettier"'
endif
endif
" This is an xo formatter (inspired by the above eslint formatter)
" To support ignore and overrides options, we need to use a tmp file
" So we create a tmp file here and then remove it afterwards
@ -254,7 +252,7 @@ if !exists('g:formatters_javascript')
\ 'jsbeautify_javascript',
\ 'jscs',
\ 'standard_javascript',
\ 'prettier_javascript',
\ 'prettier',
\ 'xo_javascript',
\ ]
endif
@ -274,11 +272,11 @@ if !exists('g:formatdef_fixjson')
let g:formatdef_fixjson = '"fixjson"'
endif
if !exists('g:formatters_json')
let g:formatters_json = [
\ 'jsbeautify_json',
\ 'fixjson',
\ 'prettier',
\ ]
endif
@ -343,19 +341,22 @@ if !exists('g:formatdef_cssbeautify')
endif
if !exists('g:formatters_css')
let g:formatters_css = ['cssbeautify']
let g:formatters_css = ['cssbeautify', 'prettier']
endif
" SCSS
if !exists('g:formatdef_sassconvert')
let g:formatdef_sassconvert = '"sass-convert -F scss -T scss --indent " . (&expandtab ? shiftwidth() : "t")'
endif
if !exists('g:formatters_scss')
let g:formatters_scss = ['sassconvert']
let g:formatters_scss = ['sassconvert', 'prettier']
endif
" Less
if !exists('g:formatters_less')
let g:formatters_less = ['prettier']
endif
" Typescript
if !exists('g:formatdef_tsfmt')
@ -363,7 +364,7 @@ if !exists('g:formatdef_tsfmt')
endif
if !exists('g:formatters_typescript')
let g:formatters_typescript = ['tsfmt']
let g:formatters_typescript = ['tsfmt', 'prettier']
endif
@ -439,7 +440,12 @@ if !exists('g:formatdef_remark_markdown')
endif
if !exists('g:formatters_markdown')
let g:formatters_markdown = ['remark_markdown']
let g:formatters_markdown = ['remark_markdown', 'prettier']
endif
" Graphql
if !exists('g:formatters_graphql')
let g:formatters_graphql = ['prettier']
endif
" Fortran