diff --git a/.eslintrc.json b/.eslintrc.json index 2006ff7a47..0237a827cc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -122,6 +122,8 @@ "no-array-constructor": "error", "array-callback-return": "error", "template-curly-spacing": "error", + //The Zulip codebase complies partially with the "no-useless-escape" rule; only regex expressions haven't been updated yet. + //Updated regex expressions are currently being tested in casper files and will decide about a potential future enforcement of this rule. "no-useless-escape": 1, "func-style": ["off", "expression"], "wrap-iife": ["error", "outside", { "functionPrototypeMethods": false }], diff --git a/frontend_tests/casper_tests/00-realm-creation.js b/frontend_tests/casper_tests/00-realm-creation.js index f8c7666e6a..4b3a361f66 100644 --- a/frontend_tests/casper_tests/00-realm-creation.js +++ b/frontend_tests/casper_tests/00-realm-creation.js @@ -26,7 +26,7 @@ casper.then(function () { }); // Make sure confirmation email is send this.waitWhileSelector('form[action^="/create_realm/"]', function () { - var regex = new RegExp('^http:\/\/[^\/]+\/accounts\/send_confirm\/' + email); + var regex = new RegExp('^http://[^/]+/accounts/send_confirm/' + email); this.test.assertUrlMatch(regex, 'Confirmation mail send'); }); }); diff --git a/frontend_tests/casper_tests/01-login.js b/frontend_tests/casper_tests/01-login.js index 0e4791bc92..10c7a90cf2 100644 --- a/frontend_tests/casper_tests/01-login.js +++ b/frontend_tests/casper_tests/01-login.js @@ -12,7 +12,7 @@ common.init_viewport(); casper.start(realm_url, common.initialize_casper); casper.then(function () { - casper.test.assertUrlMatch(/^http:\/\/[^\/]+\/login/, 'Redirected to /login'); + casper.test.assertUrlMatch(/^http:\/\/[^/]+\/login/, 'Redirected to /login'); }); common.then_log_in(); diff --git a/frontend_tests/casper_tests/03-narrow.js b/frontend_tests/casper_tests/03-narrow.js index 9c3f2b4cd5..b7b7b5c99c 100644 --- a/frontend_tests/casper_tests/03-narrow.js +++ b/frontend_tests/casper_tests/03-narrow.js @@ -205,7 +205,7 @@ function search_non_existing_user(str, item) { casper.then(function () { common.wait_for_receive(function () { casper.test.info('Narrowing by clicking stream'); - casper.click('*[title="Narrow to stream \\\"Verona\\\""]'); + casper.click('*[title="Narrow to stream \\"Verona\\""]'); }); }); @@ -219,7 +219,7 @@ expect_home(); casper.then(function () { casper.test.info('Narrowing by clicking subject'); - casper.click('*[title="Narrow to stream \\\"Verona\\\", topic \\\"frontend test\\\""]'); + casper.click('*[title="Narrow to stream \\"Verona\\", topic \\"frontend test\\""]'); }); expect_stream_subject(); diff --git a/frontend_tests/casper_tests/05-subscriptions.js b/frontend_tests/casper_tests/05-subscriptions.js index 410dce7bd7..0bdcb75ad5 100644 --- a/frontend_tests/casper_tests/05-subscriptions.js +++ b/frontend_tests/casper_tests/05-subscriptions.js @@ -12,7 +12,7 @@ casper.then(function () { casper.then(function () { casper.click('a[href^="#subscriptions"]'); casper.test.assertUrlMatch( - /^http:\/\/[^\/]+\/#subscriptions/, + /^http:\/\/[^/]+\/#subscriptions/, 'URL suggests we are on subscriptions page'); casper.test.assertExists('#subscriptions.tab-pane.active', 'Subscriptions page is active'); }); diff --git a/frontend_tests/casper_tests/06-settings.js b/frontend_tests/casper_tests/06-settings.js index 5b74057a9b..5ef2416382 100644 --- a/frontend_tests/casper_tests/06-settings.js +++ b/frontend_tests/casper_tests/06-settings.js @@ -22,7 +22,7 @@ casper.then(function () { casper.then(function () { casper.waitUntilVisible("#settings-change-box", function () { - casper.test.assertUrlMatch(/^http:\/\/[^\/]+\/#settings/, 'URL suggests we are on settings page'); + casper.test.assertUrlMatch(/^http:\/\/[^/]+\/#settings/, 'URL suggests we are on settings page'); casper.test.assertExists('#settings.tab-pane.active', 'Settings page is active'); casper.test.assertNotVisible("#pw_change_controls"); diff --git a/frontend_tests/casper_tests/10-admin.js b/frontend_tests/casper_tests/10-admin.js index 2da6042f1b..c79b62979f 100644 --- a/frontend_tests/casper_tests/10-admin.js +++ b/frontend_tests/casper_tests/10-admin.js @@ -17,7 +17,7 @@ casper.then(function () { casper.waitForSelector('#administration.tab-pane.active', function () { casper.test.info('Administration page is active'); - casper.test.assertUrlMatch(/^http:\/\/[^\/]+\/#administration/, 'URL suggests we are on administration page'); + casper.test.assertUrlMatch(/^http:\/\/[^/]+\/#administration/, 'URL suggests we are on administration page'); }); // Test only admins may create streams Setting @@ -462,7 +462,7 @@ casper.waitForSelector('input[type="checkbox"][id="id_realm_allow_message_editin casper.then(function () { casper.test.info('Administration page'); casper.click('a[href^="#administration"]'); - casper.test.assertUrlMatch(/^http:\/\/[^\/]+\/#administration/, 'URL suggests we are on administration page'); + casper.test.assertUrlMatch(/^http:\/\/[^/]+\/#administration/, 'URL suggests we are on administration page'); casper.test.assertExists('#administration.tab-pane.active', 'Administration page is active'); }); diff --git a/frontend_tests/node_tests/echo.js b/frontend_tests/node_tests/echo.js index 15f3f589ca..4d2887db95 100644 --- a/frontend_tests/node_tests/echo.js +++ b/frontend_tests/node_tests/echo.js @@ -172,7 +172,7 @@ var bugdown_data = JSON.parse(fs.readFileSync(path.join(__dirname, '../../zerver {input: 'And this is a #**wrong** stream link', expected: '

And this is a #**wrong** stream link

'}, {input: 'mmm...:burrito:s', - expected: '

mmm...\":burrito:\"s

'}, + expected: '

mmm...:burrito:s

'}, {input: 'This is an :poop: message', expected: '

This is an :poop: message

'}, {input: "\ud83d\udca9",