Skip to content

Commit d43d7db

Browse files
committed
build: update to latest version
1 parent 44c8a11 commit d43d7db

22 files changed

+7214
-8410
lines changed

.env.example

-10
This file was deleted.

.eslintrc.js

+19-13
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ module.exports = {
22
root: true,
33
env: {
44
browser: true,
5-
node: true
5+
node: true,
66
},
77
extends: [
88
'@nuxtjs/eslint-config-typescript',
99
'prettier',
1010
'prettier/vue',
1111
'plugin:prettier/recommended',
12-
'plugin:nuxt/recommended'
12+
'plugin:nuxt/recommended',
1313
],
1414
plugins: ['prettier'],
1515
// add your custom rules here
@@ -23,23 +23,29 @@ module.exports = {
2323
{
2424
vars: 'all',
2525
args: 'after-used',
26-
ignoreRestSiblings: false
27-
}
26+
ignoreRestSiblings: false,
27+
},
2828
],
2929
'@typescript-eslint/member-delimiter-style': 0,
30-
'@typescript-eslint/ban-ts-ignore': 'error',
30+
'@typescript-eslint/ban-ts-comment': 'error',
3131
'@typescript-eslint/explicit-function-return-type': 'off', // disable default
3232
'@typescript-eslint/no-explicit-any': 'error',
3333
camelcase: 'off',
34-
'@typescript-eslint/camelcase': ['warn']
34+
'@typescript-eslint/naming-convention': [
35+
'warn',
36+
{
37+
selector: 'variable',
38+
format: ['camelCase'],
39+
},
40+
],
3541
},
3642
overrides: [
3743
{
3844
// enable the rule specifically for TypeScript files
3945
files: ['*.ts', '*.tsx', '*.vue'],
4046
rules: {
41-
'@typescript-eslint/explicit-function-return-type': ['error']
42-
}
47+
'@typescript-eslint/explicit-function-return-type': ['error'],
48+
},
4349
},
4450
{
4551
// allow explicit any in these files and missing return type
@@ -48,12 +54,12 @@ module.exports = {
4854
'getters.ts',
4955
'repository.ts',
5056
'*.repository.ts',
51-
'test/**/*'
57+
'test/**/*',
5258
],
5359
rules: {
5460
'@typescript-eslint/no-explicit-any': 'off',
55-
'@typescript-eslint/explicit-function-return-type': ['off']
56-
}
57-
}
58-
]
61+
'@typescript-eslint/explicit-function-return-type': ['off'],
62+
},
63+
},
64+
],
5965
}

api/repository.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ export default ($axios: AxiosInstance) => (resource: string): any => ({
2929

3030
delete(id: string): any {
3131
return $axios.delete(`${resource}/${id}`)
32-
}
32+
},
3333
})

api/social/social.repository.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ export default ($axios: AxiosInstance) => ({
4141
.catch((error: AxiosError) => {
4242
throw error
4343
})
44-
}
44+
},
4545
})

components/header/Header.vue

+10-16
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</v-btn>
2727

