From 74bbdb88a5c999844e099de6c3809e2f3f875ca3 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Tue, 15 Jan 2019 10:03:16 -0800 Subject: [PATCH] Lint fixes --- js/views/conversation_view.js | 2 +- ts/util/lint/exceptions.json | 558 ---------------------------------- ts/util/lint/linter.ts | 4 + 3 files changed, 5 insertions(+), 559 deletions(-) diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index c009abb28c..267b90d66c 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -189,7 +189,7 @@ onDeleteMessages: () => this.destroyMessages(), onResetSession: () => this.endSession(), - // These are view only and done update the Conversation model, so they + // These are view only and don't update the Conversation model, so they // need a manual update call. onShowSafetyNumber: () => { this.showSafetyNumber(); diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index 618b8be7b9..90b8d062b5 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -655,501 +655,6 @@ "updated": "2018-09-19T18:13:29.628Z", "reasonDetail": "Interacting with already-existing DOM nodes" }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " template: $('#conversation').html(),", - "lineNumber": 78, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:26:45.287Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-html(", - "path": "js/views/conversation_view.js", - "line": " template: $('#conversation').html(),", - "lineNumber": 78, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:26:45.287Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.loadingScreen.$el.prependTo(this.$('.discussion-container'));", - "lineNumber": 148, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:26:45.287Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-prependTo(", - "path": "js/views/conversation_view.js", - "line": " this.loadingScreen.$el.prependTo(this.$('.discussion-container'));", - "lineNumber": 148, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:26:45.287Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " el: this.$('.attachment-list'),", - "lineNumber": 152, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:26:45.287Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.conversation-header').append(this.titleView.el);", - "lineNumber": 214, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:26:45.287Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-append(", - "path": "js/views/conversation_view.js", - "line": " this.$('.conversation-header').append(this.titleView.el);", - "lineNumber": 214, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:26:45.287Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.discussion-container').append(this.view.el);", - "lineNumber": 220, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:26:45.287Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-append(", - "path": "js/views/conversation_view.js", - "line": " this.$('.discussion-container').append(this.view.el);", - "lineNumber": 220, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:26:45.287Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$messageField = this.$('.send-message');", - "lineNumber": 223, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:26:45.287Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.send-message').focus(this.focusBottomBar.bind(this));", - "lineNumber": 241, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:26:45.287Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$emojiPanelContainer = this.$('.emoji-panel-container');", - "lineNumber": 244, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:26:45.287Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('input.file-input').click();", - "lineNumber": 281, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " const fileField = this.$('input.file-input');", - "lineNumber": 284, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " const container = this.$('.discussion-container');", - "lineNumber": 456, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-append(", - "path": "js/views/conversation_view.js", - "line": " container.append(this.banner.el);", - "lineNumber": 457, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.typingBubbleView.$el.appendTo(this.$('.typing-container'));", - "lineNumber": 494, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-appendTo(", - "path": "js/views/conversation_view.js", - "line": " this.typingBubbleView.$el.appendTo(this.$('.typing-container'));", - "lineNumber": 494, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.send-message').val().length > 0 ||", - "lineNumber": 503, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.capture-audio').hide();", - "lineNumber": 506, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.capture-audio').show();", - "lineNumber": 508, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " if (this.$('.send-message').val().length > 2000) {", - "lineNumber": 512, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.android-length-warning').hide();", - "lineNumber": 515, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-appendTo(", - "path": "js/views/conversation_view.js", - "line": " toast.$el.appendTo(this.$el);", - "lineNumber": 523, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " view.$el.appendTo(this.$('.capture-audio'));", - "lineNumber": 542, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-appendTo(", - "path": "js/views/conversation_view.js", - "line": " view.$el.appendTo(this.$('.capture-audio'));", - "lineNumber": 542, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.send-message').attr('disabled', true);", - "lineNumber": 544, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.bottom-bar form').submit();", - "lineNumber": 553, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.send-message').removeAttr('disabled');", - "lineNumber": 556, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.bottom-bar form').removeClass('active');", - "lineNumber": 562, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.bottom-bar form').addClass('active');", - "lineNumber": 565, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " const container = this.$('.discussion-container');", - "lineNumber": 653, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-append(", - "path": "js/views/conversation_view.js", - "line": " container.append(this.scrollDownButton.el);", - "lineNumber": 654, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-appendTo(", - "path": "js/views/conversation_view.js", - "line": " toast.$el.appendTo(this.$el);", - "lineNumber": 681, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-appendTo(", - "path": "js/views/conversation_view.js", - "line": " toast.$el.appendTo(this.$el);", - "lineNumber": 714, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-appendTo(", - "path": "js/views/conversation_view.js", - "line": " toast.$el.appendTo(this.$el);", - "lineNumber": 718, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " const el = this.$(`#${databaseId}`);", - "lineNumber": 725, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-appendTo(", - "path": "js/views/conversation_view.js", - "line": " toast.$el.appendTo(this.$el);", - "lineNumber": 728, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " lastSeenEl.insertBefore(this.$(`#${oldestUnread.get('id')}`));", - "lineNumber": 905, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-insertBefore(", - "path": "js/views/conversation_view.js", - "line": " lastSeenEl.insertBefore(this.$(`#${oldestUnread.get('id')}`));", - "lineNumber": 905, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.bar-container').show();", - "lineNumber": 960, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.bar-container').hide();", - "lineNumber": 972, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " const el = this.$(`#${message.id}`);", - "lineNumber": 1069, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-prepend(", - "path": "js/views/conversation_view.js", - "line": " this.$el.prepend(dialog.el);", - "lineNumber": 1142, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-appendTo(", - "path": "js/views/conversation_view.js", - "line": " toast.$el.appendTo(this.$el);", - "lineNumber": 1165, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-prepend(", - "path": "js/views/conversation_view.js", - "line": " this.$el.prepend(dialog.el);", - "lineNumber": 1193, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " view.$el.insertBefore(this.$('.panel').first());", - "lineNumber": 1328, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-insertBefore(", - "path": "js/views/conversation_view.js", - "line": " view.$el.insertBefore(this.$('.panel').first());", - "lineNumber": 1328, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-prepend(", - "path": "js/views/conversation_view.js", - "line": " this.$el.prepend(dialog.el);", - "lineNumber": 1406, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " elCallback: el => this.$('.send').prepend(el),", - "lineNumber": 1569, - "reasonCategory": "usageTrusted", - "updated": "2019-01-15T03:15:22.532Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-prepend(", - "path": "js/views/conversation_view.js", - "line": " elCallback: el => this.$('.send').prepend(el),", - "lineNumber": 1569, - "reasonCategory": "usageTrusted", - "updated": "2019-01-15T03:15:22.532Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-appendTo(", - "path": "js/views/conversation_view.js", - "line": " toast.$el.appendTo(this.$el);", - "lineNumber": 1603, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.bottom-bar form').submit();", - "lineNumber": 1658, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " const $attachmentPreviews = this.$('.attachment-previews');", - "lineNumber": 1667, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/conversation_view.js", - "line": " this.$('.panel').css('display') === 'none'", - "lineNumber": 1698, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T02:21:20.921Z", - "reasonDetail": "Protected from arbitrary input" - }, { "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", @@ -1222,69 +727,6 @@ "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" }, - { - "rule": "jQuery-insertAfter(", - "path": "js/views/file_input_view.js", - "line": " toast.$el.insertAfter(this.$el);", - "lineNumber": 221, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T03:04:48.403Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-insertAfter(", - "path": "js/views/file_input_view.js", - "line": " toast.$el.insertAfter(this.$el);", - "lineNumber": 227, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T03:04:48.403Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-insertAfter(", - "path": "js/views/file_input_view.js", - "line": " toast.$el.insertAfter(this.$el);", - "lineNumber": 235, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T03:04:48.403Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-insertAfter(", - "path": "js/views/file_input_view.js", - "line": " toast.$el.insertAfter(this.$el);", - "lineNumber": 241, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T03:04:48.403Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-insertAfter(", - "path": "js/views/file_input_view.js", - "line": " toast.$el.insertAfter(this.$el);", - "lineNumber": 247, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T03:04:48.403Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-insertAfter(", - "path": "js/views/file_input_view.js", - "line": " toast.$el.insertAfter(this.$el);", - "lineNumber": 253, - "reasonCategory": "usageTrusted", - "updated": "2019-01-04T20:24:04.674Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-insertAfter(", - "path": "js/views/file_input_view.js", - "line": " toast.$el.insertAfter(this.$el);", - "lineNumber": 259, - "reasonCategory": "usageTrusted", - "updated": "2018-12-15T03:04:48.403Z", - "reasonDetail": "Protected from arbitrary input" - }, { "rule": "jQuery-$(", "path": "js/views/group_member_list_view.js", diff --git a/ts/util/lint/linter.ts b/ts/util/lint/linter.ts index 7258133652..2ffe329d80 100644 --- a/ts/util/lint/linter.ts +++ b/ts/util/lint/linter.ts @@ -49,6 +49,10 @@ const allSourceFiles = glob.sync(searchPattern, { nodir: true }); const results: Array = []; const excludedFiles = [ + // High-traffic files in our project + '^js/views/conversation_view.js', + '^js/views/file_input_view.js', + // Generated files '^js/components.js', '^js/libtextsecure.js',