{"action":"created","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/1659","labels_url":"https://api.github.com/repos/eslint/eslint/issues/1659/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/1659/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/1659/events","html_url":"https://github.com/eslint/eslint/issues/1659","id":54506236,"number":1659,"title":"no-multi-spaces does not allow non-last function param to be commented-out","user":{"login":"jrencz","id":948356,"avatar_url":"https://avatars.githubusercontent.com/u/948356?v=3","gravatar_id":"","url":"https://api.github.com/users/jrencz","html_url":"https://github.com/jrencz","followers_url":"https://api.github.com/users/jrencz/followers","following_url":"https://api.github.com/users/jrencz/following{/other_user}","gists_url":"https://api.github.com/users/jrencz/gists{/gist_id}","starred_url":"https://api.github.com/users/jrencz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrencz/subscriptions","organizations_url":"https://api.github.com/users/jrencz/orgs","repos_url":"https://api.github.com/users/jrencz/repos","events_url":"https://api.github.com/users/jrencz/events{/privacy}","received_events_url":"https://api.github.com/users/jrencz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eslint/eslint/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-01-15T21:24:12Z","updated_at":"2015-01-17T22:03:50Z","closed_at":null,"body":"Consider the following example:\r\n\r\n```\r\nfunction logAndCompare(a, b, c) {\r\n    console.log(c);\r\n    return a === b;\r\n}\r\n```\r\n_listing 1.1 all params are used_\r\n\r\nthis is valid.\r\nBut if I want to temporarily comment-out the use of `c`, like this:\r\n\r\n```\r\nfunction logAndCompare(a, b, c) {\r\n//    console.log(c);\r\n    return a === b;\r\n}\r\n```\r\n_listing 1.2: usage of the last param commented out_\r\n\r\nI get noticed, that there's an unused param `c` and i get noticed by `no-unused-vars`. Reasonable.\r\nThen I comment out the last param like this:\r\n\r\n```\r\nfunction logAndCompare(a, b/*, c*/) {\r\n//    console.log(c);\r\n    return a === b;\r\n}\r\n```\r\n_listing 1.3: declaration of the last param commented out_\r\n\r\nso I will remember what it was when I come back some days later to bring it back.\r\n\r\nIf I don't need `a` or `b` I will not get noticed by `no-unused-vars` since generally in JS the position of param does matter and it's required to define both `a` and `b` to be able to use `c`\r\nIf I ever wanted to comment out `b` the order of params will not be the same and when my function gets called `c` is now `b`.\r\n\r\nFor the AngularJS environment however position of function params is not as important as their names. With this in mind let's say my function is a service (i'm not using the annotated form on purpose - there's [ngAnnotate](https://github.com/olov/ng-annotate) for that):\r\n\r\n```\r\nangular.module('foo').service('fooService', function (aService, bService, cService) {\r\n    aService.doAStuff();\r\n    bService.doBStuff();\r\n    cService.doCStuff();\r\n})\r\n```\r\n_listing 2.1: all injected services used_\r\n\r\nIf I want to comment out `aService` I'm aware that 'no-unused-vars' won't warn me:\r\n\r\n```\r\nangular.module('foo').service('fooService', function (aService, bService, cService) {\r\n//    aService.doAStuff();\r\n    bService.doBStuff();\r\n    cService.doCStuff();\r\n})\r\n```\r\n_listing 2.2: not all injected services used_\r\n\r\nWhat I'd like to do (to better emphasise that I'm aware service `aService` is no longer used but it's most probable it will be back) is to do this:\r\n\r\n```\r\nangular.module('foo').service('fooService', function (/*aService, */bService, cService) {\r\n//    aService.doAStuff();\r\n    bService.doBStuff();\r\n    cService.doCStuff();\r\n})\r\n```\r\n_listing 2.3: declaration of `aService` removed._\r\n\r\nIT does not look like a good idea but if my `fooService` has many services with long names injected and I want to both have my diffs as small as they can be and have those injected services in a particular order but not exceed the limit of line length I get stuck.\r\n\r\n```\r\nangular.module('foo').service('fooService', function (aServiceWithLongerName, bServiceWithLongerName, \r\n                                                      cService) {\r\n    aService.doAStuff();\r\n    bService.doBStuff();\r\n    cService.doCStuff();\r\n})\r\n```\r\n_listing 2.4: multiline induced by line length limit_\r\n\r\n```\r\nangular.module('foo').service('fooService', function (bServiceWithLongerName, cService) {\r\n//    aService.doAStuff();\r\n    bService.doBStuff();\r\n    cService.doCStuff();\r\n})\r\n```\r\n_listing 2.4: service removed: longer and less meaningful diff_\r\n\r\nIn terms of \"Vanilla\" JS this gets all messed up - I know. But in AngularJS this is perfectly valid and can even be considered a good practice.\r\nI cannot do this though because `no-multi-spaces` fails.\r\n\r\nI created 3 cases: https://github.com/jrencz/eslint/blob/jrencz/issue/comment/tests/lib/rules/no-multi-spaces.js#L49-51\r\nOnly the last one passes the tests. I suppose this is a bug and all of them are valid in terms of syntax but such case only makes sense when AngularJS is used (or the order does not matter for some other reason)\r\n\r\n<bountysource-plugin>\r\n\r\n---\r\nWant to back this issue? **[Place a bounty on it!](https://www.bountysource.com/issues/7797329-no-multi-spaces-does-not-allow-non-last-function-param-to-be-commented-out?utm_campaign=plugin&utm_content=tracker%2F282608&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F282608&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/eslint/eslint/issues/comments/70386291","html_url":"https://github.com/eslint/eslint/issues/1659#issuecomment-70386291","issue_url":"https://api.github.com/repos/eslint/eslint/issues/1659","id":70386291,"user":{"login":"michaelficarra","id":218840,"avatar_url":"https://avatars.githubusercontent.com/u/218840?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelficarra","html_url":"https://github.com/michaelficarra","followers_url":"https://api.github.com/users/michaelficarra/followers","following_url":"https://api.github.com/users/michaelficarra/following{/other_user}","gists_url":"https://api.github.com/users/michaelficarra/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelficarra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelficarra/subscriptions","organizations_url":"https://api.github.com/users/michaelficarra/orgs","repos_url":"https://api.github.com/users/michaelficarra/repos","events_url":"https://api.github.com/users/michaelficarra/events{/privacy}","received_events_url":"https://api.github.com/users/michaelficarra/received_events","type":"User","site_admin":false},"created_at":"2015-01-17T22:03:50Z","updated_at":"2015-01-17T22:03:50Z","body":"A commented-out parameter should have been deleted. Comments are for humans, not for disabling code (or god forbid, having some magic effect). If you're only doing it temporarily during development, you should either not run a linter yet or ignore those linter warnings."}}