Skip to content

Commit

Permalink
fix indentation level of generated tsx and jsx file
Browse files Browse the repository at this point in the history
  • Loading branch information
Björn Büttner committed Jan 24, 2024
1 parent c0b9aaa commit a3cd325
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@idrinth/react-file-based-routes",
"version": "1.0.0",
"version": "1.0.1",
"description": "A simple file based routing library, that does not force itself on you.",
"type": "module",
"keywords": [
Expand Down
21 changes: 11 additions & 10 deletions src/jsx-writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ export default class JsxWriter implements Writer {
// @ts-ignore TS6133
add(path: string, url: string, changed: string): void
{
this.items.push(' ' + `(() => {
const LazyElement = lazy(() => import(
\'./pages/${path}/index.tsx\',
),);
return {
path: \'${url}\',
exact: true,
element: <Suspense fallback={<Loader/>}><LazyElement/></Suspense>,
};
})(),`);
this.items.push(` (() => {
const LazyElement = lazy(() => import(
\'./pages/${path}/index.tsx\',
),);
return {
path: \'${url}\',
exact: true,
element: <Suspense fallback={<Loader/>}><LazyElement/></Suspense>,
};
})(),`
);
}
toString(): string {
return 'import React, {\n' +
Expand Down
21 changes: 11 additions & 10 deletions src/tsx-writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ export default class TsxWriter implements Writer {
// @ts-ignore TS6133
add(path: string, url: string, changed: string): void
{
this.items.push(' ' + `(() => {
const LazyElement = lazy(() => import(
\'./pages/${path}/index.tsx\',
),);
return {
path: \'${url}\',
exact: true,
element: <Suspense fallback={<Loader/>}><LazyElement/></Suspense>,
};
})(),`);
this.items.push(` (() => {
const LazyElement = lazy(() => import(
\'./pages/${path}/index.tsx\',
),);
return {
path: \'${url}\',
exact: true,
element: <Suspense fallback={<Loader/>}><LazyElement/></Suspense>,
};
})(),`,
);
}
toString(): string {
return 'import React, {\n' +
Expand Down

0 comments on commit a3cd325

Please sign in to comment.