Skip to content

Commit 914e376

Browse files
authored
Fix issues in pre commit hooks (#159)
* Remove data from jenkinsfile * Fix pre-commit hooks for linting and playwright tests
1 parent 46e73a6 commit 914e376

16 files changed

+1177
-61
lines changed

.husky/_/pre-push

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/sh
2+
3+
if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
4+
set -x
5+
fi
6+
7+
if [ "$LEFTHOOK" = "0" ]; then
8+
exit 0
9+
fi
10+
11+
call_lefthook()
12+
{
13+
if test -n "$LEFTHOOK_BIN"
14+
then
15+
"$LEFTHOOK_BIN" "$@"
16+
elif lefthook -h >/dev/null 2>&1
17+
then
18+
lefthook "$@"
19+
else
20+
dir="$(git rev-parse --show-toplevel)"
21+
osArch=$(uname | tr '[:upper:]' '[:lower:]')
22+
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
23+
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
24+
then
25+
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
26+
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
27+
then
28+
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
29+
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
30+
then
31+
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
32+
elif test -f "$dir/node_modules/lefthook/bin/index.js"
33+
then
34+
"$dir/node_modules/lefthook/bin/index.js" "$@"
35+
36+
elif bundle exec lefthook -h >/dev/null 2>&1
37+
then
38+
bundle exec lefthook "$@"
39+
elif yarn lefthook -h >/dev/null 2>&1
40+
then
41+
yarn lefthook "$@"
42+
elif pnpm lefthook -h >/dev/null 2>&1
43+
then
44+
pnpm lefthook "$@"
45+
elif swift package plugin lefthook >/dev/null 2>&1
46+
then
47+
swift package --disable-sandbox plugin lefthook "$@"
48+
elif command -v mint >/dev/null 2>&1
49+
then
50+
mint run csjones/lefthook-plugin "$@"
51+
elif command -v npx >/dev/null 2>&1
52+
then
53+
npx lefthook "$@"
54+
else
55+
echo "Can't find lefthook in PATH"
56+
fi
57+
fi
58+
}
59+
60+
call_lefthook run "pre-push" "$@"

.stylelintrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "extends": ["stylelint-config-standard"] }

curriculum-front/e2e/vue.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { test, expect } from '@playwright/test';
1+
import { test, expect } from '@playwright/test'
22

33
// See here how to get started:
44
// https://playwright.dev/docs/intro
55
test('visits the app root url', async ({ page }) => {
6-
await page.goto('/');
7-
await expect(page.locator('div.greetings > h1')).toHaveText('You did it!');
6+
await page.goto('/')
7+
await expect(page.locator('h1')).toHaveText('Curricula App');
88
})

curriculum-front/playwright.config.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ export default defineConfig({
5151
...devices['Desktop Chrome']
5252
}
5353
},
54-
{
55-
name: 'firefox',
56-
use: {
57-
...devices['Desktop Firefox']
58-
}
59-
},
60-
{
61-
name: 'webkit',
62-
use: {
63-
...devices['Desktop Safari']
64-
}
65-
}
54+
// {
55+
// name: 'firefox',
56+
// use: {
57+
// ...devices['Desktop Firefox']
58+
// }
59+
// },
60+
// {
61+
// name: 'webkit',
62+
// use: {
63+
// ...devices['Desktop Safari']
64+
// }
65+
// }
6666

6767
/* Test against mobile viewports. */
6868
// {

curriculum-front/src/assets/base.css

+10-21
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,30 @@
44
}
55

66
:root {
7-
--vt-c-white: #ffffff;
7+
--vt-c-white: #fff;
88
--vt-c-white-soft: #f8f8f8;
99
--vt-c-white-mute: #f2f2f2;
10-
1110
--vt-c-black: #181818;
12-
--vt-c-black-soft: #222222;
11+
--vt-c-black-soft: #222;
1312
--vt-c-black-mute: #282828;
14-
1513
--vt-c-indigo: #2c3e50;
16-
17-
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
18-
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
19-
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
20-
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
21-
14+
--vt-c-divider-light-1: rgb(60 60 60 / 29%);
15+
--vt-c-divider-light-2: rgb(60 60 60 / 12%);
16+
--vt-c-divider-dark-1: rgb(84 84 84 / 65%);
17+
--vt-c-divider-dark-2: rgb(84 84 84 / 48%);
2218
--vt-c-text-light-1: var(--vt-c-indigo);
23-
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
19+
--vt-c-text-light-2: rgb(60 60 60 / 66%);
2420
--vt-c-text-dark-1: var(--vt-c-white);
25-
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
26-
}
21+
--vt-c-text-dark-2: rgb(235 235 235 / 64%);
2722

28-
/* semantic color variables for this project */
29-
:root {
23+
/* semantic color variables for this project */
3024
--color-background: var(--vt-c-white);
3125
--color-background-soft: var(--vt-c-white-soft);
3226
--color-background-mute: var(--vt-c-white-mute);
33-
3427
--color-border: var(--vt-c-divider-light-2);
3528
--color-border-hover: var(--vt-c-divider-light-1);
36-
3729
--color-heading: var(--vt-c-text-light-1);
3830
--color-text: var(--vt-c-text-light-1);
39-
4031
--section-gap: 160px;
4132
}
4233