2828
<v-menu offset-y min-width="100vw">
29-
<template v-slot:activator="{ on, attrs }">
29+
<template #activator="{ on, attrs }">
3030
<v-btn
3131
color="primary"
3232
x-large
@@ -49,7 +49,7 @@
4949
class="ml-3 my-3"
5050
:class="[
5151
{ 'primary--text': activePage == page.name },
52-
{ 'accent--text': activePage != page.name }
52+
{ 'accent--text': activePage != page.name },
5353
]"
5454
>{{ page.title }}
5555
<div
@@ -61,9 +61,7 @@
6161
</v-list>
6262
</v-menu>
6363
<v-spacer></v-spacer>
64-
<v-btn color="primary" large class="font-weight-bold">
65-
Login
66-
</v-btn>
64+
<v-btn color="primary" large class="font-weight-bold"> Login </v-btn>
6765
</v-app-bar>
6866
</div>
6967
</template>
@@ -77,43 +75,39 @@ interface Item {
7775
to: string
7876
}
7977
80-
interface Route {
81-
name: string
82-
}
83-
8478
@Component
8579
export default class Header extends Vue {
8680
// * Data
8781
pages: Item[] = [
8882
{
8983
name: 'index',
9084
title: 'Home',
91-
to: '/'
85+
to: '/',
9286
},
9387
{
9488
name: 'users',
9589
title: 'Users',
96-
to: '/users'
90+
to: '/users',
9791
},
9892
{
9993
name: 'about',
10094
title: 'About',
101-
to: '/about'
102-
}
95+
to: '/about',
96+
},
10397
]
10498
10599
// * * Computed
106100
/**
107101
* return currect active page
108102
*/
109103
get activePage(): string {
110-
if (this.$route.name === undefined || this.$route.name === null) {
104+
if (this.$route?.name === undefined || this.$route?.name === null) {
111105
return ''
112106
}
113-
if (this.$route.name === 'users-id') {
107+
if (this.$route?.name === 'users-id') {
114108
return 'users'
115109
}
116-
return this.$route.name
110+
return this.$route?.name
117111
}
118112
119113
// * * Methods

jest.config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ module.exports = {
22
moduleNameMapper: {
33
'^@/(.*)$': '<rootDir>/$1',
44
'^~/(.*)$': '<rootDir>/$1',
5-
'^vue$': 'vue/dist/vue.common.js'
5+
'^vue$': 'vue/dist/vue.common.js',
66
},
77
moduleFileExtensions: ['ts', 'js', 'vue', 'json'],
88
transform: {
99
'^.+\\.ts$': 'ts-jest',
1010
'^.+\\.js$': 'babel-jest',
11-
'.*\\.(vue)$': 'vue-jest'
11+
'.*\\.(vue)$': 'vue-jest',
1212
},
1313
collectCoverage: true,
1414
collectCoverageFrom: [
1515
'<rootDir>/components/**/*.vue',
16-
'<rootDir>/pages/**/*.vue'
16+
'<rootDir>/pages/**/*.vue',
1717
],
18-
setupFilesAfterEnv: ['./test/jest.setup.ts']
18+
setupFilesAfterEnv: ['./test/jest.setup.ts'],
1919
}

layouts/default.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import { Header } from '~/components/header'
1515
@Component({
1616
components: {
1717
Header,
18-
Footer
19-
}
18+
Footer,
19+
},
2020
})
2121
export default class Default extends Vue {}
2222
</script>

layouts/error.vue

+4-5
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
<h1 v-else>
77
{{ otherError }}
88
</h1>
9-
<NuxtLink to="/">
10-
Home page
11-
</NuxtLink>
9+
<NuxtLink to="/"> Home page </NuxtLink>
1210
</v-app>
1311
</template>
1412

@@ -23,9 +21,10 @@ interface ErrorResponse {
2321
layout: 'empty',
2422
head(this: Error): {} {
2523
return {
26-
title: this.error.statusCode === 404 ? this.pageNotFound : this.otherError
24+
title:
25+
this.error.statusCode === 404 ? this.pageNotFound : this.otherError,
2726
}
28-
}
27+
},
2928
})
3029
export default class Error extends Vue {
3130
// props

nuxt.config.js

+39-42
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,69 @@
1-
require('dotenv').config()
2-
31
const DEBUG = process.env.NODE_ENV !== 'production'
2+
const APP_NAME = 'Nuxify'
3+
const APP_DESCRIPTION = "Writing Software Like It's Ours"
4+
const APP_URL = 'http://localhost:3000'
5+
6+
const API_URL = DEBUG
7+
? 'https://jsonplaceholder.typicode.com'
8+
: 'https://jsonplaceholder.typicode.com'
49

510
export default {
611
target: 'static',
7-
mode: 'universal',
8-
server: {
9-
port: process.env.APP_PORT,
10-
host: process.env.APP_HOST
11-
},
12+
ssr: true,
1213
/*
1314
** Headers of the page
1415
*/
1516
head: {
16-
titleTemplate: '%s - ' + process.env.APP_NAME,
17-
title: process.env.APP_NAME || '',
17+
titleTemplate: '%s - ' + APP_NAME,
18+
title: APP_NAME || '',
1819
meta: [
1920
{ charset: 'utf-8' },
2021
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
2122
{
2223
hid: 'description',
2324
name: 'description',
24-
content: process.env.APP_DESCRIPTION || ''
25+
content: APP_DESCRIPTION || '',
2526
},
2627
// OG Tag setup
2728
// https://vue-meta.nuxtjs.org/api/#meta
2829
{
2930
property: 'og:type',
3031
content: 'website',
31-
vmid: 'og:type'
32+
vmid: 'og:type',
3233
},
3334
{
3435
property: 'og:title',
35-
content: process.env.APP_NAME,
36-
vmid: 'og:title'
36+
content: APP_NAME,
37+
vmid: 'og:title',
3738
},
3839
{
3940
property: 'og:description',
40-
content: process.env.APP_DESCRIPTION,
41-
vmid: 'og:description'
41+
content: APP_DESCRIPTION,
42+
vmid: 'og:description',
4243
},
4344
{
4445
property: 'og:site_name',
45-
content: process.env.APP_URL,
46-
vmid: 'og:site_name'
46+
content: APP_URL,
47+
vmid: 'og:site_name',
4748
},
4849
{
4950
property: 'og:url',
50-
content: process.env.APP_URL,
51-
vmid: 'og:url'
51+
content: APP_URL,
52+
vmid: 'og:url',
5253
},
5354
{
5455
property: 'og:image',
55-
content: process.env.APP_URL + '/icon.png',
56-
vmid: 'og:image'
57-
}
56+
content: APP_URL + '/icon.png',
57+
vmid: 'og:image',
58+
},
5859
],
5960
link: [
6061
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
6162
{
6263
rel: 'stylesheet',
63-
href: 'https://fonts.googleapis.com/css?family=Poppins&display=swap'
64-
}
65-
]
64+
href: 'https://fonts.googleapis.com/css?family=Poppins&display=swap',
65+
},
66+
],
6667
},
6768
/*
6869
** Customize the progress-bar color
@@ -83,7 +84,7 @@ export default {
8384
'@nuxt/typescript-build',
8485
// Doc: https://github.com/nuxt-community/stylelint-module
8586
'@nuxtjs/stylelint-module',
86-
'@nuxtjs/vuetify'
87+
'@nuxtjs/vuetify',
8788
],
8889
/*
8990
** Nuxt.js modules
@@ -93,42 +94,38 @@ export default {
9394
'@nuxtjs/axios',
9495
'@nuxtjs/pwa',
9596
// Doc: https://github.com/nuxt-community/dotenv-module
96-
'@nuxtjs/dotenv'
97+
'@nuxtjs/dotenv',
9798
],
9899
/**
99100
* PWA module configuration
100101
* https://pwa.nuxtjs.org/setup.html
101102
*/
102103
pwa: {
103104
meta: {
104-
title: process.env.APP_NAME
105+
title: APP_NAME,
105106
},
106107
manifest: {
107-
name: process.env.APP_NAME,
108-
// eslint-disable-next-line @typescript-eslint/camelcase
109-
short_name: process.env.APP_NAME,
110-
description: process.env.APP_DESCRIPTION,
111-
// eslint-disable-next-line @typescript-eslint/camelcase
112-
start_url: process.env.APP_URL,
113-
lang: 'en'
114-
}
108+
name: APP_NAME,
109+
short_name: APP_NAME,
110+
description: APP_DESCRIPTION,
111+
start_url: APP_URL,
112+
lang: 'en',
113+
},
115114
},
116115
/*
117116
** Axios module configuration
118117
** See https://axios.nuxtjs.org/options
119118
*/
120119
axios: {
121-
baseURL: DEBUG
122-
? process.env.STAGING_API_URL
123-
: process.env.PRODUCTION_API_URL,
124-
debug: DEBUG
120+
baseURL: API_URL,
121+
debug: DEBUG,
125122
},
126123
/*
127124
** vuetify module configuration
128125
** https://github.com/nuxt-community/vuetify-module
129126
*/
130127
vuetify: {
131128
customVariables: ['~/assets/variables.scss'],
132-
optionsPath: './vuetify.options.js'
133-
}
129+
optionsPath: './vuetify.options.js',
130+
},
134131
}

0 commit comments

Comments
 (0)