Skip to content

Commit

Permalink
[DDW-597] fix issue with pretty-quick
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikGuzei committed Mar 13, 2019
1 parent d81f09a commit 40f6175
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 18 deletions.
23 changes: 23 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Let's start by ignoring everything
/*

# But not the following folders
!source/
!features/
!storybook/

# Now we ignore all files
*.*

# But not these file types
!*.js
!*.scss
!*.json

# Ignore any top-level json file except package.json
/*.json
!package.json

# Ignore the following special folders and files
source/renderer/app/i18n/locales/
features/support/default-wallet.json
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"cucumber:watch:debug": "KEEP_APP_AFTER_TESTS=true npm run cucumber -- --tags @watch",
"lint": "eslint --format=node_modules/eslint-formatter-pretty source features storybook *.js",
"flow:test": "flow; test $? -eq 0 -o $? -eq 2",
"prettier": "./node_modules/.bin/prettier --ignore-path .eslintignore \"./**/*.{js,scss,json}\"",
"prettier:check": "yarn prettier -c",
"prettier": "./node_modules/.bin/prettier \"**/*.*\"",
"prettier:check": "yarn prettier --check",
"prettier:format": "yarn prettier --write --loglevel warn",
"manage:translations": "gulp purge:translations && gulp clear:cache && gulp build && node ./translations/translation-runner.js",
"storybook": "start-storybook -p 6006 -c storybook",
Expand Down Expand Up @@ -184,7 +184,7 @@
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged --pattern \"./**/*.{js,scss,json}\"",
"pre-commit": "pretty-quick --staged",
"pre-push": "yarn prettier:check && yarn lint && yarn flow:test && yarn manage:translations"
}
}
Expand Down
26 changes: 11 additions & 15 deletions source/main/windows/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ const { isDev, isTest, buildLabel, isLinux } = environment;

const id = 'window';

const getWindowTitle = (
isInSafeMode: boolean,
locale: string,
): string => {
const getWindowTitle = (isInSafeMode: boolean, locale: string): string => {
const translations = require(`../locales/${locale}`);
const translation = getTranslation(translations, id);
let title = buildLabel;
Expand All @@ -37,10 +34,7 @@ type WindowOptionsType = {
icon?: string,
};

export const createMainWindow = (
isInSafeMode: boolean,
locale: string,
) => {
export const createMainWindow = (isInSafeMode: boolean, locale: string) => {
const windowOptions: WindowOptionsType = {
show: false,
width: 1150,
Expand All @@ -49,8 +43,8 @@ export const createMainWindow = (
nodeIntegration: isTest,
webviewTag: false,
enableRemoteModule: isTest,
preload: path.join(__dirname, './preload.js')
}
preload: path.join(__dirname, './preload.js'),
},
};

if (isLinux) {
Expand All @@ -74,13 +68,15 @@ export const createMainWindow = (
});

// Provide render process with an api to close the main window
ipcMain.on('close-window', (event) => {
ipcMain.on('close-window', event => {
if (event.sender !== window.webContents) return;
window.close();
});

window.loadURL(`file://${__dirname}/../renderer/index.html`);
window.on('page-title-updated', event => { event.preventDefault(); });
window.on('page-title-updated', event => {
event.preventDefault();
});
window.setTitle(getWindowTitle(isInSafeMode, locale));

window.webContents.on('context-menu', (e, props) => {
Expand All @@ -95,7 +91,7 @@ export const createMainWindow = (
label: 'Inspect element',
click() {
window.inspectElement(x, y);
}
},
});
}

Expand Down Expand Up @@ -127,11 +123,11 @@ export const createMainWindow = (
app.quit();
});

window.webContents.on('did-fail-load', (err) => {
window.webContents.on('did-fail-load', err => {
rendererErrorHandler.onError('did-fail-load', err);
});

window.webContents.on('crashed', (err) => {
window.webContents.on('crashed', err => {
rendererErrorHandler.onError('crashed', err);
});

Expand Down

0 comments on commit 40f6175

Please sign in to comment.