Skip to content

Commit

Permalink
Update eslint config, prettify project (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsnell authored Aug 31, 2017
1 parent c0d4fb8 commit 77b4c41
Show file tree
Hide file tree
Showing 126 changed files with 9,011 additions and 8,265 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = tab
indent_size = 4
indent_style = space
indent_size = 2

[package.json]
indent_style = space
Expand Down
124 changes: 42 additions & 82 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,84 +1,44 @@
{
"parser": "babel-eslint",
"env": {
"browser": true,
"es6": true,
"mocha": true,
"node": true
},
"ecmaFeatures": {
"jsx": true,
"modules": true
},
"plugins": [
"eslint-plugin-react"
],
"rules": {
"brace-style": [ 1, "1tbs" ],
// REST API objects include underscores
"camelcase": 0,
"comma-dangle": 0,
"comma-spacing": 1,
// Allows returning early as undefined
"consistent-return": 0,
"dot-notation": 1,
"eqeqeq": [ 2, "allow-null" ],
"eol-last": 1,
"indent": [ 1, "tab", { "SwitchCase": 1 } ],
"key-spacing": 1,
// Most common is "Emitter", should be improved
"new-cap": 1,
"no-cond-assign": 2,
"no-else-return": 1,
"no-empty": 1,
// Flux stores use switch case fallthrough
"no-fallthrough": 0,
"no-lonely-if": 1,
"no-mixed-requires": 0,
"no-mixed-spaces-and-tabs": 1,
"no-multiple-empty-lines": [ 1, { max: 1 } ],
"no-multi-spaces": 1,
"no-nested-ternary": 1,
"no-new": 1,
"no-process-exit": 1,
"no-shadow": 1,
"no-spaced-func": 1,
"no-trailing-spaces": 1,
"no-underscore-dangle": 0,
// Allows Chai `expect` expressions
"no-unused-expressions": 0,
"no-unused-vars": 1,
// Teach eslint about React+JSX
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1,
// Allows function use before declaration
"no-use-before-define": [ 2, "nofunc" ],
// We split external, internal, module variables
"one-var": 0,
/*
"operator-linebreak": [ 1, "after", { "overrides": {
"?": "before",
":": "before"
} } ],
*/
"padded-blocks": [ 1, "never" ],
"quote-props": [ 1, "as-needed" ],
"quotes": [ 1, "single", "avoid-escape" ],
"semi-spacing": 1,
"keyword-spacing": [ 1, { "before": true, "after": true } ],
"space-before-blocks": [ 1, "always" ],
"space-before-function-paren": [ 1, "never" ],
// Our array literal index exception violates this rule
"space-in-brackets": 0,
"space-in-parens": [ 1, "always" ],
"space-infix-ops": [ 1, { "int32Hint": false } ],
// Ideal for "!" but not for "++"
"space-unary-ops": 0,
// Assumed by default with Babel
"strict": [ 2, "never" ],
"valid-jsdoc": [ 1, { "requireReturn": false } ],
// Common top-of-file requires, expressions between external, interal
"vars-on-top": 1,
"yoda": 0
}
"parser": "babel-eslint",
"env": {
"browser": true,
"es6": true,
"jest/globals": true,
"mocha": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 6,
"sourceType": "module"
},
"extends": [
"eslint:recommended",
"plugin:jest/recommended",
"plugin:react/recommended",
"prettier",
"prettier/react"
],
"plugins": ["eslint-plugin-react", "jest", "prettier"],
"rules": {
"eqeqeq": ["error", "always"],
"no-lonely-if": "error",
"no-shadow": "warn",
"no-spaced-func": "error",
"prettier/prettier": [
"error",
{
"bracketSpacing": true,
"singleQuote": true,
"trailingComma": "es5"
}
],
"react/display-name": "warn",
"react/no-deprecated": "warn",
"react/no-string-refs": "warn",
"react/prop-types": "warn",
"vars-on-top": "error"
}
}
100 changes: 50 additions & 50 deletions builder.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
/**
* External Dependencies
*/
var packager = require( 'electron-packager' );
var fs = require( 'fs' );
var path = require( 'path' );
var packager = require('electron-packager');
var fs = require('fs');
var path = require('path');

/**
* Internal dependencies
*/
var config = require( './resources/lib/config' );
var builder = require( './resources/lib/tools' );
var pkg = require( './package.json' );
var config = require('./resources/lib/config');
var builder = require('./resources/lib/tools');
var pkg = require('./package.json');

/**
* Module variables
*/
var electronVersion = pkg.devDependencies['electron'].replace( '^', '' );
var electronVersion = pkg.devDependencies['electron'].replace('^', '');
var key;

var opts = {
dir: './desktop-build',
name: config.name,
author: config.author,
platform: builder.getPlatform( process.argv ),
arch: builder.getArch( process.argv ),
electronVersion,
appVersion: config.version,
appSign: 'Developer ID Application: ' + config.author,
out: './release',
icon: builder.getIconFile( process.argv ),
'app-bundle-id': config.bundleId,
'helper-bundle-id': config.bundleId,
'app-category-type': 'public.app-category.social-networking',
'app-version': config.version,
'build-version': config.version,
overwrite: true,
asar: false,
sign: false,
prune: true,
ignore: [],
'version-string': {
CompanyName: config.author,
LegalCopyright: config.copyright,
ProductName: config.name,
InternalName: config.name,
FileDescription: config.name,
OriginalFilename: config.name,
FileVersion: config.version,
ProductVersion: config.version
}
dir: './desktop-build',
name: config.name,
author: config.author,
platform: builder.getPlatform(process.argv),
arch: builder.getArch(process.argv),
electronVersion,
appVersion: config.version,
appSign: 'Developer ID Application: ' + config.author,
out: './release',
icon: builder.getIconFile(process.argv),
'app-bundle-id': config.bundleId,
'helper-bundle-id': config.bundleId,
'app-category-type': 'public.app-category.social-networking',
'app-version': config.version,
'build-version': config.version,
overwrite: true,
asar: false,
sign: false,
prune: true,
ignore: [],
'version-string': {
CompanyName: config.author,
LegalCopyright: config.copyright,
ProductName: config.name,
InternalName: config.name,
FileDescription: config.name,
OriginalFilename: config.name,
FileVersion: config.version,
ProductVersion: config.version,
},
};

builder.beforeBuild( __dirname, opts, function( error ) {
if ( error ) {
throw error;
}
builder.beforeBuild(__dirname, opts, function(error) {
if (error) {
throw error;
}

packager( opts, function( err ) {
if ( err ) {
console.log( 'Packager Error:' );
console.log( err );
} else {
builder.cleanUp( path.join( __dirname, 'release' ), opts );
}
} );
} )
packager(opts, function(err) {
if (err) {
console.log('Packager Error:');
console.log(err);
} else {
builder.cleanUp(path.join(__dirname, 'release'), opts);
}
});
});
4 changes: 2 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"app_id": "history-analyst-dad",
"app_key": "be606bcfa3db4377bf488900281aa1cc"
"app_id": "history-analyst-dad",
"app_key": "be606bcfa3db4377bf488900281aa1cc"
}
18 changes: 9 additions & 9 deletions desktop/app-quit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
let quitter = false;

function AppQuit() {
this.canQuit = false;
this.canQuit = false;
}

AppQuit.prototype.shouldQuitToBackground = function() {
if ( this.canQuit === false ) {
return true;
}
if (this.canQuit === false) {
return true;
}

this.canQuit = false;
return false;
this.canQuit = false;
return false;
};

AppQuit.prototype.allowQuit = function() {
this.canQuit = true;
this.canQuit = true;
};

if ( ! quitter ) {
quitter = new AppQuit();
if (!quitter) {
quitter = new AppQuit();
}

module.exports = quitter;
Loading

0 comments on commit 77b4c41

Please sign in to comment.