diff --git a/.eslintrc.js b/.eslintrc.js index 80e76c4..b87b959 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,15 +9,13 @@ module.exports = { requireConfigFile: false, project: 'tsconfig.json', sourceType: 'module', - extraFileExtensions: [ - '.vue', - ], + extraFileExtensions: ['.vue'], }, - "parser": "vue-eslint-parser", + parser: 'vue-eslint-parser', extends: [ 'plugin:vue/vue3-recommended', 'prettier', - '@nuxt/eslint-config-typescript', + '@nuxtjs/eslint-config-typescript', ], plugins: ['vue', 'import'], // add your custom rules here @@ -25,4 +23,5 @@ module.exports = { // これがないと単一名称のコンポーネントを置けない 'vue/multi-word-component-names': 'off', }, + ignorePatterns: ['.eslintrc.js'] } diff --git a/components/AddTagDialog.vue b/components/AddTagDialog.vue index 80dcc29..391e4ef 100644 --- a/components/AddTagDialog.vue +++ b/components/AddTagDialog.vue @@ -13,10 +13,17 @@ - + mdi-window-close - タグを登録します + + タグを登録します + @@ -27,8 +34,7 @@ variant="outlined" required density="compact" - > - + /> 保存する @@ -55,29 +61,29 @@ const userStore = useUserStore() export default { components: { FormButton, - Snackbar, + Snackbar }, - data() { + data () { return { tagDialog: false, newTag: '', snackbar: false, snackbarText: '', rules: { - tag: [(val) => (val || '').length > 0 || 'タグを入力してください。'], - }, + tag: [val => (val || '').length > 0 || 'タグを入力してください。'] + } } }, computed: { - tags() { + tags () { return tagStore.findAll }, - isSubmittable() { + isSubmittable () { return this.newTag || this.newTag !== '' - }, + } }, methods: { - async addTag() { + async addTag () { if (this.tags.includes(this.newTag)) { this.snackbar = true this.snackbarText = `タグ ${this.newTag} はすでに登録されています` @@ -88,16 +94,16 @@ export default { userId: userStore.getCurrent.id, name: this.newTag, createdAt: now, - updatedAt: now, + updatedAt: now }) this.newTag = '' this.tagDialog = false this.snackbar = true this.snackbarText = `タグ ${this.newTag} を追加しました` }, - close() { + close () { this.snackbar = false - }, - }, + } + } } diff --git a/components/AppHeader.vue b/components/AppHeader.vue index 23867ee..fa2db7e 100644 --- a/components/AppHeader.vue +++ b/components/AppHeader.vue @@ -3,16 +3,13 @@ Cords - + @@ -32,7 +29,7 @@ diff --git a/components/CardList.vue b/components/CardList.vue index 20418c7..4285e1a 100644 --- a/components/CardList.vue +++ b/components/CardList.vue @@ -1,11 +1,15 @@ diff --git a/components/DeleteCardDialog.vue b/components/DeleteCardDialog.vue index 182bd48..97fd519 100644 --- a/components/DeleteCardDialog.vue +++ b/components/DeleteCardDialog.vue @@ -6,12 +6,7 @@ transition="fade-transition" > @@ -22,7 +17,9 @@ - mdi-alert-circle-outline + + mdi-alert-circle-outline + この操作は取り戻せません @@ -49,24 +46,25 @@ export default { props: { noteTitle: { type: String, - default() { + default () { return '' - }, - }, + } + } }, - data() { + emits: ['cardDelete'], + data () { return { cardDeleteDialog: false, snackbar: false, - snackbarText: '', + snackbarText: '' } }, methods: { - deleteNote() { + deleteNote () { this.cardDeleteDialog = false // カード削除イベントをパブリッシュ(親側で監視して処理を行う) this.$emit('cardDelete') - }, - }, + } + } } diff --git a/components/DeleteTagDialog.vue b/components/DeleteTagDialog.vue index 759beaf..e13791e 100644 --- a/components/DeleteTagDialog.vue +++ b/components/DeleteTagDialog.vue @@ -6,16 +6,19 @@ transition="fade-transition" > - + mdi-window-close @@ -31,8 +34,7 @@ chips variant="outlined" label="削除したいタグを一つ以上選択" - > - + /> 削除する @@ -56,39 +58,39 @@ const tagStore = useTagStore() export default { components: { FormButton, - Snackbar, + Snackbar }, props: { tags: { type: Array, - default: () => [], - }, + default: () => [] + } }, - data() { + data () { return { tagDeleteDialog: false, deletingTags: [], snackbar: false, - snackbarText: '', + snackbarText: '' } }, computed: { - isDeletable() { + isDeletable () { return this.deletingTags.length > 0 - }, + } }, methods: { - async deleteTag() { - tagStore.delete(this.deletingTags) + async deleteTag () { + await tagStore.delete(this.deletingTags) this.snackbar = true const deletedTags = this.deletingTags.reduce((l, r) => `${l}, ${r}`) this.snackbarText = `タグ ${deletedTags} を削除しました` this.deletingTags = [] }, - close() { + close () { this.snackbar = false this.snackbarText = '' - }, - }, + } + } } diff --git a/components/UpdateCardForm.vue b/components/UpdateCardForm.vue index 89a37b9..c8f9156 100644 --- a/components/UpdateCardForm.vue +++ b/components/UpdateCardForm.vue @@ -10,16 +10,17 @@ const tagStore = useTagStore() const userStore = useUserStore() const noteStore = useNoteStore() -const tags = computed(() => tagStore.findAll.map((t) => t.name)) +const tags = computed(() => tagStore.findAll.map(t => t.name)) const snackbar = ref(false) const snackbarText = ref('') -const note = (await noteStore.fetchAll(userStore.getCurrent.id)).find((n) => n.id === route.params.id) +const note = (await noteStore.fetchAll(userStore.getCurrent.id)) + .find(n => n.id === route.params.id) if (!note) { - throw new Error('') + throw new Error('ページが存在しないかも') } -let newNote = note +const newNote = note const updateNote = async (): Promise => { newNote.updatedAt = new Date().toString() @@ -43,7 +44,12 @@ const close = (): void => { - + @@ -56,20 +62,23 @@ const close = (): void => { label="タグ" variant="plain" density="compact" - > - + /> - mdi-clock 作成 + + mdi-clock + 作成 {{ note.createdAt }} - mdi-clock + + mdi-clock + 更新 {{ note.updatedAt }} @@ -88,10 +97,12 @@ const close = (): void => { - 保存する + + 保存する + {{ snackbarText }} - \ No newline at end of file + diff --git a/components/atoms/BunttonLink.vue b/components/atoms/BunttonLink.vue index 899cedf..01ee505 100644 --- a/components/atoms/BunttonLink.vue +++ b/components/atoms/BunttonLink.vue @@ -1,6 +1,6 @@ @@ -9,11 +9,11 @@ export default { props: { click: { type: Function, - default() { + default () { return () => {} - }, - }, - }, + } + } + } } diff --git a/components/atoms/FormButton.vue b/components/atoms/FormButton.vue index bbf9d77..0d43b7a 100644 --- a/components/atoms/FormButton.vue +++ b/components/atoms/FormButton.vue @@ -5,7 +5,7 @@ :disabled="disabled" @click="click" > - + @@ -14,16 +14,16 @@ export default { props: { click: { type: Function, - default() { + default () { return () => {} - }, + } }, disabled: { type: Boolean, - default() { + default () { return false - }, - }, - }, + } + } + } } diff --git a/components/atoms/Snackbar.vue b/components/atoms/Snackbar.vue index ad360ff..c96b87f 100644 --- a/components/atoms/Snackbar.vue +++ b/components/atoms/Snackbar.vue @@ -1,9 +1,11 @@ diff --git a/components/atoms/editors/MenuItem.vue b/components/atoms/editors/MenuItem.vue index 2868ba4..8293fde 100644 --- a/components/atoms/editors/MenuItem.vue +++ b/components/atoms/editors/MenuItem.vue @@ -1,10 +1,6 @@ diff --git a/components/atoms/editors/MenuItems.vue b/components/atoms/editors/MenuItems.vue index f4161d3..820181c 100644 --- a/components/atoms/editors/MenuItems.vue +++ b/components/atoms/editors/MenuItems.vue @@ -102,7 +102,9 @@ @click="editor.chain().focus().toggleUnderline().run()" > mdi-format-underline -

