{"action":"created","issue":{"url":"https://api.github.com/repos/sindresorhus/eslint-plugin-ava/issues/72","repository_url":"https://api.github.com/repos/sindresorhus/eslint-plugin-ava","labels_url":"https://api.github.com/repos/sindresorhus/eslint-plugin-ava/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/sindresorhus/eslint-plugin-ava/issues/72/comments","events_url":"https://api.github.com/repos/sindresorhus/eslint-plugin-ava/issues/72/events","html_url":"https://github.com/sindresorhus/eslint-plugin-ava/issues/72","id":146723908,"number":72,"title":"Make writing \"within a test\" and \"t.XXX\" matchers easier:","user":{"login":"jamestalmage","id":4082216,"avatar_url":"https://avatars.githubusercontent.com/u/4082216?v=3","gravatar_id":"","url":"https://api.github.com/users/jamestalmage","html_url":"https://github.com/jamestalmage","followers_url":"https://api.github.com/users/jamestalmage/followers","following_url":"https://api.github.com/users/jamestalmage/following{/other_user}","gists_url":"https://api.github.com/users/jamestalmage/gists{/gist_id}","starred_url":"https://api.github.com/users/jamestalmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamestalmage/subscriptions","organizations_url":"https://api.github.com/users/jamestalmage/orgs","repos_url":"https://api.github.com/users/jamestalmage/repos","events_url":"https://api.github.com/users/jamestalmage/events{/privacy}","received_events_url":"https://api.github.com/users/jamestalmage/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sindresorhus/eslint-plugin-ava/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-07T19:44:08Z","updated_at":"2016-04-11T04:58:31Z","closed_at":null,"body":"We have this code construct everywhere:\r\n\r\n```js\r\nCallExpression: function (node) {\r\n  // only check if we are within a test file, and if this CallExpression is within a test.\r\n  if (!ava.isTestFile || !ava.currentTestNode) {\r\n    return;\r\n  }\r\n}\r\n```\r\n\r\nI propose we add some sugar to `ava.merge()` that allows something like this:\r\n\r\n```js\r\n'CallExpression:inTest': function (node) {\r\n\r\n},\r\n'VariableDeclaration:inTestFile': function (node) {\r\n\r\n},\r\n'CallExpression:inTest:inTestFile': function (node) {\r\n\r\n},\r\n\r\n```\r\n\r\nWhile we are at it, we should define one (specifically for CallExpression), that checks the callee is a `MemberExpression` of the form `t.XXX`:\r\n\r\n\r\n```js\r\n'AssertionCallExpression:inTest': function (node) {\r\n\r\n}\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/sindresorhus/eslint-plugin-ava/issues/comments/208163106","html_url":"https://github.com/sindresorhus/eslint-plugin-ava/issues/72#issuecomment-208163106","issue_url":"https://api.github.com/repos/sindresorhus/eslint-plugin-ava/issues/72","id":208163106,"user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"created_at":"2016-04-11T04:58:30Z","updated_at":"2016-04-11T04:58:30Z","body":"@twada What specifically is out of scope?"}}