{"action":"created","issue":{"url":"https://api.github.com/repos/airbnb/javascript/issues/485","labels_url":"https://api.github.com/repos/airbnb/javascript/issues/485/labels{/name}","comments_url":"https://api.github.com/repos/airbnb/javascript/issues/485/comments","events_url":"https://api.github.com/repos/airbnb/javascript/issues/485/events","html_url":"https://github.com/airbnb/javascript/issues/485","id":102766380,"number":485,"title":"Discourage use of const","user":{"login":"gajus","id":973543,"avatar_url":"https://avatars.githubusercontent.com/u/973543?v=3","gravatar_id":"","url":"https://api.github.com/users/gajus","html_url":"https://github.com/gajus","followers_url":"https://api.github.com/users/gajus/followers","following_url":"https://api.github.com/users/gajus/following{/other_user}","gists_url":"https://api.github.com/users/gajus/gists{/gist_id}","starred_url":"https://api.github.com/users/gajus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gajus/subscriptions","organizations_url":"https://api.github.com/users/gajus/orgs","repos_url":"https://api.github.com/users/gajus/repos","events_url":"https://api.github.com/users/gajus/events{/privacy}","received_events_url":"https://api.github.com/users/gajus/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-08-24T10:56:33Z","updated_at":"2015-09-01T01:28:57Z","closed_at":"2015-08-24T18:32:32Z","body":"ES6 const does not provide read-only data structure.\r\n\r\n> The const declaration creates a read-only named constant.\r\n\r\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const\r\n\r\nThe documentation is incorrect/misleading. It provides a constant reference to a value:\r\n\r\n```js\r\nconst foo = 'test';\r\n\r\nfoo = 'bar';\r\n```\r\n\r\nProduces:\r\n\r\n```\r\nLine 3: \"foo\" is read-only\r\n```\r\n\r\nThats because `foo = 'bar'` is attempting to assign a new value reference.\r\n\r\nHowever,\r\n\r\n```js\r\nconst foo = {};\r\n\r\nfoo.bar = 'bar';\r\n```\r\n\r\nDoes not produce error, because value reference does not change – the value itself changes. Therefore, this is not a read-only value.\r\n\r\nThis creates false expectations about the data structure.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/airbnb/javascript/issues/comments/136545943","html_url":"https://github.com/airbnb/javascript/issues/485#issuecomment-136545943","issue_url":"https://api.github.com/repos/airbnb/javascript/issues/485","id":136545943,"user":{"login":"justjake","id":296279,"avatar_url":"https://avatars.githubusercontent.com/u/296279?v=3","gravatar_id":"","url":"https://api.github.com/users/justjake","html_url":"https://github.com/justjake","followers_url":"https://api.github.com/users/justjake/followers","following_url":"https://api.github.com/users/justjake/following{/other_user}","gists_url":"https://api.github.com/users/justjake/gists{/gist_id}","starred_url":"https://api.github.com/users/justjake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justjake/subscriptions","organizations_url":"https://api.github.com/users/justjake/orgs","repos_url":"https://api.github.com/users/justjake/repos","events_url":"https://api.github.com/users/justjake/events{/privacy}","received_events_url":"https://api.github.com/users/justjake/received_events","type":"User","site_admin":false},"created_at":"2015-09-01T01:28:57Z","updated_at":"2015-09-01T01:28:57Z","body":"@AdamBrodzinski I think it's easier to learn what the language means by `const` than to create a linting infrastructure that understands `const` to mean something different. I think you might be able to write your own eslint rule for this; I suggest looking at the rules that forbid using certain things (like the no-eval rule, or the no-window-stuff rules) some of which look at how things are reassigned in the scope.\r\n\r\nsorry I can't help more =/"}}