Skip to content

Commit

Permalink
pre commit hooks setup
Browse files Browse the repository at this point in the history
  • Loading branch information
rouk1 committed Jul 12, 2024
1 parent a53844b commit 1f32e38
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 66 deletions.
49 changes: 32 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-yaml
- id: check-toml
- id: check-added-large-files
- id: check-merge-conflict
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
- id: check-toml
- id: check-added-large-files
- id: check-merge-conflict
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/crate-ci/typos
- repo: https://github.com/crate-ci/typos
rev: v1.21.0
hooks:
- id: typos
- id: typos

- repo: https://github.com/astral-sh/ruff-pre-commit
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.7
hooks:
# Run the linter.
- id: ruff
# Comment to disable autofix:
args: [ --fix ]
# Run the formatter.
- id: ruff-format
# Run the linter.
- id: ruff
# Comment to disable autofix:
args: [--fix]
# Run the formatter.
- id: ruff-format

- repo: local
hooks:
- id: tsc
language: node
name: Use vue-tsc to typecheck frontend code.
entry: bash -c "cd dashboard && npm run type-check"
- id: eslint
language: node
name: Use eslint to lint frontend code.
entry: bash -c "cd dashboard && npm run lint"
- id: prettier
language: node
name: Use prettier to format frontend code.
entry: bash -c "cd dashboard && npm run format"

exclude: '.*\.min\.js'
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ install:
python -m pip install -e . -r requirements.txt -r requirements-test.txt
pre-commit install

run-dashboard-api:
serve-dashboard-api:
python -m uvicorn mandr.dashboard.webapp:app --reload --reload-dir src --host 0.0.0.0 --timeout-graceful-shutdown 0
5 changes: 2 additions & 3 deletions dashboard/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"semi": true,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
"trailingComma": "es5"
}
5 changes: 2 additions & 3 deletions dashboard/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<script setup lang="ts">
import { RouterView } from 'vue-router'
import { RouterView } from "vue-router";
</script>

<template>
<header>
<nav>
</nav>
<nav></nav>
</header>

<RouterView />
Expand Down
6 changes: 3 additions & 3 deletions dashboard/src/assets/styles/main.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import './_reset.css';
@import './_variables.css';
@import './_typography.css';
@import "./_reset.css";
@import "./_variables.css";
@import "./_typography.css";
7 changes: 2 additions & 5 deletions dashboard/src/components/FileTree.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<script setup lang="ts">
</script>
<script setup lang="ts"></script>

<template>
<div class="file-tree">
file tree
</div>
<div class="file-tree">file tree</div>
</template>

<style scoped></style>
16 changes: 8 additions & 8 deletions dashboard/src/components/__tests__/FileTree.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { describe, it, expect } from 'vitest'
import { describe, it, expect } from "vitest";

import { mount } from '@vue/test-utils'
import { mount } from "@vue/test-utils";
import FileTree from "../FileTree.vue";

describe('HelloWorld', () => {
it('renders properly', () => {
const wrapper = mount(FileTree)
expect(wrapper.text()).toContain('Hey')
})
})
describe("HelloWorld", () => {
it("renders properly", () => {
const wrapper = mount(FileTree);
expect(wrapper.text()).toContain("Hey");
});
});
18 changes: 9 additions & 9 deletions dashboard/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import './assets/styles/main.css'
import "./assets/styles/main.css";

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { createApp } from "vue";
import { createPinia } from "pinia";

import App from './App.vue'
import router from './router'
import App from "./App.vue";
import router from "./router";

const app = createApp(App)
const app = createApp(App);

app.use(createPinia())
app.use(router)
app.use(createPinia());
app.use(router);

app.mount('#app')
app.mount("#app");
18 changes: 9 additions & 9 deletions dashboard/src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import DashboardView from '../views/DashboardView.vue'
import { createRouter, createWebHashHistory } from "vue-router";
import DashboardView from "../views/DashboardView.vue";

const router = createRouter({
history: createWebHashHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'home',
component: DashboardView
}
]
})
path: "/",
name: "home",
component: DashboardView,
},
],
});

export default router
export default router;
16 changes: 8 additions & 8 deletions dashboard/src/stores/counter.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import { ref, computed } from "vue";
import { defineStore } from "pinia";

export const useCounterStore = defineStore('counter', () => {
const count = ref(0)
const doubleCount = computed(() => count.value * 2)
export const useCounterStore = defineStore("counter", () => {
const count = ref(0);
const doubleCount = computed(() => count.value * 2);
function increment() {
count.value++
count.value++;
}

return { count, doubleCount, increment }
})
return { count, doubleCount, increment };
});

0 comments on commit 1f32e38

Please sign in to comment.