{"action":"created","comment":{"url":"https://api.github.com/repos/bem/bem-xjst/pulls/comments/90229160","pull_request_review_id":10750392,"id":90229160,"diff_hunk":"@@ -0,0 +1,7 @@\n+if [ \"$#\" -ne 3 ]; then\n+    ./migration/lib/index.js --lint\n+    exit 1\n+fi\n+\n+./migration/lib/index.js --lint --input $1 --from $2 --to $3","path":"bin/bem-xjst-lint","position":6,"original_position":6,"commit_id":"e2fab338b5389cbc983b26ae1b9ca74bcc5cc266","original_commit_id":"e2fab338b5389cbc983b26ae1b9ca74bcc5cc266","user":{"login":"zxqfox","id":677518,"avatar_url":"https://avatars.githubusercontent.com/u/677518?v=3","gravatar_id":"","url":"https://api.github.com/users/zxqfox","html_url":"https://github.com/zxqfox","followers_url":"https://api.github.com/users/zxqfox/followers","following_url":"https://api.github.com/users/zxqfox/following{/other_user}","gists_url":"https://api.github.com/users/zxqfox/gists{/gist_id}","starred_url":"https://api.github.com/users/zxqfox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zxqfox/subscriptions","organizations_url":"https://api.github.com/users/zxqfox/orgs","repos_url":"https://api.github.com/users/zxqfox/repos","events_url":"https://api.github.com/users/zxqfox/events{/privacy}","received_events_url":"https://api.github.com/users/zxqfox/received_events","type":"User","site_admin":false},"body":"под виндой это не будет работать, если что. нам это важно?","created_at":"2016-11-30T13:15:43Z","updated_at":"2016-11-30T13:15:43Z","html_url":"https://github.com/bem/bem-xjst/pull/377#discussion_r90229160","pull_request_url":"https://api.github.com/repos/bem/bem-xjst/pulls/377","_links":{"self":{"href":"https://api.github.com/repos/bem/bem-xjst/pulls/comments/90229160"},"html":{"href":"https://github.com/bem/bem-xjst/pull/377#discussion_r90229160"},"pull_request":{"href":"https://api.github.com/repos/bem/bem-xjst/pulls/377"}}},"pull_request":{"url":"https://api.github.com/repos/bem/bem-xjst/pulls/377","id":90995152,"html_url":"https://github.com/bem/bem-xjst/pull/377","diff_url":"https://github.com/bem/bem-xjst/pull/377.diff","patch_url":"https://github.com/bem/bem-xjst/pull/377.patch","issue_url":"https://api.github.com/repos/bem/bem-xjst/issues/377","number":377,"state":"open","locked":false,"title":"Static analyzer","user":{"login":"miripiruni","id":144537,"avatar_url":"https://avatars.githubusercontent.com/u/144537?v=3","gravatar_id":"","url":"https://api.github.com/users/miripiruni","html_url":"https://github.com/miripiruni","followers_url":"https://api.github.com/users/miripiruni/followers","following_url":"https://api.github.com/users/miripiruni/following{/other_user}","gists_url":"https://api.github.com/users/miripiruni/gists{/gist_id}","starred_url":"https://api.github.com/users/miripiruni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miripiruni/subscriptions","organizations_url":"https://api.github.com/users/miripiruni/orgs","repos_url":"https://api.github.com/users/miripiruni/repos","events_url":"https://api.github.com/users/miripiruni/events{/privacy}","received_events_url":"https://api.github.com/users/miripiruni/received_events","type":"User","site_admin":false},"body":"Fixes \r\n- [Static lint](https://github.com/bem/bem-xjst/issues/49) (Issue 49)\r\n- [Migration script for every major version](https://github.com/bem/bem-xjst/issues/353) (Issue 353)\r\n### Changes proposed in this pull request\r\n\r\nI introduce two features:\r\n1. Static linter\r\n2. Mirgation scripts\r\n\r\nBoth of them on jscodeshift + my boilerplate code for logging and AST checking.\r\n### How static lint work?\r\n\r\n`$ ./bin/bem-xjst-lint ./path-to-templates/ 7 8` \r\n\r\n7 — current major version of bem-xjst templates\r\n8 — version to check for\r\n\r\nExample:\r\n\r\n```\r\n$ ./bin/bem-xjst-lint ./migration/tmpls/ 1 8\r\nSTATIC LINT MODE\r\nProcessing 1 files...\r\nSpawning 1 workers...\r\nSending 1 files to free worker...\r\nBEM-XJST WARNING:\r\n>>>> Function that returns a literal can be replaced with literal itself.\r\n>>>> migration/tmpls/template.js:1:17\r\n>>>> function() { return 'abc'; }\r\n\r\n\r\nBEM-XJST WARNING:\r\n>>>> Function that returns a literal can be replaced with literal itself.\r\n>>>> migration/tmpls/template.js:8:17\r\n>>>> function() { return 42; }\r\n\r\n\r\nAll done.\r\nResults:\r\n0 errors\r\n0 unmodified\r\n1 skipped\r\n0 ok\r\nTime elapsed: 7.805seconds\r\n```\r\n### How migrate tool work?\r\n\r\n`./bin/bem-xjst-migrate /path-to-tamplates/ 7 8`\r\n\r\n7 — current major version of bem-xjst templates\r\n8 — version to check for\r\n\r\nExample:\r\n\r\n```\r\n$ ./bin/bem-xjst-migrate ./migration/tmpls/ 7 8\r\n\r\nProcessing 2 files...\r\nSpawning 2 workers...\r\nSending 1 files to free worker...\r\nSending 1 files to free worker...\r\nAll done.\r\nResults:\r\n0 errors\r\n1 unmodified\r\n0 skipped\r\n1 ok\r\nTime elapsed: 3.896seconds\r\n```\r\n\r\n\r\n### TODO\r\n- [x] Documentation changed\r\n- [x] Tests\r\n- [x] Collect list of transformers/linters (see below)\r\n\r\nTransformers:\r\nfor v7 to v8\r\n- [x] `mix()` to `addMix()`\r\n- [x] `attrs()` to `addAttrs()`\r\n\r\nfor v6 to v7\r\n- [x] `this.isArray(argument)` to `Array.isArray(argument)`\r\n- [x] `once()` to `def()`\r\n- [x] For safety: modifiers value should be String type. In BEMJSON and in template. If not so - we must warn you. Comare sandbox example in v6.x and v7.x https://goo.gl/auhOOV\r\n- [x] for backwards capability use xhtml: true option value in all bemxjst.compile() functions.\r\n\r\nfor v5 to v6\r\n- [x] There is nothing to rewrite in templates. (Really?)\r\n\r\nfor v4 to v5\r\n- [x] Replace elemMatch(argument) to elem('*').match(function() { ... }).\r\n- [x] `mods` for `elem` (instead of `elemMods`). behavior `mods` and `elemMods` BEMJSON fields are changed. bem-xjst should not treat `elemMods` as `mods`. See [qfox’s comment](https://nda.ya.ru/3S82Z9) — [BEMJSON tested in runtime lint](https://github.com/bem/bem-xjst/blob/master/runtime-lint/index.js#L123).\r\n- [x] API changed: require('bem-xjst') now returns two engines bemhtml and bemtree. Replace require('bem-xjst') to require('bem-xjst').bemhtml.\r\n\r\nfor v2 to v3\r\n- [x] Do not use `apply.call(BEMJSON)`. Use `apply(BEMJSON)`.\r\n\r\nfor v1 to v2\r\n- [x] Default (def()) mode of templates MUST return a string now.\r\n- [x] this._ no more\r\n- [x] mode('') no more\r\n\r\nSome common checks:\r\n- [x] Function that returns a literal can be replaced with literal itself.\r\n- [x] warn about this.mods && this.mods.some should be this.mods.some\r\n- [x] `mix()([])` to function generator instead: `function() { return []; }`.\r\n- [x] warn about html entities. Suggest UTF-8 symbols.\r\n- [x] assignment to `ctx.mods` (instead of `this.mods`) — checked in runtime linter \r\n","created_at":"2016-10-26T12:35:34Z","updated_at":"2016-11-30T13:15:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dccf1d8f9219a3ca1bbda2dde96fe777af29988a","assignee":{"login":"miripiruni","id":144537,"avatar_url":"https://avatars.githubusercontent.com/u/144537?v=3","gravatar_id":"","url":"https://api.github.com/users/miripiruni","html_url":"https://github.com/miripiruni","followers_url":"https://api.github.com/users/miripiruni/followers","following_url":"https://api.github.com/users/miripiruni/following{/other_user}","gists_url":"https://api.github.com/users/miripiruni/gists{/gist_id}","starred_url":"https://api.github.com/users/miripiruni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miripiruni/subscriptions","organizations_url":"https://api.github.com/users/miripiruni/orgs","repos_url":"https://api.github.com/users/miripiruni/repos","events_url":"https://api.github.com/users/miripiruni/events{/privacy}","received_events_url":"https://api.github.com/users/miripiruni/received_events","type":"User","site_admin":false},"assignees":[{"login":"miripiruni","id":144537,"avatar_url":"https://avatars.githubusercontent.com/u/144537?v=3","gravatar_id":"","url":"https://api.github.com/users/miripiruni","html_url":"https://github.com/miripiruni","followers_url":"https://api.github.com/users/miripiruni/followers","following_url":"https://api.github.com/users/miripiruni/following{/other_user}","gists_url":"https://api.github.com/users/miripiruni/gists{/gist_id}","starred_url":"https://api.github.com/users/miripiruni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miripiruni/subscriptions","organizations_url":"https://api.github.com/users/miripiruni/orgs","repos_url":"https://api.github.com/users/miripiruni/repos","events_url":"https://api.github.com/users/miripiruni/events{/privacy}","received_events_url":"https://api.github.com/users/miripiruni/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/bem/bem-xjst/pulls/377/commits","review_comments_url":"https://api.github.com/repos/bem/bem-xjst/pulls/377/comments","review_comment_url":"https://api.github.com/repos/bem/bem-xjst/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bem/bem-xjst/issues/377/comments","statuses_url":"https://api.github.com/repos/bem/bem-xjst/statuses/e2fab338b5389cbc983b26ae1b9ca74bcc5cc266","head":{"label":"bem:static-analyze","ref":"static-analyze","sha":"e2fab338b5389cbc983b26ae1b9ca74bcc5cc266","user":{"login":"bem","id":223412,"avatar_url":"https://avatars.githubusercontent.com/u/223412?v=3","gravatar_id":"","url":"https://api.github.com/users/bem","html_url":"https://github.com/bem","followers_url":"https://api.github.com/users/bem/followers","following_url":"https://api.github.com/users/bem/following{/other_user}","gists_url":"https://api.github.com/users/bem/gists{/gist_id}","starred_url":"https://api.github.com/users/bem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem/subscriptions","organizations_url":"https://api.github.com/users/bem/orgs","repos_url":"https://api.github.com/users/bem/repos","events_url":"https://api.github.com/users/bem/events{/privacy}","received_events_url":"https://api.github.com/users/bem/received_events","type":"Organization","site_admin":false},"repo":{"id":10028367,"name":"bem-xjst","full_name":"bem/bem-xjst","owner":{"login":"bem","id":223412,"avatar_url":"https://avatars.githubusercontent.com/u/223412?v=3","gravatar_id":"","url":"https://api.github.com/users/bem","html_url":"https://github.com/bem","followers_url":"https://api.github.com/users/bem/followers","following_url":"https://api.github.com/users/bem/following{/other_user}","gists_url":"https://api.github.com/users/bem/gists{/gist_id}","starred_url":"https://api.github.com/users/bem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem/subscriptions","organizations_url":"https://api.github.com/users/bem/orgs","repos_url":"https://api.github.com/users/bem/repos","events_url":"https://api.github.com/users/bem/events{/privacy}","received_events_url":"https://api.github.com/users/bem/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bem/bem-xjst","description":"Declarative template engine for the browser and server","fork":false,"url":"https://api.github.com/repos/bem/bem-xjst","forks_url":"https://api.github.com/repos/bem/bem-xjst/forks","keys_url":"https://api.github.com/repos/bem/bem-xjst/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bem/bem-xjst/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bem/bem-xjst/teams","hooks_url":"https://api.github.com/repos/bem/bem-xjst/hooks","issue_events_url":"https://api.github.com/repos/bem/bem-xjst/issues/events{/number}","events_url":"https://api.github.com/repos/bem/bem-xjst/events","assignees_url":"https://api.github.com/repos/bem/bem-xjst/assignees{/user}","branches_url":"https://api.github.com/repos/bem/bem-xjst/branches{/branch}","tags_url":"https://api.github.com/repos/bem/bem-xjst/tags","blobs_url":"https://api.github.com/repos/bem/bem-xjst/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bem/bem-xjst/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bem/bem-xjst/git/refs{/sha}","trees_url":"https://api.github.com/repos/bem/bem-xjst/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bem/bem-xjst/statuses/{sha}","languages_url":"https://api.github.com/repos/bem/bem-xjst/languages","stargazers_url":"https://api.github.com/repos/bem/bem-xjst/stargazers","contributors_url":"https://api.github.com/repos/bem/bem-xjst/contributors","subscribers_url":"https://api.github.com/repos/bem/bem-xjst/subscribers","subscription_url":"https://api.github.com/repos/bem/bem-xjst/subscription","commits_url":"https://api.github.com/repos/bem/bem-xjst/commits{/sha}","git_commits_url":"https://api.github.com/repos/bem/bem-xjst/git/commits{/sha}","comments_url":"https://api.github.com/repos/bem/bem-xjst/comments{/number}","issue_comment_url":"https://api.github.com/repos/bem/bem-xjst/issues/comments{/number}","contents_url":"https://api.github.com/repos/bem/bem-xjst/contents/{+path}","compare_url":"https://api.github.com/repos/bem/bem-xjst/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bem/bem-xjst/merges","archive_url":"https://api.github.com/repos/bem/bem-xjst/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bem/bem-xjst/downloads","issues_url":"https://api.github.com/repos/bem/bem-xjst/issues{/number}","pulls_url":"https://api.github.com/repos/bem/bem-xjst/pulls{/number}","milestones_url":"https://api.github.com/repos/bem/bem-xjst/milestones{/number}","notifications_url":"https://api.github.com/repos/bem/bem-xjst/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bem/bem-xjst/labels{/name}","releases_url":"https://api.github.com/repos/bem/bem-xjst/releases{/id}","deployments_url":"https://api.github.com/repos/bem/bem-xjst/deployments","created_at":"2013-05-13T09:22:05Z","updated_at":"2016-11-20T14:05:03Z","pushed_at":"2016-11-30T13:03:33Z","git_url":"git://github.com/bem/bem-xjst.git","ssh_url":"git@github.com:bem/bem-xjst.git","clone_url":"https://github.com/bem/bem-xjst.git","svn_url":"https://github.com/bem/bem-xjst","homepage":"https://bem.github.io/bem-xjst","size":1853,"stargazers_count":83,"watchers_count":83,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":29,"mirror_url":null,"open_issues_count":50,"forks":29,"open_issues":50,"watchers":83,"default_branch":"master"}},"base":{"label":"bem:master","ref":"master","sha":"929b6881a1bf0c11a60455723532c05e584ca16a","user":{"login":"bem","id":223412,"avatar_url":"https://avatars.githubusercontent.com/u/223412?v=3","gravatar_id":"","url":"https://api.github.com/users/bem","html_url":"https://github.com/bem","followers_url":"https://api.github.com/users/bem/followers","following_url":"https://api.github.com/users/bem/following{/other_user}","gists_url":"https://api.github.com/users/bem/gists{/gist_id}","starred_url":"https://api.github.com/users/bem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem/subscriptions","organizations_url":"https://api.github.com/users/bem/orgs","repos_url":"https://api.github.com/users/bem/repos","events_url":"https://api.github.com/users/bem/events{/privacy}","received_events_url":"https://api.github.com/users/bem/received_events","type":"Organization","site_admin":false},"repo":{"id":10028367,"name":"bem-xjst","full_name":"bem/bem-xjst","owner":{"login":"bem","id":223412,"avatar_url":"https://avatars.githubusercontent.com/u/223412?v=3","gravatar_id":"","url":"https://api.github.com/users/bem","html_url":"https://github.com/bem","followers_url":"https://api.github.com/users/bem/followers","following_url":"https://api.github.com/users/bem/following{/other_user}","gists_url":"https://api.github.com/users/bem/gists{/gist_id}","starred_url":"https://api.github.com/users/bem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem/subscriptions","organizations_url":"https://api.github.com/users/bem/orgs","repos_url":"https://api.github.com/users/bem/repos","events_url":"https://api.github.com/users/bem/events{/privacy}","received_events_url":"https://api.github.com/users/bem/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bem/bem-xjst","description":"Declarative template engine for the browser and server","fork":false,"url":"https://api.github.com/repos/bem/bem-xjst","forks_url":"https://api.github.com/repos/bem/bem-xjst/forks","keys_url":"https://api.github.com/repos/bem/bem-xjst/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bem/bem-xjst/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bem/bem-xjst/teams","hooks_url":"https://api.github.com/repos/bem/bem-xjst/hooks","issue_events_url":"https://api.github.com/repos/bem/bem-xjst/issues/events{/number}","events_url":"https://api.github.com/repos/bem/bem-xjst/events","assignees_url":"https://api.github.com/repos/bem/bem-xjst/assignees{/user}","branches_url":"https://api.github.com/repos/bem/bem-xjst/branches{/branch}","tags_url":"https://api.github.com/repos/bem/bem-xjst/tags","blobs_url":"https://api.github.com/repos/bem/bem-xjst/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bem/bem-xjst/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bem/bem-xjst/git/refs{/sha}","trees_url":"https://api.github.com/repos/bem/bem-xjst/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bem/bem-xjst/statuses/{sha}","languages_url":"https://api.github.com/repos/bem/bem-xjst/languages","stargazers_url":"https://api.github.com/repos/bem/bem-xjst/stargazers","contributors_url":"https://api.github.com/repos/bem/bem-xjst/contributors","subscribers_url":"https://api.github.com/repos/bem/bem-xjst/subscribers","subscription_url":"https://api.github.com/repos/bem/bem-xjst/subscription","commits_url":"https://api.github.com/repos/bem/bem-xjst/commits{/sha}","git_commits_url":"https://api.github.com/repos/bem/bem-xjst/git/commits{/sha}","comments_url":"https://api.github.com/repos/bem/bem-xjst/comments{/number}","issue_comment_url":"https://api.github.com/repos/bem/bem-xjst/issues/comments{/number}","contents_url":"https://api.github.com/repos/bem/bem-xjst/contents/{+path}","compare_url":"https://api.github.com/repos/bem/bem-xjst/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bem/bem-xjst/merges","archive_url":"https://api.github.com/repos/bem/bem-xjst/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bem/bem-xjst/downloads","issues_url":"https://api.github.com/repos/bem/bem-xjst/issues{/number}","pulls_url":"https://api.github.com/repos/bem/bem-xjst/pulls{/number}","milestones_url":"https://api.github.com/repos/bem/bem-xjst/milestones{/number}","notifications_url":"https://api.github.com/repos/bem/bem-xjst/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bem/bem-xjst/labels{/name}","releases_url":"https://api.github.com/repos/bem/bem-xjst/releases{/id}","deployments_url":"https://api.github.com/repos/bem/bem-xjst/deployments","created_at":"2013-05-13T09:22:05Z","updated_at":"2016-11-20T14:05:03Z","pushed_at":"2016-11-30T13:03:33Z","git_url":"git://github.com/bem/bem-xjst.git","ssh_url":"git@github.com:bem/bem-xjst.git","clone_url":"https://github.com/bem/bem-xjst.git","svn_url":"https://github.com/bem/bem-xjst","homepage":"https://bem.github.io/bem-xjst","size":1853,"stargazers_count":83,"watchers_count":83,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":29,"mirror_url":null,"open_issues_count":50,"forks":29,"open_issues":50,"watchers":83,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bem/bem-xjst/pulls/377"},"html":{"href":"https://github.com/bem/bem-xjst/pull/377"},"issue":{"href":"https://api.github.com/repos/bem/bem-xjst/issues/377"},"comments":{"href":"https://api.github.com/repos/bem/bem-xjst/issues/377/comments"},"review_comments":{"href":"https://api.github.com/repos/bem/bem-xjst/pulls/377/comments"},"review_comment":{"href":"https://api.github.com/repos/bem/bem-xjst/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bem/bem-xjst/pulls/377/commits"},"statuses":{"href":"https://api.github.com/repos/bem/bem-xjst/statuses/e2fab338b5389cbc983b26ae1b9ca74bcc5cc266"}}}}
{"actor":{"display_login":"zxqfox"}}