{"action":"closed","issue":{"url":"https://api.github.com/repos/ryanmcdermott/clean-code-javascript/issues/168","repository_url":"https://api.github.com/repos/ryanmcdermott/clean-code-javascript","labels_url":"https://api.github.com/repos/ryanmcdermott/clean-code-javascript/issues/168/labels{/name}","comments_url":"https://api.github.com/repos/ryanmcdermott/clean-code-javascript/issues/168/comments","events_url":"https://api.github.com/repos/ryanmcdermott/clean-code-javascript/issues/168/events","html_url":"https://github.com/ryanmcdermott/clean-code-javascript/issues/168","id":202404646,"number":168,"title":"Variables with similar names prone to typing mistakes?","user":{"login":"zurfyx","id":193447,"avatar_url":"https://avatars.githubusercontent.com/u/193447?v=3","gravatar_id":"","url":"https://api.github.com/users/zurfyx","html_url":"https://github.com/zurfyx","followers_url":"https://api.github.com/users/zurfyx/followers","following_url":"https://api.github.com/users/zurfyx/following{/other_user}","gists_url":"https://api.github.com/users/zurfyx/gists{/gist_id}","starred_url":"https://api.github.com/users/zurfyx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zurfyx/subscriptions","organizations_url":"https://api.github.com/users/zurfyx/orgs","repos_url":"https://api.github.com/users/zurfyx/repos","events_url":"https://api.github.com/users/zurfyx/events{/privacy}","received_events_url":"https://api.github.com/users/zurfyx/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-01-22T19:44:37Z","updated_at":"2017-01-24T03:55:37Z","closed_at":"2017-01-24T03:55:37Z","body":"Let's say you have `location` and `locations` one next to each other, could this to lead to typing errors if you mistakenly write an extra `s`?\r\n\r\nThe closest I found in [clean-code-javascript](https://github.com/ryanmcdermott/clean-code-javascript) was [Avoid Mental Mapping](https://github.com/ryanmcdermott/clean-code-javascript#avoid-mental-mapping):\r\n\r\n```\r\nlocations.forEach((location) => {\r\n  ...\r\n});\r\n```\r\n\r\nIn the previous example, a proper editor (or its extension) could rapidly find out that `location` is not being used if you only used `locations` instead.\r\n\r\nBut what about in the following case?\r\n\r\n```\r\nfunction processLocationByExploringOtherLocations(location, locations) {\r\n  ...\r\n}\r\n```\r\n\r\nlocation and locations have the exact same priority for any editor, should we use something like `locationsList` instead?\r\n\r\nAlso, I am well aware that in this case [TypeScript](https://github.com/Microsoft/TypeScript) or [flow](https://github.com/facebook/flow) would have recognized a typing mistake by simple checking their type. However, there are still many projects which do not use either of them."}}
{"actor":{"display_login":"ryanmcdermott"}}