@@ -45,10 +36,8 @@
4536
--color-background: var(--vt-c-black);
4637
--color-background-soft: var(--vt-c-black-soft);
4738
--color-background-mute: var(--vt-c-black-mute);
48-
4939
--color-border: var(--vt-c-divider-dark-2);
5040
--color-border-hover: var(--vt-c-divider-dark-1);
51-
5241
--color-heading: var(--vt-c-text-dark-1);
5342
--color-text: var(--vt-c-text-dark-2);
5443
}
@@ -84,7 +73,7 @@ body {
8473
'Helvetica Neue',
8574
sans-serif;
8675
font-size: 15px;
87-
text-rendering: optimizeLegibility;
76+
text-rendering: optimizelegibility;
8877
-webkit-font-smoothing: antialiased;
8978
-moz-osx-font-smoothing: grayscale;
9079
}

curriculum-front/src/assets/main.css

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import './base.css';
1+
@import url('./base.css');
22

33
#app {
44
max-width: 1280px;
@@ -10,18 +10,18 @@
1010
a,
1111
.green {
1212
text-decoration: none;
13-
color: hsla(160, 100%, 37%, 1);
13+
color: hsl(160deg 100% 37% / 100%);
1414
transition: 0.4s;
1515
padding: 3px;
1616
}
1717

1818
@media (hover: hover) {
1919
a:hover {
20-
background-color: hsla(160, 100%, 37%, 0.2);
20+
background-color: hsl(160deg 100% 37% / 20%);
2121
}
2222
}
2323

24-
@media (min-width: 1024px) {
24+
@media (width >= 1024px) {
2525
body {
2626
display: flex;
2727
place-items: center;

curriculum-front/src/components/create-form/FormSections.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<script setup>
1414
import { toRefs } from 'vue'
1515
16-
import { useCurriculumStore } from '@/stores/curricula/curriculums'
16+
import { useCurriculumStore } from '@/stores/curricula'
1717
import FormSection from './FormSection.vue'
1818
1919
const curriculumStore = useCurriculumStore()

curriculum-front/src/components/create-form/MainForm.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<script setup>
4545
import { computed, toRefs } from 'vue'
4646
import FormSections from './FormSections.vue'
47-
import { useCurriculumStore } from '@/stores/curricula/curriculums'
47+
import { useCurriculumStore } from '@/stores/curricula'
4848
4949
const curriculumStore = useCurriculumStore()
5050

curriculum-front/src/components/display-curriculum/Sections.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
<script setup>
127127
import { ref, computed } from 'vue'
128128
129-
import { useCurriculumStore } from '@/stores/curricula/curriculums'
129+
import { useCurriculumStore } from '@/stores/curricula'
130130
import AddItemDialog from './AddItemDialog.vue'
131131
132132
const curriculumStore = useCurriculumStore()

curriculum-front/src/stores/curricula/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { defineStore } from 'pinia'
22
import { ref } from 'vue'
33

44
import axios from '@/utils/axiosConfig'
5-
import router from '../router'
5+
import router from '@/router'
66

77
export const useCurriculumStore = defineStore('curriculum', () => {
88
const state = ref({

curriculum-front/src/views/CreateCurriculum.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { toRefs } from 'vue'
1212
import MainForm from '@/components/create-form/MainForm.vue'
1313
1414
import { useAuthStore } from '@/stores/auth'
15-
import { useCurriculumStore } from '@/stores/curricula/curriculums'
15+
import { useCurriculumStore } from '@/stores/curricula'
1616
1717
const authStore = useAuthStore()
1818
const { user } = toRefs(authStore)

curriculum-front/src/views/DisplayCurricula.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
import { toRefs, ref, onMounted } from 'vue'
6161
6262
import { useAuthStore } from '@/stores/auth'
63-
import { useCurriculumStore } from '@/stores/curriculum'
63+
import { useCurriculumStore } from '@/stores/curricula'
6464
6565
const authStore = useAuthStore()
6666
const curriculumStore = useCurriculumStore()

curriculum-front/src/views/DisplayCurriculum.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { onMounted, ref, toRefs } from 'vue'
3131
import { useRoute } from 'vue-router'
3232
3333
import { useAuthStore } from '@/stores/auth'
34-
import { useCurriculumStore } from '@/stores/curricula/curriculums'
34+
import { useCurriculumStore } from '@/stores/curricula'
3535
import { useGeneralStore } from '@/stores/general'
3636
3737
import Header from '@/components/display-curriculum/Header.vue'

lefthook.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
# Refer for explanation to following link:
44
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
55
#
6-
# pre-push:
7-
# commands:
6+
pre-push:
7+
commands:
8+
# playwright-tests:
9+
# run: npm --prefix ./curriculum-front run test:e2e
810
# packages-audit:
911
# tags: frontend security
1012
# run: yarn audit
@@ -21,12 +23,15 @@ pre-commit:
2123
frontend-style:
2224
glob: "*.{css,scss,sass}"
2325
run: npm --prefix ./curriculum-front run stylelint {staged_files}
24-
# playwright-tests:
25-
# run: npm --prefix ./curriculum-front run test:e2e
2626

2727
all-files:
2828
parallel: true
2929
commands:
3030
eslint:
3131
glob: "*.{js,ts,jsx,tsx}"
3232
run: npm run lint:fix {all_files}
33+
frontend-style:
34+
glob: "*.{css,scss,sass}"
35+
run: npm --prefix ./curriculum-front run stylelint {all_files}
36+
playwright-tests:
37+
run: npm --prefix ./curriculum-front run test:e2e

0 commit comments

Comments
 (0)