{"action":"closed","issue":{"url":"https://api.github.com/repos/sindresorhus/eslint-plugin-unicorn/issues/178","repository_url":"https://api.github.com/repos/sindresorhus/eslint-plugin-unicorn","labels_url":"https://api.github.com/repos/sindresorhus/eslint-plugin-unicorn/issues/178/labels{/name}","comments_url":"https://api.github.com/repos/sindresorhus/eslint-plugin-unicorn/issues/178/comments","events_url":"https://api.github.com/repos/sindresorhus/eslint-plugin-unicorn/issues/178/events","html_url":"https://github.com/sindresorhus/eslint-plugin-unicorn/issues/178","id":339030515,"node_id":"MDU6SXNzdWUzMzkwMzA1MTU=","number":178,"title":"regex-shorthand fixer does not escape RegExp constructor strings properly","user":{"login":"MrHen","id":74260,"node_id":"MDQ6VXNlcjc0MjYw","avatar_url":"https://avatars1.githubusercontent.com/u/74260?v=4","gravatar_id":"","url":"https://api.github.com/users/MrHen","html_url":"https://github.com/MrHen","followers_url":"https://api.github.com/users/MrHen/followers","following_url":"https://api.github.com/users/MrHen/following{/other_user}","gists_url":"https://api.github.com/users/MrHen/gists{/gist_id}","starred_url":"https://api.github.com/users/MrHen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrHen/subscriptions","organizations_url":"https://api.github.com/users/MrHen/orgs","repos_url":"https://api.github.com/users/MrHen/repos","events_url":"https://api.github.com/users/MrHen/events{/privacy}","received_events_url":"https://api.github.com/users/MrHen/received_events","type":"User","site_admin":false},"labels":[{"id":355209652,"node_id":"MDU6TGFiZWwzNTUyMDk2NTI=","url":"https://api.github.com/repos/sindresorhus/eslint-plugin-unicorn/labels/bug","name":"bug","color":"ee0701","default":true},{"id":355209655,"node_id":"MDU6TGFiZWwzNTUyMDk2NTU=","url":"https://api.github.com/repos/sindresorhus/eslint-plugin-unicorn/labels/help%20wanted","name":"help wanted","color":"128A0C","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-07-06T18:17:24Z","updated_at":"2018-08-23T16:11:12Z","closed_at":"2018-08-23T16:11:12Z","author_association":"CONTRIBUTOR","body":"Rule:\r\n\r\n```\r\n\"unicorn/regex-shorthand\": \"error\",\r\n```\r\n\r\nOriginal code:\r\n\r\n```\r\nconst numberRegex = new RegExp('(?=.*[0-9])');\r\n```\r\n\r\nFixed code:\r\n\r\n```\r\nconst numberRegex = new RegExp('(?=.*\\d)');\r\n```\r\n\r\nShould be:\r\n\r\n```\r\nconst numberRegex = new RegExp('(?=.*\\\\d)');\r\n```\r\n\r\nExample of altered behavior:\r\n\r\n\r\n```\r\n\r\nconst original = new RegExp('(?=.*[0-9])');\r\nconst actual = new RegExp('(?=.*\\d)');\r\nconst expected = new RegExp('(?=.*\\\\d)');\r\n\r\nconsole.log({\r\n  original: original.test('aaa111'), // true\r\n  actual: actual.test('aaa111'),     // false\r\n  expected: expected.test('aaa111'), // true\r\n});\r\n```\r\n"}}
{"actor":{"display_login":"sindresorhus"}}