{"action":"created","comment":{"url":"https://api.github.com/repos/palantir/tslint/pulls/comments/38742220","id":38742220,"diff_hunk":"@@ -67,19 +69,20 @@ class QuoteWalker extends Lint.RuleWalker {\n             const firstCharacter = text.charAt(0);\n             const lastCharacter = text.charAt(text.length - 1);\n \n-            if (this.quoteMark === QuoteMark.SINGLE_QUOTES) {\n-                if (firstCharacter !== \"'\" || lastCharacter !== \"'\") {\n-                    failure = this.createFailure(position, width, Rule.SINGLE_QUOTE_FAILURE);\n-                }\n-            } else if (this.quoteMark === QuoteMark.DOUBLE_QUOTES) {\n-                if (firstCharacter !== \"\\\"\" || lastCharacter !== \"\\\"\") {\n-                    failure = this.createFailure(position, width, Rule.DOUBLE_QUOTE_FAILURE);\n+            const includesOtherQuoteMark = (this.quoteMark === QuoteMark.SINGLE_QUOTES) ? \"'\" : \"\\\"\";\n+\n+            if (firstCharacter !== includesOtherQuoteMark || lastCharacter !== includesOtherQuoteMark) {\n+                // allow the \"other\" quote mark to be used, but only to avoid having to escape\n+                const isIncludingQuoteMark = text.slice(1, -1).indexOf(includesOtherQuoteMark) !== -1;","path":"src/rules/quotemarkRule.ts","position":null,"original_position":48,"commit_id":"11a251b3c9558d70495b4cb26b5fc3f98d2c3950","original_commit_id":"fab490f8fd79bd3693ceaac285d6c58a7beb3b1d","user":{"login":"Kuniwak","id":1124024,"avatar_url":"https://avatars.githubusercontent.com/u/1124024?v=3","gravatar_id":"","url":"https://api.github.com/users/Kuniwak","html_url":"https://github.com/Kuniwak","followers_url":"https://api.github.com/users/Kuniwak/followers","following_url":"https://api.github.com/users/Kuniwak/following{/other_user}","gists_url":"https://api.github.com/users/Kuniwak/gists{/gist_id}","starred_url":"https://api.github.com/users/Kuniwak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kuniwak/subscriptions","organizations_url":"https://api.github.com/users/Kuniwak/orgs","repos_url":"https://api.github.com/users/Kuniwak/repos","events_url":"https://api.github.com/users/Kuniwak/events{/privacy}","received_events_url":"https://api.github.com/users/Kuniwak/received_events","type":"User","site_admin":false},"body":"I fixed it on 11a251b.","created_at":"2015-09-04T11:21:54Z","updated_at":"2015-09-04T11:21:54Z","html_url":"https://github.com/palantir/tslint/pull/611#discussion_r38742220","pull_request_url":"https://api.github.com/repos/palantir/tslint/pulls/611","_links":{"self":{"href":"https://api.github.com/repos/palantir/tslint/pulls/comments/38742220"},"html":{"href":"https://github.com/palantir/tslint/pull/611#discussion_r38742220"},"pull_request":{"href":"https://api.github.com/repos/palantir/tslint/pulls/611"}}},"pull_request":{"url":"https://api.github.com/repos/palantir/tslint/pulls/611","id":43367288,"html_url":"https://github.com/palantir/tslint/pull/611","diff_url":"https://github.com/palantir/tslint/pull/611.diff","patch_url":"https://github.com/palantir/tslint/pull/611.patch","issue_url":"https://api.github.com/repos/palantir/tslint/issues/611","number":611,"state":"open","locked":false,"title":"Add a relax option \"escape\" for quotemark","user":{"login":"Kuniwak","id":1124024,"avatar_url":"https://avatars.githubusercontent.com/u/1124024?v=3","gravatar_id":"","url":"https://api.github.com/users/Kuniwak","html_url":"https://github.com/Kuniwak","followers_url":"https://api.github.com/users/Kuniwak/followers","following_url":"https://api.github.com/users/Kuniwak/following{/other_user}","gists_url":"https://api.github.com/users/Kuniwak/gists{/gist_id}","starred_url":"https://api.github.com/users/Kuniwak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kuniwak/subscriptions","organizations_url":"https://api.github.com/users/Kuniwak/orgs","repos_url":"https://api.github.com/users/Kuniwak/repos","events_url":"https://api.github.com/users/Kuniwak/events{/privacy}","received_events_url":"https://api.github.com/users/Kuniwak/received_events","type":"User","site_admin":false},"body":"This rule allow to use \"other\" quote mark for escaping.\r\nIt is similar to the \"escape\" option of JSCS or the \"avoid-escape\" option of ESLint.\r\n\r\nThis option is explained on [JSCS - validateQuoteMarks rule](http://jscs.info/rule/validateQuoteMarks.html):\r\n\r\n> Allow the \"other\" quote mark to be used, but only to avoid having to escape.\r\n\r\nand also on [Rule quotes - ESLint - Pluggable JavaScript linter](http://eslint.org/docs/rules/quotes):\r\n\r\n> The third parameter enables an exception to the rule to avoid escaping quotes.\r\n\r\nRelated #543","created_at":"2015-08-26T06:10:58Z","updated_at":"2015-09-04T11:21:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"659bc35611d572c83a82a49d51fb8781b6595b0a","assignee":{"login":"adidahiya","id":723999,"avatar_url":"https://avatars.githubusercontent.com/u/723999?v=3","gravatar_id":"","url":"https://api.github.com/users/adidahiya","html_url":"https://github.com/adidahiya","followers_url":"https://api.github.com/users/adidahiya/followers","following_url":"https://api.github.com/users/adidahiya/following{/other_user}","gists_url":"https://api.github.com/users/adidahiya/gists{/gist_id}","starred_url":"https://api.github.com/users/adidahiya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adidahiya/subscriptions","organizations_url":"https://api.github.com/users/adidahiya/orgs","repos_url":"https://api.github.com/users/adidahiya/repos","events_url":"https://api.github.com/users/adidahiya/events{/privacy}","received_events_url":"https://api.github.com/users/adidahiya/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/palantir/tslint/pulls/611/commits","review_comments_url":"https://api.github.com/repos/palantir/tslint/pulls/611/comments","review_comment_url":"https://api.github.com/repos/palantir/tslint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/palantir/tslint/issues/611/comments","statuses_url":"https://api.github.com/repos/palantir/tslint/statuses/11a251b3c9558d70495b4cb26b5fc3f98d2c3950","head":{"label":"Kuniwak:allow-quotes-to-escape","ref":"allow-quotes-to-escape","sha":"11a251b3c9558d70495b4cb26b5fc3f98d2c3950","user":{"login":"Kuniwak","id":1124024,"avatar_url":"https://avatars.githubusercontent.com/u/1124024?v=3","gravatar_id":"","url":"https://api.github.com/users/Kuniwak","html_url":"https://github.com/Kuniwak","followers_url":"https://api.github.com/users/Kuniwak/followers","following_url":"https://api.github.com/users/Kuniwak/following{/other_user}","gists_url":"https://api.github.com/users/Kuniwak/gists{/gist_id}","starred_url":"https://api.github.com/users/Kuniwak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kuniwak/subscriptions","organizations_url":"https://api.github.com/users/Kuniwak/orgs","repos_url":"https://api.github.com/users/Kuniwak/repos","events_url":"https://api.github.com/users/Kuniwak/events{/privacy}","received_events_url":"https://api.github.com/users/Kuniwak/received_events","type":"User","site_admin":false},"repo":{"id":41401151,"name":"tslint","full_name":"Kuniwak/tslint","owner":{"login":"Kuniwak","id":1124024,"avatar_url":"https://avatars.githubusercontent.com/u/1124024?v=3","gravatar_id":"","url":"https://api.github.com/users/Kuniwak","html_url":"https://github.com/Kuniwak","followers_url":"https://api.github.com/users/Kuniwak/followers","following_url":"https://api.github.com/users/Kuniwak/following{/other_user}","gists_url":"https://api.github.com/users/Kuniwak/gists{/gist_id}","starred_url":"https://api.github.com/users/Kuniwak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kuniwak/subscriptions","organizations_url":"https://api.github.com/users/Kuniwak/orgs","repos_url":"https://api.github.com/users/Kuniwak/repos","events_url":"https://api.github.com/users/Kuniwak/events{/privacy}","received_events_url":"https://api.github.com/users/Kuniwak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Kuniwak/tslint","description":"A linter for the TypeScript language.","fork":true,"url":"https://api.github.com/repos/Kuniwak/tslint","forks_url":"https://api.github.com/repos/Kuniwak/tslint/forks","keys_url":"https://api.github.com/repos/Kuniwak/tslint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kuniwak/tslint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kuniwak/tslint/teams","hooks_url":"https://api.github.com/repos/Kuniwak/tslint/hooks","issue_events_url":"https://api.github.com/repos/Kuniwak/tslint/issues/events{/number}","events_url":"https://api.github.com/repos/Kuniwak/tslint/events","assignees_url":"https://api.github.com/repos/Kuniwak/tslint/assignees{/user}","branches_url":"https://api.github.com/repos/Kuniwak/tslint/branches{/branch}","tags_url":"https://api.github.com/repos/Kuniwak/tslint/tags","blobs_url":"https://api.github.com/repos/Kuniwak/tslint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kuniwak/tslint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kuniwak/tslint/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kuniwak/tslint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kuniwak/tslint/statuses/{sha}","languages_url":"https://api.github.com/repos/Kuniwak/tslint/languages","stargazers_url":"https://api.github.com/repos/Kuniwak/tslint/stargazers","contributors_url":"https://api.github.com/repos/Kuniwak/tslint/contributors","subscribers_url":"https://api.github.com/repos/Kuniwak/tslint/subscribers","subscription_url":"https://api.github.com/repos/Kuniwak/tslint/subscription","commits_url":"https://api.github.com/repos/Kuniwak/tslint/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kuniwak/tslint/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kuniwak/tslint/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kuniwak/tslint/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kuniwak/tslint/contents/{+path}","compare_url":"https://api.github.com/repos/Kuniwak/tslint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kuniwak/tslint/merges","archive_url":"https://api.github.com/repos/Kuniwak/tslint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kuniwak/tslint/downloads","issues_url":"https://api.github.com/repos/Kuniwak/tslint/issues{/number}","pulls_url":"https://api.github.com/repos/Kuniwak/tslint/pulls{/number}","milestones_url":"https://api.github.com/repos/Kuniwak/tslint/milestones{/number}","notifications_url":"https://api.github.com/repos/Kuniwak/tslint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kuniwak/tslint/labels{/name}","releases_url":"https://api.github.com/repos/Kuniwak/tslint/releases{/id}","created_at":"2015-08-26T03:03:03Z","updated_at":"2015-08-26T03:03:03Z","pushed_at":"2015-09-04T11:16:33Z","git_url":"git://github.com/Kuniwak/tslint.git","ssh_url":"git@github.com:Kuniwak/tslint.git","clone_url":"https://github.com/Kuniwak/tslint.git","svn_url":"https://github.com/Kuniwak/tslint","homepage":null,"size":9035,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"palantir:master","ref":"master","sha":"42947956208d3ae077ce9373a72846576a22bb0d","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":11672345,"name":"tslint","full_name":"palantir/tslint","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/tslint","description":"A linter for the TypeScript language.","fork":false,"url":"https://api.github.com/repos/palantir/tslint","forks_url":"https://api.github.com/repos/palantir/tslint/forks","keys_url":"https://api.github.com/repos/palantir/tslint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/tslint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/tslint/teams","hooks_url":"https://api.github.com/repos/palantir/tslint/hooks","issue_events_url":"https://api.github.com/repos/palantir/tslint/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/tslint/events","assignees_url":"https://api.github.com/repos/palantir/tslint/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/tslint/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/tslint/tags","blobs_url":"https://api.github.com/repos/palantir/tslint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/tslint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/tslint/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/tslint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/tslint/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/tslint/languages","stargazers_url":"https://api.github.com/repos/palantir/tslint/stargazers","contributors_url":"https://api.github.com/repos/palantir/tslint/contributors","subscribers_url":"https://api.github.com/repos/palantir/tslint/subscribers","subscription_url":"https://api.github.com/repos/palantir/tslint/subscription","commits_url":"https://api.github.com/repos/palantir/tslint/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/tslint/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/tslint/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/tslint/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/tslint/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/tslint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/tslint/merges","archive_url":"https://api.github.com/repos/palantir/tslint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/tslint/downloads","issues_url":"https://api.github.com/repos/palantir/tslint/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/tslint/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/tslint/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/tslint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/tslint/labels{/name}","releases_url":"https://api.github.com/repos/palantir/tslint/releases{/id}","created_at":"2013-07-25T22:19:18Z","updated_at":"2015-09-04T08:41:55Z","pushed_at":"2015-09-04T11:16:33Z","git_url":"git://github.com/palantir/tslint.git","ssh_url":"git@github.com:palantir/tslint.git","clone_url":"https://github.com/palantir/tslint.git","svn_url":"https://github.com/palantir/tslint","homepage":null,"size":12773,"stargazers_count":338,"watchers_count":338,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":91,"mirror_url":null,"open_issues_count":108,"forks":91,"open_issues":108,"watchers":338,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/palantir/tslint/pulls/611"},"html":{"href":"https://github.com/palantir/tslint/pull/611"},"issue":{"href":"https://api.github.com/repos/palantir/tslint/issues/611"},"comments":{"href":"https://api.github.com/repos/palantir/tslint/issues/611/comments"},"review_comments":{"href":"https://api.github.com/repos/palantir/tslint/pulls/611/comments"},"review_comment":{"href":"https://api.github.com/repos/palantir/tslint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/palantir/tslint/pulls/611/commits"},"statuses":{"href":"https://api.github.com/repos/palantir/tslint/statuses/11a251b3c9558d70495b4cb26b5fc3f98d2c3950"}}}}