Skip to content

Commit 2fce9c1

Browse files
committed
style(prettier): add prettier config for trailing comma
1 parent dd2f4f1 commit 2fce9c1

15 files changed

+112
-103
lines changed

.eslintrc.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const prettierrc = require('./prettier.config.js');
2+
13
module.exports = {
24
root: true,
35
env: {
@@ -19,6 +21,7 @@ module.exports = {
1921
],
2022
// add your custom rules here
2123
rules: {
22-
'nuxt/no-cjs-in-config': 'off'
24+
'nuxt/no-cjs-in-config': 'off',
25+
'prettier/prettier': ['error', prettierrc],
2326
}
2427
}

ava.config.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ export default {
1010
root: ['.'],
1111
alias: {
1212
'@': '.',
13-
'~': '.'
14-
}
15-
}
16-
]
17-
]
18-
}
13+
'~': '.',
14+
},
15+
},
16+
],
17+
],
18+
},
1919
},
2020
tap: true,
21-
verbose: true
22-
}
21+
verbose: true,
22+
};

components/layout/last-modified.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
<script>
1717
export default {
1818
props: {
19-
utc: Boolean
19+
utc: Boolean,
2020
},
2121
computed: {
22-
lastModified: () => (process.client ? document.lastModified : null)
23-
}
24-
}
22+
lastModified: () => (process.client ? document.lastModified : null),
23+
},
24+
};
2525
</script>
2626

2727
<style></style>

components/layout/the-footer.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,18 @@
4747
</template>
4848

4949
<script>
50-
import lastModified from './last-modified'
50+
import lastModified from './last-modified';
5151
export default {
5252
components: {
53-
lastModified
53+
lastModified,
5454
},
5555
filters: {
56-
shortHash: (value) => (value ? value.substring(0, 7) : null)
56+
shortHash: (value) => (value ? value.substring(0, 7) : null),
5757
},
5858
data: () => ({
5959
version: process.env.VERSION,
6060
commit: process.env.COMMIT || process.env.TRAVIS_COMMIT,
61-
utc: false
62-
})
63-
}
61+
utc: false,
62+
}),
63+
};
6464
</script>

e2e.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import baseConfig from './ava.config.js'
1+
import baseConfig from './ava.config.js';
22

33
export default {
44
...baseConfig,
5-
files: ['test/e2e/**/*']
6-
}
5+
files: ['test/e2e/**/*'],
6+
};

layouts/default.vue

+10-10
Original file line numberDiff line numberDiff line change
@@ -94,32 +94,32 @@
9494
</template>
9595

9696
<script>
97-
import TheFooter from '@/components/layout/the-footer.vue'
97+
import TheFooter from '@/components/layout/the-footer.vue';
9898
export default {
9999
components: {
100-
TheFooter
100+
TheFooter,
101101
},
102102
data() {
103103
return {
104104
dialog: false,
105-
drawer: false
106-
}
105+
drawer: false,
106+
};
107107
},
108108
computed: {
109109
items() {
110-
return []
110+
return [];
111111
},
112112
isDark() {
113-
return false
113+
return false;
114114
// return this.$store.getters.getCurrentTheme().dark;
115-
}
115+
},
116116
},
117117
head() {
118118
return {
119119
// link: [this.$store.getters.getCurrentTheme()],
120-
}
121-
}
122-
}
120+
};
121+
},
122+
};
123123
</script>
124124

125125
<style>

nuxt.config.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const pkg = require('./package')
1+
const pkg = require('./package');
22

