eslint: Remove and prohibit unused eslint-disable directives.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-12-10 18:08:45 -08:00
parent b3aa44c914
commit c7a6902fe3
10 changed files with 10 additions and 12 deletions

View File

@ -15,6 +15,7 @@
"warnOnUnsupportedTypeScriptVersion": false, "warnOnUnsupportedTypeScriptVersion": false,
"sourceType": "unambiguous" "sourceType": "unambiguous"
}, },
"reportUnusedDisableDirectives": true,
"rules": { "rules": {
"array-callback-return": "error", "array-callback-return": "error",
"arrow-body-style": "error", "arrow-body-style": "error",

View File

@ -5,7 +5,6 @@ exports.initialize = function () {
const stripe_key = $("#payment-method").data("key"); const stripe_key = $("#payment-method").data("key");
const card_change_handler = StripeCheckout.configure({ const card_change_handler = StripeCheckout.configure({
// eslint-disable-line no-undef
key: stripe_key, key: stripe_key,
image: "/static/images/logo/zulip-icon-128x128.png", image: "/static/images/logo/zulip-icon-128x128.png",
locale: "auto", locale: "auto",

View File

@ -4,7 +4,6 @@ exports.initialize = () => {
helpers.set_tab("upgrade"); helpers.set_tab("upgrade");
const add_card_handler = StripeCheckout.configure({ const add_card_handler = StripeCheckout.configure({
// eslint-disable-line no-undef
key: $("#autopay-form").data("key"), key: $("#autopay-form").data("key"),
image: "/static/images/logo/zulip-icon-128x128.png", image: "/static/images/logo/zulip-icon-128x128.png",
locale: "auto", locale: "auto",

View File

@ -1,7 +1,7 @@
"use strict"; "use strict";
const autosize = require("autosize"); 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 moment = require("moment");
const pygments_data = require("../generated/pygments_data.json"); const pygments_data = require("../generated/pygments_data.json");
@ -750,7 +750,7 @@ const show_flatpickr = (element, callback, default_timestamp) => {
enableTime: true, enableTime: true,
clickOpens: false, clickOpens: false,
defaultDate: default_timestamp, defaultDate: default_timestamp,
plugins: [new confirmDatePlugin({})], // eslint-disable-line new-cap, no-undef plugins: [new ConfirmDatePlugin({})],
positionElement: element, positionElement: element,
dateFormat: "Z", dateFormat: "Z",
formatDate: (date) => { formatDate: (date) => {

View File

@ -253,7 +253,6 @@ exports.create = function ($container, list, opts) {
meta.sorting_function = sorting_function; meta.sorting_function = sorting_function;
} else if (typeof sorting_function === "string") { } else if (typeof sorting_function === "string") {
if (typeof prop === "string") { if (typeof prop === "string") {
/* eslint-disable max-len */
meta.sorting_function = meta.generic_sorting_functions[sorting_function](prop); meta.sorting_function = meta.generic_sorting_functions[sorting_function](prop);
} else { } else {
meta.sorting_function = meta.sorting_functions.get(sorting_function); meta.sorting_function = meta.sorting_functions.get(sorting_function);

View File

@ -1,7 +1,7 @@
"use strict"; "use strict";
const ClipboardJS = require("clipboard"); 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 moment = require("moment");
const render_actions_popover_content = require("../templates/actions_popover_content.hbs"); 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, clickOpens: false,
defaultDate: moment().format(), defaultDate: moment().format(),
minDate: "today", minDate: "today",
plugins: [new confirmDatePlugin({})], // eslint-disable-line new-cap, no-undef plugins: [new ConfirmDatePlugin({})],
}); });
current_actions_popover_elem = elt; current_actions_popover_elem = elt;
} }

View File

@ -11,7 +11,6 @@ declare namespace StackTraceGPS {
}; };
} }
// eslint-disable-next-line no-redeclare
declare class StackTraceGPS { declare class StackTraceGPS {
constructor(options?: StackTraceGPS.StackTraceGPSOptions); constructor(options?: StackTraceGPS.StackTraceGPSOptions);
pinpoint(stackframe: StackFrame): Promise<StackFrame>; pinpoint(stackframe: StackFrame): Promise<StackFrame>;

View File

@ -9,7 +9,6 @@ declare namespace BundleTracker {
} }
} }
// eslint-disable-next-line no-redeclare
declare class BundleTracker extends Plugin { declare class BundleTracker extends Plugin {
constructor(options?: BundleTracker.Options); constructor(options?: BundleTracker.Options);
} }

View File

@ -53,7 +53,7 @@ def run() -> None:
description="Standard CSS style and formatting linter " description="Standard CSS style and formatting linter "
"(config: stylelint.config.js)") "(config: stylelint.config.js)")
linter_config.external_linter('eslint', ['node', 'node_modules/.bin/eslint', 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', fix_arg='--fix',
description="Standard JavaScript style and formatting linter " description="Standard JavaScript style and formatting linter "
"(config: .eslintrc).") "(config: .eslintrc).")

View File

@ -1,5 +1,7 @@
"use strict"; "use strict";
/* global $, navigate */
const path = require("path"); const path = require("path");
const commander = require("commander"); const commander = require("commander");
@ -56,8 +58,8 @@ async function run() {
await page.waitForSelector(messageSelector); await page.waitForSelector(messageSelector);
// remove unread marker and don't select message // remove unread marker and don't select message
const marker = `#zfilt${options.messageId} .unread_marker`; const marker = `#zfilt${options.messageId} .unread_marker`;
await page.evaluate((sel) => $(sel).remove(), marker); // eslint-disable-line no-undef await page.evaluate((sel) => $(sel).remove(), marker);
await page.evaluate(() => navigate.up()); // eslint-disable-line no-undef await page.evaluate(() => navigate.up());
const messageBox = await page.$(messageSelector); const messageBox = await page.$(messageSelector);
const messageGroup = (await messageBox.$x(".."))[0]; const messageGroup = (await messageBox.$x(".."))[0];
// Compute screenshot area, with some padding around the message group // Compute screenshot area, with some padding around the message group