Upgrade eslint to v6 and add TypeScript linting (#3843)

* Upgrade eslint to v6 and add TypeScript linting

* Fix pr checks


Co-authored-by: Benjamin Staneck <Stanzilla@users.noreply.github.com>
This commit is contained in:
Labhansh Agrawal 2019-10-03 06:26:50 +05:30 committed by Benjamin Staneck
parent 25fc964ae8
commit b52d8152bf
18 changed files with 616 additions and 271 deletions

View file

@ -73,7 +73,8 @@ export default class Notifications extends React.PureComponent {
userDismissable
>
Version <b>{this.props.updateVersion}</b> ready.
{this.props.updateNote && ` ${this.props.updateNote.trim().replace(/\.$/, '')}`} (<a
{this.props.updateNote && ` ${this.props.updateNote.trim().replace(/\.$/, '')}`} (
<a
style={{color: '#000'}}
onClick={ev => {
window.require('electron').shell.openExternal(ev.target.href);
@ -82,7 +83,8 @@ export default class Notifications extends React.PureComponent {
href={`https://github.com/zeit/hyper/releases/tag/${this.props.updateVersion}`}
>
notes
</a>).{' '}
</a>
).{' '}
{this.props.updateCanInstall ? (
<a
style={{
@ -110,7 +112,8 @@ export default class Notifications extends React.PureComponent {
>
Download
</a>
)}.{' '}
)}
.{' '}
</Notification>
)}
{this.props.customChildren}

View file

@ -1,4 +1,3 @@
/* global Blob,URL,requestAnimationFrame,ResizeObserver */
import React from 'react';
import {Terminal} from 'xterm';
import * as fit from 'xterm/lib/addons/fit/fit';

View file

@ -64,7 +64,9 @@ export default class Terms extends React.Component {
componentDidMount() {
window.addEventListener('contextmenu', () => {
const selection = window.getSelection().toString();
const {props: {uid}} = this.getActiveTerm();
const {
props: {uid}
} = this.getActiveTerm();
this.props.onContextMenu(uid, selection);
});
}

View file

@ -114,7 +114,7 @@ const reducer = (state = initial, action) => {
switch (action.type) {
case CONFIG_LOAD:
// eslint-disable-next-line no-case-declarations, no-fallthrough
case CONFIG_RELOAD:
case CONFIG_RELOAD: {
const {config, now} = action;
state_ = state
// unset the user font size override if the
@ -261,7 +261,7 @@ const reducer = (state = initial, action) => {
})()
);
break;
}
case SESSION_ADD:
state_ = state.merge(
{

View file

@ -1,10 +1,12 @@
import {createSelector} from 'reselect';
const getTermGroups = ({termGroups}) => termGroups.termGroups;
const getRootGroups = createSelector(getTermGroups, termGroups =>
Object.keys(termGroups)
.map(uid => termGroups[uid])
.filter(({parentUid}) => !parentUid)
const getRootGroups = createSelector(
getTermGroups,
termGroups =>
Object.keys(termGroups)
.map(uid => termGroups[uid])
.filter(({parentUid}) => !parentUid)
);
export default getRootGroups;

View file

@ -10,7 +10,7 @@
* PR: https://github.com/kevva/executable/pull/10
*/
import fs, { Stats } from "fs";
import fs, {Stats} from "fs";
export function isExecutable(fileStat: Stats): boolean {
if (process.platform === 'win32') {

View file

@ -1,4 +1,3 @@
/* global Notification */
/* eslint no-new:0 */
export default function notify(title, body, details = {}) {
//eslint-disable-next-line no-console

View file

@ -10,7 +10,6 @@ import ReactDOM from 'react-dom';
import Notification from '../components/notification';
import notify from './notify';
//eslint-disable-next-line import/newline-after-import
const Module = require('module');
const originalLoad = Module._load;
Module._load = function _load(path) {
@ -480,9 +479,7 @@ function getDecorated(parent, name) {
if (!class__ || typeof class__.prototype.render !== 'function') {
notify(
'Plugin error',
`${
fn._pluginName
}: Invalid return value of \`${method}\`. No \`render\` method found. Please return a \`React.Component\`.`
`${fn._pluginName}: Invalid return value of \`${method}\`. No \`render\` method found. Please return a \`React.Component\`.`
);
return;
}