Skip to content

Commit 6bb7d6f

Browse files
committed
Fix the remaining incorrect Ref usages.
Update the remaining import statements to use the provided quasar webpack alias. Fix my mistake with the jest configuration. I seem to have mixed the two methods I suggested, instead of only using one. I installed require-json5, but didn't use it. I did intend to use that, rather than adding all of the aliases in jest.config.js, and so that is done here.
1 parent 4bbcb3a commit 6bb7d6f

File tree

12 files changed

+45
-47
lines changed

12 files changed

+45
-47
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ module.exports = {
4646
__statics: 'readonly',
4747
process: 'readonly'
4848
},
49+
4950
rules: baseRules,
5051

5152
overrides: [{

jest.config.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/* eslint-env node */
22

3+
const { pathsToModuleNameMapper } = require('ts-jest/utils');
4+
const requireJSON5 = require('require-json5');
5+
const { compilerOptions } = requireJSON5('./node_modules/@quasar/app/tsconfig-preset.json');
6+
37
module.exports = {
48
preset: 'ts-jest',
59
testEnvironment: 'node',
@@ -9,14 +13,6 @@ module.exports = {
913
'diagnostics': true
1014
}
1115
},
12-
moduleNameMapper: {
13-
'^src/(.*)$': '<rootDir>/src/$1',
14-
'^app/(.*)$': '<rootDir>/$1',
15-
'^components/(.*)$': '<rootDir>/src/components/$1',
16-
'^layouts/(.*)$': '<rootDir>/src/layouts/$1',
17-
'^pages/(.*)$': '<rootDir>/src/pages/$1',
18-
'^assets/(.*)$': '<rootDir>/src/assets/$1',
19-
'^boot/(.*)$': '<rootDir>/src/boot/$1'
20-
},
16+
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' }),
2117
testRegex: '(/tests/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
2218
};

src/components/common/DateTimeInput.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</template>
3030

3131
<script lang="ts">
32-
import { defineComponent, watch, ref, Ref } from 'vue';
32+
import { defineComponent, watch, ref } from 'vue';
3333
import { date } from 'quasar';
3434
3535
export default defineComponent({
@@ -40,8 +40,7 @@ export default defineComponent({
4040
},
4141
emits: ['update:modelValue'],
4242
setup (props, { emit }) {
43-
const date_string: Ref<string>
44-
= ref(date.formatDate((props.modelValue || Date.now())*1000, 'YYYY-MM-DD HH:mm'));
43+
const date_string = ref(date.formatDate((props.modelValue || Date.now())*1000, 'YYYY-MM-DD HH:mm'));
4544
4645
watch(
4746
() => date_string.value,

src/components/common/Problem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { RENDER_URL } from 'src/constants';
3434
import * as bootstrap from 'bootstrap';
3535
import type JQueryStatic from 'jquery';
3636
import JQuery from 'jquery';
37-
import { logger } from 'src/boot/logger';
37+
import { logger } from 'boot/logger';
3838
3939
import typeset from './mathjax-config';
4040

src/components/instructor/ClasslistManager.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import { defineComponent, computed, ref } from 'vue';
5959
6060
import { pick } from 'lodash-es';
6161
import { useStore } from 'src/store';
62-
import { api } from 'src/boot/axios';
62+
import { api } from 'boot/axios';
6363
import { MergedUser, CourseUser } from 'src/store/models/users';
6464
import { UserCourse } from 'src/store/models/courses';
6565
import { ResponseError } from 'src/store/models';

src/components/instructor/ClasslistManagerComponents/AddUsersManually.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
5050
import { defineComponent, ref, computed } from 'vue';
5151
import { useQuasar } from 'quasar';
52-
import { logger } from 'src/boot/logger';
52+
import { logger } from 'boot/logger';
5353
5454
import { useStore } from 'src/store';
5555

src/components/instructor/ClasslistManagerComponents/EditUsers.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,13 @@
4141
</template>
4242

4343
<script lang="ts">
44-
import type { Ref } from 'vue';
4544
import { defineComponent, ref, computed } from 'vue';
4645
import { cloneDeep, clone, remove, pick } from 'lodash-es';
4746
4847
import { MergedUser } from 'src/store/models/users';
4948
import { CourseSetting } from 'src/store/models/settings';
5049
import { useStore } from 'src/store';
51-
import { logger } from 'src/boot/logger';
50+
import { logger } from 'boot/logger';
5251
import { CourseUser } from 'src/store/models/users';
5352
5453
export default defineComponent({
@@ -57,8 +56,12 @@ export default defineComponent({
5756
},
5857
emits: ['closeDialog'],
5958
setup(props, context) {
60-
const merged_users: Ref<Array<MergedUser>> = props.users_to_edit ?
61-
ref(cloneDeep(props.users_to_edit) as unknown as Array<MergedUser>) : ref([]);
59+
const merged_users =
60+
ref<Array<MergedUser>>(
61+
props.users_to_edit
62+
? cloneDeep(props.users_to_edit) as unknown as Array<MergedUser>
63+
: []
64+
);
6265
const store = useStore();
6366
6467
const updateUsers = async () => {

src/components/instructor/LibraryComponents/LibPanelOPL.vue

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@
4444
import axios from 'axios';
4545
import { api } from 'boot/axios';
4646
47-
import type { Ref } from 'vue';
4847
import { defineComponent, ref, computed, watch } from 'vue';
4948
import { useStore } from 'src/store';
5049
// import { Discipline, LibrarySubject } from 'src/store/models';
51-
import Problem from 'src/components/common/Problem.vue';
52-
import { logger } from 'src/boot/logger';
50+
import Problem from 'components/common/Problem.vue';
51+
import { logger } from 'boot/logger';
5352
5453
interface SelectItem {
5554
label?: string;
@@ -72,10 +71,10 @@ export default defineComponent({
7271
},
7372
setup() {
7473
const store = useStore();
75-
const discipline: Ref<SelectItem|null> = ref(null); // start with the select field to be empty.
76-
const subject: Ref<SelectItem|null> = ref(null);
77-
const chapter: Ref<SelectItem|null> = ref(null);
78-
const section: Ref<SelectItem|null> = ref(null);
74+
const discipline = ref<SelectItem | null>(null); // start with the select field to be empty.
75+
const subject = ref<SelectItem | null>(null);
76+
const chapter = ref<SelectItem | null>(null);
77+
const section = ref<SelectItem | null>(null);
7978
const problems = ref<Array<LibraryProblem>>([]);
8079
8180
watch([discipline], async () => {

src/components/instructor/SetDetails/HomeworkSet.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import { defineComponent, ref, watch, toRefs } from 'vue';
4141
import { useQuasar } from 'quasar';
4242
import { cloneDeep } from 'lodash-es';
4343
44-
import DateTimeInput from 'src/components/common/DateTimeInput.vue';
44+
import DateTimeInput from 'components/common/DateTimeInput.vue';
4545
import { HomeworkSet } from 'src/store/models/problem_sets';
4646
import { useStore } from 'src/store';
4747

src/components/instructor/SetDetails/Quiz.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import { defineComponent, ref, watch, toRefs } from 'vue';
4141
import { useQuasar } from 'quasar';
4242
import { cloneDeep } from 'lodash-es';
4343
44-
import DateTimeInput from 'src/components/common/DateTimeInput.vue';
44+
import DateTimeInput from 'components/common/DateTimeInput.vue';
4545
import { Quiz } from 'src/store/models/problem_sets';
4646
import { useStore } from 'src/store';
4747

0 commit comments

Comments
 (0)