Skip to content

Commit

Permalink
style: fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnowack committed Jan 8, 2025
1 parent aeca05f commit 664680b
Show file tree
Hide file tree
Showing 84 changed files with 292 additions and 180 deletions.
12 changes: 6 additions & 6 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export default withMermaid({
items: [
{
text: 'Changelog',
link: 'https://github.com/maxnowack/signaldb/blob/main/CHANGELOG.md'
link: 'https://github.com/maxnowack/signaldb/blob/main/CHANGELOG.md',
},
{
text: 'Contributing',
link: 'https://github.com/maxnowack/signaldb/blob/main/CONTRIBUTING.md'
link: 'https://github.com/maxnowack/signaldb/blob/main/CONTRIBUTING.md',
},
],
},
Expand Down Expand Up @@ -187,8 +187,8 @@ export default withMermaid({
['link', { rel: 'mask-icon', href: '/safari-pinned-tab.svg', color: '#0367e9' }],
['meta', { name: 'msapplication-TileColor', content: '#0367e9' }],
['meta', { name: 'theme-color', content: '#ffffff' }],
['script', { defer: '', 'data-domain': 'signaldb.js.org', src: 'https://plausible.unsou.de/js/script.js' }],
['script', { async: '', 'data-uid': 'fc19a2cffc', src: 'https://maxnowack.ck.page/fc19a2cffc/index.js' }],
['script', { 'defer': '', 'data-domain': 'signaldb.js.org', 'src': 'https://plausible.unsou.de/js/script.js' }],
['script', { 'async': '', 'data-uid': 'fc19a2cffc', 'src': 'https://maxnowack.ck.page/fc19a2cffc/index.js' }],
],

sitemap: {
Expand All @@ -205,9 +205,9 @@ export default withMermaid({
'/examples/supabase',
'/examples/supabase/404',
'guides/',
'integrations/'
'integrations/',
]
return items.filter((item) => !exclude.includes(item.url))
return items.filter(item => !exclude.includes(item.url))
},
},

Expand Down
4 changes: 3 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import eslint from '@eslint/js'
import globals from 'globals'
import tseslint, { configs as tseslintConfigs } from 'typescript-eslint'
Expand Down Expand Up @@ -132,6 +133,7 @@ export default tseslint.config(
],
},
{ files: ['commitlint.config.js'], languageOptions: { globals: globals.node } },
{ files: ['**/next.config.js'], languageOptions: { globals: globals.commonjs } },
// https://github.com/import-js/eslint-plugin-import/issues/1913#issuecomment-1034025709
...projectDirs.map(projectDir => ({
files: [`${projectDir}/**/*.{t,j}s`, `${projectDir}/**/*.m{t,j}s`],
Expand All @@ -148,7 +150,7 @@ export default tseslint.config(
'**/vite.config.mts',
'**/vitest.config.mts',
],
packageDir: [__dirname, path.join(__dirname, projectDir)],
packageDir: [import.meta.url, path.join(import.meta.url, projectDir)],
}],
},
})),
Expand Down
1 change: 0 additions & 1 deletion examples/appwrite/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
const nextConfig = {
basePath: '/examples/appwrite',
output: 'export',
Expand Down
7 changes: 4 additions & 3 deletions examples/appwrite/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
import './globals.scss'
import type { Metadata } from 'next'
import { Inter } from 'next/font/google'
Expand All @@ -10,11 +9,11 @@ export const metadata: Metadata = {
description: 'Todo Example app for SignalDB using Next.js and Appwrite',
}

export default function RootLayout({
const RootLayout = ({
children,
}: {
children: React.ReactNode,
}) {
}) => {
return (
<html lang="en">
<body className={inter.className}>
Expand All @@ -30,3 +29,5 @@ export default function RootLayout({
</html>
)
}

export default RootLayout
5 changes: 3 additions & 2 deletions examples/appwrite/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use client'

import dynamic from 'next/dynamic'
/* eslint-disable jsdoc/require-jsdoc */

const App = dynamic(() => import('../containers/App'), { ssr: false })

export default function Home() {
const Home = () => {
return <App />
}

export default Home
1 change: 0 additions & 1 deletion examples/appwrite/src/containers/App/List.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
import Todos from '../../models/Todos'
import useReactivity from '../../utils/useReactivity'

Expand Down
1 change: 0 additions & 1 deletion examples/appwrite/src/containers/App/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
import { useState } from 'react'
import Todos from '../../models/Todos'
import List from './List'
Expand Down
1 change: 0 additions & 1 deletion examples/firebase/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
const nextConfig = {
basePath: '/examples/firebase',
output: 'export',
Expand Down
7 changes: 4 additions & 3 deletions examples/firebase/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
import './globals.scss'
import type { Metadata } from 'next'
import { Inter } from 'next/font/google'
Expand All @@ -10,11 +9,11 @@ export const metadata: Metadata = {
description: 'Todo Example app for SignalDB using Next.js and Firebase',
}

export default function RootLayout({
const RootLayout = ({
children,
}: {
children: React.ReactNode,
}) {
}) => {
return (
<html lang="en">
<body className={inter.className}>
Expand All @@ -30,3 +29,5 @@ export default function RootLayout({
</html>
)
}

export default RootLayout
5 changes: 3 additions & 2 deletions examples/firebase/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use client'

import dynamic from 'next/dynamic'
/* eslint-disable jsdoc/require-jsdoc */

const App = dynamic(() => import('../containers/App'), { ssr: false })

export default function Home() {
const Home = () => {
return <App />
}

export default Home
1 change: 0 additions & 1 deletion examples/firebase/src/containers/App/List.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
import Todos from '../../models/Todos'
import useReactivity from '../../utils/useReactivity'

Expand Down
1 change: 0 additions & 1 deletion examples/firebase/src/containers/App/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
import { useState } from 'react'
import Todos from '../../models/Todos'
import List from './List'
Expand Down
12 changes: 9 additions & 3 deletions examples/firebase/src/system/syncManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ const syncManager = new SyncManager({
const handleChange = () => {
void onChange()
}
onChildAdded(ref(db, name), () => { void handleChange() })
onChildChanged(ref(db, name), () => { void handleChange() })
onChildRemoved(ref(db, name), () => { void handleChange() })
onChildAdded(ref(db, name), () => {
void handleChange()
})
onChildChanged(ref(db, name), () => {
void handleChange()
})
onChildRemoved(ref(db, name), () => {
void handleChange()
})
},
async pull({ name }) {
const snapshot = await get(ref(db, name))
Expand Down
1 change: 0 additions & 1 deletion examples/replication-http/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
const nextConfig = {
basePath: '/examples/replication-http',
output: 'export',
Expand Down
7 changes: 4 additions & 3 deletions examples/replication-http/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
import './globals.scss'
import type { Metadata } from 'next'
import { Inter } from 'next/font/google'
Expand All @@ -10,11 +9,11 @@ export const metadata: Metadata = {
description: 'Todo Example app for SignalDB using Next.js, replicating data over HTTP',
}

export default function RootLayout({
const RootLayout = ({
children,
}: {
children: React.ReactNode,
}) {
}) => {
return (
<html lang="en">
<body className={inter.className}>
Expand All @@ -30,3 +29,5 @@ export default function RootLayout({
</html>
)
}

export default RootLayout
5 changes: 3 additions & 2 deletions examples/replication-http/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use client'

import dynamic from 'next/dynamic'
/* eslint-disable jsdoc/require-jsdoc */

const App = dynamic(() => import('../containers/App'), { ssr: false })

export default function Home() {
const Home = () => {
return <App />
}

export default Home
1 change: 0 additions & 1 deletion examples/replication-http/src/containers/App/List.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
import Todos from '../../models/Todos'
import useReactivity from '../../utils/useReactivity'

Expand Down
1 change: 0 additions & 1 deletion examples/replication-http/src/containers/App/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
import { useState } from 'react'
import Todos from '../../models/Todos'
import List from './List'
Expand Down
1 change: 0 additions & 1 deletion examples/supabase/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
const nextConfig = {
basePath: '/examples/supabase',
output: 'export',
Expand Down
7 changes: 4 additions & 3 deletions examples/supabase/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
import './globals.scss'
import type { Metadata } from 'next'
import { Inter } from 'next/font/google'
Expand All @@ -10,11 +9,11 @@ export const metadata: Metadata = {
description: 'Todo Example app for SignalDB using Next.js and Supabase',
}

export default function RootLayout({
const RootLayout = ({
children,
}: {
children: React.ReactNode,
}) {
}) => {
return (
<html lang="en">
<body className={inter.className}>
Expand All @@ -30,3 +29,5 @@ export default function RootLayout({
</html>
)
}

export default RootLayout
5 changes: 3 additions & 2 deletions examples/supabase/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use client'

import dynamic from 'next/dynamic'
/* eslint-disable jsdoc/require-jsdoc */

const App = dynamic(() => import('../containers/App'), { ssr: false })

export default function Home() {
const Home = () => {
return <App />
}

export default Home
1 change: 0 additions & 1 deletion examples/supabase/src/containers/App/List.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
import Todos from '../../models/Todos'
import useReactivity from '../../utils/useReactivity'

Expand Down
1 change: 0 additions & 1 deletion examples/supabase/src/containers/App/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jsdoc/require-jsdoc */
import { useState } from 'react'
import Todos from '../../models/Todos'
import List from './List'
Expand Down
28 changes: 21 additions & 7 deletions packages/base/core/__tests__/AutoFetchCollection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ it('should remove query when observer is disposed', async () => {

disposeAll()
await waitForEvent(collection, 'persistence.received')
await new Promise((resolve) => { setTimeout(resolve, 100) }) // wait a bit to ensure the observer disposal was executed
await new Promise((resolve) => {
setTimeout(resolve, 100)
}) // wait a bit to ensure the observer disposal was executed
expect(collection.find({}, { reactive: false }).fetch()).toEqual([])
})

Expand Down Expand Up @@ -133,7 +135,9 @@ it('should handle multiple observers for the same query', async () => {

disposeAll()
await waitForEvent(collection, 'persistence.received')
await new Promise((resolve) => { setTimeout(resolve, 100) }) // wait a bit to ensure the observer disposal was executed
await new Promise((resolve) => {
setTimeout(resolve, 100)
}) // wait a bit to ensure the observer disposal was executed
expect(collection.find({}, { reactive: false }).fetch()).toEqual([])
})

Expand Down Expand Up @@ -181,7 +185,9 @@ it('should handle multiple queries', async () => {

disposeAll()
await waitForEvent(collection, 'persistence.received')
await new Promise((resolve) => { setTimeout(resolve, 100) }) // wait a bit to ensure the observer disposal was executed
await new Promise((resolve) => {
setTimeout(resolve, 100)
}) // wait a bit to ensure the observer disposal was executed
expect(collection.find({}, { reactive: false }).fetch()).toEqual([])
})

Expand Down Expand Up @@ -228,7 +234,9 @@ it('should update items with result of new fetch', async () => {

disposeAll()
await waitForEvent(collection, 'persistence.received')
await new Promise((resolve) => { setTimeout(resolve, 100) }) // wait a bit to ensure the observer disposal was executed
await new Promise((resolve) => {
setTimeout(resolve, 100)
}) // wait a bit to ensure the observer disposal was executed
expect(collection.find({}, { reactive: false }).fetch()).toEqual([])
})

Expand Down Expand Up @@ -266,10 +274,14 @@ it('should purge items after specified delay', async () => {
expect(collection.find({}).fetch()).toEqual(response.items)

disposeAll()
await new Promise((resolve) => { setTimeout(resolve, 100) }) // wait a bit to ensure the observer disposal was executed
await new Promise((resolve) => {
setTimeout(resolve, 100)
}) // wait a bit to ensure the observer disposal was executed
expect(collection.find({}, { reactive: false }).fetch()).toEqual(response.items)

await new Promise((resolve) => { setTimeout(resolve, 500) }) // wait a bit to ensure the observer disposal was executed
await new Promise((resolve) => {
setTimeout(resolve, 500)
}) // wait a bit to ensure the observer disposal was executed
expect(collection.find({}, { reactive: false }).fetch()).toEqual([])
})

Expand Down Expand Up @@ -308,7 +320,9 @@ it('should register and unregister queries', async () => {

collection.unregisterQuery({})
await waitForEvent(collection, 'persistence.received')
await new Promise((resolve) => { setTimeout(resolve, 100) }) // wait a bit to ensure the observer disposal was executed
await new Promise((resolve) => {
setTimeout(resolve, 100)
}) // wait a bit to ensure the observer disposal was executed
expect(collection.find({}, { reactive: false }).fetch()).toEqual([])
})

Expand Down
Loading

0 comments on commit 664680b

Please sign in to comment.