From 40f61753242c3c48eb03e4f590eae62ce5ce074a Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Wed, 13 Mar 2019 16:34:50 +0100 Subject: [PATCH] [DDW-597] fix issue with pretty-quick --- .prettierignore | 23 +++++++++++++++++++++++ package.json | 6 +++--- source/main/windows/main.js | 26 +++++++++++--------------- 3 files changed, 37 insertions(+), 18 deletions(-) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..483df9defb --- /dev/null +++ b/.prettierignore @@ -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 diff --git a/package.json b/package.json index 181f260a8e..7a67964fbb 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" } } diff --git a/source/main/windows/main.js b/source/main/windows/main.js index c7672a1770..cbee878729 100644 --- a/source/main/windows/main.js +++ b/source/main/windows/main.js @@ -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; @@ -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, @@ -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) { @@ -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) => { @@ -95,7 +91,7 @@ export const createMainWindow = ( label: 'Inspect element', click() { window.inspectElement(x, y); - } + }, }); } @@ -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); });