{"action":"created","issue":{"url":"https://api.github.com/repos/jest-community/eslint-plugin-jest/issues/101","repository_url":"https://api.github.com/repos/jest-community/eslint-plugin-jest","labels_url":"https://api.github.com/repos/jest-community/eslint-plugin-jest/issues/101/labels{/name}","comments_url":"https://api.github.com/repos/jest-community/eslint-plugin-jest/issues/101/comments","events_url":"https://api.github.com/repos/jest-community/eslint-plugin-jest/issues/101/events","html_url":"https://github.com/jest-community/eslint-plugin-jest/pull/101","id":304977098,"number":101,"title":"chore: add parseExpect() util function","user":{"login":"macklinu","id":2344137,"avatar_url":"https://avatars1.githubusercontent.com/u/2344137?v=4","gravatar_id":"","url":"https://api.github.com/users/macklinu","html_url":"https://github.com/macklinu","followers_url":"https://api.github.com/users/macklinu/followers","following_url":"https://api.github.com/users/macklinu/following{/other_user}","gists_url":"https://api.github.com/users/macklinu/gists{/gist_id}","starred_url":"https://api.github.com/users/macklinu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macklinu/subscriptions","organizations_url":"https://api.github.com/users/macklinu/orgs","repos_url":"https://api.github.com/users/macklinu/repos","events_url":"https://api.github.com/users/macklinu/events{/privacy}","received_events_url":"https://api.github.com/users/macklinu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-13T23:58:53Z","updated_at":"2018-05-23T18:52:17Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/jest-community/eslint-plugin-jest/pulls/101","html_url":"https://github.com/jest-community/eslint-plugin-jest/pull/101","diff_url":"https://github.com/jest-community/eslint-plugin-jest/pull/101.diff","patch_url":"https://github.com/jest-community/eslint-plugin-jest/pull/101.patch"},"body":"This is related to #73. I was curious to see what a `parseExpect()` function looked like and to get some feedback on it. Right now it looks like:\r\n\r\n```ts\r\ntype ParsedExpect = {\r\n  /* The argument nodes passed to `expect()`. */\r\n  arguments: Node[],\r\n  /* The properties chained onto `expect()`, like `.not` or `.resolves`. */\r\n  properties: Node[],\r\n  /* The matcher function called on `expect()`, like `.toBe()`, or undefined if missing. */\r\n  matcher: Node | undefined,\r\n  /* The argument nodes passed to the matcher function. */\r\n  matcherArguments: Node[],\r\n}\r\n\r\n/* If a CallExpression node is passed in, return a ParsedExpect object, otherwise null. */\r\nfunction parseExpect(node: Node | null): ParsedExpect | null\r\n```\r\n\r\nI can see helper functions being built on top of this parsing function, like:\r\n\r\n```ts\r\n/* The property names chained onto an `expect()` call. */\r\nfunction expectPropertyNames(expect: ParsedExpect | null): string[] {\r\n  return expect\r\n    ? expect.properties.map(property => property.name)\r\n    : []\r\n}\r\n```\r\n\r\nI can also see this helping simplify some of the logic in the `valid-expect` rule (and the WIP #78).\r\n\r\nThoughts on this as a starting point? I haven't integrated this function into any of the rules, but I'd be happy to explore that refactoring in this PR if we'd like to see what this API looks like when it's used."},"comment":{"url":"https://api.github.com/repos/jest-community/eslint-plugin-jest/issues/comments/391457930","html_url":"https://github.com/jest-community/eslint-plugin-jest/pull/101#issuecomment-391457930","issue_url":"https://api.github.com/repos/jest-community/eslint-plugin-jest/issues/101","id":391457930,"user":{"login":"SimenB","id":1404810,"avatar_url":"https://avatars1.githubusercontent.com/u/1404810?v=4","gravatar_id":"","url":"https://api.github.com/users/SimenB","html_url":"https://github.com/SimenB","followers_url":"https://api.github.com/users/SimenB/followers","following_url":"https://api.github.com/users/SimenB/following{/other_user}","gists_url":"https://api.github.com/users/SimenB/gists{/gist_id}","starred_url":"https://api.github.com/users/SimenB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimenB/subscriptions","organizations_url":"https://api.github.com/users/SimenB/orgs","repos_url":"https://api.github.com/users/SimenB/repos","events_url":"https://api.github.com/users/SimenB/events{/privacy}","received_events_url":"https://api.github.com/users/SimenB/received_events","type":"User","site_admin":false},"created_at":"2018-05-23T18:52:17Z","updated_at":"2018-05-23T18:52:17Z","author_association":"MEMBER","body":"@macklinu GitHub doesn't send emails for pushes in this repo for some reason... Is this good to go?"}}
{"actor":{"display_login":"SimenB"}}