citation-file-format / cff-initializer-javascript

Web form to initialize CITATION.cff files.
https://citation-file-format.github.io/cff-initializer-javascript/
Apache License 2.0
21 stars 8 forks source link

`export default` v `export` #556

Open jspaaks opened 2 years ago

jspaaks commented 2 years ago

some of our own components use export default whereas others use export. I'd like to choose one approach if we can, at least for the components

jspaaks commented 2 years ago

blocked by decision

jspaaks commented 2 years ago

Affects importing:

https://github.com/citation-file-format/cff-initializer-javascript/blob/f92086c30e071fbd2ba04b1a8b3fa2a3725d0b01/src/components/AuthorCardEditing.vue#L190-L194

fdiblen commented 2 years ago

We discussed this during the standup meeting and decided to use export only but not export default.

jspaaks commented 2 years ago

I tried changing according to

export default defineComponent({
   'name': 'AuthorCardEditing'
   ...
})
export const AuthorCardEditing = defineComponent({
   'name': 'AuthorCardEditing'
   ...
})

And changed the import to not use {}. Could be I'm doing something wrong but I got some warnings:


 App •  WARNING  •  UI  in ./src/components/AuthorCardEditing.vue?vue&type=script&lang=ts

export 'default' (reexported as 'default') was not found in '-!../../node_modules/@quasar/app
/lib/webpack/loader.js.transform-quasar-imports.js!../../node_modules/ts-loader/index.js??cl
onedRuleSet-3.use[0]!../../node_modules/@quasar/app/lib/webpack/loader.vue.auto-import
-quasar.js??ruleSet[0].use[0]!../../node_modules/vue-loader/dist/index.js??ruleSet[0].use[1]!.
/AuthorCardEditing.vue?vue&type=script&lang=ts' (possible exports: AuthorCardEditing)

Also VSCode/eslint now complains about

@typescript-eslint/no-unsafe-assignment: Unsafe assignment of an `any` value.

on AuthorCardEditing.

And the Authors page in the app doesnt work anymore.

So it seems there is some magic going on with defineComponent, I suggest to leave this issue for the time being.