mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-16 01:07:06 +08:00
Remove standardts fixer in favor of allowing standard.vim fixer to handle JavaScript or TypeScript options.
This commit is contained in:
@@ -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'],
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user