{"action":"created","issue":{"url":"https://api.github.com/repos/rwjblue/ember-template-lint/issues/152","repository_url":"https://api.github.com/repos/rwjblue/ember-template-lint","labels_url":"https://api.github.com/repos/rwjblue/ember-template-lint/issues/152/labels{/name}","comments_url":"https://api.github.com/repos/rwjblue/ember-template-lint/issues/152/comments","events_url":"https://api.github.com/repos/rwjblue/ember-template-lint/issues/152/events","html_url":"https://github.com/rwjblue/ember-template-lint/pull/152","id":194853190,"number":152,"title":"CLI executable","user":{"login":"bardzusny","id":8849448,"avatar_url":"https://avatars.githubusercontent.com/u/8849448?v=3","gravatar_id":"","url":"https://api.github.com/users/bardzusny","html_url":"https://github.com/bardzusny","followers_url":"https://api.github.com/users/bardzusny/followers","following_url":"https://api.github.com/users/bardzusny/following{/other_user}","gists_url":"https://api.github.com/users/bardzusny/gists{/gist_id}","starred_url":"https://api.github.com/users/bardzusny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bardzusny/subscriptions","organizations_url":"https://api.github.com/users/bardzusny/orgs","repos_url":"https://api.github.com/users/bardzusny/repos","events_url":"https://api.github.com/users/bardzusny/events{/privacy}","received_events_url":"https://api.github.com/users/bardzusny/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-12-11T20:13:54Z","updated_at":"2017-02-05T17:23:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rwjblue/ember-template-lint/pulls/152","html_url":"https://github.com/rwjblue/ember-template-lint/pull/152","diff_url":"https://github.com/rwjblue/ember-template-lint/pull/152.diff","patch_url":"https://github.com/rwjblue/ember-template-lint/pull/152.patch"},"body":"Related issue: #108 .\r\n\r\nNode.JS script making it possible to run `ember-template-lint` check from command line. Clear use-cases for it include:\r\n\r\n* Pre-commit/push hooks\r\n* Editor integrations\r\n\r\nThe idea laid in my backlog for quite a while, finally decided to push it even in initial, very much WIP form.\r\n\r\nAs it stands, I'm already using this script with `--json` flag together with hacked-up version of [Syntastic](https://github.com/vim-syntastic/syntastic) to provide me with in-editor template linting.\r\n\r\n## Current functionality\r\n\r\n```bash\r\n# Prints all errors/warnings found in \"app/template/application.hbs\", in same format as currently provided by \"ember-cli-template-lint\" integration addon\r\n$ ember-template-lint app/templates/application.hbs\r\n\r\n# Prints all errors/warnings as JSON - for editor integrations\r\n$ ember-template-lint --json app/templates/application.hbs\r\n```\r\n\r\n## Things to consider/do pre-merge:\r\n\r\n- [x] **Node.JS version support.** I mercilessly used ESNext syntax, which could be a problem if we're to support anything older than current LTS version of Node.JS (6). No Babel here. We'd definitely want to confirm that it runs OK with 4, I think.\r\n- [x] **Parsing command-line arguments.** Currently very primitive search of `process.argv` for: `--json` flag and path of `.hbs` file to lint. On one hand I'm not too comfortable with leaving it as-is, on the other including something like [yargs](http://yargs.js.org/) seems like definite overkill.\r\n- [x] **Allow linting on more than one `.hbs` file at once.** Partially related to the above.\r\n- [ ] ~~**Handle erroneous arguments**. Anything more informative than `TypeError`s when someone passes-in path to non-existent `.hbs` file.~~ N/A anymore - if no valid file paths are passed-in, linting doesn't happen at all.\r\n- [x] **Code duplication with [ember-cli-template-lint](https://github.com/rwjblue/ember-cli-template-lint).** Mostly limited to several lines in `errorsToMessages` function (see https://github.com/rwjblue/ember-cli-template-lint/blob/master/broccoli-template-linter.js#L74 ), still worth mentioning. Didn't really consider `ember-cli-template-lint` in the bigger image, will be happy to hear opinions on where exactly we want to divide the two (general idea being that we want `ember-cli-template-lint` to be just consumer of `ember-template-lint`).\r\n- [x] **Tests.** Once everything else is out of the way, we'll definitely want to make sure command output is correctly formatted/exit code matches expectations/etc.\r\n- [ ] **README.** Make sure it includes information about provided executable."},"comment":{"url":"https://api.github.com/repos/rwjblue/ember-template-lint/issues/comments/277534105","html_url":"https://github.com/rwjblue/ember-template-lint/pull/152#issuecomment-277534105","issue_url":"https://api.github.com/repos/rwjblue/ember-template-lint/issues/152","id":277534105,"user":{"login":"bardzusny","id":8849448,"avatar_url":"https://avatars.githubusercontent.com/u/8849448?v=3","gravatar_id":"","url":"https://api.github.com/users/bardzusny","html_url":"https://github.com/bardzusny","followers_url":"https://api.github.com/users/bardzusny/followers","following_url":"https://api.github.com/users/bardzusny/following{/other_user}","gists_url":"https://api.github.com/users/bardzusny/gists{/gist_id}","starred_url":"https://api.github.com/users/bardzusny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bardzusny/subscriptions","organizations_url":"https://api.github.com/users/bardzusny/orgs","repos_url":"https://api.github.com/users/bardzusny/repos","events_url":"https://api.github.com/users/bardzusny/events{/privacy}","received_events_url":"https://api.github.com/users/bardzusny/received_events","type":"User","site_admin":false},"created_at":"2017-02-05T17:23:10Z","updated_at":"2017-02-05T17:23:10Z","body":"Hello @rwjblue - thinking that  we're close to finishing here 🎊 . Feel invited to take a look, most importantly whether you see anything left to do above minor fixes/README mention.\r\n\r\nRe. https://github.com/rwjblue/ember-template-lint/pull/152#discussion_r97345249 - I had a go at quick implementation. Quick sum-up, let me know if you see any holes in my reasoning:\r\n* `--json` case - early-emitting single object while ensuring that _valid_, nicely formatted JSON string is outputted is something that I found both problematic (indendation/trailing commas/etc.) and not very practical (because if we stop linting process mid-way we won't get parse-able JSON string, anyway - it won't have closing object brace, to start with).\r\n* non-`--json` case: Got functional version, happy to push it.  Holding myself back, because it seems like a non-blocker that would still mean a bit of divergence/inconsistency in usage of `errorsToMessages` static method (different paths for `--json`/no-`--json`)."}}
{"actor":{"display_login":"bardzusny"}}