{"action":"created","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/3567","labels_url":"https://api.github.com/repos/eslint/eslint/issues/3567/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/3567/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/3567/events","html_url":"https://github.com/eslint/eslint/issues/3567","id":103788445,"number":3567,"title":"Autocreate configuration from existing project code","user":{"login":"IanVS","id":4616705,"avatar_url":"https://avatars.githubusercontent.com/u/4616705?v=3","gravatar_id":"","url":"https://api.github.com/users/IanVS","html_url":"https://github.com/IanVS","followers_url":"https://api.github.com/users/IanVS/followers","following_url":"https://api.github.com/users/IanVS/following{/other_user}","gists_url":"https://api.github.com/users/IanVS/gists{/gist_id}","starred_url":"https://api.github.com/users/IanVS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IanVS/subscriptions","organizations_url":"https://api.github.com/users/IanVS/orgs","repos_url":"https://api.github.com/users/IanVS/repos","events_url":"https://api.github.com/users/IanVS/events{/privacy}","received_events_url":"https://api.github.com/users/IanVS/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eslint/eslint/labels/accepted","name":"accepted","color":"0052cc"},{"url":"https://api.github.com/repos/eslint/eslint/labels/cli","name":"cli","color":"eb6420"},{"url":"https://api.github.com/repos/eslint/eslint/labels/core","name":"core","color":"c7def8"},{"url":"https://api.github.com/repos/eslint/eslint/labels/feature","name":"feature","color":"bfd4f2"},{"url":"https://api.github.com/repos/eslint/eslint/labels/needs-bikeshedding","name":"needs-bikeshedding","color":"f7c6c7"}],"state":"open","locked":false,"assignee":{"login":"IanVS","id":4616705,"avatar_url":"https://avatars.githubusercontent.com/u/4616705?v=3","gravatar_id":"","url":"https://api.github.com/users/IanVS","html_url":"https://github.com/IanVS","followers_url":"https://api.github.com/users/IanVS/followers","following_url":"https://api.github.com/users/IanVS/following{/other_user}","gists_url":"https://api.github.com/users/IanVS/gists{/gist_id}","starred_url":"https://api.github.com/users/IanVS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IanVS/subscriptions","organizations_url":"https://api.github.com/users/IanVS/orgs","repos_url":"https://api.github.com/users/IanVS/repos","events_url":"https://api.github.com/users/IanVS/events{/privacy}","received_events_url":"https://api.github.com/users/IanVS/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/eslint/eslint/milestones/13","html_url":"https://github.com/eslint/eslint/milestones/v2.0.0","labels_url":"https://api.github.com/repos/eslint/eslint/milestones/13/labels","id":1277998,"number":13,"title":"v2.0.0","description":"","creator":{"login":"nzakas","id":38546,"avatar_url":"https://avatars.githubusercontent.com/u/38546?v=3","gravatar_id":"","url":"https://api.github.com/users/nzakas","html_url":"https://github.com/nzakas","followers_url":"https://api.github.com/users/nzakas/followers","following_url":"https://api.github.com/users/nzakas/following{/other_user}","gists_url":"https://api.github.com/users/nzakas/gists{/gist_id}","starred_url":"https://api.github.com/users/nzakas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nzakas/subscriptions","organizations_url":"https://api.github.com/users/nzakas/orgs","repos_url":"https://api.github.com/users/nzakas/repos","events_url":"https://api.github.com/users/nzakas/events{/privacy}","received_events_url":"https://api.github.com/users/nzakas/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":2,"state":"open","created_at":"2015-08-28T17:36:35Z","updated_at":"2015-09-10T18:02:31Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-08-28T20:15:02Z","updated_at":"2015-09-14T03:25:44Z","closed_at":null,"body":"This issue is for discussion of a new feature which would generate a configuration file based on the code styles and conventions already in use in a project.  \r\n\r\nBackground: When new users are adding ESLint to an existing project, the first step is often to sift through the many ESLint rules to find the ones which are applicable to the project.  While it might be easy to simply enable all of the [Possible Errors](http://eslint.org/docs/rules/#possible-errors) and [Best Practices](http://eslint.org/docs/rules/#best-practices) rules, [Stylistic Issues](http://eslint.org/docs/rules/#stylistic-issues) are much more subjective and need to be carefully examined, one-by-one.\r\n\r\nWhat is being proposed here is to allow the code style already in use in the project to guide the creation of an `.eslintrc` configuration file.\r\n\r\nThe most likely way this can be accomplished is by repeatedly linting the code with rules set with different options, and comparing the number of linting errors that result from each option.  Now that https://github.com/eslint/eslint/commit/ea1871f19bfd54f36c5d080e9052dedd32ac1d7d has landed, it should only be necessary to parse the code once, thereby improving performance.  \r\n\r\nWhat still needs some thought and discussion, is the criteria for deciding which rules to enable in the generated config.  Some ideas:\r\n\r\n* Only enable rules which result in zero errors.\r\n    * Advantage: Up-and-running right away, build does not break, nothing to fix.\r\n    * Downside: If linting was not previously being done in the project, it's possible the code is mostly-consistent but has a few problems here and there which should be fixed.\r\n* Set rules to warn if results < a threshold (configurable at runtime?)\r\n    * Advantage: Can catch some problems in the code right away.\r\n    * Downside: Requires some action on user's part if configurable. If not, a threshold has to be determined *a priori*\r\n* When testing options like `\"always\"` vs. `\"never\"`, if there are errors for both options, set to warn if one option has < X% of the errors when set to the other option.  For example, if `\"always\"` gives 5 errors, and `\"never\"` gives 100, it's likely the style in the project is `\"always\"`, and those 5 errors are just errors.  However, if both options give 50 errors each, the project probably doesn't want to enforce that rule at all.\r\n    * Advantage: Able to set rules with more complicated options, while allowing for some degree of imperfection in the project.\r\n    * Disadvantage: A threshold would need to either be hard-coded or configurable at runtime.\r\n\r\nA secondary goal of this is to be runnable against a project already using ESLint, to pick up new rules or make rules more strict if they are not erroring (see https://github.com/eslint/eslint/issues/3436)."},"comment":{"url":"https://api.github.com/repos/eslint/eslint/issues/comments/139952082","html_url":"https://github.com/eslint/eslint/issues/3567#issuecomment-139952082","issue_url":"https://api.github.com/repos/eslint/eslint/issues/3567","id":139952082,"user":{"login":"ilyavolodin","id":1380062,"avatar_url":"https://avatars.githubusercontent.com/u/1380062?v=3","gravatar_id":"","url":"https://api.github.com/users/ilyavolodin","html_url":"https://github.com/ilyavolodin","followers_url":"https://api.github.com/users/ilyavolodin/followers","following_url":"https://api.github.com/users/ilyavolodin/following{/other_user}","gists_url":"https://api.github.com/users/ilyavolodin/gists{/gist_id}","starred_url":"https://api.github.com/users/ilyavolodin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilyavolodin/subscriptions","organizations_url":"https://api.github.com/users/ilyavolodin/orgs","repos_url":"https://api.github.com/users/ilyavolodin/repos","events_url":"https://api.github.com/users/ilyavolodin/events{/privacy}","received_events_url":"https://api.github.com/users/ilyavolodin/received_events","type":"User","site_admin":false},"created_at":"2015-09-14T03:25:44Z","updated_at":"2015-09-14T03:25:44Z","body":"Knowing how many rules we have that support more then one option, I think we might be talking about thousands of permutations here. I'm not sure all rules can be run against target. All rules without options would be fine though, I think."}}