Skip to content

Commit

Permalink
add eslint-plugin-solid
Browse files Browse the repository at this point in the history
  • Loading branch information
rtritto committed Sep 26, 2024
1 parent 4e67c75 commit 521e0d3
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 17 deletions.
5 changes: 5 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import tseslint from 'typescript-eslint'
import solid from 'eslint-plugin-solid/configs/typescript'

export default tseslint.config(
{
files: ['**/*.{js,ts,jsx,tsx}'],
...solid
},
{
ignores: ['**/dist/']
},
Expand Down
11 changes: 6 additions & 5 deletions examples/full/pages/images/+Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,23 @@ function Page() {
);
}

function Image({ src, author }: { src: string; author: string }) {
function Image(props: { src: string; author: string }) {
return (
<>
<img src={src} height={48} style={{ "vertical-align": "middle", "margin-left": "10px" }} />
<img src={props.src} height={48} style={{ "vertical-align": "middle", "margin-left": "10px" }} />
<Head>
<script
type="application/ld+json"
// eslint-disable-next-line solid/no-innerhtml
innerHTML={JSON.stringify({
"@context": "https://schema.org/",
contentUrl: { src },
contentUrl: { src: props.src },
creator: {
"@type": "Person",
name: author,
name: props.author,
},
})}
></script>
/>
</Head>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion examples/full/pages/index/+Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const ClientOnlyCounterSlow = clientOnly(async () => {
function Page() {
return (
<>
<Config image={image}></Config>
<Config image={image} />
<h1>My Vike + Solid App</h1>
This page is:
<ul>
Expand Down
2 changes: 1 addition & 1 deletion examples/full/pages/starship/+Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function Layout(props: FlowProps) {
}

function Link(props: any) {
return <a style={{ marginRight: 10, ...props.style }} {...props} />;
return <a style={{ 'margin-right': '10', ...props.style }} {...props} />;
}

function Counter() {
Expand Down
16 changes: 8 additions & 8 deletions examples/minimal/pages/Layout.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "./Layout.css";

export function Layout({ children }) {
export function Layout(props) {
return (
<PageLayout>
<Sidebar>
Expand All @@ -11,12 +11,12 @@ export function Layout({ children }) {
About
</a>
</Sidebar>
<Content>{children}</Content>
<Content>{props.children}</Content>
</PageLayout>
);
}

function PageLayout({ children }) {
function PageLayout(props) {
return (
<div
style={{
Expand All @@ -25,12 +25,12 @@ function PageLayout({ children }) {
margin: "auto",
}}
>
{children}
{props.children}
</div>
);
}

function Sidebar({ children }) {
function Sidebar(props) {
return (
<div
style={{
Expand All @@ -43,12 +43,12 @@ function Sidebar({ children }) {
"line-height": "1.8em",
}}
>
{children}
{props.children}
</div>
);
}

function Content({ children }) {
function Content(props) {
return (
<div
style={{
Expand All @@ -58,7 +58,7 @@ function Content({ children }) {
"min-height": "100vh",
}}
>
{children}
{props.children}
</div>
);
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@brillout/test-types": "^0.1.15",
"@types/eslint": "^9.6.1",
"eslint": "^9.11.1",
"eslint-plugin-solid": "^0.14.3",
"playwright": "^1.47.2",
"typescript": "5.5.4",
"typescript-eslint": "^8.7.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/vike-solid/helpers/clientOnly.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { isServer } from "solid-js/web";
* @see {@link https://vike.dev/clientOnly}
*/
export function clientOnly<T extends Component<any>>(fn: () => Promise<{ default: T } | T>) {
if (isServer) return (props: ComponentProps<T> & { fallback?: JSX.Element }) => props.fallback;
if (isServer) return (props: ComponentProps<T> & { fallback?: JSX.Element }) => <>{props.fallback}</>;

const [comp, setComp] = createSignal<T>();
fn().then((m) => setComp(() => ("default" in m ? m.default : m)));
Expand Down
2 changes: 1 addition & 1 deletion packages/vike-solid/integration/getPageElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function Wrapper(props: { children: JSX.Element }) {
});
};

return renderWrappers();
return <>{renderWrappers()}</>;
}

function Page() {
Expand Down
58 changes: 58 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 521e0d3

Please sign in to comment.