mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-04 14:03:27 +00:00
js: Declare 'use strict' on all scripts and no modules.
And enable the import/unambiguous ESLint rule as a check on our
partition between scripts and modules. After this commit, if you add
a new file and get this error:
✖ 1:1 This module could be parsed as a valid script. import/unambiguous
* For a module, add an `import` or `export` declaration to make the
file unambiguously a module (the empty `export {};` declaration
suffices).
* For a script, add the file to the xo overrides section of
package.json that marks it "sourceType": "script", and add a 'use
strict' declaration.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
'use strict';
|
||||
import { app, dialog, shell } from 'electron';
|
||||
import { autoUpdater } from 'electron-updater';
|
||||
import { linuxUpdateNotification } from './linuxupdater'; // Required only in case of linux
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
'use strict';
|
||||
import { sentryInit } from '../renderer/js/utils/sentry-util';
|
||||
import { appUpdater } from './autoupdater';
|
||||
import { setAutoLaunch } from './startup';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
'use strict';
|
||||
import { app, shell, BrowserWindow, Menu, dialog } from 'electron';
|
||||
import { appUpdater } from './autoupdater';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
'use strict';
|
||||
import { app } from 'electron';
|
||||
|
||||
import AutoLaunch from 'auto-launch';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
export default class BaseComponent {
|
||||
generateNodeFromTemplate(template: string): Element | null {
|
||||
const wrapper = document.createElement('div');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import Tab from './tab';
|
||||
|
||||
export default class FunctionalTab extends Tab {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
import Tab from './tab';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import WebView from './webview';
|
||||
import BaseComponent from './base';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
'use strict';
|
||||
import { remote } from 'electron';
|
||||
|
||||
import path from 'path';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import { ipcRenderer, remote, clipboard, shell } from 'electron';
|
||||
import { feedbackHolder } from './feedback';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
'use strict';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import {
|
||||
appId, customReply, focusCurrentServer, parseReply, setupReply
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { focusCurrentServer } from './helpers';
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import { remote } from 'electron';
|
||||
import * as params from '../utils/params-util';
|
||||
import { appId, loadBots } from './helpers';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
export function init($reconnectButton: Element, $settingsButton: Element): void {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
'use strict';
|
||||
import electron, { app } from 'electron';
|
||||
|
||||
import * as ConfigUtil from '../../utils/config-util';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
import BaseComponent from '../../components/base';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
import BaseSection from './base-section';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
'use strict';
|
||||
import { ipcRenderer, remote, OpenDialogOptions } from 'electron';
|
||||
|
||||
import path from 'path';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import BaseComponent from '../../components/base';
|
||||
import * as t from '../../utils/translation-util';
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
import BaseSection from './base-section';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import { shell, ipcRenderer } from 'electron';
|
||||
|
||||
import BaseComponent from '../../components/base';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
import BaseComponent from '../../components/base';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import { remote, ipcRenderer } from 'electron';
|
||||
|
||||
import BaseComponent from '../../components/base';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import BaseSection from './base-section';
|
||||
import NewServerForm from './new-server-form';
|
||||
import * as t from '../../utils/translation-util';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import { shell } from 'electron';
|
||||
|
||||
import BaseSection from './base-section';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import { ipcRenderer, shell } from 'electron';
|
||||
import * as SetupSpellChecker from './spellchecker';
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import type { Subject } from 'rxjs';
|
||||
import { SpellCheckHandler, ContextMenuListener, ContextMenuBuilder } from 'electron-spellchecker';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
'use strict';
|
||||
import { ipcRenderer, remote, WebviewTag, NativeImage } from 'electron';
|
||||
|
||||
import path from 'path';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import { remote } from 'electron';
|
||||
import { JsonDB } from 'node-json-db';
|
||||
import { initSetUp } from './default-util';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
// unescape already encoded/escaped strings
|
||||
export function decodeString(stringInput: string): string {
|
||||
const parser = new DOMParser();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
'use strict';
|
||||
import { JsonDB } from 'node-json-db';
|
||||
|
||||
import fs from 'fs';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import * as ConfigUtil from './config-util';
|
||||
|
||||
// TODO: TypeScript - add to Setting interface
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
'use strict';
|
||||
import { JsonDB } from 'node-json-db';
|
||||
|
||||
import escape from 'escape-html';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
// TODO: TypeScript - Add @types/
|
||||
import wurl from 'wurl';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
'use strict';
|
||||
import { JsonDB } from 'node-json-db';
|
||||
|
||||
import fs from 'fs';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import * as ConfigUtil from './config-util';
|
||||
|
||||
export interface ProxyRule {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
'use strict';
|
||||
import { remote } from 'electron';
|
||||
|
||||
import os from 'os';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
import path from 'path';
|
||||
import electron from 'electron';
|
||||
import i18n from 'i18n';
|
||||
|
||||
16
package.json
16
package.json
@@ -219,6 +219,7 @@
|
||||
"@typescript-eslint/restrict-template-expressions": "off",
|
||||
"capitalized-comments": "off",
|
||||
"import/no-mutable-exports": "off",
|
||||
"import/unambiguous": "error",
|
||||
"max-lines": [
|
||||
"warn",
|
||||
{
|
||||
@@ -232,11 +233,26 @@
|
||||
"no-warning-comments": "off",
|
||||
"object-curly-spacing": "off",
|
||||
"padding-line-between-statements": "off",
|
||||
"strict": "error",
|
||||
"unicorn/catch-error-name": "off"
|
||||
},
|
||||
"envs": [
|
||||
"node",
|
||||
"browser"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"gulpfile.js",
|
||||
"scripts/notarize.js",
|
||||
"tools/locale-helper/index.js",
|
||||
"tools/reinstall-node-modules.js",
|
||||
"typings.d.ts"
|
||||
],
|
||||
"parserOptions": {
|
||||
"sourceType": "script"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const dotenv = require('dotenv');
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict';
|
||||
const translate = require('@vitalets/google-translate-api');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
const {exec} = require('child_process');
|
||||
const path = require('path');
|
||||
|
||||
|
||||
1
typings.d.ts
vendored
1
typings.d.ts
vendored
@@ -1,3 +1,4 @@
|
||||
'use strict';
|
||||
declare module '@electron-elements/send-feedback';
|
||||
declare module 'node-mac-notifier';
|
||||
declare module 'wurl';
|
||||
|
||||
Reference in New Issue
Block a user