{"action":"created","issue":{"url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1035","labels_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1035/labels{/name}","comments_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1035/comments","events_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1035/events","html_url":"https://github.com/jscs-dev/node-jscs/issues/1035","id":57053514,"number":1035,"title":"Ignore padding newlines rule for `function` if keyword is inline","user":{"login":"ashclarke","id":963023,"avatar_url":"https://avatars.githubusercontent.com/u/963023?v=3","gravatar_id":"","url":"https://api.github.com/users/ashclarke","html_url":"https://github.com/ashclarke","followers_url":"https://api.github.com/users/ashclarke/followers","following_url":"https://api.github.com/users/ashclarke/following{/other_user}","gists_url":"https://api.github.com/users/ashclarke/gists{/gist_id}","starred_url":"https://api.github.com/users/ashclarke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashclarke/subscriptions","organizations_url":"https://api.github.com/users/ashclarke/orgs","repos_url":"https://api.github.com/users/ashclarke/repos","events_url":"https://api.github.com/users/ashclarke/events{/privacy}","received_events_url":"https://api.github.com/users/ashclarke/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jscs-dev/node-jscs/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/jscs-dev/node-jscs/labels/new%20rule%20value","name":"new rule value","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-02-09T16:28:15Z","updated_at":"2015-04-09T10:55:37Z","closed_at":null,"body":"Hello,\r\n\r\nSometimes it is necessary to return a function, such as:\r\n\r\n```\r\nfunction orderObjectBy() {\r\n    return function (obj, value) {\r\n        // more code\r\n    }\r\n}\r\n```\r\n\r\nIn this case, if you have `requirePaddingNewlinesBeforeKeywords` set to true, it will throw the error:\r\n`Keyword 'function' should have an empty line above it`. However, sometimes it is desired that this should happen.\r\n\r\nIs it possible to ignore this rule if the `function` keyword is inline with `return`, possibly by adding it as an  [excluded token](https://github.com/jscs-dev/node-jscs/commit/0c3887b92e8543220f428ac87b3a49053a564da5)?\r\n\r\nThis would also apply for functions in arrays, that may have no dependencies, a la Angular:\r\n\r\n```\r\napp\r\n    .directive(\"myDirective\", [function () {\r\n        // more code\r\n    }]);\r\n```\r\n\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/8424790-ignore-padding-newlines-rule-for-function-if-keyword-is-inline?utm_campaign=plugin&utm_content=tracker%2F281640&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F281640&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/comments/91193693","html_url":"https://github.com/jscs-dev/node-jscs/issues/1035#issuecomment-91193693","issue_url":"https://api.github.com/repos/jscs-dev/node-jscs/issues/1035","id":91193693,"user":{"login":"ashclarke","id":963023,"avatar_url":"https://avatars.githubusercontent.com/u/963023?v=3","gravatar_id":"","url":"https://api.github.com/users/ashclarke","html_url":"https://github.com/ashclarke","followers_url":"https://api.github.com/users/ashclarke/followers","following_url":"https://api.github.com/users/ashclarke/following{/other_user}","gists_url":"https://api.github.com/users/ashclarke/gists{/gist_id}","starred_url":"https://api.github.com/users/ashclarke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashclarke/subscriptions","organizations_url":"https://api.github.com/users/ashclarke/orgs","repos_url":"https://api.github.com/users/ashclarke/repos","events_url":"https://api.github.com/users/ashclarke/events{/privacy}","received_events_url":"https://api.github.com/users/ashclarke/received_events","type":"User","site_admin":false},"created_at":"2015-04-09T10:55:37Z","updated_at":"2015-04-09T10:55:37Z","body":"I also have this issue with do while statements, where the `while` keyword is on a new line.\r\n\r\ne.g.\r\n\r\n```\r\nKeyword `while` should have an empty line above it :\r\n    90 |\r\n    91 |                        node = node.offsetParent;\r\n    92 |                    }\r\n-----------------------------^\r\n    93 |                    while (node);\r\n\r\nFROM:\r\n\r\ndo {\r\n    node = node.offsetParent;\r\n}\r\nwhile (node);\r\n\r\n```\r\n\r\nhowever:\r\n```\r\nthing = [];\r\n\r\nwhile (thing.length) {\r\n    // more code\r\n}\r\n```\r\n\r\nor:\r\n```\r\nif (!thing) {\r\n    thing = [];\r\n}\r\n\r\nwhile (thing.length) {\r\n    // more code\r\n}\r\n```\r\n\r\nis also valid.\r\n\r\n"}}