2017-08-30 21:49:46 +00:00
|
|
|
Before:
|
2019-04-07 13:58:06 +00:00
|
|
|
call ale#assert#SetUpFixerTest('javascript', 'prettier_eslint')
|
2020-08-16 20:19:07 +00:00
|
|
|
Save g:ale_command_wrapper
|
|
|
|
|
|
|
|
let g:ale_command_wrapper = ''
|
2017-08-30 21:49:46 +00:00
|
|
|
|
|
|
|
After:
|
2019-04-07 13:58:06 +00:00
|
|
|
call ale#assert#TearDownFixerTest()
|
2017-08-30 21:49:46 +00:00
|
|
|
|
|
|
|
Execute(The default command should be correct):
|
2019-04-07 13:58:06 +00:00
|
|
|
AssertFixer
|
2017-08-30 21:49:46 +00:00
|
|
|
\ {
|
|
|
|
\ 'read_temporary_file': 1,
|
|
|
|
\ 'command':
|
|
|
|
\ ale#Escape('prettier-eslint')
|
|
|
|
\ . ' %t'
|
|
|
|
\ . ' --write'
|
2019-04-07 13:58:06 +00:00
|
|
|
\ }
|
2017-08-30 21:49:46 +00:00
|
|
|
|
|
|
|
Execute(Additional options should be used when set):
|
|
|
|
let b:ale_javascript_prettier_eslint_options = '--foobar'
|
|
|
|
|
2019-04-07 13:58:06 +00:00
|
|
|
AssertFixer
|
2017-08-30 21:49:46 +00:00
|
|
|
\ {
|
|
|
|
\ 'read_temporary_file': 1,
|
|
|
|
\ 'command':
|
|
|
|
\ ale#Escape('prettier-eslint')
|
|
|
|
\ . ' %t'
|
|
|
|
\ . ' --foobar --write'
|
2019-04-07 13:58:06 +00:00
|
|
|
\ }
|
2017-08-30 21:49:46 +00:00
|
|
|
|
2017-11-22 14:46:14 +00:00
|
|
|
Execute(--eslint-config-path should be set for 4.2.0 and up):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/eslint/react-app/foo/bar.js')
|
2017-08-30 21:49:46 +00:00
|
|
|
|
2019-04-07 13:58:06 +00:00
|
|
|
GivenCommandOutput ['4.2.0']
|
|
|
|
AssertFixer
|
2017-08-30 21:49:46 +00:00
|
|
|
\ {
|
|
|
|
\ 'read_temporary_file': 1,
|
|
|
|
\ 'command':
|
|
|
|
\ ale#Escape('prettier-eslint')
|
|
|
|
\ . ' %t'
|
2021-03-20 22:11:22 +00:00
|
|
|
\ . ' --eslint-config-path ' . ale#Escape(ale#test#GetFilename('../test-files/eslint/react-app/.eslintrc.js'))
|
2017-08-30 21:49:46 +00:00
|
|
|
\ . ' --write'
|
2019-04-07 13:58:06 +00:00
|
|
|
\ }
|
2017-08-30 21:49:46 +00:00
|
|
|
|
2017-11-22 14:46:14 +00:00
|
|
|
Execute(--eslint-config-path shouldn't be used for older versions):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/eslint/react-app/foo/bar.js')
|
2017-08-30 21:49:46 +00:00
|
|
|
|
2019-04-07 13:58:06 +00:00
|
|
|
AssertFixer
|
2017-08-30 21:49:46 +00:00
|
|
|
\ {
|
|
|
|
\ 'read_temporary_file': 1,
|
|
|
|
\ 'command':
|
|
|
|
\ ale#Escape('prettier-eslint')
|
|
|
|
\ . ' %t'
|
|
|
|
\ . ' --write'
|
2019-04-07 13:58:06 +00:00
|
|
|
\ }
|
2017-11-22 14:46:14 +00:00
|
|
|
|
|
|
|
Execute(The version check should be correct):
|
2019-04-07 13:58:06 +00:00
|
|
|
AssertFixer [
|
|
|
|
\ ale#Escape('prettier-eslint') . ' --version',
|
2017-11-22 14:46:14 +00:00
|
|
|
\ {
|
2019-04-07 13:58:06 +00:00
|
|
|
\ 'read_temporary_file': 1,
|
|
|
|
\ 'command':
|
|
|
|
\ ale#Escape('prettier-eslint')
|
|
|
|
\ . ' %t'
|
|
|
|
\ . ' --write'
|
|
|
|
\ }
|
|
|
|
\]
|
2017-11-22 14:46:14 +00:00
|
|
|
|
|
|
|
Execute(The new --stdin-filepath option should be used when the version is new enough):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/eslint/react-app/foo/bar.js')
|
2017-11-22 14:46:14 +00:00
|
|
|
|
2019-04-07 13:58:06 +00:00
|
|
|
GivenCommandOutput ['4.4.0']
|
|
|
|
AssertFixer
|
2017-11-22 14:46:14 +00:00
|
|
|
\ {
|
2021-03-01 20:11:10 +00:00
|
|
|
\ 'cwd': '%s:h',
|
|
|
|
\ 'command': ale#Escape('prettier-eslint')
|
2021-03-20 22:11:22 +00:00
|
|
|
\ . ' --eslint-config-path ' . ale#Escape(ale#test#GetFilename('../test-files/eslint/react-app/.eslintrc.js'))
|
2017-11-22 14:46:14 +00:00
|
|
|
\ . ' --stdin-filepath %s --stdin',
|
2019-04-07 13:58:06 +00:00
|
|
|
\ }
|
2017-11-22 14:46:14 +00:00
|
|
|
|
|
|
|
Execute(The version number should be cached):
|
2019-04-07 13:58:06 +00:00
|
|
|
GivenCommandOutput ['4.4.0']
|
|
|
|
AssertFixer
|
2017-11-22 14:46:14 +00:00
|
|
|
\ {
|
2021-03-01 20:11:10 +00:00
|
|
|
\ 'cwd': '%s:h',
|
|
|
|
\ 'command': ale#Escape('prettier-eslint')
|
2019-04-07 13:58:06 +00:00
|
|
|
\ . ' --stdin-filepath %s --stdin',
|
|
|
|
\ }
|
2017-11-22 14:46:14 +00:00
|
|
|
|
2019-04-07 13:58:06 +00:00
|
|
|
GivenCommandOutput []
|
|
|
|
AssertFixer
|
2017-11-22 14:46:14 +00:00
|
|
|
\ {
|
2021-03-01 20:11:10 +00:00
|
|
|
\ 'cwd': '%s:h',
|
|
|
|
\ 'command': ale#Escape('prettier-eslint')
|
2017-11-22 14:46:14 +00:00
|
|
|
\ . ' --stdin-filepath %s --stdin',
|
2019-04-07 13:58:06 +00:00
|
|
|
\ }
|