mirror of
https://github.com/dense-analysis/ale.git
synced 2026-08-26 01:19:49 +08:00
Fix markdownlint fixer and add markdownlint-cli2 (#5165)
* fix(tests): fix ale_c_build_dir_names being unset in tests (#5109) - Use ale#Set() to set the ale_c_build_dir_names variable. - Ensure SetUpLinterTest() is called before any Save commands in tests. - Add c.vim to runtime before non-linter tests are executed. - Remove workarounds in c.vim. * feat: Load Prettier from cjs also * fix: wrong command for markdownlint * feat: explicit support for markdownlint-cli2 - Add markdownlint-cli2 linter and fixer, separate from markdownilnt-cli - Rename markdownlint to markdownlint-cli - Keep markdownlint as alias for markdownlint-cli --------- Co-authored-by: w0rp <devw0rp@gmail.com> Co-authored-by: Horacio Sanson <horacio.sanson@dena.jp>
This commit is contained in:
co-authored by
w0rp
Horacio Sanson
parent
1c6e71732f
commit
eff718bee9
@@ -3,3 +3,18 @@ Execute(prettier-eslint should be aliased):
|
||||
|
||||
Execute(prettier-standard should be aliased):
|
||||
AssertEqual 'ale#fixers#prettier_standard#Fix', ale#fix#registry#GetFunc('prettier-standard')
|
||||
|
||||
Execute(markdownlint should be aliased to markdownlint-cli):
|
||||
AssertEqual
|
||||
\ 'ale#fixers#markdownlint#Fix',
|
||||
\ ale#fix#registry#GetFunc('markdownlint')
|
||||
|
||||
Execute(markdownlint-cli should be available directly):
|
||||
AssertEqual
|
||||
\ 'ale#fixers#markdownlint#Fix',
|
||||
\ ale#fix#registry#GetFunc('markdownlint-cli')
|
||||
|
||||
Execute(markdownlint-cli2 should be available directly):
|
||||
AssertEqual
|
||||
\ 'ale#fixers#markdownlint_cli2#Fix',
|
||||
\ ale#fix#registry#GetFunc('markdownlint-cli2')
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
Before:
|
||||
call ale#assert#SetUpFixerTest('markdown', 'markdownlint-cli2')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The default command should use a temporary file):
|
||||
AssertFixer {
|
||||
\ 'command': ale#Escape('markdownlint-cli2') . ' --fix %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_markdownlint_cli2_executable = 'custom_markdownlint_cli2'
|
||||
|
||||
AssertFixer {
|
||||
\ 'command': ale#Escape('custom_markdownlint_cli2') . ' --fix %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
||||
Execute(Custom options should not remove the required --fix option):
|
||||
let g:ale_markdownlint_cli2_executable = 'markdownlint-cli2'
|
||||
let g:ale_markdownlint_cli2_options = '--no-globs'
|
||||
|
||||
AssertFixer {
|
||||
\ 'command': ale#Escape('markdownlint-cli2') . ' --fix --no-globs %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
@@ -4,14 +4,25 @@ Before:
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute:
|
||||
Execute(The default command should use a temporary file):
|
||||
AssertFixer {
|
||||
\ 'command': ale#Escape('markdownlint') . ' --fix',
|
||||
\ 'command': ale#Escape('markdownlint') . ' --fix %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
||||
Execute:
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_markdownlint_executable = 'custom_markdownlint'
|
||||
|
||||
|
||||
AssertFixer {
|
||||
\ 'command': ale#Escape('custom_markdownlint') . ' --fix',
|
||||
\ 'command': ale#Escape('custom_markdownlint') . ' --fix %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
||||
Execute(Custom options should not remove the required --fix option):
|
||||
let g:ale_markdownlint_executable = 'markdownlint'
|
||||
let g:ale_markdownlint_options = '--quiet'
|
||||
|
||||
AssertFixer {
|
||||
\ 'command': ale#Escape('markdownlint') . ' --fix --quiet %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
Before:
|
||||
Save g:ale_linters
|
||||
call ale#assert#SetUpLinterTest('markdown', 'markdownlint')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default markdownlint command should be correct):
|
||||
Execute(The default markdownlint-cli command should be correct):
|
||||
AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' %s'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
@@ -12,3 +13,10 @@ Execute(The executable should be configurable):
|
||||
let g:ale_markdown_markdownlint_options = '--option'
|
||||
|
||||
AssertLinter 'foo bar', ale#Escape('foo bar') . ' --option %s'
|
||||
|
||||
Execute(markdownlint should select the markdownlint-cli linter):
|
||||
let g:ale_linters = {'markdown': ['markdownlint']}
|
||||
|
||||
AssertEqual
|
||||
\ ['markdownlint_cli'],
|
||||
\ map(ale#linter#Get('markdown'), 'v:val.name')
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
Before:
|
||||
Save g:ale_linters
|
||||
call ale#assert#SetUpLinterTest('markdown', 'markdownlint_cli2')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default markdownlint-cli2 command should be correct):
|
||||
AssertLinter
|
||||
\ 'markdownlint-cli2',
|
||||
\ ale#Escape('markdownlint-cli2') . ' %s'
|
||||
|
||||
Execute(The executable and options should be configurable):
|
||||
let g:ale_markdown_markdownlint_cli2_executable = 'foo bar'
|
||||
let g:ale_markdown_markdownlint_cli2_options = '--no-globs'
|
||||
|
||||
AssertLinter 'foo bar', ale#Escape('foo bar') . ' --no-globs %s'
|
||||
|
||||
Execute(markdownlint-cli2 should select the markdownlint-cli2 linter):
|
||||
let g:ale_linters = {'markdown': ['markdownlint-cli2']}
|
||||
|
||||
AssertEqual
|
||||
\ ['markdownlint_cli2'],
|
||||
\ map(ale#linter#Get('markdown'), 'v:val.name')
|
||||
Reference in New Issue
Block a user