Remove standardts fixer in favor of allowing standard.vim fixer to handle JavaScript or TypeScript options.

This commit is contained in:
Ian Campbell
2019-10-21 20:23:33 -04:00
parent 79e9ae4550
commit cf5120ba75
4 changed files with 8 additions and 61 deletions

View File

@@ -135,11 +135,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['ruby'],
\ 'description': 'Fix ruby files with standardrb --fix',
\ },
\ 'standardts': {
\ 'function': 'ale#fixers#standardts#Fix',
\ 'suggested_filetypes': ['typescript'],
\ 'description': 'Fix TypeScript files using standard --fix',
\ },
\ 'stylelint': {
\ 'function': 'ale#fixers#stylelint#Fix',
\ 'suggested_filetypes': ['css', 'sass', 'scss', 'sugarss', 'stylus'],

View File

@@ -14,7 +14,14 @@ endfunction
function! ale#fixers#standard#Fix(buffer) abort
let l:executable = ale#fixers#standard#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'javascript_standard_options')
let l:filetype = getbufvar(a:buffer, '&filetype')
let l:options_type = 'javascript_standard_options'
if l:filetype =~# 'typescript'
let l:options_type = 'typescript_standard_options'
endif
let l:options = ale#Var(a:buffer, l:options_type)
return {
\ 'command': ale#node#Executable(a:buffer, l:executable)

View File

@@ -1,24 +0,0 @@
" Description: Fixing files with Standard for typescript.
call ale#Set('typescript_standard_executable', 'standard')
call ale#Set('typescript_standard_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('typescript_standard_options', '')
function! ale#fixers#standardts#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'typescript_standard', [
\ 'node_modules/standard/bin/cmd.js',
\ 'node_modules/.bin/standard',
\])
endfunction
function! ale#fixers#standardts#Fix(buffer) abort
let l:executable = ale#fixers#standardts#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'typescript_standard_options')
return {
\ 'command': ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --fix %t',
\ 'read_temporary_file': 1,
\}
endfunction