Skip to content

Commit ca49058

Browse files
committed
_で始まる変数名を無視するよう設定、markdownレンダー部分のeslintエラー解消
1 parent 89a3b98 commit ca49058

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

app/[docs_id]/markdown.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,31 @@ export function StyledMarkdown({ content }: { content: string }) {
1212

1313
// TailwindCSSがh1などのタグのスタイルを消してしまうので、手動でスタイルを指定する必要がある
1414
const components: Components = {
15-
h1: ({ node, ...props }) => (
15+
h1: ({ node: _, ...props }) => (
1616
<h1 className="text-2xl font-bold my-4" {...props} />
1717
),
18-
h2: ({ node, ...props }) => (
18+
h2: ({ node: _, ...props }) => (
1919
<h2 className="text-xl font-bold mt-4 mb-3 " {...props} />
2020
),
21-
h3: ({ node, ...props }) => (
21+
h3: ({ node: _, ...props }) => (
2222
<h3 className="text-lg font-bold mt-4 mb-2" {...props} />
2323
),
24-
h4: ({ node, ...props }) => (
24+
h4: ({ node: _, ...props }) => (
2525
<h4 className="text-base font-bold mt-3 mb-2" {...props} />
2626
),
27-
p: ({ node, ...props }) => <p className="mx-2 my-2" {...props} />,
28-
ul: ({ node, ...props }) => (
27+
p: ({ node: _, ...props }) => <p className="mx-2 my-2" {...props} />,
28+
ul: ({ node: _, ...props }) => (
2929
<ul className="list-disc list-outside ml-6 my-2" {...props} />
3030
),
31-
ol: ({ node, ...props }) => (
31+
ol: ({ node: _, ...props }) => (
3232
<ol className="list-decimal list-outside ml-6 my-2" {...props} />
3333
),
34-
li: ({ node, ...props }) => <li className="my-1" {...props} />,
35-
a: ({ node, ...props }) => <a className="link link-info" {...props} />,
36-
strong: ({ node, ...props }) => (
34+
li: ({ node: _, ...props }) => <li className="my-1" {...props} />,
35+
a: ({ node: _, ...props }) => <a className="link link-info" {...props} />,
36+
strong: ({ node: _, ...props }) => (
3737
<strong className="text-primary" {...props} />
3838
),
39-
code: ({ node, className, ref, style, ...props }) => {
39+
code: ({ node: _, className, ref: _, style: _, ...props }) => {
4040
const match = /language-(\w+)/.exec(className || "");
4141
if (match) {
4242
// block
@@ -73,11 +73,13 @@ const components: Components = {
7373
);
7474
}
7575
},
76-
pre: ({ node, ...props }) => (
76+
pre: ({ node: _, ...props }) => (
7777
<pre
7878
className="bg-base-200 border border-primary mx-2 my-2 rounded-lg font-mono text-sm overflow-x-auto"
7979
{...props}
8080
/>
8181
),
82-
hr: ({ node, ...props }) => <hr className="border-primary my-4" {...props} />,
82+
hr: ({ node: _, ...props }) => (
83+
<hr className="border-primary my-4" {...props} />
84+
),
8385
};

eslint.config.mjs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,22 @@ const compat = new FlatCompat({
1010
});
1111

1212
const eslintConfig = [
13-
...compat.extends("next/core-web-vitals", "next/typescript"),
13+
...compat.config({
14+
extends: ["next/core-web-vitals", "next/typescript"],
15+
rules: {
16+
// Next.jsのデフォルト設定を上書き
17+
"@typescript-eslint/no-unused-vars": [
18+
"error",
19+
{
20+
vars: "all",
21+
args: "after-used",
22+
argsIgnorePattern: "^_",
23+
varsIgnorePattern: "^_",
24+
caughtErrorsIgnorePattern: "^_",
25+
},
26+
],
27+
},
28+
}),
1429
];
1530

1631
export default eslintConfig;

0 commit comments

Comments
 (0)