mirror of https://github.com/dense-analysis/ale
support ember-template-lint 4.x (#4200)
* support ember-template-lint 4.x * update ember-template-lint linter test
This commit is contained in:
parent
e6ca599e87
commit
5479b58660
|
@ -11,10 +11,17 @@ function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
|
|||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) abort
|
||||
" Reading from stdin was introduced in ember-template-lint@1.6.0
|
||||
return ale#semver#GTE(a:version, [1, 6, 0])
|
||||
\ ? '%e --json --filename %s'
|
||||
\ : '%e --json %t'
|
||||
if ale#semver#GTE(a:version, [4, 0, 0])
|
||||
" --json was removed in favor of --format=json in ember-template-lint@4.0.0
|
||||
return '%e --format=json --filename %s'
|
||||
endif
|
||||
|
||||
if ale#semver#GTE(a:version, [1, 6, 0])
|
||||
" Reading from stdin was introduced in ember-template-lint@1.6.0
|
||||
return '%e --json --filename %s'
|
||||
endif
|
||||
|
||||
return '%e --json %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
Before:
|
||||
call ale#assert#SetUpLinterTest('handlebars', 'embertemplatelint')
|
||||
|
||||
GivenCommandOutput ['1.6.0']
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(ember-template-lint executables runs the right command):
|
||||
Execute(Runs the right command for ember-template-lint >= 4.x):
|
||||
GivenCommandOutput ['4.0.0']
|
||||
|
||||
AssertLinter 'ember-template-lint',
|
||||
\ ale#Escape('ember-template-lint') . ' --format=json --filename %s'
|
||||
|
||||
Execute(Runs the right command for ember-template-lint >= 1.6, < 4.x):
|
||||
GivenCommandOutput ['1.6.0']
|
||||
|
||||
AssertLinter 'ember-template-lint',
|
||||
\ ale#Escape('ember-template-lint') . ' --json --filename %s'
|
||||
|
||||
Execute(old ember-template-lint executables runs the right command):
|
||||
GivenCommandOutput []
|
||||
Execute(Runs the right command for ember-template-lint < 1.6):
|
||||
GivenCommandOutput ['1.5.0']
|
||||
|
||||
AssertLinter 'ember-template-lint',
|
||||
\ ale#Escape('ember-template-lint') . ' --json %t'
|
||||
|
|
Loading…
Reference in New Issue