{"action":"created","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/6314","repository_url":"https://api.github.com/repos/eslint/eslint","labels_url":"https://api.github.com/repos/eslint/eslint/issues/6314/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/6314/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/6314/events","html_url":"https://github.com/eslint/eslint/pull/6314","id":158199154,"number":6314,"title":"Update: allow regular expressions for id-blacklist (fixes #6212)","user":{"login":"lemonmade","id":3012583,"avatar_url":"https://avatars.githubusercontent.com/u/3012583?v=3","gravatar_id":"","url":"https://api.github.com/users/lemonmade","html_url":"https://github.com/lemonmade","followers_url":"https://api.github.com/users/lemonmade/followers","following_url":"https://api.github.com/users/lemonmade/following{/other_user}","gists_url":"https://api.github.com/users/lemonmade/gists{/gist_id}","starred_url":"https://api.github.com/users/lemonmade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lemonmade/subscriptions","organizations_url":"https://api.github.com/users/lemonmade/orgs","repos_url":"https://api.github.com/users/lemonmade/repos","events_url":"https://api.github.com/users/lemonmade/events{/privacy}","received_events_url":"https://api.github.com/users/lemonmade/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eslint/eslint/labels/CLA:%20Valid","name":"CLA: Valid","color":"007700"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-06-02T17:44:21Z","updated_at":"2016-09-06T02:31:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/eslint/eslint/pulls/6314","html_url":"https://github.com/eslint/eslint/pull/6314","diff_url":"https://github.com/eslint/eslint/pull/6314.diff","patch_url":"https://github.com/eslint/eslint/pull/6314.patch"},"body":"This PR updates `id-blacklist` to accept regular expressions in addition to static ID names. This was a little awkward given that the only option the rule accepts is an array of strings. I considered three alternative ways to pass regular expressions without breaking existing users of the rule:\r\n\r\n1. Add another option, probably an object with a `patterns` key that is an array of full regular expression strings to check for.\r\n\r\n2. Pass regular expressions with static identifiers, but force them to be wrapped in `/`s. This would unambiguously indicate a regular expression, since identifiers can't start with `/`.\r\n\r\n3. Pass regular expressions with static identifiers, without any indication that they are regular expressions. For this to work, the regular expressions have to be assumed to span the entire identifier name (that is, wrapped in `^...$`.\r\n\r\nI went for number three with this PR because it was the simplest and definitely covers my original issue. I tried to find any prior art but couldn't spot any, so please let me know if I missed something that would clarify the way this should be done.\r\n\r\n**Outcome**\r\n\r\nYou can now pass regular expressions in addition to static identifiers, and they will correctly blacklist offending IDs:\r\n\r\n```js\r\n/* eslint id-blacklist: [\"ref\\\\d?\"] */\r\n\r\nvar ref = {...}; // flagged\r\nvar ref3 = {...}; // flagged\r\nvar reference = {...}; // not flagged\r\n```"},"comment":{"url":"https://api.github.com/repos/eslint/eslint/issues/comments/244836073","html_url":"https://github.com/eslint/eslint/pull/6314#issuecomment-244836073","issue_url":"https://api.github.com/repos/eslint/eslint/issues/6314","id":244836073,"user":{"login":"kaicataldo","id":7041728,"avatar_url":"https://avatars.githubusercontent.com/u/7041728?v=3","gravatar_id":"","url":"https://api.github.com/users/kaicataldo","html_url":"https://github.com/kaicataldo","followers_url":"https://api.github.com/users/kaicataldo/followers","following_url":"https://api.github.com/users/kaicataldo/following{/other_user}","gists_url":"https://api.github.com/users/kaicataldo/gists{/gist_id}","starred_url":"https://api.github.com/users/kaicataldo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaicataldo/subscriptions","organizations_url":"https://api.github.com/users/kaicataldo/orgs","repos_url":"https://api.github.com/users/kaicataldo/repos","events_url":"https://api.github.com/users/kaicataldo/events{/privacy}","received_events_url":"https://api.github.com/users/kaicataldo/received_events","type":"User","site_admin":false},"created_at":"2016-09-06T02:31:50Z","updated_at":"2016-09-06T02:31:50Z","body":"@lemonmade Totally understand. Thanks for letting us know :+1:"}}
{"actor":{"display_login":"kaicataldo"}}