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 // Packages
const {parse: parseUrl} = require('url'); const {parse: parseUrl} = require('url');
const {gitDescribe} = require('git-describe');
const {app, BrowserWindow, shell, Menu} = require('electron'); const {app, BrowserWindow, shell, Menu} = require('electron');
const {gitDescribe} = require('git-describe');
const uuid = require('uuid'); const uuid = require('uuid');
const fileUriToPath = require('file-uri-to-path'); const fileUriToPath = require('file-uri-to-path');
const isDev = require('electron-is-dev'); const isDev = require('electron-is-dev');
@ -410,7 +410,8 @@ function installDevExtensions(isDev) {
if (!isDev) { if (!isDev) {
return Promise.resolve(); 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 = [ const extensions = [
'REACT_DEVELOPER_TOOLS', 'REACT_DEVELOPER_TOOLS',

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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