underline

+

+ underline +

@@ -114,7 +116,7 @@ import MenuItem from '@/components/atoms/editors/MenuItem' export default { components: { - MenuItem, + MenuItem }, props: { editor: { diff --git a/components/atoms/editors/RichEditor.vue b/components/atoms/editors/RichEditor.vue index 47806c9..1f23865 100644 --- a/components/atoms/editors/RichEditor.vue +++ b/components/atoms/editors/RichEditor.vue @@ -11,7 +11,10 @@ :class="{ 'is-active': editor.isActive('bold') }" @click="editor.chain().focus().toggleBold().run()" > - mdi-format-bold Bold + + mdi-format-bold + + Bold @@ -19,7 +22,9 @@ :class="{ 'is-active': editor.isActive('italic') }" @click="editor.chain().focus().toggleItalic().run()" > - mdi-format-italic Italic + + mdi-format-italic + Italic @@ -27,7 +32,9 @@ :class="{ 'is-active': editor.isActive('heading', { level: 1 }) }" @click="editor.chain().focus().toggleHeading({ level: 1 }).run()" > - mdi-format-header-1 + + mdi-format-header-1 +

Heading 1

@@ -36,7 +43,9 @@ :class="{ 'is-active': editor.isActive('heading', { level: 2 }) }" @click="editor.chain().focus().toggleHeading({ level: 2 }).run()" > - mdi-format-header-2 + + mdi-format-header-2 +

Heading 2

@@ -45,7 +54,9 @@ :class="{ 'is-active': editor.isActive('heading', { level: 3 }) }" @click="editor.chain().focus().toggleHeading({ level: 3 }).run()" > - mdi-format-header-3 + + mdi-format-header-3 +

Heading 3

@@ -54,7 +65,9 @@ :class="{ 'is-active': editor.isActive('heading', { level: 3 }) }" @click="editor.chain().focus().toggleHeading({ level: 3 }).run()" > - mdi-format-header-4 + + mdi-format-header-4 +

Heading 4

@@ -63,7 +76,9 @@ :class="{ 'is-active': editor.isActive('bulletList') }" @click="editor.chain().focus().toggleBulletList().run()" > - mdi-format-list-bulleted + + mdi-format-list-bulleted + @@ -74,15 +89,17 @@ :class="{ 'is-active': editor.isActive('blockquote') }" @click="editor.chain().focus().toggleBlockquote().run()" > - mdi-format-quote-open + + mdi-format-quote-open +
Block quote
- - mdi-minus Divider + + + mdi-minus + Divider @@ -90,7 +107,9 @@ :class="{ 'is-active': editor.isActive('codeBlock') }" @click="editor.chain().focus().toggleCodeBlock().run()" > - mdi-xml + + mdi-xml +
  Code Block  
@@ -99,8 +118,12 @@ :class="{ 'is-active': editor.isActive('underline') }" @click="editor.chain().focus().toggleUnderline().run()" > - mdi-format-underline -

underline

+ + mdi-format-underline + +

+ underline +

@@ -118,32 +141,33 @@ export default { components: { EditorContent, BubbleMenu, - MenuItem, + MenuItem }, props: { value: { type: String, - default: '', - }, + default: '' + } }, - data() { + emits: ['update:value'], + data () { return { - editor: null, + editor: null } }, - mounted() { + mounted () { this.editor = new Editor({ content: this.value, extensions: [ StarterKit.configure({ - heading: [1, 2, 3, 4], - }), + heading: [1, 2, 3, 4] + }) ], onUpdate: () => { this.$emit('update:value', this.editor.getHTML()) - }, + } }) - }, + } } diff --git a/jest.config.js b/jest.config.js index 5fa973b..c6d3c2d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,17 +2,17 @@ module.exports = { moduleNameMapper: { '^@/(.*)$': '/$1', '^~/(.*)$': '/$1', - '^vue$': 'vue/dist/vue.common.js', + '^vue$': 'vue/dist/vue.common.js' }, moduleFileExtensions: ['js', 'vue', 'json'], transform: { '^.+\\.js$': 'babel-jest', - '.*\\.(vue)$': 'vue-jest', + '.*\\.(vue)$': 'vue-jest' }, collectCoverage: true, collectCoverageFrom: [ '/components/**/*.vue', - '/pages/**/*.vue', + '/pages/**/*.vue' ], - testEnvironment: 'jsdom', + testEnvironment: 'jsdom' } diff --git a/layouts/error.vue b/layouts/error.vue index 6834bd8..d1106ab 100644 --- a/layouts/error.vue +++ b/layouts/error.vue @@ -6,7 +6,9 @@

