{"action":"created","issue":{"url":"https://api.github.com/repos/ovh-ux/eslint-config-ovh/issues/6","repository_url":"https://api.github.com/repos/ovh-ux/eslint-config-ovh","labels_url":"https://api.github.com/repos/ovh-ux/eslint-config-ovh/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/ovh-ux/eslint-config-ovh/issues/6/comments","events_url":"https://api.github.com/repos/ovh-ux/eslint-config-ovh/issues/6/events","html_url":"https://github.com/ovh-ux/eslint-config-ovh/pull/6","id":277877281,"number":6,"title":"feat(best-pratices): disable class methods use this","user":{"login":"jimmyfortinx","id":16029436,"avatar_url":"https://avatars0.githubusercontent.com/u/16029436?v=4","gravatar_id":"","url":"https://api.github.com/users/jimmyfortinx","html_url":"https://github.com/jimmyfortinx","followers_url":"https://api.github.com/users/jimmyfortinx/followers","following_url":"https://api.github.com/users/jimmyfortinx/following{/other_user}","gists_url":"https://api.github.com/users/jimmyfortinx/gists{/gist_id}","starred_url":"https://api.github.com/users/jimmyfortinx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimmyfortinx/subscriptions","organizations_url":"https://api.github.com/users/jimmyfortinx/orgs","repos_url":"https://api.github.com/users/jimmyfortinx/repos","events_url":"https://api.github.com/users/jimmyfortinx/events{/privacy}","received_events_url":"https://api.github.com/users/jimmyfortinx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-11-29T19:27:38Z","updated_at":"2017-11-29T19:54:07Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/ovh-ux/eslint-config-ovh/pulls/6","html_url":"https://github.com/ovh-ux/eslint-config-ovh/pull/6","diff_url":"https://github.com/ovh-ux/eslint-config-ovh/pull/6.diff","patch_url":"https://github.com/ovh-ux/eslint-config-ovh/pull/6.patch"},"body":"Signed-off-by: Jimmy Fortin <jimmy.fortin@corp.ovh.com>\r\n\r\nThere is a simple explanation of why I think we should disable this rule:\r\n\r\nSince we are using babel (es6) and we are using classes, functions not always using this but are still related and specific to a class. Also, because we are not using any import file system (like requirejs or webpack) we can't write function at the root of the file otherwise those functions will be defined on the global scope and we could have conflit.\r\n\r\nThere is an example of code if we keep this rule activated:\r\n\r\n```javascript\r\nfunction addStringPrefix(text, prefix) {\r\n    return prefix + text;\r\n}\r\n\r\nexport class Test {\r\n    constructor(test, test2) {\r\n        this.test = test;\r\n        this.test2 = test2;\r\n    }\r\n\r\n    foo() {\r\n        return addStringPrefix(this.test, \"test1\");\r\n    }\r\n\r\n    bar() {\r\n        return addStringPrefix(this.test2, \"test2\");\r\n    }\r\n}\r\n```\r\n\r\nThere is an example of code if we disable this rule:\r\n\r\n```javascript\r\nexport class Test {\r\n    constructor(test, test2) {\r\n        this.test = test;\r\n        this.test2 = test2;\r\n    }\r\n\r\n    _addStringPrefix(text, prefix) {\r\n        return prefix + text;\r\n    }\r\n\r\n    foo() {\r\n        return this._addStringPrefix(this.test, \"test1\");\r\n    }\r\n\r\n    bar() {\r\n        return this._addStringPrefix(this.test2, \"test2\");\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/ovh-ux/eslint-config-ovh/issues/comments/347976857","html_url":"https://github.com/ovh-ux/eslint-config-ovh/pull/6#issuecomment-347976857","issue_url":"https://api.github.com/repos/ovh-ux/eslint-config-ovh/issues/6","id":347976857,"user":{"login":"mlarose","id":4839980,"avatar_url":"https://avatars1.githubusercontent.com/u/4839980?v=4","gravatar_id":"","url":"https://api.github.com/users/mlarose","html_url":"https://github.com/mlarose","followers_url":"https://api.github.com/users/mlarose/followers","following_url":"https://api.github.com/users/mlarose/following{/other_user}","gists_url":"https://api.github.com/users/mlarose/gists{/gist_id}","starred_url":"https://api.github.com/users/mlarose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlarose/subscriptions","organizations_url":"https://api.github.com/users/mlarose/orgs","repos_url":"https://api.github.com/users/mlarose/repos","events_url":"https://api.github.com/users/mlarose/events{/privacy}","received_events_url":"https://api.github.com/users/mlarose/received_events","type":"User","site_admin":false},"created_at":"2017-11-29T19:54:07Z","updated_at":"2017-11-29T19:54:07Z","author_association":"NONE","body":"> Also, because we are not using any import file system (like requirejs or webpack) we can't write function at the root of the file otherwise those functions will be defined on the global scope and we could have conflit. (SIC)\r\n\r\nWrapping inside an IIFE could make the function private. \r\n"}}
{"actor":{"display_login":"mlarose"}}