Skip to content

Commit 85382fd

Browse files
committed
Format all code
1 parent 05995b6 commit 85382fd

22 files changed

+99
-85
lines changed

.github/ISSUE_TEMPLATE/bug-report.md

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,44 @@
11
---
22
name: Bug Report
33
about: Create a bug report to help improve this plugin
4-
title: ''
4+
title: ""
55
labels: bug
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

10-
### Bug description
11-
<!-- A clear and concise description of what the bug is. -->
9+
### Bug description
1210

11+
<!-- A clear and concise description of what the bug is. -->
1312

1413
### Reproduction
1514

16-
*If possible, provide a link to the source of your documentation or at least
17-
the document/page this issue is about (if applicable). If this bug report is
18-
about a failure that occurs while building your documentation, please find out
15+
_If possible, provide a link to the source of your documentation or at least
16+
the document/page this issue is about (if applicable). If this bug report is
17+
about a failure that occurs while building your documentation, please find out
1918
which document breaks the build process by building your documentation with debug
20-
information enabled as described in the README (`DEBUG=1 yarn build`). If you can,
21-
provide the document that breaks the build process as indicated by the debug messages.*
19+
information enabled as described in the README (`DEBUG=1 yarn build`). If you can,
20+
provide the document that breaks the build process as indicated by the debug messages._
2221

2322
### Environment
23+
2424
<!-- Please paste the output of the following commands: -->
2525

2626
#### Package Versions
27-
If you use Yarn:
27+
28+
If you use Yarn:
2829
`yarn list --pattern '@docusaurus|@cmfcmf' --depth=0`
29-
If you use npm:
30+
If you use npm:
3031
`npm list '@docusaurus/core' '@cmfcmf/docusaurus-search-local'`
3132

3233
#### Node Version
34+
3335
`node -v`
3436

3537
#### Docusaurus Environment
3638

3739
- Are you using a custom theme?
3840
- Paste the plugin config of the local search plugin from your `docusaurus.config.js` file
3941

40-
4142
### Additional context
43+
4244
<!-- Add any other context about the problem here. -->
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Everything Else
33
about: It's not a bug, it's a feature ;)
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

109
:unicorn:

.prettierignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
generated.js
1+
generated.js
2+
lib
3+
.husky
4+
.vscode
5+
example-docs

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,4 @@
128128

129129
# 0.0.1
130130

131-
- Initial version
131+
- Initial version

CONTRIBUTING.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Thank you for your interest in contributing to the project!
44

