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

chore: simplified eslint.config #439

Closed
Closed
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
98 changes: 8 additions & 90 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@ import {fileURLToPath} from "node:url"

import {includeIgnoreFile} from "@eslint/compat"
import js from "@eslint/js"
import prettier from "eslint-config-prettier"
bradgarropy marked this conversation as resolved.
Show resolved Hide resolved
import jsxA11y from "eslint-plugin-jsx-a11y"
import react from "eslint-plugin-react"
import reactHooks from "eslint-plugin-react-hooks"
import simpleImportSort from "eslint-plugin-simple-import-sort"
import globals from "globals"
bradgarropy marked this conversation as resolved.
Show resolved Hide resolved
import ts from "typescript-eslint"

const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
const gitignore = path.resolve(dirname, ".gitignore")

/** @type {import('eslint').Linter.Config[]} */
bradgarropy marked this conversation as resolved.
Show resolved Hide resolved

const config = [
export default ts.config(
includeIgnoreFile(gitignore),
{
files: [
Expand All @@ -30,16 +26,7 @@ const config = [
"**/*.mts",
"**/*.tsx",
],

languageOptions: {
ecmaVersion: "latest",
bradgarropy marked this conversation as resolved.
Show resolved Hide resolved
globals: {
...globals.browser,
...globals.node,
...globals.es2025,
...globals.jest,
},
parser: ts.parser,
bradgarropy marked this conversation as resolved.
Show resolved Hide resolved
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
Expand All @@ -56,11 +43,10 @@ const config = [
},
},
js.configs.recommended,
...ts.configs.recommended,
ts.configs.recommended,
react.configs.flat.recommended,
react.configs.flat["jsx-runtime"],
jsxA11y.flatConfigs.recommended,
prettier,
{
rules: {
...reactHooks.configs.recommended.rules,
Expand All @@ -72,87 +58,19 @@ const config = [
fixStyle: "separate-type-imports",
},
],
"@typescript-eslint/consistent-type-exports": [
"error",
{
fixMixedExportsWithInlineTypeSpecifier: false,
},
],
"@typescript-eslint/consistent-type-exports": "error",
bradgarropy marked this conversation as resolved.
Show resolved Hide resolved
"@typescript-eslint/no-import-type-side-effects": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
ignoreRestSiblings: true,
},
],
"comma-dangle": ["error", "always-multiline"],
"comma-spacing": [
"error",
{
before: false,
after: true,
},
],
"comma-style": ["error", "last"],
"eol-last": ["error", "always"],
bradgarropy marked this conversation as resolved.
Show resolved Hide resolved
"eqeqeq": ["error", "always"],
"function-paren-newline": ["off"],
"indent": ["off"],
"jsx-a11y/accessible-emoji": ["off"],
"no-console": ["off"],
"no-mixed-spaces-and-tabs": ["error"],
"no-unused-vars": [
"error",
{
ignoreRestSiblings: true,
},
],
bradgarropy marked this conversation as resolved.
Show resolved Hide resolved
"object-curly-newline": [
"error",
{
consistent: true,
},
],
"object-curly-spacing": ["error", "never"],
"object-property-newline": [
"error",
{
allowAllPropertiesOnSameLine: true,
},
],
"prefer-const": ["error"],
"quote-props": ["error", "consistent-as-needed"],
"quotes": ["error", "double"],
"react/jsx-tag-spacing": [
"error",
{
beforeSelfClosing: "always",
},
],
"react/react-in-jsx-scope": ["off"],
bradgarropy marked this conversation as resolved.
Show resolved Hide resolved
"react-hooks/rules-of-hooks": ["error"],
"react-hooks/exhaustive-deps": ["error"],
"semi": ["error", "never"],
"semi-spacing": [
"error",
{
before: false,
after: true,
},
],
"semi-style": ["error", "last"],
"simple-import-sort/imports": ["error"],
"simple-import-sort/exports": ["error"],
"space-before-function-paren": [
"error",
{
anonymous: "never",
named: "never",
asyncArrow: "always",
},
],
"prefer-const": "error",
"react-hooks/exhaustive-deps": "error",
bradgarropy marked this conversation as resolved.
Show resolved Hide resolved
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
},
},
]

export default config
)
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
1 change: 0 additions & 1 deletion src/transformers/twitch/twitch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,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
1 change: 0 additions & 1 deletion src/utils/feed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ test("caches json feed", async () => {

const feed = await generateFeed("json")

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

Expand Down
30 changes: 3 additions & 27 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 @@ -112,7 +105,6 @@ describe("transforms markdown", () => {

expect(html).toEqual(
expect.stringContaining(
// eslint-disable-next-line quotes
'src="https://player.twitch.tv?channel=bradgarropy&#x26;parent=bradgarropy.com"',
),
)
Expand All @@ -124,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 @@ -146,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 @@ -163,26 +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("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"'))
})
})
Loading