Fix xo 0.17 errors and use root xo config for app (#859)

* Use parent xo config in app/

* lint: Fix xo 0.17 errors

* app: add missing semver dependency
This commit is contained in:
Martin Ek 2016-10-12 21:35:44 -04:00 committed by Guillermo Rauch
parent ec9787fda4
commit 7a08b1dc3e
15 changed files with 65 additions and 61 deletions

View file

@ -3,8 +3,8 @@ const {resolve} = require('path');
// Packages
const {parse: parseUrl} = require('url');
const {gitDescribe} = require('git-describe');
const {app, BrowserWindow, shell, Menu} = require('electron');
const {gitDescribe} = require('git-describe');
const uuid = require('uuid');
const fileUriToPath = require('file-uri-to-path');
const isDev = require('electron-is-dev');
@ -410,7 +410,8 @@ function installDevExtensions(isDev) {
if (!isDev) {
return Promise.resolve();
}
const installer = require('electron-devtools-installer'); // eslint-disable-line global-require
// eslint-disable-next-line import/no-extraneous-dependencies
const installer = require('electron-devtools-installer');
const extensions = [
'REACT_DEVELOPER_TOOLS',

View file

@ -8,7 +8,7 @@ const appName = app.getName();
// based on and inspired by
// https://github.com/sindresorhus/anatine/blob/master/menu.js
module.exports = function createMenu({createWindow, updatePlugins}) {
module.exports = ({createWindow, updatePlugins}) => {
const osxApplicationMenu = {
// This menu label is overrided by OSX to be the appName
// The label is set to appName here so it matches actual behavior

View file

@ -22,7 +22,9 @@
"mkdirp": "0.5.1",
"ms": "0.7.1",
"node-fetch": "1.6.3",
"semver": "5.3.0",
"shell-env": "0.2.0",
"uuid": "2.0.2"
}
},
"xo": false
}

View file

@ -132,6 +132,7 @@ function getPluginVersions() {
return paths_.map(path => {
let version = null;
try {
// eslint-disable-next-line import/no-dynamic-require
version = require(resolve(path, 'package.json')).version;
} catch (err) { }
return [
@ -280,6 +281,7 @@ function requirePlugins() {
const load = path => {
let mod;
try {
// eslint-disable-next-line import/no-dynamic-require
mod = require(path);
const exposed = mod && Object.keys(mod).some(key => availableExtensions.has(key));
if (!exposed) {

View file

@ -51,6 +51,6 @@ class Server extends EventEmitter {
}
module.exports = function createRPC(win) {
module.exports = win => {
return new Server(win);
};

View file

@ -3,7 +3,7 @@ const Color = require('color');
// returns a background color that's in hex
// format including the alpha channel (e.g.: `#00000050`)
// input can be any css value (rgb, hsl, string…)
module.exports = function toElectronBackgroundColor(bgColor) {
module.exports = bgColor => {
const color = Color(bgColor);
if (color.alpha() === 1) {
return color.hexString();

View file

@ -88,7 +88,7 @@ function createExitAction(type) {
}
const sessions = keys(getState().sessions.sessions);
if (!sessions.length) {
if (sessions.length === 0) {
window.close();
}
}

View file

@ -1,3 +1,4 @@
/* eslint-disable quote-props */
import React from 'react';
import Component from '../component';

View file

@ -29,7 +29,7 @@ class TermGroup_ extends Component {
renderSplit(groups) {
const [first, ...rest] = groups;
if (!rest.length) {
if (rest.length === 0) {
return first;
}

View file

@ -299,11 +299,11 @@ export default class Term extends Component {
height: '100%'
}}
/> :
<div
className={css('scrollbarShim')}
onMouseEnter={this.handleScrollEnter}
onMouseLeave={this.handleScrollLeave}
/>
<div
className={css('scrollbarShim')}
onMouseEnter={this.handleScrollEnter}
onMouseLeave={this.handleScrollLeave}
/>
}
{ this.props.customChildren }
</div>);

View file

@ -1,8 +1,8 @@
import {webFrame} from 'electron';
import forceUpdate from 'react-deep-force-update';
import {Provider} from 'react-redux';
import React from 'react';
import {render} from 'react-dom';
import {webFrame} from 'electron';
import rpc from './rpc';
import {init} from './actions/index';

View file

@ -16,8 +16,8 @@ export function isExecutable(fileStat) {
}
return Boolean(
(fileStat.mode & parseInt('0001', 8)) ||
(fileStat.mode & parseInt('0010', 8)) ||
(fileStat.mode & parseInt('0100', 8))
(fileStat.mode & 0o0001) ||
(fileStat.mode & 0o0010) ||
(fileStat.mode & 0o0100)
);
}

View file

@ -5,50 +5,50 @@
*/
const _toAscii = {
'188': '44',
'109': '45',
'190': '46',
'191': '47',
'192': '96',
'220': '92',
'222': '39',
'221': '93',
'219': '91',
'173': '45',
'187': '61', // IE Key codes
'186': '59', // IE Key codes
'189': '45' // IE Key codes
188: '44',
109: '45',
190: '46',
191: '47',
192: '96',
220: '92',
222: '39',
221: '93',
219: '91',
173: '45',
187: '61', // IE Key codes
186: '59', // IE Key codes
189: '45' // IE Key codes
};
const _shiftUps = {
'96': '~',
'49': '!',
'50': '@',
'51': '#',
'52': '$',
'53': '%',
'54': '^',
'55': '&',
'56': '*',
'57': '(',
'48': ')',
'45': '_',
'61': '+',
'91': '{',
'93': '}',
'92': '|',
'59': ':',
'39': '\'',
'44': '<',
'46': '>',
'47': '?'
96: '~',
49: '!',
50: '@',
51: '#',
52: '$',
53: '%',
54: '^',
55: '&',
56: '*',
57: '(',
48: ')',
45: '_',
61: '+',
91: '{',
93: '}',
92: '|',
59: ':',
39: '\'',
44: '<',
46: '>',
47: '?'
};
const _arrowKeys = {
'38': '',
'40': '',
'39': '',
'37': ''
38: '',
40: '',
39: '',
37: ''
};
/**

View file

@ -63,13 +63,11 @@
"rules": {
"eqeqeq": ["error", "allow-null"],
"no-eq-null": 0,
"react/prop-types": 0,
"babel/new-cap": 0,
"quote-props": 0,
"import/no-extraneous-dependencies": 0,
"new-cap": 0,
"no-warning-comments": 0,
"complexity": 0,
"no-nested-ternary": 0,
"import/prefer-default-export": 0,
"react/prop-types": 0,
"react/jsx-no-bind": 0
},
"ignore": [

View file

@ -29,7 +29,7 @@ module.exports = {
plugins: [
new webpack.DefinePlugin({
'process.env': { // eslint-disable-line quote-props
'NODE_ENV': JSON.stringify(nodeEnv)
NODE_ENV: JSON.stringify(nodeEnv)
}
}),
new Copy([