{"action":"created","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/3426","labels_url":"https://api.github.com/repos/eslint/eslint/issues/3426/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/3426/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/3426/events","html_url":"https://github.com/eslint/eslint/issues/3426","id":101487187,"number":3426,"title":"Rule proposal: Prevent use of extended native objects","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},"labels":[{"url":"https://api.github.com/repos/eslint/eslint/labels/triage","name":"triage","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-17T18:55:38Z","updated_at":"2015-08-18T04:50:47Z","closed_at":"2015-08-17T21:21:07Z","body":"Similar to [`no-extend-native`](http://eslint.org/docs/rules/no-extend-native), but the intention of this is to prevent usage of extended native objects, not creation.\r\n\r\nWhen using external Node modules you can't control whether they extend native objects. I would still like to prevent usage of it. When the type can be detected it should check whether the property/method is a known native one, and if not, throw a violation.\r\n\r\nA good example is the [colors](https://github.com/marak/colors.js/) module which extends the string prototype with [coloring setter properties](https://github.com/Marak/colors.js/blob/90dd85b173cc48d668412a84306bf6b01751dd21/lib/extendStringPrototype.js).\r\n\r\nThis should be a violation as there's is no `green` property on the native string prototype:\r\n\r\n```js\r\nvar colors = require('colors');\r\nconsole.log('unicorn'.green);\r\n```\r\n\r\n-\r\n\r\nI've made a [module](https://github.com/sindresorhus/proto-props) with a static list of prototype properties for each type, which could potentially be used."},"comment":{"url":"https://api.github.com/repos/eslint/eslint/issues/comments/132071251","html_url":"https://github.com/eslint/eslint/issues/3426#issuecomment-132071251","issue_url":"https://api.github.com/repos/eslint/eslint/issues/3426","id":132071251,"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":"2015-08-18T04:50:47Z","updated_at":"2015-08-18T04:50:47Z","body":"Too bad. I think it would be a lot more useful than `no-native-extend` as it's much more common to see usage of extended native objects than construction (that usually happens in libs). I guess I'll just have to show its usefulness through plugin popularity ;)\r\n\r\nI've opened a module request. Happy to discuss there with any potential takers.\r\n\r\nhttps://github.com/sindresorhus/module-requests/issues/25"}}