Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bot] Run grit migration: Apply a GritQL pattern #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function Feature({Svg, title, description}) {
);
}

export default function HomepageFeatures() {
export function HomepageFeatures() {
return (
<section className={styles.features}>
<div className="container">
Expand Down
2 changes: 1 addition & 1 deletion examples/docusaurus/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function HomepageHeader() {
);
}

export default function Home() {
export function Home() {
const {siteConfig} = useDocusaurusContext();
return (
<Layout
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-typedoc/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from './plugin';
export const index = ;
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-typedoc/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const DEFAULT_PLUGIN_OPTIONS: PluginOptions = {
frontmatter: undefined,
};

export const getPluginOptions = (
export const options = const getPluginOptions = (
opts: Partial<PluginOptions>,
): PluginOptions => {
const options = {
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-typedoc/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { PluginOptions } from './types';
// store list of plugin ids when running multiple instances
const apps: string[] = [];

export default function pluginDocusaurus(
export function pluginDocusaurus(
context: LoadContext,
opts: Partial<PluginOptions>,
) {
Expand Down
10 changes: 5 additions & 5 deletions packages/docusaurus-plugin-typedoc/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface PluginOptions {
export const types = interface PluginOptions {
id: string;
docsRoot: string;
out: string;
Expand All @@ -22,11 +22,11 @@ export interface PluginOptions {
frontmatter: FrontMatter;
}

export type FrontMatter =
export const types = type FrontMatter =
| Record<string, string | boolean | number | null>
| undefined;

export interface SidebarOptions {
export const types = interface SidebarOptions {
fullNames?: boolean;
categoryLabel: string;
collapsed: boolean;
Expand All @@ -36,10 +36,10 @@ export interface SidebarOptions {
autoConfiguration: boolean;
}

export interface SidebarCategory {
export const types = interface SidebarCategory {
type: string;
label: string;
items: SidebarItem[];
}

export type SidebarItem = SidebarCategory | string;
export const types = type SidebarItem = SidebarCategory | string;
2 changes: 1 addition & 1 deletion packages/typedoc-plugin-markdown/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ export function load(app: Application) {
}
});
}
export { MarkdownTheme };
export const index = ;
6 changes: 3 additions & 3 deletions packages/typedoc-plugin-markdown/src/render-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ import { MarkdownTheme } from './theme';

const TEMPLATE_PATH = path.join(__dirname, 'resources', 'templates');

export const indexTemplate = Handlebars.compile(
export const render_utils = const indexTemplate = Handlebars.compile(
fs.readFileSync(path.join(TEMPLATE_PATH, 'index.hbs')).toString(),
);

export const reflectionTemplate = Handlebars.compile(
export const render_utils = const reflectionTemplate = Handlebars.compile(
fs.readFileSync(path.join(TEMPLATE_PATH, 'reflection.hbs')).toString(),
);

export const reflectionMemberTemplate = Handlebars.compile(
export const render_utils = const reflectionMemberTemplate = Handlebars.compile(
fs.readFileSync(path.join(TEMPLATE_PATH, 'reflection.member.hbs')).toString(),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { PageEvent } from 'typedoc';
import { MarkdownTheme } from '../../theme';
import { escapeChars, getDisplayName } from '../../utils';

export default function (theme: MarkdownTheme) {
Handlebars.registerHelper('breadcrumbs', function (this: PageEvent) {
export function breadcrumbs(theme: MarkdownTheme) { Handlebars.registerHelper('breadcrumbs', function (this: PageEvent) {
const { entryPoints, entryDocument, project, readme } = theme;

if (!project) {
Expand All @@ -30,8 +29,7 @@ export default function (theme: MarkdownTheme) {
}
const breadcrumbsOut = breadcrumb(this, this.model, breadcrumbs);
return breadcrumbsOut;
});
}
}); }

function breadcrumb(page: PageEvent, model: any, md: string[]) {
if (model && model.parent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import * as Path from 'path';
import { CommentDisplayPart } from 'typedoc/dist/lib/models/comments/comment';
import { MarkdownTheme } from '../../theme';

export default function (theme: MarkdownTheme) {
Handlebars.registerHelper('comment', function (parts: CommentDisplayPart[]) {
export function comment(theme: MarkdownTheme) { Handlebars.registerHelper('comment', function (parts: CommentDisplayPart[]) {
const result: string[] = [];
for (const part of parts) {
switch (part.kind) {
Expand Down Expand Up @@ -46,8 +45,7 @@ export default function (theme: MarkdownTheme) {
}

return parseMarkdown(result.join(''), theme);
});
}
}); }

function parseMarkdown(text: string, theme: MarkdownTheme) {
const includePattern = /\[\[include:([^\]]+?)\]\]/g;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import * as Handlebars from 'handlebars';
import { Comment } from 'typedoc';
import { camelToTitleCase } from '../../utils';

export default function () {
Handlebars.registerHelper(
export function comments() { Handlebars.registerHelper(
'comments',
function (comment: Comment, showSummary = true, showTags = true) {
const md: string[] = [];
Expand All @@ -28,5 +27,4 @@ export default function () {

return md.join('\n\n');
},
);
}
); }
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import {
stripLineBreaks,
} from '../../utils';

export default function (theme: MarkdownTheme) {
Handlebars.registerHelper(
export function declaration_title(theme: MarkdownTheme) { Handlebars.registerHelper(
'declarationTitle',
function (this: ParameterReflection | DeclarationReflection) {
const md = theme.hideMembersSymbol ? [] : [memberSymbol(this)];
Expand Down Expand Up @@ -61,5 +60,4 @@ export default function (theme: MarkdownTheme) {
}
return md.join('');
},
);
}
); }
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import * as Handlebars from 'handlebars';
import { escapeChars } from '../../utils';

export default function () {
Handlebars.registerHelper('escape', function (str: string) {
export function escape() { Handlebars.registerHelper('escape', function (str: string) {
return escapeChars(str);
});
}
}); }
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import * as Handlebars from 'handlebars';
import { DeclarationHierarchy } from 'typedoc/dist/lib/models';
import { spaces } from '../../utils';

export default function () {
Handlebars.registerHelper(
export function hierarchy() { Handlebars.registerHelper(
'hierarchy',
function (this: DeclarationHierarchy, level: number) {
const md: string[] = [];
Expand All @@ -24,5 +23,4 @@ export default function () {

function getSymbol(level: number) {
return spaces(2) + [...Array(level)].map(() => '↳').join('');
}
}
} }
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as Handlebars from 'handlebars';
import { DeclarationReflection, ReferenceReflection } from 'typedoc';

export default function () {
Handlebars.registerHelper(
export function if_is_reference() { Handlebars.registerHelper(
'ifIsReference',
function (
this: DeclarationReflection | ReferenceReflection,
Expand All @@ -12,5 +11,4 @@ export default function () {
? options.fn(this)
: options.inverse(this);
},
);
}
); }
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import * as Handlebars from 'handlebars';
import { PageEvent } from 'typedoc';
import { MarkdownTheme } from '../../theme';

export default function (theme: MarkdownTheme) {
Handlebars.registerHelper(
export function if_named_anchors(theme: MarkdownTheme) { Handlebars.registerHelper(
'ifNamedAnchors',
function (this: PageEvent, options: Handlebars.HelperOptions) {
return theme.namedAnchors ? options.fn(this) : options.inverse(this);
},
);
}
); }
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import * as Handlebars from 'handlebars';
import { PageEvent } from 'typedoc';
import { MarkdownTheme } from '../../theme';

export default function (theme: MarkdownTheme) {
Handlebars.registerHelper(
export function if_show_breadcrumbs(theme: MarkdownTheme) { Handlebars.registerHelper(
'ifShowBreadcrumbs',
function (this: PageEvent, options: Handlebars.HelperOptions) {
return theme.hideBreadcrumbs ? options.inverse(this) : options.fn(this);
},
);
}
); }
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import * as Handlebars from 'handlebars';
import { PageEvent } from 'typedoc';
import { MarkdownTheme } from '../../theme';

export default function (theme: MarkdownTheme) {
Handlebars.registerHelper(
export function if_show_named_anchors(theme: MarkdownTheme) { Handlebars.registerHelper(
'ifShowNamedAnchors',
function (this: PageEvent, options: Handlebars.HelperOptions) {
return theme.namedAnchors ? options.fn(this) : options.inverse(this);
},
);
}
); }
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import * as Handlebars from 'handlebars';
import { PageEvent } from 'typedoc';
import { MarkdownTheme } from '../../theme';

export default function (theme: MarkdownTheme) {
Handlebars.registerHelper(
export function if_show_page_title(theme: MarkdownTheme) { Handlebars.registerHelper(
'ifShowPageTitle',
function (this: PageEvent, options: Handlebars.HelperOptions) {
return theme.hidePageTitle ? options.inverse(this) : options.fn(this);
},
);
}
); }
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import * as Handlebars from 'handlebars';
import { ReflectionKind, SignatureReflection } from 'typedoc';

export default function () {
Handlebars.registerHelper(
export function if_show_returns() { Handlebars.registerHelper(
'ifShowReturns',
function (this: SignatureReflection, options: Handlebars.HelperOptions) {
return this.type && !this.parent?.kindOf(ReflectionKind.Constructor)
? options.fn(this)
: options.inverse(this);
},
);
}
); }
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import * as Handlebars from 'handlebars';
import { DeclarationHierarchy, DeclarationReflection } from 'typedoc';
import { PageEvent } from 'typedoc';

export default function () {
Handlebars.registerHelper(
export function if_show_type_hierarchy() { Handlebars.registerHelper(
'ifShowTypeHierarchy',
function (
this: PageEvent<DeclarationReflection>,
Expand All @@ -14,5 +13,4 @@ export default function () {
? options.fn(this)
: options.inverse(this);
},
);
}
); }
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as Handlebars from 'handlebars';
import { SignatureReflection } from 'typedoc';

export default function () {
Handlebars.registerHelper(
export function index_signature_title() { Handlebars.registerHelper(
'indexSignatureTitle',
function (this: SignatureReflection) {
const md = ['▪'];
Expand All @@ -20,5 +19,4 @@ export default function () {
);
return md.join(' ');
},
);
}
); }
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { ParameterReflection, ReflectionKind, ReflectionType } from 'typedoc';
import { stripLineBreaks } from '../../utils';
import { getReflectionType } from './type';

export default function () {
Handlebars.registerHelper(
export function parameter_table() { Handlebars.registerHelper(
'parameterTable',

function (this: ParameterReflection[]) {
Expand Down Expand Up @@ -34,8 +33,7 @@ export default function () {
this.reduce((acc: any, current: any) => parseParams(current, acc), []),
);
},
);
}
); }

function table(parameters: any) {
const showDefaults = hasDefaultValues(parameters);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as Handlebars from 'handlebars';
import { ReferenceReflection } from 'typedoc';

export default function () {
Handlebars.registerHelper(
export function reference_member() { Handlebars.registerHelper(
'referenceMember',
function (this: ReferenceReflection) {
const referenced = this.tryGetTargetReflectionDeep();
Expand All @@ -21,5 +20,4 @@ export default function () {
referenced.name
}](${Handlebars.helpers.relativeURL(referenced.url)})`;
},
);
}
); }
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import * as Handlebars from 'handlebars';
import { ContainerReflection, ReflectionKind } from 'typedoc';
import { PageEvent } from 'typedoc/dist/lib/output/events';

export default function () {
Handlebars.registerHelper(
export function reflection_path() { Handlebars.registerHelper(
'reflectionPath',

function (this: PageEvent<ContainerReflection>) {
Expand Down Expand Up @@ -32,5 +31,4 @@ export default function () {
}
return null;
},
);
}
); }
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { PageEvent, ParameterReflection, ReflectionKind } from 'typedoc';
import { MarkdownTheme } from '../../theme';
import { escapeChars, getDisplayName } from '../../utils';

export default function (theme: MarkdownTheme) {
Handlebars.registerHelper(
export function reflection_title(theme: MarkdownTheme) { Handlebars.registerHelper(
'reflectionTitle',
function (this: PageEvent<any>, shouldEscape = true) {
const title: string[] = [''];
Expand All @@ -26,5 +25,4 @@ export default function (theme: MarkdownTheme) {
}
return title.join('');
},
);
}
); }
Loading