{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/eslint-plugin-amo/issues/3","repository_url":"https://api.github.com/repos/mozilla/eslint-plugin-amo","labels_url":"https://api.github.com/repos/mozilla/eslint-plugin-amo/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/eslint-plugin-amo/issues/3/comments","events_url":"https://api.github.com/repos/mozilla/eslint-plugin-amo/issues/3/events","html_url":"https://github.com/mozilla/eslint-plugin-amo/issues/3","id":342266175,"node_id":"MDU6SXNzdWUzNDIyNjYxNzU=","number":3,"title":"Add a rule to avoid a `sinon.assert.called()` followed by `sinon.assert.calledWith()`","user":{"login":"willdurand","id":217628,"node_id":"MDQ6VXNlcjIxNzYyOA==","avatar_url":"https://avatars0.githubusercontent.com/u/217628?v=4","gravatar_id":"","url":"https://api.github.com/users/willdurand","html_url":"https://github.com/willdurand","followers_url":"https://api.github.com/users/willdurand/followers","following_url":"https://api.github.com/users/willdurand/following{/other_user}","gists_url":"https://api.github.com/users/willdurand/gists{/gist_id}","starred_url":"https://api.github.com/users/willdurand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willdurand/subscriptions","organizations_url":"https://api.github.com/users/willdurand/orgs","repos_url":"https://api.github.com/users/willdurand/repos","events_url":"https://api.github.com/users/willdurand/events{/privacy}","received_events_url":"https://api.github.com/users/willdurand/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-18T10:18:34Z","updated_at":"2018-07-19T14:17:05Z","closed_at":null,"author_association":"MEMBER","body":"When we use `sinon.assert.calledWith()`, there is no need to have `sinon.assert.called()` before, it is implied with `calledWith()`.\r\n\r\n```js\r\n// BAD\r\nconst stub = sinon.spy();\r\n\r\nsinon.assert.called(stub);\r\nsinon.assert.calledWith(stub, params);\r\n```\r\n\r\n```js\r\n// GOOD\r\nconst stub = sinon.spy();\r\n\r\nsinon.assert.calledWith(stub, params);\r\n```"},"comment":{"url":"https://api.github.com/repos/mozilla/eslint-plugin-amo/issues/comments/406291885","html_url":"https://github.com/mozilla/eslint-plugin-amo/issues/3#issuecomment-406291885","issue_url":"https://api.github.com/repos/mozilla/eslint-plugin-amo/issues/3","id":406291885,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjI5MTg4NQ==","user":{"login":"kumar303","id":55398,"node_id":"MDQ6VXNlcjU1Mzk4","avatar_url":"https://avatars1.githubusercontent.com/u/55398?v=4","gravatar_id":"","url":"https://api.github.com/users/kumar303","html_url":"https://github.com/kumar303","followers_url":"https://api.github.com/users/kumar303/followers","following_url":"https://api.github.com/users/kumar303/following{/other_user}","gists_url":"https://api.github.com/users/kumar303/gists{/gist_id}","starred_url":"https://api.github.com/users/kumar303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumar303/subscriptions","organizations_url":"https://api.github.com/users/kumar303/orgs","repos_url":"https://api.github.com/users/kumar303/repos","events_url":"https://api.github.com/users/kumar303/events{/privacy}","received_events_url":"https://api.github.com/users/kumar303/received_events","type":"User","site_admin":false},"created_at":"2018-07-19T14:17:05Z","updated_at":"2018-07-19T14:17:05Z","author_association":"MEMBER","body":"Call counts need to be asserted independently from `calledWith()`, correct.\r\n\r\nPersonally, I'd prefer to see it in this order:\r\n\r\n```js\r\nsinon.assert.calledWith(stub, params);\r\nsinon.assert.calledOnce(stub);\r\n```\r\n\r\nThat way the first error is more informative in the case where `stub` is never called. It may not be worth adding a lint rule just for that, though."}}
{"actor":{"display_login":"kumar303"}}