Skip to content

Commit 7d561a4

Browse files
committed
chore: update
1 parent 6027752 commit 7d561a4

File tree

12 files changed

+22
-24
lines changed

12 files changed

+22
-24
lines changed

packages/core/src/node/mdx/rehypePlugins/headerAnchor.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('rehypeHeadAnchor', () => {
99
1010
## title 1 {#custom-id}
1111
12-
## title 1 \{#custom-id}
12+
## title 1 \\{#custom-id}
1313
1414
## title 2
1515

packages/core/src/node/mdx/rehypePlugins/headerAnchor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function create(node: Element): Element {
6464
properties: {
6565
class: 'header-anchor',
6666
ariaHidden: 'true',
67-
href: `#${node.properties!.id}`,
67+
href: `#${node.properties.id}`,
6868
},
6969
children: [
7070
{

packages/core/src/node/mdx/rehypePlugins/transformers/add-title.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function parseTitleFromMeta(meta: string | undefined): string {
66
if (!meta) {
77
return '';
88
}
9-
const kvList = meta.split(' ').filter(Boolean) as string[];
9+
const kvList = meta.split(' ').filter(Boolean);
1010
for (const item of kvList) {
1111
const [k, v = ''] = item.split('=').filter(Boolean);
1212
if (k === 'title' && v.length > 0) {

packages/core/src/runtime/App.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import React, { useContext, useLayoutEffect } from 'react';
44
import globalComponents from 'virtual-global-components';
55
import { initPageData } from './initPageData';
66

7-
enum QueryStatus {
8-
Show = '1',
9-
Hide = '0',
10-
}
7+
const QueryStatus = {
8+
Show: '1',
9+
Hide: '0',
10+
} as const;
1111

1212
export function App() {
1313
const { setData: setPageData, data } = useContext(PageContext);
@@ -51,8 +51,7 @@ export function App() {
5151
// The component order is stable
5252
// eslint-disable-next-line react/no-array-index-key
5353
key: index,
54-
// FIXME: ` as object` should be omitted, seems like `@microsoft/api-extractor` issue
55-
...(props as object),
54+
...props,
5655
});
5756
}
5857

packages/plugin-api-docgen/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function pluginApiDocgen(options?: PluginOptions): RspressPlugin {
3030
[]
3131
).filter((lang): lang is SupportLanguages =>
3232
['zh', 'en', 'ru'].includes(lang),
33-
) as SupportLanguages[];
33+
);
3434
await docgen({
3535
entries,
3636
apiParseTool,

packages/plugin-sitemap/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function pluginSitemap(options: PluginSitemapOptions): RspressPlugin {
8181
lastmod: (await stat(pageData._filepath)).mtime.toISOString(),
8282
priority: pageData.routePath === '/' ? '1.0' : defaultPriority,
8383
changefreq: defaultChangeFreq,
84-
...(customMaps?.[pageData.routePath] ?? {}),
84+
...customMaps?.[pageData.routePath],
8585
});
8686
}
8787
}

packages/plugin-twoslash/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ function renderMarkdownInline(
9595
// If the result is a single paragraph, unwrap it to return just its children
9696
if (
9797
children.length === 1 &&
98-
children[0]!.type === 'element' &&
99-
children[0]!.tagName === 'p'
98+
children[0].type === 'element' &&
99+
children[0].tagName === 'p'
100100
) {
101-
return children[0]!.children;
101+
return children[0].children;
102102
}
103103

104104
return children;

packages/shared/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const DEFAULT_CONFIG_NAME = 'rspress.config' as const;
1+
export const DEFAULT_CONFIG_NAME = 'rspress.config';
22

33
export const DEFAULT_CONFIG_EXTENSIONS = [
44
'.js',

packages/theme-default/src/components/Search/SearchPanel.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ export function SearchPanel({ focused, setFocused }: SearchPanelProps) {
303303
const searchResult: MatchResult = [];
304304

305305
if ('beforeSearch' in userSearchHooks) {
306-
const key = 'beforeSearch' as const;
306+
const key = 'beforeSearch';
307307
const transformedQuery = await userSearchHooks[key](newQuery);
308308
if (transformedQuery) {
309309
newQuery = transformedQuery;
@@ -318,7 +318,7 @@ export function SearchPanel({ focused, setFocused }: SearchPanelProps) {
318318
}
319319

320320
if ('onSearch' in userSearchHooks) {
321-
const key = 'onSearch' as const;
321+
const key = 'onSearch';
322322
const customSearchResult = await userSearchHooks[key](
323323
newQuery,
324324
searchResult as DefaultMatchResult[],
@@ -337,7 +337,7 @@ export function SearchPanel({ focused, setFocused }: SearchPanelProps) {
337337
}
338338

339339
if ('afterSearch' in userSearchHooks) {
340-
const key = 'afterSearch' as const;
340+
const key = 'afterSearch';
341341
await userSearchHooks[key](newQuery, searchResult);
342342
}
343343

@@ -386,7 +386,7 @@ export function SearchPanel({ focused, setFocused }: SearchPanelProps) {
386386
return item.group;
387387
});
388388

389-
const renderKey = 'render' as const;
389+
const renderKey = 'render';
390390

391391
return (
392392
<Tabs

packages/theme-default/src/components/Search/logic/providers/LocalProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ export class LocalProvider implements Provider {
135135
});
136136
for (const item of pagesForSearch) {
137137
// Add search index async to avoid blocking the main thread
138-
this.#index!.addAsync(item.routePath, item);
139-
this.#cjkIndex!.addAsync(item.routePath, item);
140-
this.#cyrillicIndex!.addAsync(item.routePath, item);
138+
this.#index.addAsync(item.routePath, item);
139+
this.#cjkIndex.addAsync(item.routePath, item);
140+
this.#cyrillicIndex.addAsync(item.routePath, item);
141141
}
142142
}
143143

0 commit comments

Comments
 (0)