mirror of https://github.com/zulip/zulip.git
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:
parent
39c3a02736
commit
6ec808b8df
|
@ -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": {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var util = require("util");
|
||||
|
||||
var test_credentials = require("../../var/casper/test_credentials.js").test_credentials;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
/* eslint-env browser */
|
||||
|
||||
// PhantomJS doesn’t support new DOMParser().parseFromString(…, "text/html").
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
var email = "alice@test.example.com";
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
var realm_url = "http://zulip.zulipdev.com:9981/";
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
common.start_and_log_in();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
common.start_and_log_in();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
function stream_checkbox(stream_name) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var test_credentials = require("../../var/casper/test_credentials.js").test_credentials;
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
function star_count() {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
casper.options.verbose = true;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
// Test basic tab navigation.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
common.start_and_log_in();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
common.start_and_log_in();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
common.start_and_log_in();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
function user_row(name) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
function waitWhileDraftsVisible(then) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
common.start_and_log_in();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
common.start_and_log_in();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var common = require("../casper_lib/common.js");
|
||||
|
||||
common.start_and_log_in();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
const window_stub = $.create("window-stub");
|
||||
set_global("to_$", () => window_stub);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const params = {
|
||||
alert_words: ["alertone", "alerttwo", "alertthree", "al*rt.*s", ".+", "emoji"],
|
||||
};
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
set_global("channel", {});
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const noop = () => {};
|
||||
const fs = require("fs");
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const JQuery = require("jquery");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const blueslip_stacktrace = zrequire("blueslip_stacktrace");
|
||||
|
||||
run_test("clean_path", () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const _settings_bots = {
|
||||
render_bots: () => {},
|
||||
};
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const _ = require("lodash");
|
||||
|
||||
const _page_params = {};
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const _ = require("lodash");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const _ = require("lodash");
|
||||
|
||||
set_global("$", {});
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("color_data");
|
||||
|
||||
run_test("pick_color", () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("colorspace");
|
||||
|
||||
run_test("sRGB_to_linear", () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const _ = require("lodash");
|
||||
|
||||
zrequire("keydown_util");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const {JSDOM} = require("jsdom");
|
||||
const rewiremock = require("rewiremock/node");
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const noop = function () {};
|
||||
const return_false = function () {
|
||||
return false;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("stream_data");
|
||||
zrequire("people");
|
||||
zrequire("compose_fade");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
const _people = {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("compose_ui");
|
||||
zrequire("people");
|
||||
zrequire("user_status");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||
const typeahead = zrequire("typeahead", "shared/js/typeahead");
|
||||
zrequire("compose_state");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
global.stub_out_jquery();
|
||||
|
||||
set_global("page_params", {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const noop = function () {};
|
||||
|
||||
const events = require("./lib/events.js");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const events = require("./lib/events.js");
|
||||
|
||||
const event_fixtures = events.fixtures;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const XDate = require("xdate");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("dropdown_list_widget");
|
||||
zrequire("scroll_util");
|
||||
set_global("$", global.make_zjquery());
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
set_global("markdown", {});
|
||||
set_global("local_message", {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json");
|
||||
|
||||
const events = require("./lib/events.js");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const _ = require("lodash");
|
||||
|
||||
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const fenced_code = zrequire("fenced_code", "shared/js/fenced_code");
|
||||
|
||||
run_test("get_unused_fence", () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const FetchStatus = zrequire("fetch_status");
|
||||
set_global("message_scroll", {
|
||||
hide_loading_older: () => {},
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("unread");
|
||||
zrequire("stream_data");
|
||||
zrequire("people");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const FoldDict = zrequire("fold_dict").FoldDict;
|
||||
|
||||
run_test("basic", () => {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("hash_util");
|
||||
zrequire("stream_data");
|
||||
zrequire("people");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
const window_stub = $.create("window-stub");
|
||||
set_global("location", {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
// Important note on these tests:
|
||||
//
|
||||
// The way the Zulip hotkey tests work is as follows. First, we set
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("templates");
|
||||
|
||||
// We download our translations in `page_params` (which
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
zrequire("input_pill");
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
zrequire("keydown_util");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const LazySet = zrequire("lazy_set").LazySet;
|
||||
|
||||
/*
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("rows");
|
||||
zrequire("lightbox");
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("list_cursor");
|
||||
|
||||
run_test("config errors", () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("list_render");
|
||||
|
||||
// We need these stubs to get by instanceof checks.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("hash_util");
|
||||
|
||||
const emoji = zrequire("emoji", "shared/js/emoji");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
/*
|
||||
This whole module is dedicated to adding
|
||||
one line of coverage for markdown.js.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
set_global("document", null);
|
||||
set_global("page_params", {
|
||||
realm_community_topic_editing_limit_seconds: 86400,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("message_events");
|
||||
zrequire("message_store");
|
||||
zrequire("muting");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const _ = require("lodash");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("unread");
|
||||
zrequire("unread_ops");
|
||||
zrequire("message_flags");
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("unread");
|
||||
|
||||
zrequire("Filter", "js/filter");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const _ = require("lodash");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const util = zrequire("util");
|
||||
zrequire("pm_conversations");
|
||||
zrequire("people");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("timerender");
|
||||
zrequire("muting");
|
||||
zrequire("stream_data");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
zrequire("hash_util");
|
||||
zrequire("hashchange");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const util = zrequire("util");
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("Filter", "js/filter");
|
||||
zrequire("FetchStatus", "js/fetch_status");
|
||||
zrequire("MessageListData", "js/message_list_data");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("people");
|
||||
zrequire("Filter", "js/filter");
|
||||
zrequire("stream_data");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("Filter", "js/filter");
|
||||
zrequire("people");
|
||||
zrequire("stream_data");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
// Dependencies
|
||||
set_global(
|
||||
"$",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
set_global("zxcvbn", zrequire("zxcvbn", "zxcvbn"));
|
||||
zrequire("common");
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const _ = require("lodash");
|
||||
const moment = require("moment-timezone");
|
||||
const rewiremock = require("rewiremock/node");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("people");
|
||||
|
||||
const return_false = function () {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const pmc = zrequire("pm_conversations");
|
||||
|
||||
run_test("partners", () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
set_global("narrow_state", {});
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("poll_widget");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const rewiremock = require("rewiremock/node");
|
||||
|
||||
set_global("$", global.make_zjquery());
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const XDate = require("xdate");
|
||||
|
||||
zrequire("people");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
set_global("document", "document-stub");
|
||||
set_global("$", global.make_zjquery());
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const rs = zrequire("recent_senders");
|
||||
|
||||
let next_id = 0;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("message_util");
|
||||
|
||||
const noop = () => {};
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const rm = zrequire("rendered_markdown");
|
||||
zrequire("people");
|
||||
zrequire("user_groups");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const rtl = zrequire("rtl");
|
||||
|
||||
run_test("get_direction", () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("schema");
|
||||
|
||||
run_test("basics", () => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
zrequire("scroll_util");
|
||||
set_global("ui", {
|
||||
get_scroll_element: (element) => element,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
set_global("page_params", {
|
||||
search_pills_enabled: true,
|
||||
});
|
||||
|
|
|
@ -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
Loading…
Reference in New Issue