Skip to content

Commit

Permalink
chore: runs prettier and enforces it via lint
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielcsapo committed Nov 27, 2024
1 parent d54d4e3 commit 1249602
Show file tree
Hide file tree
Showing 79 changed files with 1,115 additions and 1,106 deletions.
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
dist
.docusaurus
39 changes: 21 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,62 @@



## v2.1.2 (2024-11-27)

#### :rocket: Enhancement
* [#87](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/87) feat(a11y): add hotkeys to search input aria props ([@bvandercar-vt](https://github.com/bvandercar-vt))

- [#87](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/87) feat(a11y): add hotkeys to search input aria props ([@bvandercar-vt](https://github.com/bvandercar-vt))

#### :bug: Bug Fix
* [#89](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/89) bug: fixes linking search results for sub links, fixes type checking in CI ([@gabrielcsapo](https://github.com/gabrielcsapo))
* [#87](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/87) feat(a11y): add hotkeys to search input aria props ([@bvandercar-vt](https://github.com/bvandercar-vt))
* [#81](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/81) Fixing links to search results if hash is present ([@dima](https://github.com/dima))

- [#89](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/89) bug: fixes linking search results for sub links, fixes type checking in CI ([@gabrielcsapo](https://github.com/gabrielcsapo))
- [#87](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/87) feat(a11y): add hotkeys to search input aria props ([@bvandercar-vt](https://github.com/bvandercar-vt))
- [#81](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/81) Fixing links to search results if hash is present ([@dima](https://github.com/dima))

#### Committers: 3

- Blake V. ([@bvandercar-vt](https://github.com/bvandercar-vt))
- Dima Berastau ([@dima](https://github.com/dima))
- Gabriel Csapo ([@gabrielcsapo](https://github.com/gabrielcsapo))


## v2.1.1 (2024-11-27)

#### :rocket: Enhancement
* [#87](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/87) feat(a11y): add hotkeys to search input aria props ([@bvandercar-vt](https://github.com/bvandercar-vt))

- [#87](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/87) feat(a11y): add hotkeys to search input aria props ([@bvandercar-vt](https://github.com/bvandercar-vt))

#### :bug: Bug Fix
* [#87](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/87) feat(a11y): add hotkeys to search input aria props ([@bvandercar-vt](https://github.com/bvandercar-vt))
* [#81](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/81) Fixing links to search results if hash is present ([@dima](https://github.com/dima))

- [#87](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/87) feat(a11y): add hotkeys to search input aria props ([@bvandercar-vt](https://github.com/bvandercar-vt))
- [#81](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/81) Fixing links to search results if hash is present ([@dima](https://github.com/dima))

#### Committers: 2

- Blake V. ([@bvandercar-vt](https://github.com/bvandercar-vt))
- Dima Berastau ([@dima](https://github.com/dima))


## v2.1.0 (2024-10-11)


## v2.0.1 (2024-02-03)

#### :bug: Bug Fix
* [#79](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/79) Fixes package content ([@scalvert](https://github.com/scalvert))

- [#79](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/79) Fixes package content ([@scalvert](https://github.com/scalvert))

#### Committers: 1
- Steve Calvert ([@scalvert](https://github.com/scalvert))

- Steve Calvert ([@scalvert](https://github.com/scalvert))

## v2.0.0 (2024-02-01)

#### :boom: Breaking Change
* [#75](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/75) Docusaurus v3 ([@scalvert](https://github.com/scalvert))

- [#75](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/75) Docusaurus v3 ([@scalvert](https://github.com/scalvert))

#### :house: Internal
* [#76](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/76) Cleanup of internal tools ([@scalvert](https://github.com/scalvert))

- [#76](https://github.com/gabrielcsapo/docusaurus-plugin-search-local/pull/76) Cleanup of internal tools ([@scalvert](https://github.com/scalvert))

#### Committers: 1
- Steve Calvert ([@scalvert](https://github.com/scalvert))

- Steve Calvert ([@scalvert](https://github.com/scalvert))

## v1.0.1 (2023-05-11)

Expand Down
16 changes: 8 additions & 8 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ guiding principle here is that changelogs are for humans, not machines.

When reviewing merged PR's the labels to be used are:

* breaking - Used when the PR is considered a breaking change.
* enhancement - Used when the PR adds a new feature or enhancement.
* bug - Used when the PR fixes a bug included in a previous release.
* documentation - Used when the PR adds or updates documentation.
* internal - Used for internal changes that still require a mention in the
- breaking - Used when the PR is considered a breaking change.
- enhancement - Used when the PR adds a new feature or enhancement.
- bug - Used when the PR fixes a bug included in a previous release.
- documentation - Used when the PR adds or updates documentation.
- internal - Used for internal changes that still require a mention in the
changelog/release notes.

## Release

Once the prep work is completed, the actual release is straight forward:

* First, ensure that you have installed your projects dependencies:
- First, ensure that you have installed your projects dependencies:

```sh
yarn install
```

* Second, ensure that you have obtained a
- Second, ensure that you have obtained a
[GitHub personal access token][generate-token] with the `repo` scope (no
other permissions are needed). Make sure the token is available as the
`GITHUB_AUTH` environment variable.
Expand All @@ -47,7 +47,7 @@ yarn install

[generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_AUTH+env+variable

* And last (but not least 😁) do your release.
- And last (but not least 😁) do your release.

```sh
npx release-it
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"check": "npm run check:client && npm run check:server",
"check:client": "tsc --noEmit --project ./tsconfig.client.json",
"check:server": "tsc --noEmit --project ./tsconfig.server.json",
"lint": "eslint ./src --config .eslintrc",
"lint": "eslint ./src --config .eslintrc && prettier --check .",
"parcel": "nf start --procfile ./procfiles/parcel.procfile",
"prepare": "npm run build",
"prepublishOnly": "npm run build",
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ErrorInfo } from "react";
import { Component, ErrorInfo } from 'react';

type ErrorBoundaryProps = {
children?: JSX.Element | JSX.Element[];
Expand Down
6 changes: 3 additions & 3 deletions src/client/theme/LoadingRing/LoadingRing.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// istanbul ignore file
import * as React from "react";
import clsx from "clsx";
import * as React from 'react';
import clsx from 'clsx';

import styles from "./LoadingRing.module.css";
import styles from './LoadingRing.module.css';

export default function LoadingRing({
className,
Expand Down
40 changes: 20 additions & 20 deletions src/client/theme/SearchBar/SearchBar.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { Component, ReactElement, useEffect, useState } from "react";
import { Component, ReactElement, useEffect, useState } from 'react';

import { useLocation } from "@docusaurus/router";
import { usePluginData } from "@docusaurus/useGlobalData";
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";
import { useLocation } from '@docusaurus/router';
import { usePluginData } from '@docusaurus/useGlobalData';
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';

import { GlobalPluginData } from "docusaurus-plugin-search-local";
import { GlobalPluginData } from 'docusaurus-plugin-search-local';

import { SearchButton } from "./SearchButton";
import SearchModal from "../SearchModal";
import ErrorBoundary from "../ErrorBoundary";
import { SearchButton } from './SearchButton';
import SearchModal from '../SearchModal';
import ErrorBoundary from '../ErrorBoundary';

import Mark from "mark.js";
import Mark from 'mark.js';

const SEARCH_PARAM_HIGHLIGHT = "_highlight";
const SEARCH_PARAM_HIGHLIGHT = '_highlight';

function isEditingContent(event: KeyboardEvent): boolean {
const element = event.target as HTMLElement;
const tagName = element.tagName;

return (
element.isContentEditable ||
tagName === "INPUT" ||
tagName === "SELECT" ||
tagName === "TEXTAREA"
tagName === 'INPUT' ||
tagName === 'SELECT' ||
tagName === 'TEXTAREA'
);
}

Expand All @@ -38,7 +38,7 @@ export default class SearchBarWrapper extends Component {

export function SearchBar(): ReactElement {
const { highlightSearchTermsOnTargetPage } = usePluginData(
"docusaurus-plugin-search-local"
'docusaurus-plugin-search-local',
) as GlobalPluginData;

const [isOpen, setIsOpen] = useState(false);
Expand All @@ -55,7 +55,7 @@ export function SearchBar(): ReactElement {
if (keywords.length === 0) {
return;
}
const root = document.querySelector("article");
const root = document.querySelector('article');
if (!root) {
return;
}
Expand All @@ -70,10 +70,10 @@ export function SearchBar(): ReactElement {
if (
(event.keyCode === 27 && isOpen) ||
// The `Cmd+K` shortcut both opens and closes the modal.
(event.key === "k" && (event.metaKey || event.ctrlKey)) ||
(event.key === 'k' && (event.metaKey || event.ctrlKey)) ||
// The `/` shortcut opens but doesn't close the modal because it's
// a character.
(!isEditingContent(event) && event.key === "/" && !isOpen)
(!isEditingContent(event) && event.key === '/' && !isOpen)
) {
event.preventDefault();

Expand All @@ -85,10 +85,10 @@ export function SearchBar(): ReactElement {
}
}

window.addEventListener("keydown", onKeyDown);
window.addEventListener('keydown', onKeyDown);

return () => {
window.removeEventListener("keydown", onKeyDown);
window.removeEventListener('keydown', onKeyDown);
};
}, [isOpen]);

Expand All @@ -100,7 +100,7 @@ export function SearchBar(): ReactElement {
}}
/>

{isOpen ? <SearchModal onClose={() => setIsOpen(false)} /> : ""}
{isOpen ? <SearchModal onClose={() => setIsOpen(false)} /> : ''}
</>
);
}
2 changes: 1 addition & 1 deletion src/client/theme/SearchBar/SearchButton.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

/* Darkmode */

html[data-theme="dark"] {
html[data-theme='dark'] {
--search-local-key-gradient: linear-gradient(
-26.5deg,
rgb(86, 88, 114) 0%,
Expand Down
20 changes: 10 additions & 10 deletions src/client/theme/SearchBar/SearchButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo } from "react";
import * as React from "react";
import { useMemo } from 'react';
import * as React from 'react';

import "./SearchButton.css";
import './SearchButton.css';

function ControlKeyIcon() {
return (
Expand Down Expand Up @@ -42,12 +42,12 @@ type Translations = Partial<{
buttonAriaLabel: string;
}>;

export type DocSearchButtonProps = React.ComponentProps<"button"> & {
export type DocSearchButtonProps = React.ComponentProps<'button'> & {
translations?: Translations;
};

const ACTION_KEY_DEFAULT = "Ctrl" as const;
const ACTION_KEY_APPLE = "⌘" as const;
const ACTION_KEY_DEFAULT = 'Ctrl' as const;
const ACTION_KEY_APPLE = '⌘' as const;

function isAppleDevice() {
return /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
Expand All @@ -57,12 +57,12 @@ export const SearchButton = React.forwardRef<
HTMLButtonElement,
DocSearchButtonProps
>(({ translations = {}, ...props }, ref) => {
const { buttonText = "Search", buttonAriaLabel = "Search" } = translations;
const { buttonText = 'Search', buttonAriaLabel = 'Search' } = translations;

const key = useMemo<
typeof ACTION_KEY_APPLE | typeof ACTION_KEY_DEFAULT | null
>(() => {
if (typeof navigator !== "undefined") {
if (typeof navigator !== 'undefined') {
return isAppleDevice() ? ACTION_KEY_APPLE : ACTION_KEY_DEFAULT;
}
return null;
Expand All @@ -74,7 +74,7 @@ export const SearchButton = React.forwardRef<
(['Control', <ControlKeyIcon />] as const)
: (['Meta', key] as const);

const shortcut = `${actionKeyAltText}+k`
const shortcut = `${actionKeyAltText}+k`;

return (
<button
Expand Down Expand Up @@ -102,4 +102,4 @@ export const SearchButton = React.forwardRef<
);
});

SearchButton.displayName = "SearchButton";
SearchButton.displayName = 'SearchButton';
2 changes: 1 addition & 1 deletion src/client/theme/SearchBar/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import SearchBar from "./SearchBar";
import SearchBar from './SearchBar';

export default SearchBar;
Loading

0 comments on commit 1249602

Please sign in to comment.