Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

eslint: Remove and prohibit unused eslint-disable directives.

Anders Kaseorgc7a6902fe3c0
diff --git a/.eslintrc.json b/.eslintrc.json
index 5257cf274b4..50a1da790e7 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -15,6 +15,7 @@
"warnOnUnsupportedTypeScriptVersion": false,
"sourceType": "unambiguous"
},
+ "reportUnusedDisableDirectives": true,
"rules": {
"array-callback-return": "error",
"arrow-body-style": "error",
diff --git a/static/js/billing/billing.js b/static/js/billing/billing.js
index c6b54b059a3..3aff0a4eae6 100644
--- a/static/js/billing/billing.js
+++ b/static/js/billing/billing.js
@@ -5,7 +5,6 @@ exports.initialize = function () {
const stripe_key = $("#payment-method").data("key");
const card_change_handler = StripeCheckout.configure({
- // eslint-disable-line no-undef
key: stripe_key,
image: "/static/images/logo/zulip-icon-128x128.png",
locale: "auto",
diff --git a/static/js/billing/upgrade.js b/static/js/billing/upgrade.js
index ab0f344f308..9bd127bdd15 100644
--- a/static/js/billing/upgrade.js
+++ b/static/js/billing/upgrade.js
@@ -4,7 +4,6 @@ exports.initialize = () => {
helpers.set_tab("upgrade");
const add_card_handler = StripeCheckout.configure({
- // eslint-disable-line no-undef
key: $("#autopay-form").data("key"),
image: "/static/images/logo/zulip-icon-128x128.png",
locale: "auto",
diff --git a/static/js/composebox_typeahead.js b/static/js/composebox_typeahead.js
index 541cc3ac37e..543efe71c73 100644
--- a/static/js/composebox_typeahead.js
+++ b/static/js/composebox_typeahead.js
@@ -1,7 +1,7 @@
"use strict";
const autosize = require("autosize");
-const confirmDatePlugin = require("flatpickr/dist/plugins/confirmDate/confirmDate");
+const ConfirmDatePlugin = require("flatpickr/dist/plugins/confirmDate/confirmDate");
const moment = require("moment");
const pygments_data = require("../generated/pygments_data.json");
@@ -750,7 +750,7 @@ const show_flatpickr = (element, callback, default_timestamp) => {
enableTime: true,
clickOpens: false,
defaultDate: default_timestamp,
- plugins: [new confirmDatePlugin({})], // eslint-disable-line new-cap, no-undef
+ plugins: [new ConfirmDatePlugin({})],
positionElement: element,
dateFormat: "Z",
formatDate: (date) => {
diff --git a/static/js/list_render.js b/static/js/list_render.js
index 2600c0e0281..f0cffbc2b4b 100644
--- a/static/js/list_render.js
+++ b/static/js/list_render.js
@@ -253,7 +253,6 @@ exports.create = function ($container, list, opts) {
meta.sorting_function = sorting_function;
} else if (typeof sorting_function === "string") {
if (typeof prop === "string") {
- /* eslint-disable max-len */
meta.sorting_function = meta.generic_sorting_functions[sorting_function](prop);
} else {
meta.sorting_function = meta.sorting_functions.get(sorting_function);
diff --git a/static/js/popovers.js b/static/js/popovers.js
index 980b1b12ae4..c7eb5f82579 100644
--- a/static/js/popovers.js
+++ b/static/js/popovers.js
@@ -1,7 +1,7 @@
"use strict";
const ClipboardJS = require("clipboard");
-const confirmDatePlugin = require("flatpickr/dist/plugins/confirmDate/confirmDate");
+const ConfirmDatePlugin = require("flatpickr/dist/plugins/confirmDate/confirmDate");
const moment = require("moment");
const render_actions_popover_content = require("../templates/actions_popover_content.hbs");
@@ -587,7 +587,7 @@ exports.render_actions_remind_popover = function (element, id) {
clickOpens: false,
defaultDate: moment().format(),
minDate: "today",
- plugins: [new confirmDatePlugin({})], // eslint-disable-line new-cap, no-undef
+ plugins: [new ConfirmDatePlugin({})],
});
current_actions_popover_elem = elt;
}
diff --git a/static/js/types/stacktrace-gps/index.d.ts b/static/js/types/stacktrace-gps/index.d.ts
index e1a43fd93c7..153f06e6a2c 100644
--- a/static/js/types/stacktrace-gps/index.d.ts
+++ b/static/js/types/stacktrace-gps/index.d.ts
@@ -11,7 +11,6 @@ declare namespace StackTraceGPS {
};
}
-// eslint-disable-next-line no-redeclare
declare class StackTraceGPS {
constructor(options?: StackTraceGPS.StackTraceGPSOptions);
pinpoint(stackframe: StackFrame): Promise<StackFrame>;
diff --git a/static/js/types/webpack4-bundle-tracker/index.d.ts b/static/js/types/webpack4-bundle-tracker/index.d.ts
index 9c3238ff12d..e08c8b50b10 100644
--- a/static/js/types/webpack4-bundle-tracker/index.d.ts
+++ b/static/js/types/webpack4-bundle-tracker/index.d.ts
@@ -9,7 +9,6 @@ declare namespace BundleTracker {
}
}
-// eslint-disable-next-line no-redeclare
declare class BundleTracker extends Plugin {
constructor(options?: BundleTracker.Options);
}
diff --git a/tools/lint b/tools/lint
index db14f424548..ecb82f5b363 100755
--- a/tools/lint
+++ b/tools/lint
@@ -53,7 +53,7 @@ def run() -> None:
description="Standard CSS style and formatting linter "
"(config: stylelint.config.js)")
linter_config.external_linter('eslint', ['node', 'node_modules/.bin/eslint',
- '--quiet', '--cache', '--ext', '.js,.ts'], ['js', 'ts'],
+ '--max-warnings=0', '--cache', '--ext', '.js,.ts'], ['js', 'ts'],
fix_arg='--fix',
description="Standard JavaScript style and formatting linter "
"(config: .eslintrc).")
diff --git a/tools/message-screenshot.js b/tools/message-screenshot.js
index db05cff0268..7586f3f2146 100644
--- a/tools/message-screenshot.js
+++ b/tools/message-screenshot.js
@@ -1,5 +1,7 @@
"use strict";
+/* global $, navigate */
+
const path = require("path");
const commander = require("commander");
@@ -56,8 +58,8 @@ async function run() {
await page.waitForSelector(messageSelector);
// remove unread marker and don't select message
const marker = `#zfilt${options.messageId} .unread_marker`;
- await page.evaluate((sel) => $(sel).remove(), marker); // eslint-disable-line no-undef
- await page.evaluate(() => navigate.up()); // eslint-disable-line no-undef
+ await page.evaluate((sel) => $(sel).remove(), marker);
+ await page.evaluate(() => navigate.up());
const messageBox = await page.$(messageSelector);
const messageGroup = (await messageBox.$x(".."))[0];
// Compute screenshot area, with some padding around the message group