33
module.exports = {
44
mode: 'universal',
@@ -7,7 +7,7 @@ module.exports = {
77
HOST: process.env.HOST,
88
PORT: process.env.PORT,
99
VERSION: pkg.version,
10-
COMMIT: process.env.npm_package_gitHead
10+
COMMIT: process.env.npm_package_gitHead,
1111
},
1212

1313
/*
@@ -21,10 +21,10 @@ module.exports = {
2121
{
2222
hid: 'description',
2323
name: 'description',
24-
content: process.env.npm_package_description || ''
25-
}
24+
content: process.env.npm_package_description || '',
25+
},
2626
],
27-
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
27+
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
2828
},
2929

3030
/*
@@ -49,7 +49,7 @@ module.exports = {
4949
// Doc: https://github.com/nuxt-community/eslint-module
5050
'@nuxtjs/eslint-module',
5151
// Doc: https://github.com/nuxt-community/stylelint-module
52-
'@nuxtjs/stylelint-module'
52+
'@nuxtjs/stylelint-module',
5353
],
5454

5555
/*
@@ -63,7 +63,7 @@ module.exports = {
6363
'@nuxtjs/pwa',
6464
// Doc: https://github.com/nuxt-community/dotenv-module
6565
'@nuxtjs/dotenv',
66-
'@nuxtjs/vuetify'
66+
'@nuxtjs/vuetify',
6767
],
6868

6969
/*
@@ -82,9 +82,9 @@ module.exports = {
8282
'ButtonPlugin',
8383
'FormTextareaPlugin',
8484
'FormGroupPlugin',
85-
'FormInputPlugin'
85+
'FormInputPlugin',
8686
],
87-
directivePlugins: ['Tooltip']
87+
directivePlugins: ['Tooltip'],
8888
},
8989

9090
/*
@@ -101,9 +101,9 @@ module.exports = {
101101
enforce: 'pre',
102102
test: /\.(js|vue)$/,
103103
loader: 'eslint-loader',
104-
exclude: /(node_modules)/
105-
})
104+
exclude: /(node_modules)/,
105+
});
106106
}
107-
}
108-
}
109-
}
107+
},
108+
},
109+
};

pages/index.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
</template>
2626

2727
<script>
28-
import Logo from '~/components/Logo.vue'
28+
import Logo from '~/components/Logo.vue';
2929
3030
export default {
3131
components: {
32-
Logo
33-
}
34-
}
32+
Logo,
33+
},
34+
};
3535
</script>
3636

3737
<style>

prettier.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
trailingComma: 'all',
3+
arrowParens: 'always',
4+
semi: true,
5+
singleQuote: true,
6+
};

server/index.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
const Koa = require('koa')
2-
const consola = require('consola')
3-
const { Nuxt, Builder } = require('nuxt')
1+
const Koa = require('koa');
2+
const consola = require('consola');
3+
const { Nuxt, Builder } = require('nuxt');
44

5-
const app = new Koa()
5+
const app = new Koa();
66

77
// Import and Set Nuxt.js options
8-
const config = require('../nuxt.config.js')
9-
config.dev = app.env !== 'production'
8+
const config = require('../nuxt.config.js');
9+
config.dev = app.env !== 'production';
1010

1111
async function start() {
1212
// Instantiate nuxt.js
13-
const nuxt = new Nuxt(config)
13+
const nuxt = new Nuxt(config);
1414

1515
const {
1616
host = process.env.HOST || '127.0.0.1',
17-
port = process.env.PORT || 3000
18-
} = nuxt.options.server
17+
port = process.env.PORT || 3000,
18+
} = nuxt.options.server;
1919

2020
// Build in development
2121
if (config.dev) {
22-
const builder = new Builder(nuxt)
23-
await builder.build()
22+
const builder = new Builder(nuxt);
23+
await builder.build();
2424
} else {
25-
await nuxt.ready()
25+
await nuxt.ready();
2626
}
2727

2828
app.use((ctx) => {
29-
ctx.status = 200
30-
ctx.respond = false // Bypass Koa's built-in response handling
31-
ctx.req.ctx = ctx // This might be useful later on, e.g. in nuxtServerInit or with nuxt-stash
32-
nuxt.render(ctx.req, ctx.res)
33-
})
29+
ctx.status = 200;
30+
ctx.respond = false; // Bypass Koa's built-in response handling
31+
ctx.req.ctx = ctx; // This might be useful later on, e.g. in nuxtServerInit or with nuxt-stash
32+
nuxt.render(ctx.req, ctx.res);
33+
});
3434

35-
app.listen(port, host)
35+
app.listen(port, host);
3636
consola.ready({
3737
message: `Server listening on http://${host}:${port}`,
38-
badge: true
39-
})
38+
badge: true,
39+
});
4040
}
4141

42-
start()
42+
start();

stylelint.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
// add your custom config here
33
// https://stylelint.io/user-guide/configuration
4-
}
4+
};

test/ava.setup.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
require('browser-env')()
2-
const hooks = require('require-extension-hooks')
3-
const Vue = require('vue')
1+
require('browser-env')();
2+
const hooks = require('require-extension-hooks');
3+
const Vue = require('vue');
44

5-
Vue.config.productionTip = false
5+
Vue.config.productionTip = false;
66

77
// https://github.com/nuxt/create-nuxt-app/issues/180#issuecomment-463069941
8-
window.Date = global.Date = Date
8+
window.Date = global.Date = Date;
99

1010
hooks('vue')
1111
.plugin('vue')
12-
.push()
12+
.push();
1313
hooks(['vue', 'js'])
1414
.exclude(({ filename }) => filename.match(/\/node_modules\//))
1515
.plugin('babel')
16-
.push()
16+
.push();

test/e2e/index.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
import { resolve } from 'path'
2-
import test from 'ava'
3-
import { Nuxt, Builder } from 'nuxt'
1+
import { resolve } from 'path';
2+
import test from 'ava';
3+
import { Nuxt, Builder } from 'nuxt';
44

55
// We keep the nuxt and server instance
66
// So we can close them at the end of the test
7-
let nuxt = null
7+
let nuxt = null;
88

99
// Init Nuxt.js and create a server listening on localhost:4000
1010
test.before(async () => {
1111
const config = {
1212
dev: false,
13-
rootDir: resolve(__dirname, '../../')
14-
}
15-
nuxt = new Nuxt(config)
16-
await new Builder(nuxt).build()
17-
await nuxt.server.listen(4000, 'localhost')
18-
}, 30000)
13+
rootDir: resolve(__dirname, '../../'),
14+
};
15+
nuxt = new Nuxt(config);
16+
await new Builder(nuxt).build();
17+
await nuxt.server.listen(4000, 'localhost');
18+
}, 30000);
1919

2020
// Example of testing only generated html
2121
test('Route / exits and render HTML', async (t) => {
22-
const { html } = await nuxt.renderRoute('/', {})
23-
t.true(html.includes('Documentation'))
24-
})
22+
const { html } = await nuxt.renderRoute('/', {});
23+
t.true(html.includes('Documentation'));
24+
});
2525

2626
// Close server and ask nuxt to stop listening to file changes
2727
test.after('Closing server and nuxt.js', (t) => {
28-
nuxt.close()
29-
})
28+
nuxt.close();
29+
});

test/specs/Logo.spec.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { mount } from '@vue/test-utils'
2-
import test from 'ava'
3-
import Logo from '@/components/Logo.vue'
1+
import { mount } from '@vue/test-utils';
2+
import test from 'ava';
3+
import Logo from '@/components/Logo.vue';
44

55
test('is a Vue instance', (t) => {
6-
const wrapper = mount(Logo)
7-
t.is(wrapper.isVueInstance(), true)
8-
})
6+
const wrapper = mount(Logo);
7+
t.is(wrapper.isVueInstance(), true);
8+
});

unit.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import baseConfig from './ava.config.js'
1+
import baseConfig from './ava.config.js';
22

33
export default {
44
...baseConfig,
5-
files: ['test/specs/**/*']
6-
}
5+
files: ['test/specs/**/*'],
6+
};

0 commit comments

Comments
 (0)