Skip to content

Commit 271c75d

Browse files
committed
Add prettier
1 parent c79d7f7 commit 271c75d

21 files changed

+829
-812
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"targets": {
77
"browsers": ["last 2 versions", "ie >= 9"]
88
}
9-
},
9+
}
1010
]
1111
],
1212
"env": {

.eslintrc.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ module.exports = {
66
'no-console': 0,
77
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
88
'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
9-
},
10-
};
9+
'comma-dangle': 0
10+
}
11+
}

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
2+
"trailingComma": "none",
3+
"tabWidth": 2,
4+
"semi": false,
5+
"singleQuote": true,
26
"overrides": [
37
{
48
"files": "*.scss",

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Make a PR modifying the files [`package.json`](/package.json) and [`src/lib/vers
133133
```
134134

135135
```javascript
136-
export default "X.X.X";
136+
export default 'X.X.X'
137137
```
138138

139139
Once the changes are merged on `main`, you can publish the current draft release via the [GitHub interface](https://github.com/meilisearch/docs-searchbar.js/releases).

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ If you already have your own scraper but you still want to use MeiliSearch and `
8080
<script src="https://cdn.jsdelivr.net/npm/docs-searchbar.js@{version}/dist/cdn/docs-searchbar.min.js"></script>
8181
<script>
8282
docsSearchBar({
83-
hostUrl: "https://mymeilisearch.com",
84-
apiKey: "XXX",
85-
indexUid: "docs",
86-
inputSelector: "#search-bar-input",
87-
debug: true, // Set debug to true if you want to inspect the dropdown
88-
});
83+
hostUrl: 'https://mymeilisearch.com',
84+
apiKey: 'XXX',
85+
indexUid: 'docs',
86+
inputSelector: '#search-bar-input',
87+
debug: true // Set debug to true if you want to inspect the dropdown
88+
})
8989
</script>
9090
</body>
9191
</html>
@@ -107,7 +107,7 @@ Read more about [MeiliSearch authentication](https://docs.meilisearch.com/refere
107107
In an ES+ environment:
108108

109109
```js
110-
import "docs-searchbar.js/dist/cdn/docs-searchbar.css";
110+
import 'docs-searchbar.js/dist/cdn/docs-searchbar.css'
111111
```
112112

113113
In a `HTML` file, the `link` tag should be added in your header:
@@ -148,14 +148,14 @@ docsSearchBar({
148148
handleSelected: function (input, event, suggestion, datasetNumber, context) {
149149
// Prevents the default behavior on click and rather opens the suggestion
150150
// in a new tab.
151-
if (context.selectionMethod === "click") {
152-
input.setVal("");
151+
if (context.selectionMethod === 'click') {
152+
input.setVal('')
153153

154-
const windowReference = window.open(suggestion.url, "_blank");
155-
windowReference.focus();
154+
const windowReference = window.open(suggestion.url, '_blank')
155+
windowReference.focus()
156156
}
157-
},
158-
});
157+
}
158+
})
159159
```
160160

161161
Note that, by default, you can already open a new tab thanks to the CMD/CTRL + Click action.
@@ -181,9 +181,9 @@ For example, you might want to increase the number of results displayed in the d
181181
```javascript
182182
docsSearchBar({
183183
meilisearchOptions: {
184-
limit: 10,
185-
},
186-
});
184+
limit: 10
185+
}
186+
})
187187
```
188188

189189
##### More Examples <!-- omit in toc -->

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import docsSearchBar from './src/lib/main';
1+
import docsSearchBar from './src/lib/main'
22

3-
export default docsSearchBar;
3+
export default docsSearchBar

jest.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ module.exports = {
33
bail: true,
44
resetMocks: true,
55
restoreMocks: true,
6-
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/docs/'],
7-
};
6+
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/docs/']
7+
}

playgrounds/html/index.html

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@
44
<meta charset="utf-8" />
55
<meta name="color-scheme" content="dark light" />
66
<title>Docs SearchBar playground</title>
7-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css" />
7+
<link
8+
rel="stylesheet"
9+
href="https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css"
10+
/>
811
<link rel="stylesheet" href="../../src/styles/main.scss" />
912
</head>
1013
<body>
1114
<div class="container">
1215
<div class="col-md-12">
1316
<div class="searchbox">
14-
<input type="search" placeholder="docs-searchbar input" class="form-control" id="q">
17+
<input
18+
type="search"
19+
placeholder="docs-searchbar input"
20+
class="form-control"
21+
id="q"
22+
/>
1523
</div>
1624
</div>
1725
</div>
@@ -21,18 +29,19 @@
2129
docsSearchBar.default({
2230
// Test with MeiliSearch Documentation
2331
hostUrl: 'https://docs-search-bar.meilisearch.com',
24-
apiKey: 'd79226ae89f29d4dadba8d0c30c240e435f584fb83a7ae573b13eb62edec35cd',
32+
apiKey:
33+
'd79226ae89f29d4dadba8d0c30c240e435f584fb83a7ae573b13eb62edec35cd',
2534
indexUid: 'docs',
2635
inputSelector: '#q',
2736
handleSelected(input, event, suggestion, datasetNumber, context) {
28-
console.info(input);
29-
console.info(event);
30-
console.info(suggestion);
31-
console.info(datasetNumber);
32-
console.info(context);
37+
console.info(input)
38+
console.info(event)
39+
console.info(suggestion)
40+
console.info(datasetNumber)
41+
console.info(context)
3342
},
3443
debug: true // Set debug to true if you want to inspect the dropdown
35-
});
44+
})
3645
</script>
3746
<style>
3847
.container {

playgrounds/javascript/index.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@
44
<meta charset="utf-8" />
55
<meta name="color-scheme" content="dark light" />
66
<title>Docs SearchBar playground</title>
7-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css" />
7+
<link
8+
rel="stylesheet"
9+
href="https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css"
10+
/>
811
</head>
912
<body>
1013
<div class="container">
1114
<div class="col-md-12">
1215
<div class="searchbox">
13-
<input type="search" placeholder="docs-searchbar input" class="form-control" id="q">
16+
<input
17+
type="search"
18+
placeholder="docs-searchbar input"
19+
class="form-control"
20+
id="q"
21+
/>
1422
</div>
1523
</div>
1624
</div>

playgrounds/javascript/src/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import docsSearchBar from '../../../index';
2-
import '../../../src/styles/main.scss';
1+
import docsSearchBar from '../../../index'
2+
import '../../../src/styles/main.scss'
33

44
docsSearchBar({
55
// Test with MeiliSearch Documentation
@@ -8,11 +8,11 @@ docsSearchBar({
88
indexUid: 'docs',
99
inputSelector: '#q',
1010
handleSelected(input, event, suggestion, datasetNumber, context) {
11-
console.info(input);
12-
console.info(event);
13-
console.info(suggestion);
14-
console.info(datasetNumber);
15-
console.info(context);
11+
console.info(input)
12+
console.info(event)
13+
console.info(suggestion)
14+
console.info(datasetNumber)
15+
console.info(context)
1616
},
17-
debug: true, // Set debug to true if you want to inspect the dropdown
18-
});
17+
debug: true // Set debug to true if you want to inspect the dropdown
18+
})

0 commit comments

Comments
 (0)