Skip to content

Commit 41e1d53

Browse files
bors[bot]mdubus
andauthored
Merge #152
152: Add prettier r=bidoubiwa a=mdubus ## What's wrong ? Prettier missing. Many developper use the "format on save" option in their IDE, and without a code formatter and a configuration file, it can be pretty time-consuming trying not to break the current format. ## What's inside this PR ? Addition of prettier as dev dependency + configuration file, and formatting of every file regarding the same specification. Please take a look at the rules to see if it seems coherent to you 🙏 Co-authored-by: Morgane Dubus <[email protected]>
2 parents 4172aab + edd64ca commit 41e1d53

File tree

11 files changed

+378
-671
lines changed

11 files changed

+378
-671
lines changed

.eslintrc.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ module.exports = {
55
es6: true,
66
jest: true
77
},
8-
extends: [
9-
'plugin:vue/essential',
10-
'standard',
11-
'plugin:vue/recommended'
12-
],
8+
extends: ['plugin:vue/essential', 'standard', 'plugin:vue/recommended'],
139
globals: {
1410
HOST_URL: 'readonly',
1511
API_KEY: 'readonly',
@@ -24,10 +20,10 @@ module.exports = {
2420
parser: 'babel-eslint',
2521
ecmaVersion: 2018
2622
},
27-
plugins: [
28-
'vue'
29-
],
23+
plugins: ['vue'],
3024
rules: {
31-
'no-console': ['error', { allow: ['warn', 'error'] }]
25+
'no-console': ['error', { allow: ['warn', 'error'] }],
26+
'vue/html-self-closing': 0,
27+
'space-before-function-paren': 'off'
3228
}
3329
}

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"trailingComma": "none",
3+
"tabWidth": 2,
4+
"semi": false,
5+
"singleQuote": true
6+
}

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ First of all, thank you for contributing to MeiliSearch! The goal of this docume
2222
4. Review the [Development Workflow](#workflow) section that describes the steps to maintain the repository.
2323
5. Make the changes on your branch.
2424
6. [Submit the branch as a PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) pointing to the `main` branch of the main vuepress-plugin-meilisearch repository. A maintainer should comment and/or review your Pull Request within a few days. Although depending on the circumstances, it may take longer.<br>
25-
We do not enforce a naming convention for the PRs, but **please use something descriptive of your changes**, having in mind that the title of your PR will be automatically added to the next [release changelog](https://github.com/meilisearch/vuepress-plugin-meilisearch/releases/).
25+
We do not enforce a naming convention for the PRs, but **please use something descriptive of your changes**, having in mind that the title of your PR will be automatically added to the next [release changelog](https://github.com/meilisearch/vuepress-plugin-meilisearch/releases/).
2626

2727
## Development Workflow
2828

@@ -65,6 +65,7 @@ We do not enforce any branch naming style, but please use something descriptive
6565
### Git Commits <!-- omit in TOC -->
6666

6767
As minimal requirements, your commit message should:
68+
6869
- be capitalized
6970
- not finish by a dot or any other punctuation character (!,?)
7071
- start with a verb so that we can read your commit message this way: "This commit will ...", where "..." is the commit message.

MeiliSearchBox.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,31 @@
88
id="meilisearch-search-input"
99
class="search-query"
1010
:placeholder="placeholder"
11-
>
11+
/>
1212
</form>
1313
</template>
1414

1515
<script>
1616
export default {
1717
name: 'MeiliSearchBox',
18-
data () {
18+
data() {
1919
return {
2020
placeholder: undefined
2121
}
2222
},
2323
watch: {
24-
options (newValue) {
24+
options(newValue) {
2525
this.update(newValue)
2626
}
2727
},
28-
mounted () {
28+
mounted() {
2929
const options = {
3030
hostUrl: HOST_URL,
3131
apiKey: API_KEY,
3232
indexUid: INDEX_UID,
3333
meilisearchOptions: {
34-
limit: MAX_SUGGESTIONS || this.$site.themeConfig.searchMaxSuggestions || 5,
34+
limit:
35+
MAX_SUGGESTIONS || this.$site.themeConfig.searchMaxSuggestions || 5,
3536
cropLength: CROP_LENGTH
3637
},
3738
autocompleteOptions: {
@@ -40,11 +41,12 @@ export default {
4041
layout: LAYOUT
4142
}
4243
this.initialize(options)
43-
this.placeholder = PLACEHOLDER || this.$site.themeConfig.searchPlaceholder || ''
44+
this.placeholder =
45+
PLACEHOLDER || this.$site.themeConfig.searchPlaceholder || ''
4446
},
4547
4648
methods: {
47-
initialize (userOptions) {
49+
initialize(userOptions) {
4850
Promise.all([
4951
import(
5052
/* webpackChunkName: "docs-searchbar" */ 'docs-searchbar.js/dist/cdn/docs-searchbar.min.js'
@@ -66,7 +68,7 @@ export default {
6668
})
6769
},
6870
69-
update (options) {
71+
update(options) {
7072
this.$el.innerHTML =
7173
'<input id="meilisearch-search-input" class="search-query">'
7274
this.initialize(options)

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ In your `config.js` file:
8282
module.exports = {
8383
plugins: [
8484
[
85-
"vuepress-plugin-meilisearch",
85+
'vuepress-plugin-meilisearch',
8686
{
87-
"hostUrl": "https://mymeilisearch.com",
88-
"apiKey": "XXX",
89-
"indexUid": "docs"
87+
hostUrl: 'https://mymeilisearch.com',
88+
apiKey: 'XXX',
89+
indexUid: 'docs'
9090
}
91-
],
92-
],
91+
]
92+
]
9393
}
9494
```
9595

@@ -102,19 +102,19 @@ Read more about [MeiliSearch authentication](https://docs.meilisearch.com/refere
102102
module.exports = {
103103
plugins: [
104104
[
105-
"vuepress-plugin-meilisearch",
105+
'vuepress-plugin-meilisearch',
106106
{
107-
"hostUrl": "https://mymeilisearch.com", // Mandatory
108-
"apiKey": "XXX", // Mandatory
109-
"indexUid": "docs-test", // Mandatory
110-
"placeholder": "Search as you type...", // Default: ""
111-
"maxSuggestions": 10, // Default: 5
112-
"hotKeys": [], // Default: ['s', '/']
113-
"cropLength": 50, // Default: 30
114-
"layout": "simple" // Default: "columns"
107+
hostUrl: 'https://mymeilisearch.com', // Mandatory
108+
apiKey: 'XXX', // Mandatory
109+
indexUid: 'docs-test', // Mandatory
110+
placeholder: 'Search as you type...', // Default: ""
111+
maxSuggestions: 10, // Default: 5
112+
hotKeys: [], // Default: ['s', '/']
113+
cropLength: 50, // Default: 30
114+
layout: 'simple' // Default: "columns"
115115
}
116-
],
117-
],
116+
]
117+
]
118118
}
119119
```
120120

babel.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
module.exports = {
2-
presets: [
3-
'@vue/cli-plugin-babel/preset'
4-
]
2+
presets: ['@vue/cli-plugin-babel/preset']
53
}

jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ module.exports = {
33
testMatch: ['<rootDir>/tests/**/*.js?(x)'],
44
preset: '@vue/cli-plugin-unit-jest',
55
moduleNameMapper: {
6-
'docs-searchbar.js': '<rootDir>/node_modules/docs-searchbar.js/dist/cdn/docs-searchbar.js'
6+
'docs-searchbar.js':
7+
'<rootDir>/node_modules/docs-searchbar.js/dist/cdn/docs-searchbar.js'
78
},
89
globals: {
910
HOST_URL: 'https://e10b17e6.getmeili.com',

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"yargs-parser": "^13.1.2"
1818
},
1919
"devDependencies": {
20-
"@vue/cli-plugin-unit-jest": "^4.5.13",
2120
"@vue/cli-plugin-babel": "^4.5.13",
21+
"@vue/cli-plugin-unit-jest": "^4.5.13",
2222
"@vue/cli-service": "^4.5.13",
2323
"@vue/test-utils": "^1.2.0",
2424
"babel-eslint": "^10.1.0",
@@ -29,6 +29,7 @@
2929
"eslint-plugin-promise": "^4.3.1",
3030
"eslint-plugin-standard": "^5.0.0",
3131
"eslint-plugin-vue": "^7.9.0",
32+
"prettier": "^2.3.0",
3233
"vue": "^2.6.11",
3334
"vue-template-compiler": "^2.6.11"
3435
},

playground/.vuepress/config.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
module.exports = {
2-
title: "Welcome to the Playground!",
3-
plugins: [
4-
[
5-
require('../../index.js'),
6-
{
7-
// Testing with MeiliSearch documentation content (https://docs.meilisearch.com/)
8-
"hostUrl": "https://docs-search-bar.meilisearch.com",
9-
"apiKey": "d79226ae89f29d4dadba8d0c30c240e435f584fb83a7ae573b13eb62edec35cd",
10-
"indexUid": "docs",
11-
// "maxSuggestions": 10,
12-
// "placeholder": "Search as you type..."
13-
}
14-
],
15-
],
2+
title: 'Welcome to the Playground!',
3+
plugins: [
4+
[
5+
require('../../index.js'),
6+
{
7+
// Testing with MeiliSearch documentation content (https://docs.meilisearch.com/)
8+
hostUrl: 'https://docs-search-bar.meilisearch.com',
9+
apiKey:
10+
'd79226ae89f29d4dadba8d0c30c240e435f584fb83a7ae573b13eb62edec35cd',
11+
indexUid: 'docs'
12+
// "maxSuggestions": 10,
13+
// "placeholder": "Search as you type..."
14+
}
15+
]
16+
]
1617
}

tests/MeiliSearchBoxTest.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ describe('MeiliSearchBox', () => {
55
let wrapper = null
66

77
beforeEach(() => {
8-
wrapper = shallowMount(
9-
MeiliSearchBox,
10-
{
11-
mocks: {
12-
$site: { themeConfig: {} }
13-
}
8+
wrapper = shallowMount(MeiliSearchBox, {
9+
mocks: {
10+
$site: { themeConfig: {} }
1411
}
15-
)
12+
})
1613
})
1714

1815
it('renders default form and input', () => {
19-
expect(wrapper.html()).toContain('<form id="search-form" role="search" class="meilisearch-search-wrapper search-box">')
20-
expect(wrapper.html()).toContain('<input id="meilisearch-search-input" class="search-query" placeholder="">')
16+
expect(wrapper.html()).toContain(
17+
'<form id="search-form" role="search" class="meilisearch-search-wrapper search-box">'
18+
)
19+
expect(wrapper.html()).toContain(
20+
'<input id="meilisearch-search-input" class="search-query" placeholder="">'
21+
)
2122
})
2223
})

0 commit comments

Comments
 (0)