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: Forbid CommonJS variables in ES6 modules.

Anders Kaseorg9553f113879e
diff --git a/.eslintrc.json b/.eslintrc.json
index a858845c696..4e91ddc0d13 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -209,7 +209,6 @@
"files": ["static/**"],
"env": {
"browser": true,
- "commonjs": true,
"node": false
},
"rules": {
@@ -223,7 +222,6 @@
"files": ["static/shared/**"],
"env": {
"browser": false,
- "commonjs": false,
"shared-node-browser": true
},
"rules": {
diff --git a/frontend_tests/zjsunit/index.js b/frontend_tests/zjsunit/index.js
index 66ab6f6335b..d43190b5b99 100644
--- a/frontend_tests/zjsunit/index.js
+++ b/frontend_tests/zjsunit/index.js
@@ -1,6 +1,5 @@
"use strict";
-const Module = require("module");
const path = require("path");
require("css.escape");
@@ -52,11 +51,6 @@ handlebars.hook_require();
const noop = function () {};
-// Set up fake module.hot
-Module.prototype.hot = {
- accept: noop,
-};
-
function short_tb(tb) {
const lines = tb.split("\n");
diff --git a/static/assets/icons/zulip-icons.font.js b/static/assets/icons/zulip-icons.font.js
index 765a5362df7..37d01037ba8 100644
--- a/static/assets/icons/zulip-icons.font.js
+++ b/static/assets/icons/zulip-icons.font.js
@@ -1,3 +1,5 @@
+/* eslint-env commonjs */
+
"use strict";
module.exports = {
diff --git a/static/js/avatar.js b/static/js/avatar.js
index 498f8d81651..47e8c994156 100644
--- a/static/js/avatar.js
+++ b/static/js/avatar.js
@@ -1,12 +1,12 @@
import $ from "jquery";
+import render_confirm_delete_user_avatar from "../templates/confirm_delete_user_avatar.hbs";
+
import * as channel from "./channel";
import * as confirm_dialog from "./confirm_dialog";
import * as settings_data from "./settings_data";
import * as upload_widget from "./upload_widget";
-const render_confirm_delete_user_avatar = require("../templates/confirm_delete_user_avatar.hbs");
-
export function build_bot_create_widget() {
// We have to do strange gyrations with the file input to clear it,
// where we replace it wholesale, so we generalize the file input with
diff --git a/static/js/common.js b/static/js/common.js
index 7d9bd3526e6..5ddecd4ceb8 100644
--- a/static/js/common.js
+++ b/static/js/common.js
@@ -1,10 +1,5 @@
import $ from "jquery";
-// This reloads the module in development rather than refreshing the page
-if (module.hot) {
- module.hot.accept();
-}
-
export const status_classes = "alert-error alert-success alert-info alert-warning";
// TODO: Move this to the portico codebase.
diff --git a/static/js/csrf.js b/static/js/csrf.js
index e77e171b0e7..5360a17b74a 100644
--- a/static/js/csrf.js
+++ b/static/js/csrf.js
@@ -1,3 +1,5 @@
+/* eslint-env commonjs */
+
"use strict";
const $ = require("jquery");
diff --git a/static/js/css_variables.js b/static/js/css_variables.js
index 973be41e506..9a11287b49d 100644
--- a/static/js/css_variables.js
+++ b/static/js/css_variables.js
@@ -1,3 +1,5 @@
+/* eslint-env commonjs */
+
"use strict";
// Media query breakpoints according to Bootstrap 4.5
diff --git a/static/js/page_params.js b/static/js/page_params.js
index 6dc311471fe..c7493cabcee 100644
--- a/static/js/page_params.js
+++ b/static/js/page_params.js
@@ -1,3 +1,5 @@
+/* eslint-env commonjs */
+
"use strict";
const $ = require("jquery");
diff --git a/static/js/zulip.js b/static/js/zulip.js
index 8d662d1532a..4aac7611905 100644
--- a/static/js/zulip.js
+++ b/static/js/zulip.js
@@ -1,3 +1,5 @@
+/* eslint-env commonjs */
+
"use strict";
const {Filter} = require("./filter");