{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babel.github.io/issues/246","labels_url":"https://api.github.com/repos/babel/babel.github.io/issues/246/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel.github.io/issues/246/comments","events_url":"https://api.github.com/repos/babel/babel.github.io/issues/246/events","html_url":"https://github.com/babel/babel.github.io/issues/246","id":69494436,"number":246,"title":"Clarify usage of \"only\" option","user":{"login":"IanVS","id":4616705,"avatar_url":"https://avatars.githubusercontent.com/u/4616705?v=3","gravatar_id":"","url":"https://api.github.com/users/IanVS","html_url":"https://github.com/IanVS","followers_url":"https://api.github.com/users/IanVS/followers","following_url":"https://api.github.com/users/IanVS/following{/other_user}","gists_url":"https://api.github.com/users/IanVS/gists{/gist_id}","starred_url":"https://api.github.com/users/IanVS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IanVS/subscriptions","organizations_url":"https://api.github.com/users/IanVS/orgs","repos_url":"https://api.github.com/users/IanVS/repos","events_url":"https://api.github.com/users/IanVS/events{/privacy}","received_events_url":"https://api.github.com/users/IanVS/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-20T02:46:35Z","updated_at":"2015-04-24T03:58:58Z","closed_at":null,"body":"According to https://github.com/babel/babel/issues/1306#issuecomment-94341372 there are a lot of ways that the \"only\" option can be used:\r\n\r\n> It can take an array of globs, a single regex, a single string glob or an array of regexs.\r\n\r\nIt would be great it the documentation could be a little more clear on this.  As-is, the documentation tells partial stories in different places.  The [options docs](https://babeljs.io/docs/usage/options/) currently state that the `only` option takes an array of globs:\r\n\r\n> An array of glob paths to **only** compile. When attempting to compile a non-matching file it's returned verbatim.\r\n\r\nBut the [require usage](https://babeljs.io/docs/usage/require/) only mentions regex.  \r\n\r\n> // Optional only regex - if any filenames don't match this regex then they\r\n// aren't compiled\r\nonly: /my_es6_folder/,"},"comment":{"url":"https://api.github.com/repos/babel/babel.github.io/issues/comments/95793050","html_url":"https://github.com/babel/babel.github.io/issues/246#issuecomment-95793050","issue_url":"https://api.github.com/repos/babel/babel.github.io/issues/246","id":95793050,"user":{"login":"greim","id":317786,"avatar_url":"https://avatars.githubusercontent.com/u/317786?v=3","gravatar_id":"","url":"https://api.github.com/users/greim","html_url":"https://github.com/greim","followers_url":"https://api.github.com/users/greim/followers","following_url":"https://api.github.com/users/greim/following{/other_user}","gists_url":"https://api.github.com/users/greim/gists{/gist_id}","starred_url":"https://api.github.com/users/greim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greim/subscriptions","organizations_url":"https://api.github.com/users/greim/orgs","repos_url":"https://api.github.com/users/greim/repos","events_url":"https://api.github.com/users/greim/events{/privacy}","received_events_url":"https://api.github.com/users/greim/received_events","type":"User","site_admin":false},"created_at":"2015-04-24T03:58:58Z","updated_at":"2015-04-24T03:58:58Z","body":"The docs are indeed confusing; I've taken to using this really ugly hack until the day I finally understand how this thing works:\r\n\r\n```js\r\nvar patt = /.*/\r\npatt.test = function(path){\r\n  var isMatch = /* do some logic here on \"path\" */\r\n  return isMatch\r\n}\r\nrequire('babel').register({\r\n  ignore: patt\r\n})\r\n```"}}