Skip to content

Commit

Permalink
refactor: prettier (azerothcore#1230)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoBorzi authored May 17, 2021
1 parent dfca3e0 commit 2368ab1
Show file tree
Hide file tree
Showing 651 changed files with 12,796 additions and 11,908 deletions.
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx pretty-quick --staged
15 changes: 15 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.tmp
.idea
.vscode
.npmrc
.nvmrc
node_modules/
build/
build-tools/
reports/
coverage/
dist/
**/*.md
**/*.yml
package.json
package-lock.json
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 140,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"arrowParens": "always"
}
4 changes: 2 additions & 2 deletions e2e/common-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ export default function setup() {
// The following line tells spectron to look and use the main.js file
// and the package.json located 1 level above.
args: [path.join(__dirname, '..')],
webdriverOptions: {}
webdriverOptions: {},
});
await this.app.start();
const browser = this.app.client;
await browser.waitUntilWindowLoaded();

browser.setTimeout({ 'script': 150000 });
browser.setTimeout({ script: 150000 });
});

afterEach(function () {
Expand Down
3 changes: 1 addition & 2 deletions e2e/main.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ describe('Keira3 App', function () {
});

it('sqlite should correctly work', async function () {
const sleep = time => new Promise(r => setTimeout(r, time));
const sleep = (time) => new Promise((r) => setTimeout(r, time));
const selector = '#sqlite-e2e-test';
const expectedText = 'Tricks and Treats of Azeroth';
const element = await browser.$(selector);
const text = await element.getAttribute('e2e');
await sleep(500);
expect(text).to.equal(expectedText);
});

});
6 changes: 3 additions & 3 deletions extra-webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
externals: {
'sqlite3':'commonjs sqlite3'
}
externals: {
sqlite3: 'commonjs sqlite3',
},
};
60 changes: 28 additions & 32 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ require('@electron/remote/main').initialize();

let win, serve;
const args = process.argv.slice(1);
serve = args.some(val => val === '--serve');
serve = args.some((val) => val === '--serve');

function createWindow() {

const size = screen.getPrimaryDisplay().workAreaSize;

// Create the browser window.
Expand All @@ -23,23 +22,25 @@ function createWindow() {
minHeight: 600,
webPreferences: {
nodeIntegration: true,
contextIsolation: false, // TODO: change this once Spectron supports it
contextIsolation: false, // TODO: change this once Spectron supports it
enableRemoteModule: true, // TODO: change this once Spectron supports it
},
icon: nativeImage.createFromPath('src/assets/img/ac.png'),
});

if (serve) {
require('electron-reload')(__dirname, {
electron: require(`${__dirname}/node_modules/electron`)
electron: require(`${__dirname}/node_modules/electron`),
});
win.loadURL('http://localhost:4200');
} else {
win.loadURL(url.format({
pathname: path.join(__dirname, 'dist/index.html'),
protocol: 'file:',
slashes: true
}));
win.loadURL(
url.format({
pathname: path.join(__dirname, 'dist/index.html'),
protocol: 'file:',
slashes: true,
}),
);
}

if (serve) {
Expand All @@ -48,13 +49,12 @@ function createWindow() {

win.on('close', function (e) {
if (!process.env.RUNNING_IN_SPECTRON) {
const choice = require('electron').dialog.showMessageBoxSync(this,
{
type: 'question',
buttons: ['Yes', 'No'],
title: 'Confirm',
message: 'Are you sure you want to quit?'
});
const choice = require('electron').dialog.showMessageBoxSync(this, {
type: 'question',
buttons: ['Yes', 'No'],
title: 'Confirm',
message: 'Are you sure you want to quit?',
});
if (choice === 1) {
e.preventDefault();
}
Expand All @@ -77,7 +77,6 @@ function createWindow() {
}

try {

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
Expand All @@ -88,9 +87,7 @@ try {
const navMenu: Electron.MenuItemConstructorOptions[] = [
{
label: app.name,
submenu: [
{ role: 'quit' },
]
submenu: [{ role: 'quit' }],
},
{
label: 'Edit',
Expand All @@ -103,8 +100,8 @@ try {
{ role: 'paste' },
{ role: 'delete' },
{ type: 'separator' },
{ role: 'selectAll' }
]
{ role: 'selectAll' },
],
},
{
label: 'Window',
Expand All @@ -120,8 +117,8 @@ try {
{ type: 'separator' },
{ role: 'togglefullscreen' },
{ role: 'minimize' },
{ role: 'close' }
]
{ role: 'close' },
],
},
{
label: 'Help',
Expand All @@ -140,9 +137,9 @@ try {
label: 'Report a Bug',
click: () => {
shell.openExternal('https://github.com/AzerothCore/Keira3/issues/new');
}
},
},
]
],
},
{
label: 'AzerothCore',
Expand All @@ -151,15 +148,15 @@ try {
label: 'AzerothCore Repository',
click: () => {
shell.openExternal('https://github.com/azerothcore/azerothcore-wotlk');
}
},
},
{
label: 'Report a Bug',
click: () => {
shell.openExternal('https://github.com/azerothcore/azerothcore-wotlk/issues/new/choose');
}
},
},
]
],
},
{
label: 'Wiki',
Expand All @@ -173,8 +170,8 @@ try {
click: () => {
shell.openExternal('https://discord.com/channels/217589275766685707/536630256048799744');
},
}
]
},
],
},
];

Expand Down Expand Up @@ -214,7 +211,6 @@ try {
createWindow();
}
});

} catch (e) {
// Catch Error
// throw e;
Expand Down
Loading

0 comments on commit 2368ab1

Please sign in to comment.