chore: prettier in the root

This commit is contained in:
Beanow
2023-07-01 14:33:43 +02:00
parent 0e83a60121
commit 51b8ecf72f
8 changed files with 86 additions and 57 deletions

6
.prettierignore Normal file
View File

@@ -0,0 +1,6 @@
.nuxt
Cargo.lock
dist
node_modules
pnpm-lock.yaml
target

View File

@@ -1,32 +1,32 @@
// calculates the luma from a hex color `#abcdef`
function luma(hex) {
if (hex.startsWith('#')) {
hex = hex.substring(1)
if (hex.startsWith("#")) {
hex = hex.substring(1);
}
const rgb = parseInt(hex, 16)
const r = (rgb >> 16) & 0xff
const g = (rgb >> 8) & 0xff
const b = (rgb >> 0) & 0xff
return 0.2126 * r + 0.7152 * g + 0.0722 * b
const rgb = parseInt(hex, 16);
const r = (rgb >> 16) & 0xff;
const g = (rgb >> 8) & 0xff;
const b = (rgb >> 0) & 0xff;
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
}
describe('Hello Tauri', () => {
it('should be cordial', async () => {
const header = await $('body > h1')
const text = await header.getText()
expect(text).toMatch(/^[hH]ello/)
})
describe("Hello Tauri", () => {
it("should be cordial", async () => {
const header = await $("body > h1");
const text = await header.getText();
expect(text).toMatch(/^[hH]ello/);
});
it('should be excited', async () => {
const header = await $('body > h1')
const text = await header.getText()
expect(text).toMatch(/!$/)
})
it("should be excited", async () => {
const header = await $("body > h1");
const text = await header.getText();
expect(text).toMatch(/!$/);
});
it('should be easy on the eyes', async () => {
const body = await $('body')
const backgroundColor = await body.getCSSProperty('background-color')
expect(luma(backgroundColor.parsed.hex)).toBeLessThan(100)
})
})
it("should be easy on the eyes", async () => {
const body = await $("body");
const backgroundColor = await body.getCSSProperty("background-color");
expect(luma(backgroundColor.parsed.hex)).toBeLessThan(100);
});
});

View File

@@ -1,39 +1,39 @@
const os = require('os')
const path = require('path')
const { spawn, spawnSync } = require('child_process')
const os = require("os");
const path = require("path");
const { spawn, spawnSync } = require("child_process");
// keep track of the `tauri-driver` child process
let tauriDriver
let tauriDriver;
exports.config = {
specs: ['./tests/specs/**/*.js'],
specs: ["./tests/specs/**/*.js"],
maxInstances: 1,
capabilities: [
{
maxInstances: 1,
'tauri:options': {
application: '../../target/debug/app',
"tauri:options": {
application: "../../target/debug/app",
},
},
],
reporters: ['spec'],
framework: 'mocha',
reporters: ["spec"],
framework: "mocha",
mochaOpts: {
ui: 'bdd',
ui: "bdd",
timeout: 60000,
},
// ensure the rust project is built since we expect this binary to exist for the webdriver sessions
onPrepare: () => spawnSync('cargo', ['build']),
onPrepare: () => spawnSync("cargo", ["build"]),
// ensure we are running `tauri-driver` before the session starts so that we can proxy the webdriver requests
beforeSession: () =>
(tauriDriver = spawn(
path.resolve(os.homedir(), '.cargo', 'bin', 'tauri-driver'),
path.resolve(os.homedir(), ".cargo", "bin", "tauri-driver"),
[],
{ stdio: [null, process.stdout, process.stderr] }
)),
// clean up the `tauri-driver` process we spawned at the start of the session
afterSession: () => tauriDriver.kill(),
}
};

View File

@@ -1,4 +1,4 @@
@import './vuetify/main.scss';
@import "./vuetify/main.scss";
html,
body {

View File

@@ -1,3 +1,3 @@
@use 'vuetify/settings' with (
@use "vuetify/settings" with (
$utilities: yes
);

View File

@@ -1,4 +1,4 @@
@use 'vuetify' with (
@use "vuetify" with (
$utilities: yes,
$color-pack: false
);

11
package.json Normal file
View File

@@ -0,0 +1,11 @@
{
"name": "board-voter-root",
"private": true,
"scripts": {
"format": "prettier --write .",
"format-check": "prettier --check ."
},
"devDependencies": {
"prettier": "^2.8.8"
}
}

12
pnpm-lock.yaml generated
View File

@@ -6,6 +6,12 @@ settings:
importers:
.:
devDependencies:
prettier:
specifier: ^2.8.8
version: 2.8.8
crates/backend:
dependencies:
'@tauri-apps/cli':
@@ -6332,6 +6338,12 @@ packages:
picocolors: 1.0.0
source-map-js: 1.0.2
/prettier@2.8.8:
resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==}
engines: {node: '>=10.13.0'}
hasBin: true
dev: true
/pretty-bytes@6.1.0:
resolution: {integrity: sha512-Rk753HI8f4uivXi4ZCIYdhmG1V+WKzvRMg/X+M42a6t7D07RcmopXJMDNk6N++7Bl75URRGsb40ruvg7Hcp2wQ==}
engines: {node: ^14.13.1 || >=16.0.0}