{"action":"opened","issue":{"url":"https://api.github.com/repos/prettier/prettier/issues/4881","repository_url":"https://api.github.com/repos/prettier/prettier","labels_url":"https://api.github.com/repos/prettier/prettier/issues/4881/labels{/name}","comments_url":"https://api.github.com/repos/prettier/prettier/issues/4881/comments","events_url":"https://api.github.com/repos/prettier/prettier/issues/4881/events","html_url":"https://github.com/prettier/prettier/issues/4881","id":343969075,"node_id":"MDU6SXNzdWUzNDM5NjkwNzU=","number":4881,"title":"CLI cursor-offset option for vue file throws TypeError","user":{"login":"jackysee","id":30516,"node_id":"MDQ6VXNlcjMwNTE2","avatar_url":"https://avatars1.githubusercontent.com/u/30516?v=4","gravatar_id":"","url":"https://api.github.com/users/jackysee","html_url":"https://github.com/jackysee","followers_url":"https://api.github.com/users/jackysee/followers","following_url":"https://api.github.com/users/jackysee/following{/other_user}","gists_url":"https://api.github.com/users/jackysee/gists{/gist_id}","starred_url":"https://api.github.com/users/jackysee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackysee/subscriptions","organizations_url":"https://api.github.com/users/jackysee/orgs","repos_url":"https://api.github.com/users/jackysee/repos","events_url":"https://api.github.com/users/jackysee/events{/privacy}","received_events_url":"https://api.github.com/users/jackysee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-24T10:03:29Z","updated_at":"2018-07-24T10:03:29Z","closed_at":null,"author_association":"NONE","body":"<!--\r\n\r\nBEFORE SUBMITTING AN ISSUE:\r\n\r\n1.  Search for your issue on GitHub: https://github.com/prettier/prettier/issues\r\n    A large number of opened issues are duplicates of existing issues.\r\n    If someone has already opened an issue for what you are experiencing,\r\n    you do not need to open a new issue — please add a 👍 reaction to the\r\n    existing issue instead.\r\n\r\n2.  If your issue is with a prettier editor extension or add-on, please open the\r\n    issue in the repo for that extension or add-on, instead of this repo.\r\n\r\n-->\r\n\r\n**Environments:**\r\n- Prettier Version: 1.13.7\r\n- Running Prettier via: CLI\r\n- Runtime: Node 10.6.0\r\n- Operating System: Windows\r\n\r\n**Steps to reproduce:**\r\nhttps://github.com/jackysee/prettier_vue_cursor_bug\r\nRun `npm run test3`  ( which runs `prettier index.vue --cursor-offset -1`)\r\n\r\n**Expected behavior:**\r\nIt should print out the result, as in `npm run test2` ( which runs `prettier index.vue`), with the offset print out at last line.\r\n```\r\n<style>\r\n</style>\r\n\r\n\r\n<template>\r\n<div> Hello </div>\r\n</template>\r\n\r\n\r\n<script>\r\nexport default {\r\n  a() {\r\n    return \"1\";\r\n  }\r\n};\r\n</script>\r\n0\r\n```\r\n\r\n**Actual behavior:**\r\n\r\nIt throws error:\r\n```\r\nC:\\workspace\\web\\prettier_cursor_bug>npm run test3\r\n\r\n> prettier_cursor_bug@1.0.0 test3 C:\\workspace\\web\\prettier_cursor_bug\r\n> prettier index.vue --cursor-offset -1\r\n\r\n[error] index.vue: TypeError: options.locStart is not a function\r\n[error]     at Object.findNodeAtOffset (C:\\workspace\\web\\prettier_cursor_bug\\node_modules\\prettier\\bin-prettier.js:10017:23)\r\n[error]     at coreFormat (C:\\workspace\\web\\prettier_cursor_bug\\node_modules\\prettier\\bin-prettier.js:10203:32)\r\n[error]     at format (C:\\workspace\\web\\prettier_cursor_bug\\node_modules\\prettier\\bin-prettier.js:10369:16)\r\n[error]     at formatWithCursor (C:\\workspace\\web\\prettier_cursor_bug\\node_modules\\prettier\\bin-prettier.js:10381:12)\r\n[error]     at Object.formatWithCursor (C:\\workspace\\web\\prettier_cursor_bug\\node_modules\\prettier\\bin-prettier.js:31224:15)\r\n[error]     at format$1 (C:\\workspace\\web\\prettier_cursor_bug\\node_modules\\prettier\\bin-prettier.js:33227:21)\r\n[error]     at C:\\workspace\\web\\prettier_cursor_bug\\node_modules\\prettier\\bin-prettier.js:33413:16\r\n[error]     at C:\\workspace\\web\\prettier_cursor_bug\\node_modules\\prettier\\bin-prettier.js:33359:14\r\n[error]     at Array.forEach (<anonymous>)\r\n[error]     at eachFilename (C:\\workspace\\web\\prettier_cursor_bug\\node_modules\\prettier\\bin-prettier.js:33358:15)\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! errno 2\r\nnpm ERR! prettier_cursor_bug@1.0.0 test3: `prettier index.vue --cursor-offset -1`\r\nnpm ERR! Exit status 2\r\nnpm ERR!\r\nnpm ERR! Failed at the prettier_cursor_bug@1.0.0 test3 script.\r\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\n```\r\n\r\nI'm tracing this because sublime's JsPrettier is running this CLI and I found the cursor-offset option would have problem for `.vue` file.\r\n\r\n"}}
{"actor":{"display_login":"jackysee"}}