js: Add "use strict" directive to CommonJS files.

ES and TypeScript modules are strict by default and don’t need this
directive.  ESLint will remind us to add it to new CommonJS files and
remove it from ES and TypeScript modules.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-07-31 18:43:15 -07:00 committed by Tim Abbott
parent 39c3a02736
commit 6ec808b8df
370 changed files with 746 additions and 2 deletions

View File

@ -7,7 +7,7 @@
"parser": "babel-eslint",
"parserOptions": {
"warnOnUnsupportedTypeScriptVersion": false,
"sourceType": "module"
"sourceType": "unambiguous"
},
"plugins": ["eslint-plugin-empty-returns"],
"rules": {
@ -29,6 +29,7 @@
"newlines-between": "always"
}
],
"import/unambiguous": "error",
"new-cap": [
"error",
{
@ -88,7 +89,7 @@
],
"radix": "error",
"spaced-comment": "off",
"strict": "off",
"strict": "error",
"valid-typeof": ["error", {"requireStringLiterals": true}],
"yoda": "error"
},
@ -331,6 +332,12 @@
"@typescript-eslint/unified-signatures": "error"
}
},
{
"files": ["**/*.d.ts"],
"rules": {
"import/unambiguous": "off"
}
},
{
"files": ["frontend_tests/**"],
"globals": {

View File

@ -1,3 +1,5 @@
"use strict";
module.exports = {
presets: [
[

View File

@ -1,3 +1,5 @@
"use strict";
var util = require("util");
var test_credentials = require("../../var/casper/test_credentials.js").test_credentials;

View File

@ -1,3 +1,5 @@
"use strict";
/* eslint-env browser */
// PhantomJS doesnt support new DOMParser().parseFromString(…, "text/html").

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
var email = "alice@test.example.com";

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
var realm_url = "http://zulip.zulipdev.com:9981/";

View File

@ -1,3 +1,5 @@
"use strict";
/* Script for testing the web client.
This runs under CasperJS. It's an end-to-end black-box sort of test. It

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
common.start_and_log_in();

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
common.start_and_log_in();

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
function stream_checkbox(stream_name) {

View File

@ -1,3 +1,5 @@
"use strict";
var test_credentials = require("../../var/casper/test_credentials.js").test_credentials;
var common = require("../casper_lib/common.js");

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
function star_count() {

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
casper.options.verbose = true;

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
// Test basic tab navigation.

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
common.start_and_log_in();

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
common.start_and_log_in();

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
common.start_and_log_in();

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
function user_row(name) {

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
function waitWhileDraftsVisible(then) {

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
common.start_and_log_in();

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
common.start_and_log_in();

View File

@ -1,3 +1,5 @@
"use strict";
var common = require("../casper_lib/common.js");
common.start_and_log_in();

View File

@ -1,3 +1,5 @@
"use strict";
set_global("$", global.make_zjquery());
const window_stub = $.create("window-stub");
set_global("to_$", () => window_stub);

View File

@ -1,3 +1,5 @@
"use strict";
const params = {
alert_words: ["alertone", "alerttwo", "alertthree", "al*rt.*s", ".+", "emoji"],
};

View File

@ -1,3 +1,5 @@
"use strict";
set_global("$", global.make_zjquery());
set_global("channel", {});

View File

@ -1,3 +1,5 @@
"use strict";
const noop = () => {};
const fs = require("fs");

View File

@ -1,3 +1,5 @@
"use strict";
const fs = require("fs");
const JQuery = require("jquery");

View File

@ -1,3 +1,5 @@
"use strict";
const blueslip_stacktrace = zrequire("blueslip_stacktrace");
run_test("clean_path", () => {

View File

@ -1,3 +1,5 @@
"use strict";
const _settings_bots = {
render_bots: () => {},
};

View File

@ -1,3 +1,5 @@
"use strict";
const _ = require("lodash");
const _page_params = {};

View File

@ -1,3 +1,5 @@
"use strict";
const _ = require("lodash");
set_global("$", global.make_zjquery());

View File

@ -1,3 +1,5 @@
"use strict";
const _ = require("lodash");
set_global("$", {});

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("color_data");
run_test("pick_color", () => {

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("colorspace");
run_test("sRGB_to_linear", () => {

View File

@ -1,3 +1,5 @@
"use strict";
const noop = () => {};
set_global("$", global.make_zjquery());

View File

@ -1,3 +1,5 @@
"use strict";
const _ = require("lodash");
zrequire("keydown_util");

View File

@ -1,3 +1,5 @@
"use strict";
const {JSDOM} = require("jsdom");
const rewiremock = require("rewiremock/node");

View File

@ -1,3 +1,5 @@
"use strict";
const noop = function () {};
const return_false = function () {
return false;

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("stream_data");
zrequire("people");
zrequire("compose_fade");

View File

@ -1,3 +1,5 @@
"use strict";
set_global("$", global.make_zjquery());
const _people = {

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("compose_ui");
zrequire("people");
zrequire("user_status");

View File

@ -1,3 +1,5 @@
"use strict";
const emoji = zrequire("emoji", "shared/js/emoji");
const typeahead = zrequire("typeahead", "shared/js/typeahead");
zrequire("compose_state");

View File

@ -1,3 +1,5 @@
"use strict";
global.stub_out_jquery();
set_global("page_params", {

View File

@ -1,3 +1,5 @@
"use strict";
const noop = function () {};
const events = require("./lib/events.js");

View File

@ -1,3 +1,5 @@
"use strict";
const events = require("./lib/events.js");
const event_fixtures = events.fixtures;

View File

@ -1,3 +1,5 @@
"use strict";
const XDate = require("xdate");
set_global("$", global.make_zjquery());

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("dropdown_list_widget");
zrequire("scroll_util");
set_global("$", global.make_zjquery());

View File

@ -1,3 +1,5 @@
"use strict";
set_global("$", global.make_zjquery());
set_global("markdown", {});
set_global("local_message", {

View File

@ -1,3 +1,5 @@
"use strict";
const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json");
const events = require("./lib/events.js");

View File

@ -1,3 +1,5 @@
"use strict";
const _ = require("lodash");
const emoji = zrequire("emoji", "shared/js/emoji");

View File

@ -1,3 +1,5 @@
"use strict";
const fenced_code = zrequire("fenced_code", "shared/js/fenced_code");
run_test("get_unused_fence", () => {

View File

@ -1,3 +1,5 @@
"use strict";
const FetchStatus = zrequire("fetch_status");
set_global("message_scroll", {
hide_loading_older: () => {},

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("unread");
zrequire("stream_data");
zrequire("people");

View File

@ -1,3 +1,5 @@
"use strict";
const FoldDict = zrequire("fold_dict").FoldDict;
run_test("basic", () => {

View File

@ -1,3 +1,5 @@
"use strict";
// This is a general tour of how to write node tests that
// may also give you some quick insight on how the Zulip
// browser app is constructed. Let's start with testing

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("hash_util");
zrequire("stream_data");
zrequire("people");

View File

@ -1,3 +1,5 @@
"use strict";
set_global("$", global.make_zjquery());
const window_stub = $.create("window-stub");
set_global("location", {

View File

@ -1,3 +1,5 @@
"use strict";
// Important note on these tests:
//
// The way the Zulip hotkey tests work is as follows. First, we set

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("templates");
// We download our translations in `page_params` (which

View File

@ -1,3 +1,5 @@
"use strict";
set_global("$", global.make_zjquery());
zrequire("input_pill");

View File

@ -1,3 +1,5 @@
"use strict";
set_global("$", global.make_zjquery());
zrequire("keydown_util");

View File

@ -1,3 +1,5 @@
"use strict";
const LazySet = zrequire("lazy_set").LazySet;
/*

View File

@ -1,3 +1,5 @@
"use strict";
// TODO: These events are not guaranteed to be perfectly
// representative of what the server sends. For
// now we just want very basic test coverage. We

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("rows");
zrequire("lightbox");

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("list_cursor");
run_test("config errors", () => {

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("list_render");
// We need these stubs to get by instanceof checks.

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("hash_util");
const emoji = zrequire("emoji", "shared/js/emoji");

View File

@ -1,3 +1,5 @@
"use strict";
/*
This whole module is dedicated to adding
one line of coverage for markdown.js.

View File

@ -1,3 +1,5 @@
"use strict";
set_global("document", null);
set_global("page_params", {
realm_community_topic_editing_limit_seconds: 86400,

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("message_events");
zrequire("message_store");
zrequire("muting");

View File

@ -1,3 +1,5 @@
"use strict";
const _ = require("lodash");
set_global("$", global.make_zjquery());

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("unread");
zrequire("unread_ops");
zrequire("message_flags");

View File

@ -1,3 +1,5 @@
"use strict";
// These unit tests for static/js/message_list.js emphasize the model-ish
// aspects of the MessageList class. We have to stub out a few functions
// related to views and events to get the tests working.

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("unread");
zrequire("Filter", "js/filter");

View File

@ -1,3 +1,5 @@
"use strict";
const _ = require("lodash");
set_global("$", global.make_zjquery());

View File

@ -1,3 +1,5 @@
"use strict";
const util = zrequire("util");
zrequire("pm_conversations");
zrequire("people");

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("timerender");
zrequire("muting");
zrequire("stream_data");

View File

@ -1,3 +1,5 @@
"use strict";
set_global("$", global.make_zjquery());
zrequire("hash_util");
zrequire("hashchange");

View File

@ -1,3 +1,5 @@
"use strict";
const util = zrequire("util");
set_global("$", global.make_zjquery());

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("Filter", "js/filter");
zrequire("FetchStatus", "js/fetch_status");
zrequire("MessageListData", "js/message_list_data");

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("people");
zrequire("Filter", "js/filter");
zrequire("stream_data");

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("Filter", "js/filter");
zrequire("people");
zrequire("stream_data");

View File

@ -1,3 +1,5 @@
"use strict";
// Dependencies
set_global(
"$",

View File

@ -1,3 +1,5 @@
"use strict";
set_global("zxcvbn", zrequire("zxcvbn", "zxcvbn"));
zrequire("common");

View File

@ -1,3 +1,5 @@
"use strict";
const _ = require("lodash");
const moment = require("moment-timezone");
const rewiremock = require("rewiremock/node");

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("people");
const return_false = function () {

View File

@ -1,3 +1,5 @@
"use strict";
const pmc = zrequire("pm_conversations");
run_test("partners", () => {

View File

@ -1,3 +1,5 @@
"use strict";
set_global("$", global.make_zjquery());
set_global("narrow_state", {});

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("poll_widget");
set_global("$", global.make_zjquery());

View File

@ -1,3 +1,5 @@
"use strict";
const rewiremock = require("rewiremock/node");
set_global("$", global.make_zjquery());

View File

@ -1,3 +1,5 @@
"use strict";
const XDate = require("xdate");
zrequire("people");

View File

@ -1,3 +1,5 @@
"use strict";
set_global("document", "document-stub");
set_global("$", global.make_zjquery());

View File

@ -1,3 +1,5 @@
"use strict";
const rs = zrequire("recent_senders");
let next_id = 0;

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("message_util");
const noop = () => {};

View File

@ -1,3 +1,5 @@
"use strict";
const rm = zrequire("rendered_markdown");
zrequire("people");
zrequire("user_groups");

View File

@ -1,3 +1,5 @@
"use strict";
const rtl = zrequire("rtl");
run_test("get_direction", () => {

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("schema");
run_test("basics", () => {

View File

@ -1,3 +1,5 @@
"use strict";
zrequire("scroll_util");
set_global("ui", {
get_scroll_element: (element) => element,

View File

@ -1,3 +1,5 @@
"use strict";
set_global("page_params", {
search_pills_enabled: true,
});

View File

@ -1,3 +1,5 @@
"use strict";
set_global("page_params", {
search_pills_enabled: false,
});

Some files were not shown because too many files have changed in this diff Show More