Skip to content

Commit

Permalink
Update eslint and a few ZEIT references to Vercel
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanzilla committed Jul 13, 2020
1 parent 6ef561a commit 5692d32
Show file tree
Hide file tree
Showing 24 changed files with 263 additions and 184 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@
],
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/prefer-optional-chain": "error"
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/ban-types": "off"
}
}
]
Expand Down
6 changes: 3 additions & 3 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
-->

<!-- Checked checkbox should look like this: [x] -->
- [ ] I am on the [latest](https://github.com/zeit/hyper/releases/latest) Hyper.app version
- [ ] I have searched the [issues](https://github.com/zeit/hyper/issues) of this repo and believe that this is not a duplicate
- [ ] I am on the [latest](https://github.com/vercel/hyper/releases/latest) Hyper.app version
- [ ] I have searched the [issues](https://github.com/vercel/hyper/issues) of this repo and believe that this is not a duplicate

<!--
Once those are done, if you're able to fill in the following list with your information,
Expand All @@ -22,4 +22,4 @@
- **The issue is reproducible in vanilla Hyper.app**: <!-- Replace with info if applicable, or `Is Vanilla`. (Vanilla means Hyper.app without any add-ons or extras. Straight out of the box.) -->

## Issue
<!-- Now feel free to write your issue, but please be descriptive! Thanks again 🙌 ❤ -->
<!-- Now feel free to write your issue, but please be descriptive! Thanks again 🙌 ❤ -->
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
- To help whoever reviews your PR, it'd be extremely helpful for you to list whether your PR is ready to be merged,
If there's anything left to do and if there are any related PRs
- It'd also be extremely helpful to enable us to update your PR incase we need to rebase or what-not by checking `Allow edits from maintainers`
- If your PR changes some API, please make a PR for hyper website too: https://github.com/zeit/hyper-site.
- If your PR changes some API, please make a PR for hyper website too: https://github.com/vercel/hyper-site.
Thanks, again! -->
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License

Copyright (c) 2018 ZEIT, Inc.
Copyright (c) 2018 Vercel, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 4 additions & 4 deletions PLUGINS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
## Workflow

### Run Hyper in dev mode
Hyper can be run in dev mode by cloning this repository and following the ["Contributing" section of our README](https://github.com/zeit/hyper#contribute).
Hyper can be run in dev mode by cloning this repository and following the ["Contributing" section of our README](https://github.com/vercel/hyper#contribute).

In dev mode you'll get more ouput and access to React/Redux dev-tools in Electron.

Prerequisites and steps are described in the ["Contributing" section of our README](https://github.com/zeit/hyper#contribute).
Prerequisites and steps are described in the ["Contributing" section of our README](https://github.com/vercel/hyper#contribute).
Be sure to use the `canary` branch.

### Create a dev config file
Expand All @@ -30,7 +30,7 @@ module.exports = {
```

### Running your plugin
To load, your plugin should expose at least one API method. All possible methods are listed [here](https://github.com/zeit/hyper/blob/canary/app/plugins/extensions.ts).
To load, your plugin should expose at least one API method. All possible methods are listed [here](https://github.com/vercel/hyper/blob/canary/app/plugins/extensions.ts).

After launching Hyper in dev mode, run `yarn run app`, it should log that your plugin has been correcty loaded: `Plugin hyper-awesome-plugin (0.1.0) loaded.`. Name and version printed are the ones in your plugins `package.json` file.

Expand Down Expand Up @@ -70,7 +70,7 @@ exports.decorateTerms = (Terms, {React}) => {
// <Terms onDecorated={this.onDecorated} />
}
}
```
```
:warning: Note that you have to execute `this.props.onDecorated` to not break the handler chain. Without this, you could break other plugins that decorate the same component.
### Keymaps
Expand Down
2 changes: 0 additions & 2 deletions app/auto-updater-linux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ class AutoUpdater extends EventEmitter implements Electron.AutoUpdater {
this.emit('update-not-available');
return;
}
// eslint-disable-next-line @typescript-eslint/camelcase
return res.json().then(({name, notes, pub_date}) => {
// Only name is mandatory, needed to construct release URL.
if (!name) {
throw new Error('Malformed server response: release name is missing.');
}
// If `null` is passed to Date constructor, current time will be used. This doesn't work with `undefined`
// eslint-disable-next-line @typescript-eslint/camelcase
const date = new Date(pub_date || null);
this.emit('update-available', {}, notes, name, date);
});
Expand Down
8 changes: 4 additions & 4 deletions app/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const getDeprecatedCSS = (config: configOptions) => {
const deprecated: string[] = [];
const deprecatedCSS = ['x-screen', 'x-row', 'cursor-node', '::selection'];
deprecatedCSS.forEach((css) => {
if ((config.css && config.css.includes(css)) || (config.termCSS && config.termCSS.includes(css))) {
if (config.css?.includes(css) || config.termCSS?.includes(css)) {
deprecated.push(css);
}
});
Expand Down Expand Up @@ -52,7 +52,7 @@ const _watch = () => {
// Windows
if (process.platform === 'win32') {
// watch for changes on config every 2s on Windows
// https://github.com/zeit/hyper/pull/1772
// https://github.com/vercel/hyper/pull/1772
_watcher = fs.watchFile(cfgPath, {interval: 2000}, (curr, prev) => {
if (!curr.mtime || curr.mtime.getTime() === 0) {
console.error('error watching config');
Expand Down Expand Up @@ -144,8 +144,8 @@ export const htermConfigTranslate = (config: configOptions) => {
Object.keys(cssReplacements).forEach((pattern) => {
const searchvalue = new RegExp(pattern, 'g');
const newvalue = cssReplacements[pattern];
config.css = config.css && config.css.replace(searchvalue, newvalue);
config.termCSS = config.termCSS && config.termCSS.replace(searchvalue, newvalue);
config.css = config.css?.replace(searchvalue, newvalue);
config.termCSS = config.termCSS?.replace(searchvalue, newvalue);
});
return config;
};
1 change: 1 addition & 0 deletions app/config/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default () => {
} catch (err) {
console.error(err);
}
// eslint-disable-next-line @typescript-eslint/no-var-requires
const {exec} = require('child_process') as typeof import('child_process');

const getUserChoiceKey = async () => {
Expand Down
1 change: 1 addition & 0 deletions app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ function installDevExtensions(isDev_: boolean) {
if (!isDev_) {
return Promise.resolve([]);
}
// eslint-disable-next-line @typescript-eslint/no-var-requires
const installer = require('electron-devtools-installer') as typeof import('electron-devtools-installer');

const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'] as const;
Expand Down
2 changes: 1 addition & 1 deletion app/menus/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const createMenu = (
dialog.showMessageBox({
title: `About ${appName}`,
message: `${appName} ${appVersion} (${updateChannel})`,
detail: `Renderers: ${renderers}\nPlugins: ${pluginList}\n\nCreated by Guillermo Rauch\nCopyright © 2020 ZEIT, Inc.`,
detail: `Renderers: ${renderers}\nPlugins: ${pluginList}\n\nCreated by Guillermo Rauch\nCopyright © 2020 Vercel, Inc.`,
buttons: [],
icon: icon as any
});
Expand Down
8 changes: 4 additions & 4 deletions app/menus/menus/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export default (commands: Record<string, string>, showAbout: () => void): MenuIt
If not, please try and fulfil these first.
-->
<!-- 👉 Checked checkbox should look like this: [x] -->
- [ ] Your Hyper.app version is **${version}**. Please verify your using the [latest](https://github.com/zeit/hyper/releases/latest) Hyper.app version
- [ ] I have searched the [issues](https://github.com/zeit/hyper/issues) of this repo and believe that this is not a duplicate
- [ ] Your Hyper.app version is **${version}**. Please verify your using the [latest](https://github.com/vercel/hyper/releases/latest) Hyper.app version
- [ ] I have searched the [issues](https://github.com/vercel/hyper/issues) of this repo and believe that this is not a duplicate
---
- **Any relevant information from devtools?** _(CMD+OPTION+I on macOS, CTRL+SHIFT+I elsewhere)_:
<!-- 👉 Replace with info if applicable, or N/A -->
Expand Down Expand Up @@ -57,11 +57,11 @@ ${JSON.stringify(getPlugins(), null, 2)}
\`\`\`
</details>`;

const issueURL = `https://github.com/zeit/hyper/issues/new?body=${encodeURIComponent(body)}`;
const issueURL = `https://github.com/vercel/hyper/issues/new?body=${encodeURIComponent(body)}`;
const copyAndSend = () => {
clipboard.writeText(body);
shell.openExternal(
`https://github.com/zeit/hyper/issues/new?body=${encodeURIComponent(
`https://github.com/vercel/hyper/issues/new?body=${encodeURIComponent(
'<!-- We have written the needed data into your clipboard because it was too large to send. ' +
'Please paste. -->\n'
)}`
Expand Down
8 changes: 4 additions & 4 deletions app/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable @typescript-eslint/no-use-before-define */
import {app, dialog, BrowserWindow, App} from 'electron';
import {resolve, basename} from 'path';
import {writeFileSync} from 'fs';
Expand Down Expand Up @@ -51,7 +49,7 @@ config.subscribe(() => {

// patching Module._load
// so plugins can `require` them without needing their own version
// https://github.com/zeit/hyper/issues/619
// https://github.com/vercel/hyper/issues/619
function patchModuleLoad() {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const Module = require('module');
Expand Down Expand Up @@ -144,6 +142,7 @@ function getPluginVersions() {
return paths_.map((path_) => {
let version = null;
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
version = require(resolve(path_, 'package.json')).version;
//eslint-disable-next-line no-empty
} catch (err) {}
Expand Down Expand Up @@ -199,7 +198,7 @@ function syncPackageJSON() {
description: 'Auto-generated from `~/.hyper.js`!',
private: true,
version: '0.0.1',
repository: 'zeit/hyper',
repository: 'vercel/hyper',
license: 'MIT',
homepage: 'https://hyper.is',
dependencies
Expand Down Expand Up @@ -282,6 +281,7 @@ function requirePlugins(): any[] {
// populate the name for internal errors here
mod._name = basename(path_);
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
mod._version = require(resolve(path_, 'package.json')).version;
} catch (err) {
console.warn(`No package.json found in ${path_}`);
Expand Down
4 changes: 3 additions & 1 deletion app/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const createNodePtyError = () =>

let spawn: typeof npSpawn;
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
spawn = require('node-pty').spawn;
} catch (err) {
throw createNodePtyError();
Expand Down Expand Up @@ -100,6 +101,7 @@ export default class Session extends EventEmitter {
}

init({uid, rows, cols: columns, cwd, shell, shellArgs}: SessionOptions) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const osLocale = require('os-locale') as typeof import('os-locale');
const baseEnv = Object.assign(
{},
Expand All @@ -116,7 +118,7 @@ export default class Session extends EventEmitter {

// Electron has a default value for process.env.GOOGLE_API_KEY
// We don't want to leak this to the shell
// See https://github.com/zeit/hyper/issues/696
// See https://github.com/vercel/hyper/issues/696
if (baseEnv.GOOGLE_API_KEY && process.env.GOOGLE_API_KEY === baseEnv.GOOGLE_API_KEY) {
delete baseEnv.GOOGLE_API_KEY;
}
Expand Down
2 changes: 1 addition & 1 deletion app/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default (win: BrowserWindow) => {
updateUrl: string,
onQuitAndInstall: any
) => {
const releaseUrl = updateUrl || `https://github.com/zeit/hyper/releases/tag/${releaseName}`;
const releaseUrl = updateUrl || `https://github.com/vercel/hyper/releases/tag/${releaseName}`;
rpc.emit('update available', {releaseNotes, releaseName, releaseUrl, canInstall: !!onQuitAndInstall});
};

Expand Down
2 changes: 1 addition & 1 deletion lib/components/notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class Notifications extends React.PureComponent<NotificationsProp
window.require('electron').shell.openExternal(ev.currentTarget.href);
ev.preventDefault();
}}
href={`https://github.com/zeit/hyper/releases/tag/${this.props.updateVersion}`}
href={`https://github.com/vercel/hyper/releases/tag/${this.props.updateVersion}`}
>
notes
</a>
Expand Down
1 change: 0 additions & 1 deletion lib/components/term-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {HyperState, HyperDispatch, TermGroupProps, TermGroupOwnProps} from '../h
const Term = decorate(Term_, 'Term');
const SplitPane = decorate(SplitPane_, 'SplitPane');

// eslint-disable-next-line @typescript-eslint/class-name-casing
class TermGroup_ extends React.PureComponent<TermGroupProps> {
bound: WeakMap<(uid: string, ...args: any[]) => any, Record<string, (...args: any[]) => any>>;
term?: Term_ | null;
Expand Down
2 changes: 1 addition & 1 deletion lib/containers/hyper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Hyper extends React.PureComponent<HyperProps> {

componentWillUnmount() {
document.body.style.backgroundColor = 'inherit';
this.mousetrap && this.mousetrap.reset();
this.mousetrap?.reset();
}

render() {
Expand Down
1 change: 0 additions & 1 deletion lib/ext-modules.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
declare module 'php-escape-shell' {
// eslint-disable-next-line @typescript-eslint/camelcase
export function php_escapeshellcmd(path: string): string;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/reducers/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const reducer = (state: ImmutableType<sessionState> = initialState, action: Hype
case SESSION_PTY_DATA:
// we avoid a direct merge for perf reasons
// as this is the most common action
if (state.sessions[action.uid] && state.sessions[action.uid].cleared) {
if (state.sessions[action.uid]?.cleared) {
return state.merge(
{
sessions: {
Expand Down
5 changes: 3 additions & 2 deletions lib/utils/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {basename} from 'path';

// patching Module._load
// so plugins can `require` them without needing their own version
// https://github.com/zeit/hyper/issues/619
// https://github.com/vercel/hyper/issues/619
import React, {PureComponent} from 'react';
import ReactDOM from 'react-dom';
import Notification from '../components/notification';
Expand Down Expand Up @@ -66,7 +66,7 @@ let reducersDecorators: {
// expose decorated component instance to the higher-order components
function exposeDecorated<P extends Record<string, any>>(
Component_: React.ComponentType<P>
): React.ComponentClass<P, {}> {
): React.ComponentClass<P, unknown> {
return class DecoratedComponent extends React.Component<P> {
constructor(props: P, context: any) {
super(props, context);
Expand Down Expand Up @@ -155,6 +155,7 @@ export function decorate<P>(
};
}

// eslint-disable-next-line @typescript-eslint/no-var-requires
const Module = require('module') as typeof import('module') & {_load: Function};
const originalLoad = Module._load;
Module._load = function _load(path: string) {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
"@types/terser-webpack-plugin": "3.0.0",
"@types/uuid": "8.0.0",
"@types/webpack": "4.41.21",
"@typescript-eslint/eslint-plugin": "2.34.0",
"@typescript-eslint/parser": "2.34.0",
"@typescript-eslint/eslint-plugin": "3.6.0",
"@typescript-eslint/parser": "3.6.0",
"ava": "3.10.1",
"babel-loader": "8.1.0",
"concurrently": "5.2.0",
Expand All @@ -103,7 +103,7 @@
"electron-builder-squirrel-windows": "22.7.0",
"electron-devtools-installer": "3.1.0",
"electron-rebuild": "1.11.0",
"eslint": "6.8.0",
"eslint": "7.4.0",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-prettier": "3.1.4",
Expand Down
1 change: 1 addition & 0 deletions test/unit/cli-api.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import test from 'ava';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const proxyquire = require('proxyquire').noCallThru();

test('existsOnNpm() builds the url for non-scoped packages', (t) => {
Expand Down
1 change: 1 addition & 0 deletions test/unit/window-utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import test from 'ava';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const proxyquire = require('proxyquire').noCallThru();

test('positionIsValid() returns true when window is on only screen', (t) => {
Expand Down
Loading

0 comments on commit 5692d32

Please sign in to comment.