2017-04-07 10:38:50 -04:00
|
|
|
" Author: Adrian Zalewski <aazalewski@hotmail.com>
|
|
|
|
Before:
|
|
|
|
runtime ale_linters/handlebars/embertemplatelint.vim
|
|
|
|
|
2017-11-15 12:21:17 -05:00
|
|
|
After:
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
2017-04-07 10:38:50 -04:00
|
|
|
Execute(The ember-template-lint handler should parse lines correctly):
|
|
|
|
let input_lines = split('{
|
|
|
|
\ "/ember-project/app/templates/application.hbs": [
|
|
|
|
\ {
|
|
|
|
\ "moduleId": "app/templates/application",
|
|
|
|
\ "rule": "bare-strings",
|
|
|
|
\ "severity": 2,
|
|
|
|
\ "message": "Non-translated string used",
|
|
|
|
\ "line": 1,
|
|
|
|
\ "column": 10,
|
|
|
|
\ "source": " Bare String\n"
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ "moduleId": "app/templates/application",
|
|
|
|
\ "rule": "invalid-interactive",
|
|
|
|
\ "severity": 1,
|
|
|
|
\ "message": "Interaction added to non-interactive element",
|
|
|
|
\ "line": 3,
|
|
|
|
\ "column": 6,
|
|
|
|
\ "source": "<span {{action someAction}}></span>"
|
|
|
|
\ }
|
|
|
|
\ ]
|
|
|
|
\ }', '\n')
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'bufnr': 347,
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'col': 10,
|
|
|
|
\ 'text': 'bare-strings: Non-translated string used',
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'bufnr': 347,
|
|
|
|
\ 'lnum': 3,
|
|
|
|
\ 'col': 6,
|
|
|
|
\ 'text': 'invalid-interactive: Interaction added to non-interactive element',
|
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#handlebars#embertemplatelint#Handle(347, input_lines)
|
|
|
|
|
2017-05-28 15:19:47 -04:00
|
|
|
Execute(The ember-template-lint handler should handle template parsing error correctly):
|
|
|
|
let input_lines = split('{
|
|
|
|
\ "/ember-project/app/templates/application.hbs": [
|
|
|
|
\ {
|
|
|
|
\ "fatal": true,
|
|
|
|
\ "moduleId": "app/templates/application",
|
|
|
|
\ "message": "Parse error on line 5 ...",
|
|
|
|
\ "line": 1,
|
|
|
|
\ "column": 1,
|
|
|
|
\ "source": "Error: Parse error on line 5 ...",
|
|
|
|
\ "severity": 2
|
|
|
|
\ }
|
|
|
|
\ ]
|
|
|
|
\ }', '\n')
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'bufnr': 347,
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'col': 1,
|
|
|
|
\ 'text': 'Parse error on line 5 ...',
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#handlebars#embertemplatelint#Handle(347, input_lines)
|
|
|
|
|
2017-04-07 10:38:50 -04:00
|
|
|
Execute(The ember-template-lint handler should handle no lint errors/warnings):
|
|
|
|
AssertEqual
|
2017-07-26 19:45:25 -04:00
|
|
|
\ [],
|
2017-04-07 10:38:50 -04:00
|
|
|
\ ale_linters#handlebars#embertemplatelint#Handle(347, [])
|
2017-07-26 19:45:25 -04:00
|
|
|
AssertEqual
|
|
|
|
\ [],
|
|
|
|
\ ale_linters#handlebars#embertemplatelint#Handle(347, ['{}'])
|