{{ otherError }}

- Home page + + Home page + @@ -17,22 +19,22 @@ export default { props: { error: { type: Object, - default: null, - }, + default: null + } }, - data() { + data () { return { pageNotFound: '404 Not Found', - otherError: 'An error occurred', + otherError: 'An error occurred' } }, - head() { + head () { const title = this.error.statusCode === 404 ? this.pageNotFound : this.otherError return { - title, + title } - }, + } } diff --git a/middleware/auth.ts b/middleware/auth.ts index fb61887..2e7d362 100644 --- a/middleware/auth.ts +++ b/middleware/auth.ts @@ -2,7 +2,7 @@ import { useUserStore } from '@/store/user.store' export default defineNuxtRouteMiddleware((_, from) => { const { isAuthenticated } = useUserStore() - if (!isAuthenticated && !(new Set(['/signin', '/signup']).has(from.path))) { + if (!isAuthenticated && !new Set(['/signin', '/signup']).has(from.path)) { return navigateTo('/signin') } }) diff --git a/nuxt.config.js b/nuxt.config.js index d9cc521..de02f13 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -1,13 +1,14 @@ +// eslint-disable-next-line @typescript-eslint/no-var-requires require('dotenv').config() export default defineNuxtConfig({ vue: { config: { - devtools: true, - }, + devtools: true + } }, typescript: { - shim: false, + shim: false }, // Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode ssr: false, @@ -19,15 +20,15 @@ export default defineNuxtConfig({ head: { title: 'cords | Online text editor', htmlAttrs: { - lang: 'en', + lang: 'en' }, meta: [ { charset: 'utf-8' }, { name: 'viewport', content: 'width=device-width, initial-scale=1' }, { hid: 'description', name: 'description', content: '' }, - { name: 'format-detection', content: 'telephone=no' }, + { name: 'format-detection', content: 'telephone=no' } ], - link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }], + link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }] }, // Global CSS: https://go.nuxtjs.dev/config-css @@ -48,7 +49,7 @@ export default defineNuxtConfig({ projectId: process.env.PROJECT_ID, storageBucket: process.env.STORAGE_BUCKET, messagingSenderId: process.env.MESSAGING_SENDER_ID, - appId: process.env.APP_ID, + appId: process.env.APP_ID } }, @@ -61,15 +62,15 @@ export default defineNuxtConfig({ '@nuxtjs/eslint-module', // https://go.nuxtjs.dev/vuetify '@nuxtjs/vuetify', - '@nuxtjs/google-fonts', + '@nuxtjs/google-fonts' ], googleFonts: { families: { download: false, NotoSansJapanese: [400], - JetBrainsMono: [500], - }, + JetBrainsMono: [500] + } }, // Modules: https://go.nuxtjs.dev/config-modules @@ -81,14 +82,14 @@ export default defineNuxtConfig({ customVariables: ['~/assets/variables.scss'], defaultAssets: { font: { - family: 'Noto Sans Japanese', - }, - }, + family: 'Noto Sans Japanese' + } + } }, // Build Configuration: https://go.nuxtjs.dev/config-build build: { - transpile: ["vuetify"], + transpile: ['vuetify'] }, vite: { diff --git a/package.json b/package.json index 3535667..5c6b03f 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "@nuxt/bridge": "npm:@nuxt/bridge-edge", "@nuxt/eslint-config": "^0.1.1", "@nuxtjs/eslint-config": "^11.0.0", + "@nuxtjs/eslint-config-typescript": "^12.0.0", "@nuxtjs/eslint-module": "^3.1.0", "@vue/test-utils": "^1.3.0", "babel-core": "7.0.0-bridge.0", diff --git a/pages/signin.vue b/pages/signin.vue index 6db8cd6..29a5d27 100644 --- a/pages/signin.vue +++ b/pages/signin.vue @@ -1,10 +1,14 @@