Skip to content

Commit 318743a

Browse files
committed
Merge remote-tracking branch 'origin/dev' into highlight-duplicate-author
2 parents 513a249 + 141182a commit 318743a

29 files changed

Lines changed: 121 additions & 111 deletions

.eslintrc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@ module.exports = {
103103
'import/no-unresolved': 'off',
104104
'import/no-extraneous-dependencies': 'off',
105105
'prefer-promise-reject-errors': 'off',
106+
'no-restricted-imports': ['error', {
107+
'patterns': ['.*']
108+
}],
109+
'sort-imports': ['error', {
110+
'ignoreCase': false,
111+
'ignoreDeclarationSort': false,
112+
'ignoreMemberSort': false,
113+
'memberSyntaxSortOrder': ['none', 'all', 'multiple', 'single'],
114+
'allowSeparatedGroups': false
115+
}],
106116

107117
// TypeScript
108118
quotes: ['warn', 'single', { avoidEscape: true }],

src/components/AuthorCardEditing.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@
187187
</template>
188188

189189
<script lang="ts">
190-
import { computed, defineComponent, onUpdated } from 'vue'
191-
import SchemaGuideLink from './SchemaGuideLink.vue'
192-
import { useValidation } from 'src/store/validation'
193190
import { byError, emailQueries, orcidQueries } from 'src/error-filtering'
191+
import { computed, defineComponent, onUpdated } from 'vue'
192+
import SchemaGuideLink from 'src/components/SchemaGuideLink.vue'
194193
import { useStepperErrors } from 'src/store/stepper-errors'
194+
import { useValidation } from 'src/store/validation'
195195
196196
export default defineComponent({
197197
name: 'AuthorCardEditing',

src/components/AuthorCardViewing.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
</template>
4444

4545
<script lang="ts">
46-
import { computed, defineComponent, onUpdated, PropType } from 'vue'
46+
import { PropType, computed, defineComponent, onUpdated } from 'vue'
47+
import { byError, duplicateAuthorMatcher, duplicateAuthorQueries, emailQueries, orcidQueries } from 'src/error-filtering'
4748
import { AuthorType } from 'src/types'
4849
import { useStepperErrors } from 'src/store/stepper-errors'
4950
import { useValidation } from 'src/store/validation'
50-
import { byError, duplicateAuthorMatcher, duplicateAuthorQueries, emailQueries, orcidQueries } from 'src/error-filtering'
5151
5252
export default defineComponent({
5353
name: 'AuthorCardViewing',

src/components/DownloadButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</template>
1313

1414
<script lang="ts">
15-
import { defineComponent, computed } from 'vue'
15+
import { computed, defineComponent } from 'vue'
1616
import { useCffstr } from 'src/store/cffstr'
1717
1818
const toDownloadUrl = (body: string) => {

src/components/IdentifierCardEditing.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@
8989
</template>
9090

9191
<script lang="ts">
92-
import { IdentifierTypeType } from '../types'
93-
import { computed, defineComponent, PropType } from 'vue'
94-
import SchemaGuideLink from 'src/components/SchemaGuideLink.vue'
92+
import { PropType, computed, defineComponent } from 'vue'
9593
import { byError, identifierValueQueries } from 'src/error-filtering'
94+
import { IdentifierTypeType } from 'src/types'
95+
import SchemaGuideLink from 'src/components/SchemaGuideLink.vue'
9696
import { useValidation } from 'src/store/validation'
9797
9898
export default defineComponent({

src/components/IdentifierCardViewing.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
</template>
4343

4444
<script lang="ts">
45-
import { computed, defineComponent, PropType } from 'vue'
45+
import { PropType, computed, defineComponent } from 'vue'
46+
import { byError, duplicateIdentifierMatcher, duplicateIdentifierQueries, identifierValueQueries } from 'src/error-filtering'
4647
import { IdentifierType } from 'src/types'
4748
import { useValidation } from 'src/store/validation'
48-
import { byError, duplicateIdentifierMatcher, duplicateIdentifierQueries, identifierValueQueries } from 'src/error-filtering'
4949
5050
export default defineComponent({
5151
name: 'IdentifierCardViewing',

src/components/Keyword.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
</template>
4545

4646
<script lang="ts">
47+
import { byError, duplicateKeywordMatcher, duplicateKeywordQueries, keywordQueries } from 'src/error-filtering'
4748
import { computed, defineComponent } from 'vue'
4849
import { useValidation } from 'src/store/validation'
49-
import { byError, duplicateKeywordMatcher, duplicateKeywordQueries, keywordQueries } from 'src/error-filtering'
5050
5151
export default defineComponent({
5252
name: 'Keyword',

src/components/LayoutStepper.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
</template>
3131

3232
<script lang="ts">
33-
import Header from 'components/Header.vue'
34-
import Preview from 'components/Preview.vue'
33+
import { computed, defineComponent } from 'vue'
3534
import DownloadButton from 'components/DownloadButton.vue'
3635
import Footer from 'components/Footer.vue'
37-
import { defineComponent, computed } from 'vue'
36+
import Header from 'components/Header.vue'
37+
import Preview from 'components/Preview.vue'
3838
import { useRoute } from 'vue-router'
3939
4040
export default defineComponent({

src/components/ScreenAbstract.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import SchemaGuideLink from 'components/SchemaGuideLink.vue'
3939
import Stepper from 'components/Stepper.vue'
4040
import StepperActions from 'components/StepperActions.vue'
4141
import { defineComponent } from 'vue'
42-
import { useCff } from '../store/cff'
42+
import { useCff } from 'src/store/cff'
4343
4444
export default defineComponent({
4545
name: 'ScreenAbstract',

src/components/ScreenAuthors.vue

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,19 @@
7575
</template>
7676

7777
<script lang="ts">
78+
import { authorsQueries, byError } from 'src/error-filtering'
7879
import { computed, defineComponent, nextTick, onUpdated, ref } from 'vue'
79-
import SchemaGuideLink from 'components/SchemaGuideLink.vue'
80-
import Stepper from 'components/Stepper.vue'
81-
import StepperActions from 'components/StepperActions.vue'
80+
import { moveDown, moveUp } from 'src/updown'
8281
import AuthorCardEditing from 'components/AuthorCardEditing.vue'
8382
import AuthorCardViewing from 'components/AuthorCardViewing.vue'
8483
import { AuthorType } from 'src/types'
85-
import { moveDown, moveUp } from '../updown'
84+
import SchemaGuideLink from 'components/SchemaGuideLink.vue'
85+
import Stepper from 'components/Stepper.vue'
86+
import StepperActions from 'components/StepperActions.vue'
87+
import { scrollToBottom } from 'src/scroll-to-bottom'
8688
import { useCff } from 'src/store/cff'
87-
import { scrollToBottom } from '../scroll-to-bottom'
88-
import { useValidation } from 'src/store/validation'
89-
import { byError, authorsQueries } from 'src/error-filtering'
9089
import { useStepperErrors } from 'src/store/stepper-errors'
90+
import { useValidation } from 'src/store/validation'
9191
9292
export default defineComponent({
9393
name: 'ScreenAuthors',
@@ -107,40 +107,27 @@ export default defineComponent({
107107
const { errors } = useValidation()
108108
const editingId = ref(-1)
109109
const addAuthor = async () => {
110-
let newAuthors:AuthorType[]
111110
const newAuthor: AuthorType = {}
112-
if (authors.value === undefined) {
113-
newAuthors = [newAuthor]
114-
} else {
115-
newAuthors = [...authors.value, newAuthor]
116-
}
111+
const newAuthors = [...authors.value, newAuthor]
117112
setAuthors(newAuthors)
118113
editingId.value = newAuthors.length - 1
119114
// await the DOM update that resulted from updating the authors list
120115
await nextTick()
121116
scrollToBottom()
122117
}
123118
const removeAuthor = () => {
124-
if (authors.value !== undefined) {
125-
const newAuthors = [...authors.value]
126-
newAuthors.splice(editingId.value, 1)
127-
setAuthors(newAuthors)
128-
editingId.value = -1
129-
if (Array.isArray(newAuthors) && newAuthors.length === 0) {
130-
setAuthors([])
131-
}
132-
}
119+
const newAuthors = [...authors.value]
120+
newAuthors.splice(editingId.value, 1)
121+
setAuthors(newAuthors)
122+
editingId.value = -1
133123
}
134124
const setAuthorField = (field: keyof AuthorType, value: string) => {
135-
if (authors.value !== undefined) {
136-
const author = { ...authors.value[editingId.value] }
137-
author[field] = value === '' ? undefined : value
138-
authors.value[editingId.value] = author
139-
setAuthors(authors.value)
140-
}
125+
const newAuthor = { ...authors.value[editingId.value] }
126+
newAuthor[field] = value === '' ? undefined : value
127+
authors.value[editingId.value] = newAuthor
128+
setAuthors(authors.value)
141129
}
142130
const moveAuthorUp = (index: number) => {
143-
if (authors.value === undefined) return
144131
moveUp(index, authors.value, setAuthors)
145132
if (editingId.value === index && index > 0) {
146133
editingId.value = editingId.value - 1
@@ -149,7 +136,6 @@ export default defineComponent({
149136
}
150137
}
151138
const moveAuthorDown = (index: number) => {
152-
if (authors.value === undefined) return
153139
moveDown(index, authors.value, setAuthors)
154140
if (editingId.value === index && index < authors.value.length - 1) {
155141
editingId.value = editingId.value + 1

0 commit comments

Comments
 (0)