diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index 7f6fc681fa..2a8f5c7e27 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -227,6 +227,14 @@ "reasonCategory": "falseMatch", "updated": "2020-03-20T20:40:34.498Z" }, + { + "rule": "jQuery-append(", + "path": "js/modules/debuglogs.js", + "line": " form.append('file', contentBuffer, {", + "lineNumber": 60, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-load(", "path": "js/modules/emojis.js", @@ -394,6 +402,15 @@ "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/debug_log_view.js", + "line": " this.$('.result').addClass('loading');", + "lineNumber": 70, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Static selector argument" + }, { "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", @@ -430,6 +447,15 @@ "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/debug_log_view.js", + "line": " this.$('.result').text(i18n('debugLogError'));", + "lineNumber": 89, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Static selector argument" + }, { "rule": "jQuery-$(", "path": "js/views/group_member_list_view.js", @@ -556,6 +582,15 @@ "updated": "2020-05-28T17:42:35.329Z", "reasonDetail": "Hardcoded selector" }, + { + "rule": "jQuery-$(", + "path": "js/views/inbox_view.js", + "line": " this.$('.conversation-stack').removeClass('inactive');", + "lineNumber": 195, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Static selector argument" + }, { "rule": "jQuery-$(", "path": "js/views/inbox_view.js", @@ -565,6 +600,15 @@ "updated": "2020-05-28T17:42:35.329Z", "reasonDetail": "Hardcoded selector" }, + { + "rule": "jQuery-$(", + "path": "js/views/inbox_view.js", + "line": " this.$('#header, .gutter').removeClass('inactive');", + "lineNumber": 199, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Static selector argument" + }, { "rule": "jQuery-$(", "path": "js/views/inbox_view.js", @@ -601,6 +645,15 @@ "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/install_view.js", + "line": " this.$('#qr canvas').remove();", + "lineNumber": 159, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Static selector argument" + }, { "rule": "jQuery-$(", "path": "js/views/install_view.js", @@ -610,6 +663,15 @@ "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/install_view.js", + "line": " this.$('#qr').removeClass('ready');", + "lineNumber": 161, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Static selector argument" + }, { "rule": "jQuery-$(", "path": "js/views/install_view.js", @@ -637,6 +699,15 @@ "updated": "2020-03-24T19:03:04.861Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/install_view.js", + "line": " this.$('#qr').removeAttr('title');", + "lineNumber": 172, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Static selector argument" + }, { "rule": "jQuery-$(", "path": "js/views/install_view.js", @@ -655,6 +726,15 @@ "updated": "2020-03-24T19:03:04.861Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/install_view.js", + "line": " this.$(DEVICE_NAME_SELECTOR).focus();", + "lineNumber": 179, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Static selector argument" + }, { "rule": "jQuery-$(", "path": "js/views/install_view.js", @@ -761,6 +841,15 @@ "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/phone-input-view.js", + "line": " this.$('.number-container').addClass('valid');", + "lineNumber": 28, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Static selector argument" + }, { "rule": "jQuery-$(", "path": "js/views/phone-input-view.js", @@ -1010,6 +1099,15 @@ "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/settings_view.js", + "line": " this.$('.sync').removeAttr('disabled');", + "lineNumber": 272, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Static selector argument" + }, { "rule": "jQuery-$(", "path": "js/views/settings_view.js", @@ -1019,6 +1117,15 @@ "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/settings_view.js", + "line": " this.$('.sync').text(i18n('syncing'));", + "lineNumber": 276, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Static selector argument" + }, { "rule": "jQuery-$(", "path": "js/views/settings_view.js", @@ -1028,6 +1135,15 @@ "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/settings_view.js", + "line": " this.$('.sync_failed').show();", + "lineNumber": 288, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Static selector argument" + }, { "rule": "jQuery-$(", "path": "js/views/settings_view.js", @@ -1109,6 +1225,15 @@ "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/standalone_registration_view.js", + "line": " this.$('#request-sms, #request-voice').removeAttr('disabled');", + "lineNumber": 72, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Static selector argument" + }, { "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", @@ -1293,6 +1418,15 @@ "reasonCategory": "falseMatch", "updated": "2018-09-15T00:38:04.183Z" }, + { + "rule": "DOM-innerHTML", + "path": "node_modules/@sinonjs/formatio/lib/formatio.js", + "line": " var content = element.innerHTML || \"\";", + "lineNumber": 205, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Read, not write" + }, { "rule": "eval", "path": "node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-implied-eval.js", @@ -1482,6 +1616,14 @@ "reasonCategory": "falseMatch", "updated": "2019-12-11T01:10:06.091Z" }, + { + "rule": "jQuery-wrap(", + "path": "node_modules/attr-accept/node_modules/core-js/client/core.js", + "line": " setInterval: wrap(global.setInterval)", + "lineNumber": 8753, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-$(", "path": "node_modules/attr-accept/node_modules/core-js/client/core.min.js", @@ -1489,6 +1631,13 @@ "reasonCategory": "falseMatch", "updated": "2019-12-11T01:10:06.091Z" }, + { + "rule": "jQuery-$(", + "path": "node_modules/attr-accept/node_modules/core-js/client/core.min.js", + "lineNumber": 8, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-$(", "path": "node_modules/attr-accept/node_modules/core-js/client/core.min.js", @@ -1520,6 +1669,14 @@ "reasonCategory": "falseMatch", "updated": "2019-12-11T01:10:06.091Z" }, + { + "rule": "jQuery-wrap(", + "path": "node_modules/attr-accept/node_modules/core-js/client/library.js", + "line": " setInterval: wrap(global.setInterval)", + "lineNumber": 7821, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-$(", "path": "node_modules/attr-accept/node_modules/core-js/client/library.min.js", @@ -1582,6 +1739,14 @@ "reasonCategory": "falseMatch", "updated": "2019-12-11T01:10:06.091Z" }, + { + "rule": "jQuery-wrap(", + "path": "node_modules/attr-accept/node_modules/core-js/client/shim.js", + "line": " setInterval: wrap(global.setInterval)", + "lineNumber": 8651, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-$(", "path": "node_modules/attr-accept/node_modules/core-js/client/shim.min.js", @@ -1620,6 +1785,14 @@ "reasonCategory": "falseMatch", "updated": "2019-12-11T01:10:06.091Z" }, + { + "rule": "jQuery-wrap(", + "path": "node_modules/attr-accept/node_modules/core-js/library/modules/web.timers.js", + "line": " setInterval: wrap(global.setInterval)", + "lineNumber": 19, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-$(", "path": "node_modules/attr-accept/node_modules/core-js/modules/_regexp-exec.js", @@ -1668,6 +1841,14 @@ "reasonCategory": "falseMatch", "updated": "2019-12-11T01:10:06.091Z" }, + { + "rule": "jQuery-wrap(", + "path": "node_modules/attr-accept/node_modules/core-js/modules/web.timers.js", + "line": " setInterval: wrap(global.setInterval)", + "lineNumber": 19, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-wrap(", "path": "node_modules/axe-core/axe.js", @@ -1987,6 +2168,14 @@ "updated": "2020-08-26T19:34:24.581Z", "reasonDetail": "only used by eslint-plugin-jsx-ally" }, + { + "rule": "jQuery-$(", + "path": "node_modules/backbone/backbone-min.js", + "lineNumber": 1, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Used inside a Backbone view to populate this.$el" + }, { "rule": "jQuery-insertBefore(", "path": "node_modules/backbone/backbone-min.js", @@ -2947,6 +3136,14 @@ "reasonCategory": "falseMatch", "updated": "2018-09-19T18:13:29.628Z" }, + { + "rule": "jQuery-append(", + "path": "node_modules/form-data/lib/form_data.js", + "line": " append(value);", + "lineNumber": 74, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-append(", "path": "node_modules/form-data/lib/form_data.js", @@ -6207,6 +6404,15 @@ "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "node_modules/intl-tel-input/src/spec/helpers/helpers.js", + "line": " $(\"body\").trigger(getKeyEvent(key, \"keypress\"));", + "lineNumber": 120, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Static selector argument" + }, { "rule": "jQuery-$(", "path": "node_modules/intl-tel-input/src/spec/helpers/helpers.js", @@ -6429,6 +6635,13 @@ "reasonCategory": "falseMatch", "updated": "2020-04-30T22:35:27.860Z" }, + { + "rule": "jQuery-append(", + "path": "node_modules/jszip/dist/jszip.min.js", + "lineNumber": 13, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-load(", "path": "node_modules/jszip/lib/generate/index.js", @@ -6509,6 +6722,14 @@ "reasonCategory": "falseMatch", "updated": "2020-04-30T22:35:27.860Z" }, + { + "rule": "jQuery-wrap(", + "path": "node_modules/jszip/node_modules/core-js/client/core.js", + "line": "\t setInterval: wrap(global.setInterval)", + "lineNumber": 7014, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-$(", "path": "node_modules/jszip/node_modules/core-js/client/core.min.js", @@ -6547,6 +6768,14 @@ "reasonCategory": "falseMatch", "updated": "2020-04-30T22:35:27.860Z" }, + { + "rule": "jQuery-wrap(", + "path": "node_modules/jszip/node_modules/core-js/client/library.js", + "line": "\t setInterval: wrap(global.setInterval)", + "lineNumber": 6537, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-$(", "path": "node_modules/jszip/node_modules/core-js/client/library.min.js", @@ -6586,6 +6815,14 @@ "reasonCategory": "falseMatch", "updated": "2020-04-30T22:35:27.860Z" }, + { + "rule": "jQuery-wrap(", + "path": "node_modules/jszip/node_modules/core-js/client/shim.js", + "line": "\t setInterval: wrap(global.setInterval)", + "lineNumber": 7000, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-$(", "path": "node_modules/jszip/node_modules/core-js/client/shim.min.js", @@ -6624,6 +6861,14 @@ "reasonCategory": "falseMatch", "updated": "2020-04-30T22:35:27.860Z" }, + { + "rule": "jQuery-wrap(", + "path": "node_modules/jszip/node_modules/core-js/library/modules/web.timers.js", + "line": " setInterval: wrap(global.setInterval)", + "lineNumber": 19, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-$(", "path": "node_modules/jszip/node_modules/core-js/modules/es6.regexp.split.js", @@ -6656,6 +6901,14 @@ "reasonCategory": "falseMatch", "updated": "2020-04-30T22:35:27.860Z" }, + { + "rule": "jQuery-wrap(", + "path": "node_modules/jszip/node_modules/core-js/modules/web.timers.js", + "line": " setInterval: wrap(global.setInterval)", + "lineNumber": 19, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-$(", "path": "node_modules/lazy-universal-dotenv/node_modules/core-js/internals/collection.js", @@ -9641,6 +9894,15 @@ "updated": "2018-09-15T00:38:04.183Z", "reasonDetail": "Getting the value, not setting it" }, + { + "rule": "DOM-innerHTML", + "path": "node_modules/min-document/serialize.js", + "line": " strings.push(elem.innerHTML)", + "lineNumber": 37, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Read, not write" + }, { "rule": "DOM-innerHTML", "path": "node_modules/min-document/serialize.js", @@ -9755,6 +10017,13 @@ "reasonCategory": "falseMatch", "updated": "2019-07-19T17:16:02.404Z" }, + { + "rule": "jQuery-insertAfter(", + "path": "node_modules/mksnapshot/node_modules/ajv/dist/regenerator.min.js", + "lineNumber": 13, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-$(", "path": "node_modules/mksnapshot/node_modules/ajv/dist/regenerator.min.js", @@ -9770,6 +10039,14 @@ "reasonCategory": "falseMatch", "updated": "2019-07-19T17:16:02.404Z" }, + { + "rule": "jQuery-append(", + "path": "node_modules/mksnapshot/node_modules/form-data/lib/form_data.js", + "line": " append(value);", + "lineNumber": 68, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-append(", "path": "node_modules/mksnapshot/node_modules/form-data/lib/form_data.js", @@ -10239,6 +10516,13 @@ "reasonCategory": "falseMatch", "updated": "2019-07-19T17:16:02.404Z" }, + { + "rule": "jQuery-insertAfter(", + "path": "node_modules/nugget/node_modules/ajv/dist/regenerator.min.js", + "lineNumber": 13, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-$(", "path": "node_modules/nugget/node_modules/ajv/dist/regenerator.min.js", @@ -10286,6 +10570,14 @@ "reasonCategory": "falseMatch", "updated": "2019-07-19T17:16:02.404Z" }, + { + "rule": "jQuery-append(", + "path": "node_modules/nugget/node_modules/form-data/lib/form_data.js", + "line": " append(value);", + "lineNumber": 68, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-append(", "path": "node_modules/nugget/node_modules/form-data/lib/form_data.js", @@ -11322,6 +11614,14 @@ "reasonCategory": "falseMatch", "updated": "2018-09-19T18:13:29.628Z" }, + { + "rule": "jQuery-append(", + "path": "node_modules/progress-stream/node_modules/through2/test.js", + "line": " bufs.append(crypto.randomBytes(5))", + "lineNumber": 56, + "reasonCategory": "falseMatch", + "updated": "2020-09-11T17:24:56.124Z" + }, { "rule": "jQuery-append(", "path": "node_modules/progress-stream/node_modules/through2/test.js", @@ -12534,6 +12834,15 @@ "updated": "2020-05-28T17:22:06.472Z", "reasonDetail": "Used to render local preview video" }, + { + "rule": "React-createRef", + "path": "ts/components/CallScreen.js", + "line": " this.remoteVideoRef = react_1.default.createRef();", + "lineNumber": 98, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Necessary for showing call video" + }, { "rule": "React-createRef", "path": "ts/components/CallScreen.tsx", @@ -12543,6 +12852,15 @@ "updated": "2020-06-02T21:51:34.813Z", "reasonDetail": "Used to render local preview video" }, + { + "rule": "React-createRef", + "path": "ts/components/CallScreen.tsx", + "line": " this.remoteVideoRef = React.createRef();", + "lineNumber": 75, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Necessary for showing call video" + }, { "rule": "React-createRef", "path": "ts/components/CaptionEditor.js", @@ -12604,6 +12922,15 @@ "updated": "2019-11-05T01:14:21.081Z", "reasonDetail": "Used for focus management" }, + { + "rule": "React-createRef", + "path": "ts/components/LeftPane.js", + "line": " this.containerRef = react_1.default.createRef();", + "lineNumber": 17, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Used for scroll calculations" + }, { "rule": "React-createRef", "path": "ts/components/Lightbox.js", @@ -12613,6 +12940,15 @@ "updated": "2019-11-06T19:56:38.557Z", "reasonDetail": "Used to double-check outside clicks" }, + { + "rule": "React-createRef", + "path": "ts/components/Lightbox.js", + "line": " this.videoRef = react_1.default.createRef();", + "lineNumber": 142, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Used to control video" + }, { "rule": "React-createRef", "path": "ts/components/Lightbox.js", @@ -12658,6 +12994,15 @@ "updated": "2019-08-09T00:44:31.008Z", "reasonDetail": "SearchResults needs to interact with its child List directly" }, + { + "rule": "React-createRef", + "path": "ts/components/SearchResults.js", + "line": " this.containerRef = react_1.default.createRef();", + "lineNumber": 25, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Used for scroll calculations" + }, { "rule": "React-createRef", "path": "ts/components/conversation/ConversationHeader.js", @@ -12702,6 +13047,15 @@ "reasonCategory": "usageTrusted", "updated": "2020-08-28T16:12:19.904Z" }, + { + "rule": "React-createRef", + "path": "ts/components/conversation/Message.js", + "line": " this.focusRef = react_1.default.createRef();", + "lineNumber": 61, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Used for managing focus only" + }, { "rule": "React-createRef", "path": "ts/components/conversation/Message.js", @@ -12719,6 +13073,15 @@ "reasonCategory": "usageTrusted", "updated": "2020-08-28T19:36:40.817Z" }, + { + "rule": "React-createRef", + "path": "ts/components/conversation/Message.tsx", + "line": " public focusRef: React.RefObject = React.createRef();", + "lineNumber": 211, + "reasonCategory": "usageTrusted", + "updated": "2020-09-11T17:24:56.124Z", + "reasonDetail": "Used for managing focus only" + }, { "rule": "React-createRef", "path": "ts/components/conversation/Message.tsx", diff --git a/ts/util/lint/linter.ts b/ts/util/lint/linter.ts index 45e2c0aecb..803e0ad56a 100644 --- a/ts/util/lint/linter.ts +++ b/ts/util/lint/linter.ts @@ -338,9 +338,14 @@ forEach(allSourceFiles, file => { forEach(lines, (rawLine, lineIndex) => { const line = rawLine.replace(/\r/g, ''); + if (!rule.regex.test(line)) { return; } + // recreate this rule since it has g flag, and carries local state + if (rule.expression) { + rule.regex = new RegExp(rule.expression, 'g'); + } const path = relativePath; const lineNumber = lineIndex + 1;