2017-04-07 14:38:50 +00:00
|
|
|
" Author: Adrian Zalewski <aazalewski@hotmail.com>
|
|
|
|
Before:
|
2024-02-23 04:30:12 +00:00
|
|
|
runtime autoload/ale/handlers/embertemplatelint.vim
|
2017-04-07 14:38:50 +00:00
|
|
|
|
2017-11-15 17:21:17 +00:00
|
|
|
After:
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
2017-04-07 14:38:50 +00: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
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'col': 10,
|
|
|
|
\ 'text': 'bare-strings: Non-translated string used',
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 3,
|
|
|
|
\ 'col': 6,
|
|
|
|
\ 'text': 'invalid-interactive: Interaction added to non-interactive element',
|
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
|
|
|
\ ],
|
2024-02-23 04:30:12 +00:00
|
|
|
\ ale#handlers#embertemplatelint#Handle(347, input_lines)
|
2017-04-07 14:38:50 +00:00
|
|
|
|
2017-05-28 19:19:47 +00: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 ...",
|
2017-12-19 17:42:51 +00:00
|
|
|
\ "line": 5,
|
|
|
|
\ "column": 3,
|
2017-05-28 19:19:47 +00:00
|
|
|
\ "source": "Error: Parse error on line 5 ...",
|
|
|
|
\ "severity": 2
|
|
|
|
\ }
|
|
|
|
\ ]
|
|
|
|
\ }', '\n')
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
2017-12-19 17:42:51 +00:00
|
|
|
\ 'lnum': 5,
|
|
|
|
\ 'col': 3,
|
2017-05-28 19:19:47 +00:00
|
|
|
\ 'text': 'Parse error on line 5 ...',
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ ],
|
2024-02-23 04:30:12 +00:00
|
|
|
\ ale#handlers#embertemplatelint#Handle(347, input_lines)
|
2017-05-28 19:19:47 +00:00
|
|
|
|
2017-04-07 14:38:50 +00:00
|
|
|
Execute(The ember-template-lint handler should handle no lint errors/warnings):
|
|
|
|
AssertEqual
|
2017-07-26 23:45:25 +00:00
|
|
|
\ [],
|
2024-02-23 04:30:12 +00:00
|
|
|
\ ale#handlers#embertemplatelint#Handle(347, [])
|
2017-07-26 23:45:25 +00:00
|
|
|
AssertEqual
|
|
|
|
\ [],
|
2024-02-23 04:30:12 +00:00
|
|
|
\ ale#handlers#embertemplatelint#Handle(347, ['{}'])
|