-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- adding facebook presets as a configurable option to overwrite prettier defaults
- Loading branch information
1 parent
bce2e04
commit 98845cd
Showing
5 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
" Return facebook style config overwrite presets | ||
function! prettier#presets#fb#config() abort | ||
return { | ||
\ 'bracketSpacing': 'false', | ||
\ 'jsxBracketSameLine': 'true', | ||
\ 'printWidth': 80, | ||
\ 'parser': 'flow', | ||
\ 'singleQuote': 'true', | ||
\ 'tabWidth': 2, | ||
\ 'trailingComma': 'all', | ||
\ 'useTabs': 'false', | ||
\ } | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
" Build config using predefined preset | ||
function! prettier#resolver#preset#build(fileTypeConfigOverwrites) abort | ||
if ( g:prettier#preset#config ==# 'fb' ) | ||
return extend(prettier#presets#fb#config(), a:fileTypeConfigOverwrites) | ||
endif | ||
|
||
return a:fileTypeConfigOverwrites | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98845cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @docwhat
Added support for presets, this way we can have the old prettier defaults for users that wanted it by simply including
let g:prettier#preset#config = 'fb'
on their .vimrc