55
To get up and running, follow these steps:
6+
67
1. Clone the repository
78
2. Install dependencies: `yarn install`
89
3. Build everthing `yarn build`
@@ -14,4 +15,4 @@ To get up and running, follow these steps:
1415
yarn test:e2e # add --debug to step through the tests
1516
```
1617

17-
You can view debug information at http://localhost:3000/__docusaurus/debug (generated by [@docusaurus/plugin-debug](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-debug))
18+
You can view debug information at http://localhost:3000/\_\_docusaurus/debug (generated by [@docusaurus/plugin-debug](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-debug))

README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,20 @@ Add this plugin to the `plugins` array in `docusaurus.config.js`.
4242
```js
4343
module.exports = {
4444
// ...
45-
plugins: [
46-
require.resolve('@cmfcmf/docusaurus-search-local')
47-
],
45+
plugins: [require.resolve("@cmfcmf/docusaurus-search-local")],
4846

4947
// or, if you want to specify options:
5048

5149
// ...
5250
plugins: [
53-
[require.resolve('@cmfcmf/docusaurus-search-local'), {
54-
// Options here
55-
}]
51+
[
52+
require.resolve("@cmfcmf/docusaurus-search-local"),
53+
{
54+
// Options here
55+
},
56+
],
5657
],
57-
}
58+
};
5859
```
5960

6061
The following options are available (defaults are shown below):

babel.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
module.exports = {
33
// Jest
44
presets: [
5-
['@babel/preset-env', {targets: {node: 'current'}}],
6-
'@babel/preset-typescript',
5+
["@babel/preset-env", { targets: { node: "current" } }],
6+
"@babel/preset-typescript",
77
],
8-
};
8+
};

e2e-tests/e2e.spec.ts

+39-34
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,70 @@
1-
import { test, expect } from '@playwright/test';
1+
import { test, expect } from "@playwright/test";
22

33
async function search(page, text: string) {
4-
const searchFieldButton = page.locator('.dsla-search-field button');
4+
const searchFieldButton = page.locator(".dsla-search-field button");
55
searchFieldButton.click();
66

7-
await expect(page.locator('.aa-Input')).toBeFocused();
8-
await page.fill('.aa-Input', text);
9-
await page.press('.aa-Input', 'Enter');
7+
await expect(page.locator(".aa-Input")).toBeFocused();
8+
await page.fill(".aa-Input", text);
9+
await page.press(".aa-Input", "Enter");
1010
}
1111

12-
test('basic search works', async ({ page }) => {
13-
await page.goto('http://localhost:3000/');
14-
await search(page, '3');
12+
test("basic search works", async ({ page }) => {
13+
await page.goto("http://localhost:3000/");
14+
await search(page, "3");
1515

16-
await expect(page.url()).toBe('http://localhost:3000/docs/doc3');
17-
await expect(page.locator('mark[data-markjs="true"]')).toHaveText('3');
16+
await expect(page.url()).toBe("http://localhost:3000/docs/doc3");
17+
await expect(page.locator('mark[data-markjs="true"]')).toHaveText("3");
1818
});
1919

20-
test('version matches version in version selector navbar item', async ({ page }) => {
21-
await page.goto('http://localhost:3000/');
22-
const searchFieldButton = page.locator('.dsla-search-field button');
20+
test("version matches version in version selector navbar item", async ({
21+
page,
22+
}) => {
23+
await page.goto("http://localhost:3000/");
24+
const searchFieldButton = page.locator(".dsla-search-field button");
2325

24-
await expect(searchFieldButton).toHaveText('Search... [1.0.0]');
26+
await expect(searchFieldButton).toHaveText("Search... [1.0.0]");
2527

26-
const VERSION_SELECTOR = '.navbar__inner > div:nth-child(1) > div:nth-child(3)';
28+
const VERSION_SELECTOR =
29+
".navbar__inner > div:nth-child(1) > div:nth-child(3)";
2730
const currentVersionButton = page.locator(`${VERSION_SELECTOR} > a`);
28-
await expect(currentVersionButton).toHaveText('1.0.0');
31+
await expect(currentVersionButton).toHaveText("1.0.0");
2932

3033
// Change version to 'Next'
31-
await (currentVersionButton).hover();
34+
await currentVersionButton.hover();
3235
await page.locator(`${VERSION_SELECTOR} > ul > li:nth-child(1) > a`).click();
3336

34-
await expect(currentVersionButton).toHaveText('Next');
35-
await expect(searchFieldButton).toHaveText('Search... [Next]');
37+
await expect(currentVersionButton).toHaveText("Next");
38+
await expect(searchFieldButton).toHaveText("Search... [Next]");
3639

3740
// Go back to the homepage, which does not indicate in its url which version is active
38-
await page.goto('http://localhost:3000/');
39-
await expect(currentVersionButton).toHaveText('Next');
40-
await expect(searchFieldButton).toHaveText('Search... [Next]');
41+
await page.goto("http://localhost:3000/");
42+
await expect(currentVersionButton).toHaveText("Next");
43+
await expect(searchFieldButton).toHaveText("Search... [Next]");
4144

4245
// Reload the page - the active version should be persisted in localstorage
4346
await page.reload();
44-
await expect(currentVersionButton).toHaveText('Next');
45-
await expect(searchFieldButton).toHaveText('Search... [Next]');
47+
await expect(currentVersionButton).toHaveText("Next");
48+
await expect(searchFieldButton).toHaveText("Search... [Next]");
4649

4750
// Go to a doc of version 1.0.0, it should change the version back to 1.0.0.
48-
await page.goto('http://localhost:3000/docs/d-s-l-test')
49-
await expect(currentVersionButton).toHaveText('1.0.0');
50-
await expect(searchFieldButton).toHaveText('Search... [1.0.0]');
51+
await page.goto("http://localhost:3000/docs/d-s-l-test");
52+
await expect(currentVersionButton).toHaveText("1.0.0");
53+
await expect(searchFieldButton).toHaveText("Search... [1.0.0]");
5154
});
5255

53-
test('language-based search index is used', async ({ page }) => {
56+
test("language-based search index is used", async ({ page }) => {
5457
// Go to a random English doc
55-
await page.goto('http://localhost:3000/docs/next/d-s-l-test');
58+
await page.goto("http://localhost:3000/docs/next/d-s-l-test");
5659

57-
await search(page, 'english');
58-
await expect(page.url()).toBe('http://localhost:3000/docs/next/translated');
60+
await search(page, "english");
61+
await expect(page.url()).toBe("http://localhost:3000/docs/next/translated");
5962

6063
// Go to a random German doc
61-
await page.goto('http://localhost:3000/de/docs/next/d-s-l-test');
64+
await page.goto("http://localhost:3000/de/docs/next/d-s-l-test");
6265

63-
await search(page, 'german');
64-
await expect(page.url()).toBe('http://localhost:3000/de/docs/next/translated');
66+
await search(page, "german");
67+
await expect(page.url()).toBe(
68+
"http://localhost:3000/de/docs/next/translated"
69+
);
6570
});

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
"build": "yarn --cwd packages/docusaurus-search-local build && yarn --cwd packages/example-docs build",
1919
"build-and-serve": "yarn build && yarn --cwd packages/example-docs serve",
2020
"prepare": "husky install",
21-
"lint": "prettier --check packages/docusaurus-search-local/{src,cypress}/**/*.{js,jsx,ts,tsx,json,css,scss,md,html}",
22-
"format": "prettier --write packages/docusaurus-search-local/{src,cypress}/**/*.{js,jsx,ts,tsx,json,css,scss,md,html}",
21+
"lint": "prettier --check **/*.{js,jsx,ts,tsx,json,css,scss,md,html}",
22+
"format": "prettier --write **/*.{js,jsx,ts,tsx,json,css,scss,md,html}",
2323
"test": "jest packages/docusaurus-search-local",
2424
"test:e2e": "playwright test e2e-tests"
2525
},
2626
"lint-staged": {
27-
"packages/docusaurus-search-local/{src,cypress}/**/*.{js,jsx,ts,tsx,json,css,scss,md,html}": [
27+
"**/*.{js,jsx,ts,tsx,json,css,scss,md,html}": [
2828
"prettier --write"
2929
]
3030
},

packages/docusaurus-search-local/codeTranslations/de.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"cmfcmf/d-s-l.searchBar.clearButtonTitle": "Leeren",
66
"cmfcmf/d-s-l.searchBar.detachedCancelButtonText": "Abbrechen",
77
"cmfcmf/d-s-l.searchBar.submitButtonTitle": "Suchen"
8-
}
8+
}

packages/docusaurus-search-local/codeTranslations/en.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"cmfcmf/d-s-l.searchBar.clearButtonTitle": "Clear",
66
"cmfcmf/d-s-l.searchBar.detachedCancelButtonText": "Cancel",
77
"cmfcmf/d-s-l.searchBar.submitButtonTitle": "Submit"
8-
}
8+
}

packages/docusaurus-search-local/codeTranslations/es.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"cmfcmf/d-s-l.searchBar.clearButtonTitle": "Borrar",
66
"cmfcmf/d-s-l.searchBar.detachedCancelButtonText": "Cancelar",
77
"cmfcmf/d-s-l.searchBar.submitButtonTitle": "Enviar"
8-
}
8+
}

packages/docusaurus-search-local/codeTranslations/fr.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"cmfcmf/d-s-l.searchBar.clearButtonTitle": "Effacer",
66
"cmfcmf/d-s-l.searchBar.detachedCancelButtonText": "Annuler",
77
"cmfcmf/d-s-l.searchBar.submitButtonTitle": "Chercher"
8-
}
8+
}

packages/docusaurus-search-local/codeTranslations/id.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"cmfcmf/d-s-l.searchBar.clearButtonTitle": "Hapus",
66
"cmfcmf/d-s-l.searchBar.detachedCancelButtonText": "Batal",
77
"cmfcmf/d-s-l.searchBar.submitButtonTitle": "Kirim"
8-
}
8+
}

packages/docusaurus-search-local/codeTranslations/ja.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"cmfcmf/d-s-l.searchBar.clearButtonTitle": "Clear",
66
"cmfcmf/d-s-l.searchBar.detachedCancelButtonText": "Cancel",
77
"cmfcmf/d-s-l.searchBar.submitButtonTitle": "Submit"
8-
}
8+
}

packages/docusaurus-search-local/codeTranslations/pt-BR.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"cmfcmf/d-s-l.searchBar.clearButtonTitle": "Remover",
66
"cmfcmf/d-s-l.searchBar.detachedCancelButtonText": "Cancelar",
77
"cmfcmf/d-s-l.searchBar.submitButtonTitle": "Buscar"
8-
}
8+
}

packages/docusaurus-search-local/codeTranslations/pt.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"cmfcmf/d-s-l.searchBar.clearButtonTitle": "Limpar",
66
"cmfcmf/d-s-l.searchBar.detachedCancelButtonText": "Cancelar",
77
"cmfcmf/d-s-l.searchBar.submitButtonTitle": "Enviar"
8-
}
8+
}

packages/docusaurus-search-local/tsconfig.client.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"lib": ["ESNext", "DOM"]
77
},
88
"include": ["src/client/**/*"]
9-
}
9+
}

packages/docusaurus-search-local/tsconfig.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737

3838
"rootDir": "src",
3939
"outDir": "lib",
40-
"types": ["node", "@docusaurus/module-type-aliases", "@docusaurus/theme-classic"]
40+
"types": [
41+
"node",
42+
"@docusaurus/module-type-aliases",
43+
"@docusaurus/theme-classic"
44+
]
4145
}
42-
}
46+
}

packages/docusaurus-search-local/tsconfig.server.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"lib": ["ESNext", "DOM"]
77
},
88
"include": ["src/server/**/*"]
9-
}
9+
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
declare module '@algolia/autocomplete-theme-classic' {
1+
declare module "@algolia/autocomplete-theme-classic" {
22
// CSS only
3-
}
3+
}

tsconfig.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
2-
"references": [
3-
{ "path": "./packages/docusaurus-search-local" }
4-
],
2+
"references": [{ "path": "./packages/docusaurus-search-local" }],
53
"files": [],
64
"include": [],
75
"exclude": ["**/node_modules"]
8-
}
6+
}

0 commit comments

Comments
 (0)