Skip to content

Commit 99f5c43

Browse files
stevematneyCarl Willman
authored andcommitted
Adding --no-color flag to stylelint args (dense-analysis#5050)
* Adding --no-color flag to sass stylelint * Adding --no-color to all stylelint args * Adding --no-color expectation to stylelint tests * Properly handling SyntaxError for stylelint; adding corresponding test * Fixing CSS stylelint parameters and adding regression test
1 parent 11b98b3 commit 99f5c43

File tree

16 files changed

+79
-23
lines changed

16 files changed

+79
-23
lines changed

ale_linters/css/stylelint.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ call ale#Set('css_stylelint_use_global', get(g:, 'ale_use_global_executables', 0
66

77
function! ale_linters#css#stylelint#GetCommand(buffer) abort
88
return '%e ' . ale#Pad(ale#Var(a:buffer, 'css_stylelint_options'))
9-
\ . ' --stdin-filename %s'
9+
\ . ' --no-color --stdin-filename %s'
1010
endfunction
1111

1212
call ale#linter#Define('css', {

ale_linters/html/stylelint.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function! ale_linters#html#stylelint#GetCommand(buffer) abort
1616

1717
return ale#Escape(l:executable)
1818
\ . (!empty(l:options) ? ' ' . l:options : '')
19-
\ . ' --stdin-filename %s'
19+
\ . ' --no-color --stdin-filename %s'
2020
endfunction
2121

2222
call ale#linter#Define('html', {

ale_linters/less/stylelint.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ call ale#Set('less_stylelint_use_global', get(g:, 'ale_use_global_executables',
77
function! ale_linters#less#stylelint#GetCommand(buffer) abort
88
let l:options = ale#Var(a:buffer, 'less_stylelint_options')
99

10-
return '%e' . ale#Pad(l:options) . ' --stdin-filename %s'
10+
return '%e' . ale#Pad(l:options) . ' --no-color --stdin-filename %s'
1111
endfunction
1212

1313
call ale#linter#Define('less', {

ale_linters/sass/stylelint.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ call ale#linter#Define('sass', {
99
\ 'executable': {b -> ale#path#FindExecutable(b, 'sass_stylelint', [
1010
\ 'node_modules/.bin/stylelint',
1111
\ ])},
12-
\ 'command': '%e --stdin-filename %s',
12+
\ 'command': '%e --no-color --stdin-filename %s',
1313
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
1414
\})

ale_linters/scss/stylelint.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ call ale#Set('scss_stylelint_use_global', get(g:, 'ale_use_global_executables',
66

77
function! ale_linters#scss#stylelint#GetCommand(buffer) abort
88
return '%e ' . ale#Pad(ale#Var(a:buffer, 'scss_stylelint_options'))
9-
\ . ' --stdin-filename %s'
9+
\ . ' --no-color --stdin-filename %s'
1010
endfunction
1111

1212
call ale#linter#Define('scss', {

ale_linters/stylus/stylelint.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ call ale#Set('stylus_stylelint_use_global', get(g:, 'ale_use_global_executables'
77
function! ale_linters#stylus#stylelint#GetCommand(buffer) abort
88
return '%e'
99
\ . ale#Pad(ale#Var(a:buffer, 'stylus_stylelint_options'))
10-
\ . ' --stdin-filename %s'
10+
\ . ' --no-color --stdin-filename %s'
1111
endfunction
1212

1313
call ale#linter#Define('stylus', {

ale_linters/sugarss/stylelint.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ call ale#Set('sugarss_stylelint_use_global', get(g:, 'ale_use_global_executables
88
function! ale_linters#sugarss#stylelint#GetCommand(buffer) abort
99
return '%e ' . ale#Pad(ale#Var(a:buffer, 'sugarss_stylelint_options'))
1010
\ . ' --syntax=sugarss'
11-
\ . ' --stdin-filename %s'
11+
\ . ' --no-color --stdin-filename %s'
1212
endfunction
1313

1414
call ale#linter#Define('sugarss', {

autoload/ale/fixers/stylelint.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function! ale#fixers#stylelint#Fix(buffer) abort
2020
\ 'cwd': '%s:h',
2121
\ 'command': ale#node#Executable(a:buffer, l:executable)
2222
\ . ale#Pad(l:options)
23-
\ . ' --fix --stdin --stdin-filename %s',
23+
\ . ' --fix --stdin --no-color --stdin-filename %s',
2424
\ 'read_temporary_file': 0,
2525
\}
2626
endfunction

autoload/ale/handlers/css.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function! ale#handlers#css#HandleCSSLintFormat(buffer, lines) abort
3636
endfunction
3737

3838
function! ale#handlers#css#HandleStyleLintFormat(buffer, lines) abort
39-
let l:exception_pattern = '\v^Error:'
39+
let l:exception_pattern = '\v^(Syntax)?Error:'
4040

4141
for l:line in a:lines[:10]
4242
if len(matchlist(l:line, l:exception_pattern)) > 0

test/fixers/test_stylelint_fixer_callback.vader

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Execute(The stylelint callback should return the correct default values):
1717
\ 'cwd': '%s:h',
1818
\ 'command': (has('win32') ? 'node.exe ' : '')
1919
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/stylelint/bin/stylelint.js'))
20-
\ . ' --fix --stdin --stdin-filename %s',
20+
\ . ' --fix --stdin --no-color --stdin-filename %s',
2121
\ }
2222

2323
Execute(The stylelint callback should include custom stylelint options):
@@ -30,5 +30,5 @@ Execute(The stylelint callback should include custom stylelint options):
3030
\ 'cwd': '%s:h',
3131
\ 'command': (has('win32') ? 'node.exe ' : '')
3232
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/stylelint/bin/stylelint.js'))
33-
\ . ' --cache --fix --stdin --stdin-filename %s',
33+
\ . ' --cache --fix --stdin --no-color --stdin-filename %s',
3434
\ }

0 commit comments

Comments
 (0)