{"action":"created","comment":{"url":"https://api.github.com/repos/eslint/eslint/pulls/comments/28166945","id":28166945,"diff_hunk":"@@ -0,0 +1,87 @@\n+/**\n+ * @fileoverview No mixed linebreaks\n+ * @author Erik Mueller\n+ * @copyright 2015 Erik Mueller. All rights reserved.\n+ */\n+\"use strict\";\n+\n+//------------------------------------------------------------------------------\n+// Requirements\n+//------------------------------------------------------------------------------\n+\n+var eslint = require(\"../../../lib/eslint\"),\n+    ESLintTester = require(\"eslint-tester\");\n+\n+var EXPECTED_LF_MSG = \"Expected linebreaks to be 'LF' but found 'CRLF'.\",\n+    EXPECTED_CRLF_MSG = \"Expected linebreaks to be 'CRLF' but found 'LF'.\";\n+\n+//------------------------------------------------------------------------------\n+// Tests\n+//------------------------------------------------------------------------------\n+\n+var eslintTester = new ESLintTester(eslint);\n+eslintTester.addRuleTest(\"lib/rules/linebreak-style\", {\n+\n+    valid: [\n+        {\n+            code: \"var a = 'a',\\n b = 'b';\\n\\n function foo(params) {\\n /* do stuff */ \\n }\\n\",\n+            args: [2]\n+        },\n+        {\n+            code: \"var a = 'a',\\n b = 'b';\\n\\n function foo(params) {\\n /* do stuff */ \\n }\\n\",\n+            args: [2, \"unix\"]\n+        },\n+        {\n+            code: \"var a = 'a',\\r\\n b = 'b';\\r\\n\\r\\n function foo(params) {\\r\\n /* do stuff */ \\r\\n }\\r\\n\",\n+            args: [2, \"windows\"]\n+        }\n+    ],\n+\n+    invalid: [\n+        {\n+            code: \"var a = 'a';\\r\\n\",\n+            args: [2],\n+            errors: [{\n+                line: 1,\n+                col: 12,\n+                message: EXPECTED_LF_MSG\n+            }]\n+        },\n+        {\n+            code: \"var a = 'a';\\r\\n\",\n+            args: [2, \"unix\"],\n+            errors: [{\n+                line: 1,\n+                col: 12,\n+                message: EXPECTED_LF_MSG\n+            }]\n+        },\n+        {\n+            code: \"var a = 'a';\\n\",\n+            args: [2, \"windows\"],\n+            errors: [{\n+                line: 1,\n+                col: 12,\n+                message: EXPECTED_CRLF_MSG\n+            }]\n+        },\n+        {\n+            code: \"var a = 'a',\\n b = 'b';\\n\\n function foo(params) {\\r\\n /* do stuff */ \\n }\\r\\n\",\n+            args: [2],\n+            errors: [{\n+                line: 4,\n+                col: 23,\n+                message: EXPECTED_LF_MSG\n+            }]\n+        },\n+        {\n+            code: \"var a = 'a',\\r\\n b = 'b';\\r\\n\\n function foo(params) {\\r\\n /* do stuff */ \\n }\\r\\n\",","path":"tests/lib/rules/linebreak-style.js","position":78,"original_position":78,"commit_id":"06a06c8a4a2d52b6dee2a81efbc289095d2cda62","original_commit_id":"06a06c8a4a2d52b6dee2a81efbc289095d2cda62","user":{"login":"btmills","id":1709537,"avatar_url":"https://avatars.githubusercontent.com/u/1709537?v=3","gravatar_id":"","url":"https://api.github.com/users/btmills","html_url":"https://github.com/btmills","followers_url":"https://api.github.com/users/btmills/followers","following_url":"https://api.github.com/users/btmills/following{/other_user}","gists_url":"https://api.github.com/users/btmills/gists{/gist_id}","starred_url":"https://api.github.com/users/btmills/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btmills/subscriptions","organizations_url":"https://api.github.com/users/btmills/orgs","repos_url":"https://api.github.com/users/btmills/repos","events_url":"https://api.github.com/users/btmills/events{/privacy}","received_events_url":"https://api.github.com/users/btmills/received_events","type":"User","site_admin":false},"body":"Question: should this catch both `\\n`s, or just report the first? At least in my case, changing one will fix them all, but that may not be the case for everyone.","created_at":"2015-04-10T18:05:54Z","updated_at":"2015-04-10T18:05:54Z","html_url":"https://github.com/eslint/eslint/pull/2249#discussion_r28166945","pull_request_url":"https://api.github.com/repos/eslint/eslint/pulls/2249","_links":{"self":{"href":"https://api.github.com/repos/eslint/eslint/pulls/comments/28166945"},"html":{"href":"https://github.com/eslint/eslint/pull/2249#discussion_r28166945"},"pull_request":{"href":"https://api.github.com/repos/eslint/eslint/pulls/2249"}}},"pull_request":{"url":"https://api.github.com/repos/eslint/eslint/pulls/2249","id":32771026,"html_url":"https://github.com/eslint/eslint/pull/2249","diff_url":"https://github.com/eslint/eslint/pull/2249.diff","patch_url":"https://github.com/eslint/eslint/pull/2249.patch","issue_url":"https://api.github.com/repos/eslint/eslint/issues/2249","number":2249,"state":"open","locked":false,"title":"New: linebreak-style rule","user":{"login":"erikmueller","id":2292532,"avatar_url":"https://avatars.githubusercontent.com/u/2292532?v=3","gravatar_id":"","url":"https://api.github.com/users/erikmueller","html_url":"https://github.com/erikmueller","followers_url":"https://api.github.com/users/erikmueller/followers","following_url":"https://api.github.com/users/erikmueller/following{/other_user}","gists_url":"https://api.github.com/users/erikmueller/gists{/gist_id}","starred_url":"https://api.github.com/users/erikmueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikmueller/subscriptions","organizations_url":"https://api.github.com/users/erikmueller/orgs","repos_url":"https://api.github.com/users/erikmueller/repos","events_url":"https://api.github.com/users/erikmueller/events{/privacy}","received_events_url":"https://api.github.com/users/erikmueller/received_events","type":"User","site_admin":false},"body":"Serves #1255 \r\n\r\nSince this is my very first eslint rule (I thought I try since s/o put the `beginner` label there),\r\nI'd appreciate any constructive critizism :)\r\n","created_at":"2015-04-07T14:48:55Z","updated_at":"2015-04-10T18:05:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c178801a0776af46ef1eaa4d1bfc509a392d4f4e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/eslint/eslint/pulls/2249/commits","review_comments_url":"https://api.github.com/repos/eslint/eslint/pulls/2249/comments","review_comment_url":"https://api.github.com/repos/eslint/eslint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/2249/comments","statuses_url":"https://api.github.com/repos/eslint/eslint/statuses/06a06c8a4a2d52b6dee2a81efbc289095d2cda62","head":{"label":"erikmueller:no-mixed-linebreaks","ref":"no-mixed-linebreaks","sha":"06a06c8a4a2d52b6dee2a81efbc289095d2cda62","user":{"login":"erikmueller","id":2292532,"avatar_url":"https://avatars.githubusercontent.com/u/2292532?v=3","gravatar_id":"","url":"https://api.github.com/users/erikmueller","html_url":"https://github.com/erikmueller","followers_url":"https://api.github.com/users/erikmueller/followers","following_url":"https://api.github.com/users/erikmueller/following{/other_user}","gists_url":"https://api.github.com/users/erikmueller/gists{/gist_id}","starred_url":"https://api.github.com/users/erikmueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikmueller/subscriptions","organizations_url":"https://api.github.com/users/erikmueller/orgs","repos_url":"https://api.github.com/users/erikmueller/repos","events_url":"https://api.github.com/users/erikmueller/events{/privacy}","received_events_url":"https://api.github.com/users/erikmueller/received_events","type":"User","site_admin":false},"repo":{"id":33531252,"name":"eslint","full_name":"erikmueller/eslint","owner":{"login":"erikmueller","id":2292532,"avatar_url":"https://avatars.githubusercontent.com/u/2292532?v=3","gravatar_id":"","url":"https://api.github.com/users/erikmueller","html_url":"https://github.com/erikmueller","followers_url":"https://api.github.com/users/erikmueller/followers","following_url":"https://api.github.com/users/erikmueller/following{/other_user}","gists_url":"https://api.github.com/users/erikmueller/gists{/gist_id}","starred_url":"https://api.github.com/users/erikmueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikmueller/subscriptions","organizations_url":"https://api.github.com/users/erikmueller/orgs","repos_url":"https://api.github.com/users/erikmueller/repos","events_url":"https://api.github.com/users/erikmueller/events{/privacy}","received_events_url":"https://api.github.com/users/erikmueller/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/erikmueller/eslint","description":"A fully pluggable tool for identifying and reporting on patterns in JavaScript.","fork":true,"url":"https://api.github.com/repos/erikmueller/eslint","forks_url":"https://api.github.com/repos/erikmueller/eslint/forks","keys_url":"https://api.github.com/repos/erikmueller/eslint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/erikmueller/eslint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/erikmueller/eslint/teams","hooks_url":"https://api.github.com/repos/erikmueller/eslint/hooks","issue_events_url":"https://api.github.com/repos/erikmueller/eslint/issues/events{/number}","events_url":"https://api.github.com/repos/erikmueller/eslint/events","assignees_url":"https://api.github.com/repos/erikmueller/eslint/assignees{/user}","branches_url":"https://api.github.com/repos/erikmueller/eslint/branches{/branch}","tags_url":"https://api.github.com/repos/erikmueller/eslint/tags","blobs_url":"https://api.github.com/repos/erikmueller/eslint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/erikmueller/eslint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/erikmueller/eslint/git/refs{/sha}","trees_url":"https://api.github.com/repos/erikmueller/eslint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/erikmueller/eslint/statuses/{sha}","languages_url":"https://api.github.com/repos/erikmueller/eslint/languages","stargazers_url":"https://api.github.com/repos/erikmueller/eslint/stargazers","contributors_url":"https://api.github.com/repos/erikmueller/eslint/contributors","subscribers_url":"https://api.github.com/repos/erikmueller/eslint/subscribers","subscription_url":"https://api.github.com/repos/erikmueller/eslint/subscription","commits_url":"https://api.github.com/repos/erikmueller/eslint/commits{/sha}","git_commits_url":"https://api.github.com/repos/erikmueller/eslint/git/commits{/sha}","comments_url":"https://api.github.com/repos/erikmueller/eslint/comments{/number}","issue_comment_url":"https://api.github.com/repos/erikmueller/eslint/issues/comments{/number}","contents_url":"https://api.github.com/repos/erikmueller/eslint/contents/{+path}","compare_url":"https://api.github.com/repos/erikmueller/eslint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/erikmueller/eslint/merges","archive_url":"https://api.github.com/repos/erikmueller/eslint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/erikmueller/eslint/downloads","issues_url":"https://api.github.com/repos/erikmueller/eslint/issues{/number}","pulls_url":"https://api.github.com/repos/erikmueller/eslint/pulls{/number}","milestones_url":"https://api.github.com/repos/erikmueller/eslint/milestones{/number}","notifications_url":"https://api.github.com/repos/erikmueller/eslint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/erikmueller/eslint/labels{/name}","releases_url":"https://api.github.com/repos/erikmueller/eslint/releases{/id}","created_at":"2015-04-07T08:26:57Z","updated_at":"2015-04-07T08:26:58Z","pushed_at":"2015-04-10T08:56:32Z","git_url":"git://github.com/erikmueller/eslint.git","ssh_url":"git@github.com:erikmueller/eslint.git","clone_url":"https://github.com/erikmueller/eslint.git","svn_url":"https://github.com/erikmueller/eslint","homepage":"http://eslint.org","size":15388,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"eslint:master","ref":"master","sha":"e11fb44454b7e3c289206136fed24d58f99c4b42","user":{"login":"eslint","id":6019716,"avatar_url":"https://avatars.githubusercontent.com/u/6019716?v=3","gravatar_id":"","url":"https://api.github.com/users/eslint","html_url":"https://github.com/eslint","followers_url":"https://api.github.com/users/eslint/followers","following_url":"https://api.github.com/users/eslint/following{/other_user}","gists_url":"https://api.github.com/users/eslint/gists{/gist_id}","starred_url":"https://api.github.com/users/eslint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eslint/subscriptions","organizations_url":"https://api.github.com/users/eslint/orgs","repos_url":"https://api.github.com/users/eslint/repos","events_url":"https://api.github.com/users/eslint/events{/privacy}","received_events_url":"https://api.github.com/users/eslint/received_events","type":"Organization","site_admin":false},"repo":{"id":11061773,"name":"eslint","full_name":"eslint/eslint","owner":{"login":"eslint","id":6019716,"avatar_url":"https://avatars.githubusercontent.com/u/6019716?v=3","gravatar_id":"","url":"https://api.github.com/users/eslint","html_url":"https://github.com/eslint","followers_url":"https://api.github.com/users/eslint/followers","following_url":"https://api.github.com/users/eslint/following{/other_user}","gists_url":"https://api.github.com/users/eslint/gists{/gist_id}","starred_url":"https://api.github.com/users/eslint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eslint/subscriptions","organizations_url":"https://api.github.com/users/eslint/orgs","repos_url":"https://api.github.com/users/eslint/repos","events_url":"https://api.github.com/users/eslint/events{/privacy}","received_events_url":"https://api.github.com/users/eslint/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/eslint/eslint","description":"A fully pluggable tool for identifying and reporting on patterns in JavaScript.","fork":false,"url":"https://api.github.com/repos/eslint/eslint","forks_url":"https://api.github.com/repos/eslint/eslint/forks","keys_url":"https://api.github.com/repos/eslint/eslint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eslint/eslint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eslint/eslint/teams","hooks_url":"https://api.github.com/repos/eslint/eslint/hooks","issue_events_url":"https://api.github.com/repos/eslint/eslint/issues/events{/number}","events_url":"https://api.github.com/repos/eslint/eslint/events","assignees_url":"https://api.github.com/repos/eslint/eslint/assignees{/user}","branches_url":"https://api.github.com/repos/eslint/eslint/branches{/branch}","tags_url":"https://api.github.com/repos/eslint/eslint/tags","blobs_url":"https://api.github.com/repos/eslint/eslint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eslint/eslint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eslint/eslint/git/refs{/sha}","trees_url":"https://api.github.com/repos/eslint/eslint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eslint/eslint/statuses/{sha}","languages_url":"https://api.github.com/repos/eslint/eslint/languages","stargazers_url":"https://api.github.com/repos/eslint/eslint/stargazers","contributors_url":"https://api.github.com/repos/eslint/eslint/contributors","subscribers_url":"https://api.github.com/repos/eslint/eslint/subscribers","subscription_url":"https://api.github.com/repos/eslint/eslint/subscription","commits_url":"https://api.github.com/repos/eslint/eslint/commits{/sha}","git_commits_url":"https://api.github.com/repos/eslint/eslint/git/commits{/sha}","comments_url":"https://api.github.com/repos/eslint/eslint/comments{/number}","issue_comment_url":"https://api.github.com/repos/eslint/eslint/issues/comments{/number}","contents_url":"https://api.github.com/repos/eslint/eslint/contents/{+path}","compare_url":"https://api.github.com/repos/eslint/eslint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eslint/eslint/merges","archive_url":"https://api.github.com/repos/eslint/eslint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eslint/eslint/downloads","issues_url":"https://api.github.com/repos/eslint/eslint/issues{/number}","pulls_url":"https://api.github.com/repos/eslint/eslint/pulls{/number}","milestones_url":"https://api.github.com/repos/eslint/eslint/milestones{/number}","notifications_url":"https://api.github.com/repos/eslint/eslint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eslint/eslint/labels{/name}","releases_url":"https://api.github.com/repos/eslint/eslint/releases{/id}","created_at":"2013-06-29T23:59:48Z","updated_at":"2015-04-10T16:01:20Z","pushed_at":"2015-04-10T16:51:50Z","git_url":"git://github.com/eslint/eslint.git","ssh_url":"git@github.com:eslint/eslint.git","clone_url":"https://github.com/eslint/eslint.git","svn_url":"https://github.com/eslint/eslint","homepage":"http://eslint.org","size":15388,"stargazers_count":1978,"watchers_count":1978,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":348,"mirror_url":null,"open_issues_count":136,"forks":348,"open_issues":136,"watchers":1978,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eslint/eslint/pulls/2249"},"html":{"href":"https://github.com/eslint/eslint/pull/2249"},"issue":{"href":"https://api.github.com/repos/eslint/eslint/issues/2249"},"comments":{"href":"https://api.github.com/repos/eslint/eslint/issues/2249/comments"},"review_comments":{"href":"https://api.github.com/repos/eslint/eslint/pulls/2249/comments"},"review_comment":{"href":"https://api.github.com/repos/eslint/eslint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eslint/eslint/pulls/2249/commits"},"statuses":{"href":"https://api.github.com/repos/eslint/eslint/statuses/06a06c8a4a2d52b6dee2a81efbc289095d2cda62"}}}}