mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-28 14:56:52 +08:00
Add prettier-standard support (#702)
* Add prettier-standard support * Update ale-javascript.txt Remove a duplicated header line.
This commit is contained in:
@@ -12,6 +12,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['python'],
|
||||
\ 'description': 'Fix PEP8 issues with autopep8.',
|
||||
\ },
|
||||
\ 'prettier_standard': {
|
||||
\ 'function': 'ale#fixers#prettier_standard#Fix',
|
||||
\ 'suggested_filetypes': ['javascript'],
|
||||
\ 'description': 'Apply prettier-standard to a file.',
|
||||
\ },
|
||||
\ 'eslint': {
|
||||
\ 'function': 'ale#fixers#eslint#Fix',
|
||||
\ 'suggested_filetypes': ['javascript', 'typescript'],
|
||||
|
||||
24
autoload/ale/fixers/prettier_standard.vim
Normal file
24
autoload/ale/fixers/prettier_standard.vim
Normal file
@@ -0,0 +1,24 @@
|
||||
" Author: sheerun (Adam Stankiewicz) <sheerun@sher.pl>
|
||||
" Description: Integration of Prettier Standard with ALE.
|
||||
|
||||
call ale#Set('javascript_prettier_standard_executable', 'prettier-standard')
|
||||
call ale#Set('javascript_prettier_standard_use_global', 0)
|
||||
call ale#Set('javascript_prettier_standard_options', '')
|
||||
|
||||
function! ale#fixers#prettier_standard#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_prettier_standard', [
|
||||
\ 'node_modules/prettier-standard/lib/index.js',
|
||||
\ 'node_modules/.bin/prettier-standard',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#prettier_standard#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'javascript_prettier_standard_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#prettier_standard#GetExecutable(a:buffer))
|
||||
\ . ' %t'
|
||||
\ . ' ' . l:options,
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user