Skip to content

Commit

Permalink
🆙 eslint (#441)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradgarropy authored Dec 17, 2024
1 parent 61f6342 commit da6d9d5
Show file tree
Hide file tree
Showing 14 changed files with 1,454 additions and 804 deletions.
29 changes: 0 additions & 29 deletions .eslintignore

This file was deleted.

8 changes: 0 additions & 8 deletions .eslintrc

This file was deleted.

2 changes: 2 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import config from "@bradgarropy/eslint-config"
export default config
2,142 changes: 1,438 additions & 704 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 2 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bradgarropy.com",
"version": "8.1.0",
"version": "8.2.0",
"description": "🏠 my home on the web",
"type": "module",
"keywords": [
Expand Down Expand Up @@ -81,9 +81,7 @@
"unified": "^11.0.4"
},
"devDependencies": {
"@bradgarropy/eslint-config": "^1.1.0",
"@bradgarropy/eslint-config-react": "^1.0.0",
"@bradgarropy/eslint-config-typescript": "^1.1.0",
"@bradgarropy/eslint-config": "^3.0.1",
"@bradgarropy/plop-generator-react-component": "^1.1.1",
"@bradgarropy/plop-generator-react-context": "^1.1.1",
"@bradgarropy/plop-generator-react-hook": "^1.1.1",
Expand All @@ -100,17 +98,9 @@
"@types/node": "^20.10.4",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"@typescript-eslint/eslint-plugin": "^8.18.0",
"@typescript-eslint/parser": "^8.18.0",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-v8": "^1.1.0",
"all-contributors-cli": "^6.24.0",
"eslint": "^8.37.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-simple-import-sort": "^12.0.0",
"jest": "^29.7.0",
"jsdom": "^24.0.0",
"plop": "^4.0.1",
Expand Down
5 changes: 3 additions & 2 deletions src/components/GoogleAnalytics/GoogleAnalytics.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {render} from "@testing-library/react"
import {test} from "vitest"
import {expect, test} from "vitest"

import GoogleAnalytics from "~/components/GoogleAnalytics"

test("renders script tags", async () => {
render(<GoogleAnalytics measurementId="test" />)
const {baseElement} = render(<GoogleAnalytics measurementId="test" />)
expect(baseElement.children).toHaveLength(1)
})
5 changes: 3 additions & 2 deletions src/components/Logo/Logo.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {render} from "@testing-library/react"
import {test} from "vitest"
import {expect, test} from "vitest"

import Logo from "~/components/Logo"

test("shows logo", () => {
render(<Logo />)
const {container} = render(<Logo />)
expect(container.getElementsByTagName("svg")).toHaveLength(1)
})
1 change: 0 additions & 1 deletion src/hooks/useMarkdown/useMarkdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ test("renders images", () => {

const {result} = renderHook(() =>
useMarkdown(
// eslint-disable-next-line quotes
'<img src="https://bradgarropy.com/profile.jpg" alt="profile" width="100" height="100"/>',
),
)
Expand Down
2 changes: 0 additions & 2 deletions src/transformers/twitch/twitch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,5 @@ test("transforms twitch clips", () => {
)

const emptyHtml = twitchTransformer.getHTML("https://twitch.tv")

// eslint-disable-next-line quotes
expect(emptyHtml).toEqual('<div class="twitch"></div>')
})
1 change: 0 additions & 1 deletion src/transformers/twitch/twitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const getHTML = (string: string): string => {
} else if (isClip(string)) {
src = `https://clips.twitch.tv/embed?clip=${id}`
} else {
// eslint-disable-next-line quotes
const html = '<div class="twitch"></div>'
return html
}
Expand Down
3 changes: 0 additions & 3 deletions src/transformers/twitter/twitter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,15 @@ test("transforms twitter links", async () => {
)

expect(html).toEqual(
// eslint-disable-next-line quotes
expect.stringContaining('<div class="grid justify-center">'),
)

expect(html).toEqual(
// eslint-disable-next-line quotes
expect.stringContaining('<blockquote class="twitter-tweet">'),
)

expect(html).toEqual(
expect.stringContaining(
// eslint-disable-next-line quotes
'<script async src="https://platform.twitter.com/widgets.js" charset="utf-8">',
),
)
Expand Down
2 changes: 0 additions & 2 deletions src/utils/feed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ test("caches json feed", async () => {
expect(feedCache.get("feed")).toBeUndefined()

const feed = await generateFeed("json")

// eslint-disable-next-line quotes
expect(feed).toContain('"title": "bradgarropy.com"')
expect(feed).not.toBeUndefined()

Expand Down
42 changes: 5 additions & 37 deletions src/utils/markdown.server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ describe("transforms markdown", () => {
)

expect(html).toEqual(
// eslint-disable-next-line quotes
'<a href="https://bradgarropy.com/profile.jpg"><img src="https://bradgarropy.com/profile.jpg" alt="brad garropy"></a>',
)
})
Expand All @@ -43,7 +42,6 @@ describe("transforms markdown", () => {
)

expect(html).toEqual(
// eslint-disable-next-line quotes
'<a href="http://res.cloudinary.com/profile.jpg"><img src="http://res.cloudinary.com/profile.jpg" alt="brad garropy" width="100" height="100"></a>',
)

Expand All @@ -52,7 +50,6 @@ describe("transforms markdown", () => {
)

expect(html).toEqual(
// eslint-disable-next-line quotes
'<a href="https://res.cloudinary.com/profile.jpg"><img src="https://res.cloudinary.com/profile.jpg" alt="brad garropy" width="100" height="100"></a>',
)
})
Expand All @@ -63,7 +60,6 @@ describe("transforms markdown", () => {
)

expect(html).toEqual(
// eslint-disable-next-line quotes
'<a href="https://bradgarropy.com/profile.jpg"><img src="https://bradgarropy.com/profile.jpg" alt="brad garropy"></a>',
)
})
Expand All @@ -74,7 +70,6 @@ describe("transforms markdown", () => {
)

expect(html).toEqual(
// eslint-disable-next-line quotes
'<a href="https://res.cloudinary.com/bradgarropy/image/upload/bradgarropy.com/profile.jpg"><img src="https://res.cloudinary.com/bradgarropy/image/upload/f_auto,q_auto,w_660,c_limit/bradgarropy.com/profile.jpg" alt="brad garropy" width="100" height="100"></a>',
)
})
Expand All @@ -85,7 +80,6 @@ describe("transforms markdown", () => {
)

expect(html).toEqual(
// eslint-disable-next-line quotes
'<a href="https://bradgarropy.com/profile.jpg"><img src="https://bradgarropy.com/profile.jpg" alt="brad garropy"></a>',
)
})
Expand All @@ -99,7 +93,6 @@ describe("transforms markdown", () => {

expect(html).toEqual(
expect.stringContaining(
// eslint-disable-next-line quotes
'src="https://codesandbox.io/embed/exciting-pascal-j5hwu"',
),
)
Expand All @@ -108,14 +101,10 @@ describe("transforms markdown", () => {
test("embeds twitch", async () => {
const html = await transformMarkdown("https://twitch.tv/bradgarropy")

expect(html).toEqual(
// eslint-disable-next-line quotes
expect.stringContaining("<iframe"),
)
expect(html).toEqual(expect.stringContaining("<iframe"))

expect(html).toEqual(
expect.stringContaining(
// eslint-disable-next-line quotes
'src="https://player.twitch.tv?channel=bradgarropy&#x26;parent=bradgarropy.com"',
),
)
Expand All @@ -127,18 +116,15 @@ describe("transforms markdown", () => {
)

expect(html).toEqual(
// eslint-disable-next-line quotes
expect.stringContaining('<div class="grid justify-center">'),
)

expect(html).toEqual(
// eslint-disable-next-line quotes
expect.stringContaining('<blockquote class="twitter-tweet">'),
)

expect(html).toEqual(
expect.stringContaining(
// eslint-disable-next-line quotes
'<script async src="https://platform.twitter.com/widgets.js" charset="utf-8">',
),
)
Expand All @@ -149,12 +135,10 @@ describe("transforms markdown", () => {

expect(html).toEqual(expect.stringContaining("<iframe"))

// eslint-disable-next-line quotes
expect(html).toEqual(expect.stringContaining('title="9zcU6oUOHVc"'))

expect(html).toEqual(
expect.stringContaining(
// eslint-disable-next-line quotes
'src="https://www.youtube-nocookie.com/embed/9zcU6oUOHVc"',
),
)
Expand All @@ -166,31 +150,15 @@ describe("transforms markdown", () => {
)

expect(html).toEqual(
expect.stringContaining(
// eslint-disable-next-line quotes
'<a href="https://example.com"',
),
expect.stringContaining('<a href="https://example.com"'),
)

expect(html).toEqual(
expect.stringContaining(
// eslint-disable-next-line quotes
"external link</a>",
),
)
expect(html).toEqual(expect.stringContaining("external link</a>"))

expect(html).toEqual(
expect.stringContaining(
// eslint-disable-next-line quotes
'rel="noopener noreferrer"',
),
expect.stringContaining('rel="noopener noreferrer"'),
)

expect(html).toEqual(
expect.stringContaining(
// eslint-disable-next-line quotes
'target="_blank"',
),
)
expect(html).toEqual(expect.stringContaining('target="_blank"'))
})
})
2 changes: 1 addition & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('tailwindcss').Config} */

const typography = require("@tailwindcss/typography")
import typography from "@tailwindcss/typography"

const config = {
content: [
Expand Down

0 comments on commit da6d9d5

Please sign in to comment.