mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
* 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
67 lines
2.9 KiB
Plaintext
67 lines
2.9 KiB
Plaintext
After:
|
|
unlet! g:error_lines
|
|
|
|
Execute (stylelint errors should be handled correctly):
|
|
" Stylelint includes trailing spaces for output. This needs to be taken into
|
|
" account for parsing errors.
|
|
AssertEqual
|
|
\ [
|
|
\ {
|
|
\ 'lnum': 108,
|
|
\ 'col': 10,
|
|
\ 'type': 'E',
|
|
\ 'text': 'Unexpected leading zero',
|
|
\ 'code': 'number-leading-zero',
|
|
\ },
|
|
\ {
|
|
\ 'lnum': 116,
|
|
\ 'col': 20,
|
|
\ 'type': 'E',
|
|
\ 'text': 'Expected a trailing semicolon',
|
|
\ 'code': 'declaration-block-trailing-semicolon',
|
|
\ },
|
|
\ ],
|
|
\ ale#handlers#css#HandleStyleLintFormat(42, [
|
|
\ 'src/main.css',
|
|
\ ' 108:10 ✖ Unexpected leading zero number-leading-zero ',
|
|
\ ' 116:20 ✖ Expected a trailing semicolon declaration-block-trailing-semicolon',
|
|
\ ])
|
|
|
|
Execute (stylelint should complain when no configuration file is used):
|
|
let g:error_lines = [
|
|
\ 'Error: No configuration provided for /home/w0rp/.vim/bundle/ale/test.stylus',
|
|
\ ' at module.exports (/home/w0rp/.vim/bundle/ale/node_modules/stylelint/lib/utils/configurationError.js:8:27)',
|
|
\ ' at stylelint._fullExplorer.load.then.then.config (/home/w0rp/.vim/bundle/ale/node_modules/stylelint/lib/getConfigForFile.js:39:13)',
|
|
\]
|
|
|
|
AssertEqual
|
|
\ [{
|
|
\ 'lnum': 1,
|
|
\ 'text': 'stylelint exception thrown (type :ALEDetail for more information)',
|
|
\ 'detail': join(g:error_lines, "\n"),
|
|
\ }],
|
|
\ ale#handlers#css#HandleStyleLintFormat(347, g:error_lines[:])
|
|
|
|
Execute (stylelint should complain but not blow up when SyntaxError is encountered):
|
|
let g:error_lines = [
|
|
\ 'SyntaxError: Unexpected token, expected "," (136:4)',
|
|
\ ' at constructor (/home/ts-project/node_modules/@babel/parser/lib/index.js:367:19)',
|
|
\ ' at TypeScriptParserMixin.raise (/home/ts-project/node_modules/@babel/parser/lib/index.js:6630:19)',
|
|
\ ' at TypeScriptParserMixin.unexpected (/home/ts-project/node_modules/@babel/parser/lib/index.js:6650:16)',
|
|
\ ' at TypeScriptParserMixin.expect (/home/ts-project/node_modules/@babel/parser/lib/index.js:6930:12)',
|
|
\ ' at TypeScriptParserMixin.tsParseDelimitedListWorker (/home/ts-project/node_modules/@babel/parser/lib/index.js:7932:14)',
|
|
\ ' at TypeScriptParserMixin.tsParseDelimitedList (/home/ts-project/node_modules/@babel/parser/lib/index.js:7909:25)',
|
|
\ ' at /home/ts-project/node_modules/@babel/parser/lib/index.js:9170:19',
|
|
\ ' at TypeScriptParserMixin.tsInTopLevelContext (/home/ts-project/node_modules/@babel/parser/lib/index.js:8834:14)',
|
|
\ ' at /home/ts-project/node_modules/@babel/parser/lib/index.js:9168:44',
|
|
\ ' at TypeScriptParserMixin.tsInType (/home/ts-project/node_modules/@babel/parser/lib/index.js:8841:14)',
|
|
\]
|
|
|
|
AssertEqual
|
|
\ [{
|
|
\ 'lnum': 1,
|
|
\ 'text': 'stylelint exception thrown (type :ALEDetail for more information)',
|
|
\ 'detail': join(g:error_lines, "\n"),
|
|
\ }],
|
|
\ ale#handlers#css#HandleStyleLintFormat(347, g:error_lines[:])
|