feat: prettier for astro

This commit is contained in:
Gwon Hyuksang 2024-05-15 22:37:16 +09:00
parent c88bddfa83
commit 6b9148feee
No known key found for this signature in database
GPG Key ID: C5D68DD1FC88ADA2
3 changed files with 16 additions and 1 deletions

View File

@ -152,7 +152,7 @@ let s:default_registry = {
\ },
\ 'prettier': {
\ 'function': 'ale#fixers#prettier#Fix',
\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'svelte', 'html', 'yaml', 'openapi', 'ruby'],
\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'svelte', 'html', 'yaml', 'openapi', 'ruby', 'astro'],
\ 'description': 'Apply prettier to a file.',
\ },
\ 'prettier_eslint': {

View File

@ -79,6 +79,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort
\ 'openapi': 'yaml',
\ 'html': 'html',
\ 'ruby': 'ruby',
\ 'astro': 'astro',
\}
for l:filetype in l:filetypes

View File

@ -293,6 +293,20 @@ Execute(Should set --parser based on first filetype of multiple filetypes):
\ . ' --stdin-filepath %s --stdin',
\ }
Execute(Should set --parser based on first filetype of multiple filetypes):
call ale#test#SetFilename('../test-files/prettier/testfile')
set filetype=astro
GivenCommandOutput ['1.6.0']
AssertFixer
\ {
\ 'cwd': '%s:h',
\ 'command': ale#Escape(g:ale_javascript_prettier_executable)
\ . ' --parser astro'
\ . ' --stdin-filepath %s --stdin',
\ }
Execute(Should set --parser for experimental language, Handlebars):
call ale#test#SetFilename('../test-files/prettier/testfile.hbs')